Skip to content

Commit ac63e7e

Browse files
Consolidated quickview checks with first column, column key
1 parent dda4829 commit ac63e7e

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

ui/src/components/view/ListView.vue

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</div>
5050
</template>
5151
<template #bodyCell="{ column, text, record }">
52-
<template v-if="column.key === 'name' || (column.key === 'provider' && ['oauthsetting'].includes($route.path.split('/')[1]))">
52+
<template v-if="['name', 'provider'].includes(column.key)">
5353
<span
5454
v-if="['vm', 'vnfapp'].includes($route.path.split('/')[1])"
5555
style="margin-right: 5px"
@@ -70,7 +70,7 @@
7070
style="margin-left: 5px"
7171
:actions="actions"
7272
:resource="record"
73-
:enabled="quickViewEnabled() && actions.length > 0 && columns && (columns[0].dataIndex === 'name' || (columns[0].dataIndex === 'provider' && ['oauthsetting'].includes($route.path.split('/')[1])))"
73+
:enabled="quickViewEnabled(actions, columns, column.key)"
7474
@exec-action="$parent.execAction"
7575
/>
7676
<span
@@ -257,7 +257,7 @@
257257
style="margin-right: 8px"
258258
:actions="actions"
259259
:resource="record"
260-
:enabled="quickViewEnabled() && actions.length > 0"
260+
:enabled="quickViewEnabled(actions, columns, column.key)"
261261
@exec-action="$parent.execAction"
262262
/>
263263
<span v-if="record.intervaltype===0">
@@ -282,7 +282,7 @@
282282
style="margin-left: 5px"
283283
:actions="actions"
284284
:resource="record"
285-
:enabled="quickViewEnabled() && actions.length > 0 && columns && columns[0].dataIndex === 'displayname' "
285+
:enabled="quickViewEnabled(actions, columns, column.key)"
286286
@exec-action="$parent.execAction"
287287
/>
288288
<router-link :to="{ path: $route.path + '/' + record.id }">{{ text }}</router-link>
@@ -436,7 +436,7 @@
436436
style="margin-left: 5px"
437437
:actions="actions"
438438
:resource="record"
439-
:enabled="quickViewEnabled() && actions.length > 0 && columns && columns[0].dataIndex === 'hypervisor' "
439+
:enabled="quickViewEnabled(actions, columns, column.key)"
440440
@exec-action="$parent.execAction"
441441
/>
442442
<router-link :to="{ path: $route.path + '/' + record.id }">{{ text }}</router-link>
@@ -834,7 +834,7 @@
834834
style="margin-left: 5px"
835835
:actions="actions"
836836
:resource="record"
837-
:enabled="quickViewEnabled() && actions.length > 0"
837+
:enabled="quickViewEnabled(actions, columns, column.key)"
838838
@exec-action="$parent.execAction"
839839
/>
840840
</template>
@@ -1179,17 +1179,19 @@ export default {
11791179
'/tungstenpolicyset', '/tungstenroutingpolicy', '/firewallrule', '/tungstenfirewallpolicy'].includes(this.$route.path)
11801180
},
11811181
createPathBasedOnVmType: createPathBasedOnVmType,
1182-
quickViewEnabled () {
1183-
return new RegExp(['/vm', '/kubernetes', '/ssh', '/userdata', '/vmgroup', '/affinitygroup', '/autoscalevmgroup',
1184-
'/volume', '/snapshot', '/vmsnapshot', '/backup',
1185-
'/guestnetwork', '/vpc', '/vpncustomergateway', '/vnfapp',
1186-
'/template', '/iso',
1187-
'/project', '/account', 'buckets', 'objectstore',
1188-
'/zone', '/pod', '/cluster', '/host', '/storagepool', '/imagestore', '/systemvm', '/router', '/ilbvm', '/annotation',
1189-
'/computeoffering', '/systemoffering', '/diskoffering', '/backupoffering', '/networkoffering', '/vpcoffering',
1190-
'/tungstenfabric', '/oauthsetting', '/guestos', '/guestoshypervisormapping', '/webhook', 'webhookdeliveries', '/quotatariff', '/sharedfs',
1191-
'/ipv4subnets', '/managementserver', '/gpucard', '/gpudevices', '/vgpuprofile', '/extension', '/snapshotpolicy', '/backupschedule'].join('|'))
1192-
.test(this.$route.path)
1182+
quickViewEnabled (actions, columns, key) {
1183+
return actions.length > 0 &&
1184+
(columns && ['name', 'provider', 'hypervisor', 'intervaltype'].includes(columns[0].dataIndex) || ['displayname'].includes(key)) &&
1185+
new RegExp(['/vm', '/kubernetes', '/ssh', '/userdata', '/vmgroup', '/affinitygroup', '/autoscalevmgroup',
1186+
'/volume', '/snapshot', '/vmsnapshot', '/backup',
1187+
'/guestnetwork', '/vpc', '/vpncustomergateway', '/vnfapp',
1188+
'/template', '/iso',
1189+
'/project', '/account', 'buckets', 'objectstore',
1190+
'/zone', '/pod', '/cluster', '/host', '/storagepool', '/imagestore', '/systemvm', '/router', '/ilbvm', '/annotation',
1191+
'/computeoffering', '/systemoffering', '/diskoffering', '/backupoffering', '/networkoffering', '/vpcoffering',
1192+
'/tungstenfabric', '/oauthsetting', '/guestos', '/guestoshypervisormapping', '/webhook', 'webhookdeliveries', '/quotatariff', '/sharedfs',
1193+
'/ipv4subnets', '/managementserver', '/gpucard', '/gpudevices', '/vgpuprofile', '/extension', '/snapshotpolicy', '/backupschedule'].join('|'))
1194+
.test(this.$route.path)
11931195
},
11941196
enableGroupAction () {
11951197
return ['vm', 'alert', 'vmgroup', 'ssh', 'userdata', 'affinitygroup', 'autoscalevmgroup', 'volume', 'snapshot',

0 commit comments

Comments
 (0)