diff --git a/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts index 52f095816..3c8e316d5 100644 --- a/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts @@ -8,6 +8,7 @@ import { ListingComponent, LoadingService, TableColumnConfig, + Toaster, } from '@iqser/common-ui'; import { fileAttributeTypesTranslations } from '../../translations/file-attribute-types-translations'; import { UserService } from '@services/user.service'; @@ -50,6 +51,7 @@ export class FileAttributesListingScreenComponent extends ListingComponent { - this._loadingService.start(); - await this._fileAttributesService - .setFileAttributesConfig(newValue, this._dossierTemplatesService.activeDossierTemplateId) - .toPromise(); - await this._appStateService.refreshDossierTemplate(this._dossierTemplatesService.activeDossierTemplateId); - await this._loadData(); + (newValue: IFileAttributeConfig) => { + this._loadingService.loadWhile(this._createNewFileAttributeAndRefreshView(newValue)); }, ); } @@ -115,6 +112,22 @@ export class FileAttributesListingScreenComponent extends ListingComponent { + await this._fileAttributesService + .setFileAttributesConfig(newValue, this._dossierTemplatesService.activeDossierTemplateId) + .toPromise() + .catch(error => { + if (error.status === 409) { + this._toaster.error(_('file-attributes-listing.error.conflict')); + } else { + this._toaster.error(_('file-attributes-listing.error.generic')); + } + this._loadingService.stop(); + }); + await this._appStateService.refreshDossierTemplate(this._dossierTemplatesService.activeDossierTemplateId); + await this._loadData(); + } + private async _loadData() { this._loadingService.start(); diff --git a/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.html b/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.html index caa8253a7..79d5cc468 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.html +++ b/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.html @@ -28,17 +28,20 @@
-
-
- - -
+
+
+
+ + +
+
+
- - - + -
- {{ translations[file.workflowStatus] | translate }} - {{ 'by' | translate }}: -
-
+
+ {{ translations[file.workflowStatus] | translate }} + {{ 'by' | translate }}: +
- -
-
+ +
this.appStateService.reloadFile(this.dossierId, this.fileId))) .subscribe(); this.addSubscription = this._filesMapService.fileReanalysed$ .pipe(filter(file => file.fileId === this.fileId)) diff --git a/apps/red-ui/src/app/state/app-state.service.ts b/apps/red-ui/src/app/state/app-state.service.ts index 75667f909..9e656a460 100644 --- a/apps/red-ui/src/app/state/app-state.service.ts +++ b/apps/red-ui/src/app/state/app-state.service.ts @@ -115,7 +115,7 @@ export class AppStateService { this._dossiersService.replace(dossiers.map(dossier => new Dossier(dossier))); } - async reloadFile(dossierId: string, fileId: string) { + async reloadFile(dossierId: string, fileId: string): Promise { const dossier = this._dossiersService.find(dossierId); const oldFile = this._filesMapService.get(dossierId, fileId); diff --git a/apps/red-ui/src/assets/i18n/de.json b/apps/red-ui/src/assets/i18n/de.json index cbff5c390..d480549e2 100644 --- a/apps/red-ui/src/assets/i18n/de.json +++ b/apps/red-ui/src/assets/i18n/de.json @@ -997,6 +997,10 @@ "total-rows": "{rows} Zeilen insgesamt" }, "file-attributes-listing": { + "error": { + "generic": "Attribute konnte nicht erstellt werden!", + "conflict": "Es gibt bereits ein Attribute mit diesem Name!" + }, "action": { "delete": "Attribut löschen", "edit": "Attribute bearbeiten" diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 93e6216db..20d2fd1e5 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -985,6 +985,10 @@ "total-rows": "{rows} rows in total" }, "file-attributes-listing": { + "error": { + "generic": "Failed to add File-Attribute", + "conflict": "File-Attribute with this name already exists!" + }, "action": { "delete": "Delete Attribute", "edit": "Edit Attribute" diff --git a/libs/common-ui b/libs/common-ui index d3d322d44..17c65675b 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit d3d322d444242ad43c1ac9f7313433cb23f7a87c +Subproject commit 17c65675b934698a61a2c80435f532e5a77f0c97