From ad9342e15bebf622b9add5ba52654ff2e0b0d06c Mon Sep 17 00:00:00 2001 From: Katrin Yordanova Date: Fri, 16 Dec 2022 18:57:37 +0200 Subject: [PATCH] Update view after importing a record, namespace, module or chart --- client/web/compose/src/components/Admin/Import.vue | 2 +- .../compose/src/components/PageBlocks/RecordListBase.vue | 5 +++++ .../src/components/Public/Record/Importer/Progress.vue | 5 ++--- .../compose/src/components/Public/Record/Importer/index.vue | 5 +++++ client/web/compose/src/views/Admin/Charts/List.vue | 6 ++++++ client/web/compose/src/views/Admin/Modules/List.vue | 6 ++++++ client/web/compose/src/views/Namespace/Manage.vue | 5 ++++- 7 files changed, 29 insertions(+), 5 deletions(-) diff --git a/client/web/compose/src/components/Admin/Import.vue b/client/web/compose/src/components/Admin/Import.vue index 62d7dabdb..4e9fe1ee2 100644 --- a/client/web/compose/src/components/Admin/Import.vue +++ b/client/web/compose/src/components/Admin/Import.vue @@ -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) } diff --git a/client/web/compose/src/components/PageBlocks/RecordListBase.vue b/client/web/compose/src/components/PageBlocks/RecordListBase.vue index 455550642..d40bc10d9 100644 --- a/client/web/compose/src/components/PageBlocks/RecordListBase.vue +++ b/client/web/compose/src/components/PageBlocks/RecordListBase.vue @@ -60,6 +60,7 @@ :module="recordListModule" :namespace="namespace" class="mr-1 float-left" + @importSuccessful="onImportSuccessful" /> @@ -1367,6 +1368,10 @@ export default { console.warning(this.$t('notification:record-list.corrupted-filter')) } }, + + onImportSuccessful () { + this.refresh(true) + }, }, } diff --git a/client/web/compose/src/components/Public/Record/Importer/Progress.vue b/client/web/compose/src/components/Public/Record/Importer/Progress.vue index 82daf8713..0ea6565c4 100644 --- a/client/web/compose/src/components/Public/Record/Importer/Progress.vue +++ b/client/web/compose/src/components/Public/Record/Importer/Progress.vue @@ -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, }, }, diff --git a/client/web/compose/src/components/Public/Record/Importer/index.vue b/client/web/compose/src/components/Public/Record/Importer/index.vue index 507230629..026afb795 100644 --- a/client/web/compose/src/components/Public/Record/Importer/index.vue +++ b/client/web/compose/src/components/Public/Record/Importer/index.vue @@ -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 diff --git a/client/web/compose/src/views/Admin/Charts/List.vue b/client/web/compose/src/views/Admin/Charts/List.vue index f1a97f1ea..4099c66be 100644 --- a/client/web/compose/src/views/Admin/Charts/List.vue +++ b/client/web/compose/src/views/Admin/Charts/List.vue @@ -64,6 +64,7 @@ :namespace="namespace" type="chart" class="float-left mr-1" + @importSuccessful="onImportSuccessful" /> diff --git a/client/web/compose/src/views/Admin/Modules/List.vue b/client/web/compose/src/views/Admin/Modules/List.vue index eeb9fa995..bc6d4ae2f 100644 --- a/client/web/compose/src/views/Admin/Modules/List.vue +++ b/client/web/compose/src/views/Admin/Modules/List.vue @@ -50,6 +50,7 @@ :namespace="namespace" type="module" class="mr-1 float-left" + @importSuccessful="onImportSuccessful" /> diff --git a/client/web/compose/src/views/Namespace/Manage.vue b/client/web/compose/src/views/Namespace/Manage.vue index b704fdb9e..51ae1e749 100644 --- a/client/web/compose/src/views/Namespace/Manage.vue +++ b/client/web/compose/src/views/Namespace/Manage.vue @@ -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'))) },