Update view after importing a record, namespace, module or chart

This commit is contained in:
Katrin Yordanova
2022-12-20 14:28:02 +02:00
parent ec5232699e
commit ad9342e15b
7 changed files with 29 additions and 5 deletions
@@ -137,7 +137,7 @@ export default {
break
}
}
this.toastSuccess(this.$t('notification:general.import.successful'))
this.$emit('importSuccessful')
} catch (e) {
this.toastErrorHandler(this.$t('notification:general.import.failed'))(e)
}
@@ -60,6 +60,7 @@
:module="recordListModule"
:namespace="namespace"
class="mr-1 float-left"
@importSuccessful="onImportSuccessful"
/>
</template>
</template>
@@ -1367,6 +1368,10 @@ export default {
console.warning(this.$t('notification:record-list.corrupted-filter'))
}
},
onImportSuccessful () {
this.refresh(true)
},
},
}
</script>
@@ -63,17 +63,16 @@ export default {
watch: {
progress: {
handler: function ({ finishedAt, failed }) {
handler ({ finishedAt, failed }) {
if (finishedAt && failed) {
this.clearTimeout()
this.$emit('importFailed', this.progress)
} else if (finishedAt) {
this.clearTimeout()
this.$root.$emit('recordList.refresh', this.session)
this.$emit('importSuccessful')
}
},
deep: true,
immediate: true,
},
},
@@ -23,6 +23,7 @@
:session="session"
@fileUploaded="onFileUploaded"
@fieldsMatched="onFieldsMatched"
@importSuccessful="onImportSuccessful"
@importFailed="onImportFailed"
@back="onBack"
@reset="onReset"
@@ -110,6 +111,10 @@ export default {
this.$ComposeAPI.recordImportRun(this.session)
},
onImportSuccessful () {
this.$emit('importSuccessful')
},
onImportFailed (e) {
this.session.progress = e
this.step = 3
@@ -64,6 +64,7 @@
:namespace="namespace"
type="chart"
class="float-left mr-1"
@importSuccessful="onImportSuccessful"
/>
<export
@@ -234,6 +235,11 @@ export default {
query: null,
})
},
onImportSuccessful () {
this.filterList()
this.toastSuccess(this.$t('notification:general.import.successful'))
},
},
}
</script>
@@ -50,6 +50,7 @@
:namespace="namespace"
type="module"
class="mr-1 float-left"
@importSuccessful="onImportSuccessful"
/>
<export
@@ -276,6 +277,11 @@ export default {
items () {
return this.procListResults(this.$ComposeAPI.moduleList(this.encodeListParams()))
},
onImportSuccessful () {
this.filterList()
this.toastSuccess(this.$t('notification:general.import.successful'))
},
},
}
</script>
@@ -199,7 +199,10 @@ export default {
methods: {
onImported () {
this.$store.dispatch('namespace/load', { force: true })
.then(() => this.toastSuccess(this.$t('notification:namespace.imported')))
.then(() => {
this.filterList()
this.toastSuccess(this.$t('notification:namespace.imported'))
})
.catch(this.toastErrorHandler(this.$t('notification:namespace.importFailed')))
},