Skip to content

Commit 17f3710

Browse files
Consolidated quickview checks with first column, column key
1 parent 8872732 commit 17f3710

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

ui/src/components/view/ListView.vue

Lines changed: 10 additions & 8 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>
@@ -845,7 +845,7 @@
845845
style="margin-left: 5px"
846846
:actions="actions"
847847
:resource="record"
848-
:enabled="quickViewEnabled() && actions.length > 0"
848+
:enabled="quickViewEnabled(actions, columns, column.key)"
849849
@exec-action="$parent.execAction"
850850
/>
851851
</template>
@@ -1208,8 +1208,10 @@ export default {
12081208
'/tungstenpolicyset', '/tungstenroutingpolicy', '/firewallrule', '/tungstenfirewallpolicy'].includes(this.$route.path)
12091209
},
12101210
createPathBasedOnVmType: createPathBasedOnVmType,
1211-
quickViewEnabled () {
1212-
return new RegExp(['/vm', '/kubernetes', '/ssh', '/userdata', '/vmgroup', '/affinitygroup', '/autoscalevmgroup',
1211+
quickViewEnabled (actions, columns, key) {
1212+
return actions.length > 0 &&
1213+
(columns && ['name', 'provider', 'hypervisor', 'intervaltype'].includes(columns[0].dataIndex) || ['displayname'].includes(key)) &&
1214+
new RegExp(['/vm', '/kubernetes', '/ssh', '/userdata', '/vmgroup', '/affinitygroup', '/autoscalevmgroup',
12131215
'/volume', '/snapshot', '/vmsnapshot', '/backup',
12141216
'/guestnetwork', '/vpc', '/vpncustomergateway', '/vnfapp',
12151217
'/template', '/iso',

0 commit comments

Comments
 (0)