3
0

Fix potential alterations modal loop

This commit is contained in:
Jože Fortun
2023-11-13 15:17:56 +01:00
parent 9199dbc708
commit fc58070b42
3 changed files with 19 additions and 32 deletions

View File

@@ -6,8 +6,7 @@
body-class="p-0 border-top-0 position-relative"
header-class="p-3 pb-0 border-bottom-0"
no-fade
@hide="$emit('hide')"
@change="$emit('change', $event)"
v-on="$listeners"
>
<b-table-simple
borderless
@@ -138,11 +137,10 @@
<template #modal-footer>
<b-button
variant="link"
size="sm"
variant="outline-light"
:disabled="processing"
class="text-decoration-none"
@click="$emit('cancel')"
class="text-primary border-0"
@click="showModal = false"
>
{{ canResolveAlterations ? $t('general:label.cancel') : $t('general:label.close') }}
</b-button>
@@ -151,7 +149,7 @@
v-if="canResolveAlterations"
variant="primary"
:disabled="processing"
:borderless="false"
size="md"
@confirmed="onResolve()"
>
{{ $t('resolveAuto') }}
@@ -217,17 +215,11 @@ export default {
},
watch: {
modal: {
immediate: true,
handler (show = false) {
this.showModal = show
},
},
batch: {
immediate: true,
handler (batch) {
this.load(batch)
if (batch) {
this.load(batch)
}
},
},
},
@@ -290,8 +282,8 @@ export default {
return this.$SystemAPI.dalSchemaAlterationList({ batchID }).then(({ set }) => {
this.alterations = set
if (!this.alterations.length) {
this.$emit('hide')
if (this.alterations.length) {
this.showModal = true
}
}).catch(this.toastErrorHandler(this.$t('notification:module.schemaAlterations.load.error')))
.finally(() => {

View File

@@ -417,11 +417,9 @@
</b-modal>
<dal-schema-alterations
:modal="dalSchemaAlterations.modal"
:batch="dalSchemaAlterations.batchID"
:module="module"
@hide="fetchModuleWithAlterations"
@cancel="dalSchemaAlterations.modal = ($event || false)"
@hide="onDalAlterationsHide"
/>
<federation-settings
@@ -828,9 +826,9 @@ export default {
}
},
async fetchModuleWithAlterations () {
async onDalAlterationsHide () {
await this.fetchModule(this.moduleID)
this.checkAlterations()
this.dalSchemaAlterations.batchID = undefined
},
async fetchModule (moduleID = this.moduleID) {
@@ -881,23 +879,20 @@ export default {
},
checkAlterations () {
if (!this.module) {
const { issues = [] } = this.module || {}
if (!issues.length) {
return
}
// Check if module has Alterations to resolve
let modal = false
let batchID
this.dalSchemaAlterations.batchID = undefined
for (const i of this.module.issues) {
if (i.meta.batchID) {
modal = true
batchID = i.meta.batchID
this.dalSchemaAlterations.batchID = i.meta.batchID
break
}
}
this.dalSchemaAlterations.modal = modal
this.dalSchemaAlterations.batchID = batchID
},
handleDelete () {