|
166 | 166 | </a-affix> |
167 | 167 |
|
168 | 168 | <div v-show="showAction"> |
169 | | - <keep-alive |
170 | | - v-if="currentAction.component && (!currentAction.groupAction || selectedRowKeys.length === 0 || (this.selectedRowKeys.length > 0 && currentAction.api === 'destroyVirtualMachine'))" |
171 | | - > |
| 169 | + <keep-alive v-if="currentAction.component && (!currentAction.invokedAsGroupAction || (this.selectedRowKeys.length > 0 && currentAction.api === 'destroyVirtualMachine'))"> |
172 | 170 | <a-modal |
173 | 171 | :visible="showAction" |
174 | 172 | :closable="true" |
|
447 | 445 | :maskClosable="false" |
448 | 446 | :footer="null" |
449 | 447 | style="top: 20px;" |
450 | | - :width="currentAction.groupAction ? modalWidth : '30vw'" |
| 448 | + :width="currentAction.invokedAsGroupAction ? modalWidth : '30vw'" |
451 | 449 | :ok-button-props="getOkProps()" |
452 | 450 | ok-text="111" |
453 | 451 | :cancel-button-props="getCancelProps()" |
|
471 | 469 | v-ctrl-enter="handleSubmit" |
472 | 470 | > |
473 | 471 | <span v-if="currentAction.message"> |
474 | | - <div v-if="selectedRowKeys.length > 0 && currentAction.groupAction"> |
| 472 | + <div v-if="selectedRowKeys.length > 0 && currentAction.invokedAsGroupAction"> |
475 | 473 | <a-alert |
476 | 474 | v-if="['delete-outlined', 'DeleteOutlined', 'poweroff-outlined', 'PoweroffOutlined'].includes(currentAction.icon)" |
477 | 475 | type="error" |
|
499 | 497 | </template> |
500 | 498 | </a-alert> |
501 | 499 | </div> |
502 | | - <div v-if="selectedRowKeys.length > 0 && currentAction.groupAction"> |
| 500 | + <div v-if="selectedRowKeys.length > 0 && currentAction.invokedAsGroupAction"> |
503 | 501 | <a-divider /> |
504 | 502 | <a-table |
505 | 503 | v-if="selectedRowKeys.length > 0" |
@@ -1127,6 +1125,13 @@ export default { |
1127 | 1125 | }, |
1128 | 1126 | '$store.getters.listAllProjects' (oldVal, newVal) { |
1129 | 1127 | this.fetchData() |
| 1128 | + }, |
| 1129 | + showAction (visible) { |
| 1130 | + if (visible) { |
| 1131 | + this.clearAutoRefresh() |
| 1132 | + } else if (!this.dataView) { |
| 1133 | + this.scheduleAutoRefresh() |
| 1134 | + } |
1130 | 1135 | } |
1131 | 1136 | }, |
1132 | 1137 | computed: { |
@@ -1259,7 +1264,7 @@ export default { |
1259 | 1264 | return 'inline-flex' |
1260 | 1265 | }, |
1261 | 1266 | getOkProps () { |
1262 | | - if (this.selectedRowKeys.length > 0 && this.currentAction?.groupAction) { |
| 1267 | + if (this.selectedRowKeys.length > 0 && this.currentAction?.invokedAsGroupAction) { |
1263 | 1268 | } else { |
1264 | 1269 | return { props: { type: 'primary' } } |
1265 | 1270 | } |
@@ -1305,7 +1310,7 @@ export default { |
1305 | 1310 | downloadLink.click() |
1306 | 1311 | }, |
1307 | 1312 | getCancelProps () { |
1308 | | - if (this.selectedRowKeys.length > 0 && this.currentAction?.groupAction) { |
| 1313 | + if (this.selectedRowKeys.length > 0 && this.currentAction?.invokedAsGroupAction) { |
1309 | 1314 | return { props: { type: 'primary' } } |
1310 | 1315 | } else { |
1311 | 1316 | return { props: { type: 'default' } } |
@@ -1771,7 +1776,10 @@ export default { |
1771 | 1776 | this.$router.push({ name: action.api, query }) |
1772 | 1777 | return |
1773 | 1778 | } |
1774 | | - this.currentAction = action |
| 1779 | + this.currentAction = { |
| 1780 | + ...action, |
| 1781 | + invokedAsGroupAction: !!isGroupAction |
| 1782 | + } |
1775 | 1783 | this.currentAction.params = store.getters.apis[this.currentAction.api].params |
1776 | 1784 | this.resource = action.resource |
1777 | 1785 | this.$emit('change-resource', this.resource) |
@@ -2057,7 +2065,7 @@ export default { |
2057 | 2065 | handleSubmit (e) { |
2058 | 2066 | if (this.actionLoading) return |
2059 | 2067 | this.promises = [] |
2060 | | - if (!this.dataView && this.currentAction.groupAction && this.selectedRowKeys.length > 0) { |
| 2068 | + if (!this.dataView && this.currentAction.invokedAsGroupAction && this.selectedRowKeys.length > 0) { |
2061 | 2069 | if (this.selectedRowKeys.length > 0) { |
2062 | 2070 | this.bulkColumns = this.chosenColumns |
2063 | 2071 | this.selectedItems = this.selectedItems.map(v => ({ ...v, status: 'InProgress' })) |
|
0 commit comments