Skip to content

Commit cc649cc

Browse files
committed
add button on compute and volume views and logic to show/hide in data/list views
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 9fc8630 commit cc649cc

File tree

3 files changed

+74
-23
lines changed

3 files changed

+74
-23
lines changed

ui/src/components/CloudMonkey/Resource.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
<a-row>
2828
<a-col :span="16">
29-
<a-tooltip placement="bottom" v-for="(action, actionIndex) in actions" :key="actionIndex">
29+
<a-tooltip placement="bottom" v-for="(action, actionIndex) in actions" :key="actionIndex" v-if="(!dataView && action.listView) || (dataView && action.dataView)">
3030
<template slot="title">
3131
{{ action.label }}
3232
</template>
@@ -152,7 +152,7 @@
152152
</a-spin>
153153
</a-drawer>
154154

155-
<div v-if="showDetails">
155+
<div v-if="dataView">
156156
<a-row :gutter="12">
157157
<a-col :xl="12">
158158
<chart-card class="info-card" v-if="resource.name">
@@ -258,7 +258,7 @@ export default {
258258
selectedRowKeys: [],
259259
currentAction: {},
260260
showAction: false,
261-
showDetails: false,
261+
dataView: false,
262262
actions: [],
263263
breadList: []
264264
}
@@ -309,9 +309,9 @@ export default {
309309
params['keyword'] = search
310310
}
311311
if (this.$route && this.$route.params && this.$route.params.id) {
312-
this.showDetails = true
312+
this.dataView = true
313313
} else {
314-
this.showDetails = false
314+
this.dataView = false
315315
}
316316
if (this.$route && this.$route.meta && this.$route.meta.permission) {
317317
this.apiName = this.$route.meta.permission[0]

ui/src/config/section/compute.js

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,57 @@ export default {
2020
api: 'deployVirtualMachine',
2121
icon: 'plus',
2222
label: 'Deploy VM',
23-
params: ['name', 'zoneid', 'diskofferingid']
23+
params: ['name', 'zoneid', 'diskofferingid'],
24+
listView: true
2425
},
26+
{
27+
api: 'startVirtualMachine',
28+
icon: 'right-square',
29+
label: 'View Console',
30+
dataView: true
31+
},
32+
2533
{
2634
api: 'startVirtualMachine',
2735
icon: 'caret-right',
2836
label: 'Start VM',
29-
params: ['name', 'zoneid', 'diskofferingid']
37+
params: ['name', 'zoneid', 'diskofferingid'],
38+
listView: true,
39+
dataView: true
3040
},
3141
{
3242
api: 'stopVirtualMachine',
3343
icon: 'stop',
3444
label: 'Stop VM',
35-
params: ['name', 'zoneid', 'diskofferingid']
45+
params: ['name', 'zoneid', 'diskofferingid'],
46+
listView: true,
47+
dataView: true
48+
},
49+
{
50+
api: 'rebootVirtualMachine',
51+
icon: 'sync',
52+
label: 'Reboot VM',
53+
dataView: true
54+
},
55+
{
56+
api: 'migrateVirtualMachine',
57+
icon: 'drag',
58+
label: 'Migrate VM',
59+
dataView: true
60+
},
61+
{
62+
api: 'resetSSHKeyForVirtualMachine',
63+
icon: 'lock',
64+
label: 'Reset SSH Key',
65+
dataView: true
66+
},
67+
{
68+
api: 'destroyVirtualMachine',
69+
icon: 'delete',
70+
label: 'Destroy VM',
71+
params: ['id'],
72+
listView: true,
73+
dataView: true
3674
}
3775
]
3876
},

ui/src/config/section/storage.js

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,48 @@ export default {
1717
icon: 'plus',
1818
label: 'Create Volume',
1919
type: 'main',
20-
params: ['name', 'zoneid', 'diskofferingid']
20+
params: ['name', 'zoneid', 'diskofferingid'],
21+
listView: true
2122
}, {
2223
api: 'uploadVolume',
2324
icon: 'cloud-upload',
2425
label: 'Upload Volume From URL',
2526
type: 'main',
26-
params: ['url', 'name', 'zoneid', 'format', 'diskofferingid', 'checksum']
27+
params: ['url', 'name', 'zoneid', 'format', 'diskofferingid', 'checksum'],
28+
listView: true
2729
}, {
2830
api: 'getUploadParamsForVolume',
2931
icon: 'upload',
3032
label: 'Upload Local Volume',
31-
params: ['@file', 'name', 'zoneid', 'format', 'checksum']
32-
}, {
33+
params: ['@file', 'name', 'zoneid', 'format', 'checksum'],
34+
listView: true
35+
},
36+
{
37+
api: 'migrateVolume',
38+
icon: 'drag',
39+
label: 'Migrate Volume',
40+
params: ['volumeid', 'storageid', 'livemigrate'],
41+
dataView: true
42+
},
43+
{
3344
api: 'resizeVolume',
3445
icon: 'fullscreen',
3546
label: 'Resize Volume',
3647
type: 'main',
37-
params: ['id', 'virtualmachineid']
48+
params: ['id', 'virtualmachineid'],
49+
dataView: true
3850
}, {
3951
api: 'attachVolume',
4052
icon: 'paper-clip',
4153
label: 'Attach Volume',
42-
params: ['id', 'virtualmachineid']
54+
params: ['id', 'virtualmachineid'],
55+
dataView: true
4356
}, {
4457
api: 'detachVolume',
4558
icon: 'link',
4659
label: 'Detach Volume',
47-
params: ['id', 'virtualmachineid']
60+
params: ['id', 'virtualmachineid'],
61+
dataView: true
4862
}, {
4963
api: 'extractVolume',
5064
icon: 'cloud-download',
@@ -54,17 +68,16 @@ export default {
5468
'mode': {
5569
'value': 'HTTP_DOWNLOAD'
5670
}
57-
}
58-
}, {
59-
api: 'migrateVolume',
60-
icon: 'drag',
61-
label: 'Migrate Volume',
62-
params: ['volumeid', 'storageid', 'livemigrate']
63-
}, {
71+
},
72+
dataView: true
73+
},
74+
{
6475
api: 'deleteVolume',
6576
icon: 'delete',
6677
label: 'Delete Volume',
67-
params: ['id']
78+
params: ['id'],
79+
listView: true,
80+
dataView: true
6881
}
6982
]
7083
},

0 commit comments

Comments
 (0)