This repository was archived by the owner on Jan 20, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323 :rowKey =" item => item.id"
2424 :loading =" loading"
2525 :pagination =" false" >
26- <template v-if =" routerLink " :slot =" routerLink .name " slot-scope="text, item">
27- <router-link :to =" { path: routerLink.prefix + item.id }" v-if =" routerLink" >{{ text }}</router-link >
26+
27+ <span v-for =" (column, index) in columns" :key =" index" :slot =" column" slot-scope =" text, item" >
28+ <router-link v-if =" routerlinks(item)[column]" :to =" { path: routerlinks(item)[column] }" >{{ text }}</router-link >
2829 <span v-else >{{ text }}</span >
29- </template >
30+ </span >
3031 <template slot="state" slot-scope="text">
3132 <status :text =" text ? text : ''" />{{ text }}
3233 </template >
@@ -38,7 +39,7 @@ import { api } from '@/api'
3839import Status from ' @/components/widgets/Status'
3940
4041export default {
41- name: ' ListApiView ' ,
42+ name: ' ListResourceTable ' ,
4243 components: {
4344 Status
4445 },
@@ -47,9 +48,9 @@ export default {
4748 type: String ,
4849 required: true
4950 },
50- routerLink : {
51- type: Object ,
52- default : () => {}
51+ routerlinks : {
52+ type: Function ,
53+ default : () => []
5354 },
5455 params: {
5556 type: Object ,
Original file line number Diff line number Diff line change 119119 <DetailSettings :resource =" resource" :loading =" loading" />
120120 </a-tab-pane >
121121 <a-tab-pane :tab =" $t('label.vm.snapshots')" key =" snapshots" v-if =" 'listVMSnapshot' in $store.getters.apis" >
122- <ListApiView
122+ <ListResourceTable
123123 apiName =" listVMSnapshot"
124124 :params =" {virtualmachineid: this.resource.id}"
125125 :columns =" ['name', 'type', 'state', 'created']"
126- :routerLink = " {name: 'name', prefix : '/vmsnapshot/'}" />
126+ :routerlinks = " (record) => { return { name : '/vmsnapshot/' + record.id } }" />
127127 </a-tab-pane >
128128 <a-tab-pane :tab =" $t('label.backup')" key =" backups" v-if =" 'listBackups' in $store.getters.apis" >
129- <ListApiView
129+ <ListResourceTable
130130 apiName =" listBackups"
131131 :params =" {virtualmachineid: this.resource.id}"
132132 :columns =" ['id', 'type', 'status', 'created']"
133- :routerLink = " {name: 'id', prefix : '/backup/'}" />
133+ :routerlinks = " (record) => { return { id : '/backup/' + record.id } }" />
134134 </a-tab-pane >
135135 </a-tabs >
136136
@@ -217,7 +217,7 @@ import Status from '@/components/widgets/Status'
217217import DetailsTab from ' @/components/view/DetailsTab'
218218import DetailSettings from ' @/components/view/DetailSettings'
219219import NicsTable from ' @/views/network/NicsTable'
220- import ListApiView from ' @/components/view/ListApiView '
220+ import ListResourceTable from ' @/components/view/ListResourceTable '
221221
222222export default {
223223 name: ' InstanceTab' ,
@@ -227,7 +227,7 @@ export default {
227227 DetailSettings,
228228 NicsTable,
229229 Status,
230- ListApiView
230+ ListResourceTable
231231 },
232232 mixins: [mixinDevice],
233233 props: {
You can’t perform that action at this time.
0 commit comments