Skip to content

Commit 9adbfa3

Browse files
committed
settings: simplify instance/template settings tab component
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent ed42277 commit 9adbfa3

File tree

2 files changed

+24
-57
lines changed

2 files changed

+24
-57
lines changed

ui/src/components/view/SettingTable.vue

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,33 @@
1616
// under the License.
1717

1818
<template>
19-
<a-table
20-
size="small"
21-
:scroll="{ x: 'true' }"
22-
:loading="loading"
23-
:columns="columns"
24-
:dataSource="items"
25-
:rowKey="record => record.id || record.name || record.key"
26-
:pagination="false"
27-
:rowClassName="getRowClassName"
28-
bordered
29-
>
30-
<template slot="value" slot-scope="text, record">
31-
<span style="float: left; margin-right: 5px" v-if="record">
32-
<a-button size="small" shape="circle">
33-
<a-icon type="close" />
34-
</a-button>
35-
<a-button size="small" shape="circle">
36-
<a-icon type="edit" />
37-
</a-button>
38-
</span>
39-
<span>{{ text }}</span>
40-
</template>
41-
</a-table>
19+
<div>
20+
<a-button type="dashed" style="width: 100%" icon="plus" @click="addSettingForm()">Add Setting</a-button>
21+
<a-list size="large">
22+
<a-list-item :key="index" v-for="(item, index) in items">
23+
<a-list-item-meta>
24+
<span slot="title">{{ item.name }}</span>
25+
<span slot="description" style="word-break: break-all">{{ item.value }}</span>
26+
</a-list-item-meta>
27+
<div slot="actions">
28+
<a-button size="small" shape="circle">
29+
<a-icon type="edit" />
30+
</a-button>
31+
</div>
32+
<div slot="actions">
33+
<a-button size="small" shape="circle">
34+
<a-icon type="close" />
35+
</a-button>
36+
</div>
37+
</a-list-item>
38+
</a-list>
39+
</div>
4240
</template>
4341

4442
<script>
4543
export default {
4644
name: 'SettingTable',
4745
props: {
48-
columns: {
49-
type: Array,
50-
required: true
51-
},
5246
items: {
5347
type: Array,
5448
required: true
@@ -63,26 +57,12 @@ export default {
6357
}
6458
},
6559
methods: {
66-
getRowClassName (record, index) {
67-
if (index % 2 === 0) {
68-
return 'light-row'
69-
}
70-
return 'dark-row'
60+
addSettingForm () {
61+
console.log('Add setting button clicked')
7162
}
7263
}
7364
}
7465
</script>
7566

7667
<style scoped>
77-
/deep/ .ant-table-thead {
78-
background-color: #f9f9f9;
79-
}
80-
81-
/deep/ .light-row {
82-
background-color: #fff;
83-
}
84-
85-
/deep/ .dark-row {
86-
background-color: #f9f9f9;
87-
}
8868
</style>

ui/src/views/compute/InstanceSettings.vue

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,9 @@
1717

1818
<template>
1919
<div>
20-
<a-button style="margin-bottom: 15px; float: right">
21-
Add Setting
22-
</a-button>
2320
<setting-table
24-
:columns="[{
25-
title: $t('name'),
26-
dataIndex: 'name',
27-
width: '40%'
28-
},{
29-
title: $t('value'),
30-
dataIndex: 'value',
31-
width: '40%',
32-
scopedSlots: { customRender: 'value' }
33-
}]"
34-
:items="Object.keys(resource.details).map(k => { return { name: k, value: resource.details[k] } })"
3521
:loading="loading"
22+
:items="Object.keys(resource.details).map(k => { return { name: k, value: resource.details[k] } })"
3623
>
3724
</setting-table>
3825
</div>

0 commit comments

Comments
 (0)