diff --git a/frontend/src/app/modules/page/parts/presentation/parts.component.ts b/frontend/src/app/modules/page/parts/presentation/parts.component.ts index 7add524f4c..e15ea887b7 100644 --- a/frontend/src/app/modules/page/parts/presentation/parts.component.ts +++ b/frontend/src/app/modules/page/parts/presentation/parts.component.ts @@ -19,27 +19,27 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import { AfterViewInit, Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core'; -import { FormControl, FormGroup } from '@angular/forms'; -import { Pagination } from '@core/model/pagination.model'; -import { RoleService } from '@core/user/role.service'; -import { PartsFacade } from '@page/parts/core/parts.facade'; -import { resetMultiSelectionAutoCompleteComponent } from '@page/parts/core/parts.helper'; -import { MainAspectType } from '@page/parts/model/mainAspectType.enum'; -import { AssetAsBuiltFilter, AssetAsPlannedFilter, Part } from '@page/parts/model/parts.model'; -import { BomLifecycleSize } from '@shared/components/bom-lifecycle-activator/bom-lifecycle-activator.model'; -import { TableType } from '@shared/components/multi-select-autocomplete/table-type.model'; -import { PartsTableComponent } from '@shared/components/parts-table/parts-table.component'; -import { TableEventConfig, TableHeaderSort } from '@shared/components/table/table.model'; -import { ToastService } from '@shared/components/toasts/toast.service'; -import { toAssetFilter, toGlobalSearchAssetFilter } from '@shared/helper/filter-helper'; -import { NotificationType } from '@shared/model/notification.model'; -import { View } from '@shared/model/view.model'; -import { PartDetailsFacade } from '@shared/modules/part-details/core/partDetails.facade'; -import { BomLifecycleSettingsService, UserSettingView } from '@shared/service/bom-lifecycle-settings.service'; -import { StaticIdService } from '@shared/service/staticId.service'; -import { BehaviorSubject, combineLatest, Observable, Subject } from 'rxjs'; -import { map } from 'rxjs/operators'; +import {AfterViewInit, Component, OnDestroy, OnInit, QueryList, ViewChildren} from '@angular/core'; +import {FormControl, FormGroup} from '@angular/forms'; +import {Pagination} from '@core/model/pagination.model'; +import {RoleService} from '@core/user/role.service'; +import {PartsFacade} from '@page/parts/core/parts.facade'; +import {resetMultiSelectionAutoCompleteComponent} from '@page/parts/core/parts.helper'; +import {MainAspectType} from '@page/parts/model/mainAspectType.enum'; +import {AssetAsBuiltFilter, AssetAsPlannedFilter, Part} from '@page/parts/model/parts.model'; +import {BomLifecycleSize} from '@shared/components/bom-lifecycle-activator/bom-lifecycle-activator.model'; +import {TableType} from '@shared/components/multi-select-autocomplete/table-type.model'; +import {PartsTableComponent} from '@shared/components/parts-table/parts-table.component'; +import {TableEventConfig, TableHeaderSort} from '@shared/components/table/table.model'; +import {ToastService} from '@shared/components/toasts/toast.service'; +import {toAssetFilter, toGlobalSearchAssetFilter} from '@shared/helper/filter-helper'; +import {NotificationType} from '@shared/model/notification.model'; +import {View} from '@shared/model/view.model'; +import {PartDetailsFacade} from '@shared/modules/part-details/core/partDetails.facade'; +import {BomLifecycleSettingsService, UserSettingView} from '@shared/service/bom-lifecycle-settings.service'; +import {StaticIdService} from '@shared/service/staticId.service'; +import {BehaviorSubject, combineLatest, Observable, Subject} from 'rxjs'; +import {map} from 'rxjs/operators'; @Component({ @@ -136,11 +136,11 @@ export class PartsComponent implements OnInit, OnDestroy, AfterViewInit { } - refreshPartsOnPublish(success: boolean) { - if(!success) { - this.toastService.error("Failed to publish Assets"); + refreshPartsOnPublish(message: string) { + if(message) { + this.toastService.error(message); } else { - this.toastService.success("Request to publish Assets was successful") + this.toastService.success("requestPublishAssets.success") this.partsFacade.setPartsAsBuilt(); this.partsFacade.setPartsAsPlanned(); this.partsTableComponents.map(component => component.clearAllRows()) diff --git a/frontend/src/app/modules/shared/components/asset-publisher/asset-publisher.component.ts b/frontend/src/app/modules/shared/components/asset-publisher/asset-publisher.component.ts index de3bab343d..9892d86feb 100644 --- a/frontend/src/app/modules/shared/components/asset-publisher/asset-publisher.component.ts +++ b/frontend/src/app/modules/shared/components/asset-publisher/asset-publisher.component.ts @@ -1,9 +1,9 @@ -import { Component, EventEmitter, Input, Output } from '@angular/core'; -import { FormControl, Validators } from '@angular/forms'; -import { ImportState, Part } from '@page/parts/model/parts.model'; -import { Policy } from '@page/policies/model/policy.model'; -import { PolicyService } from '@shared/service/policy.service'; -import { Observable, Subscription } from 'rxjs'; +import {Component, EventEmitter, Input, Output} from '@angular/core'; +import {FormControl, Validators} from '@angular/forms'; +import {ImportState, Part} from '@page/parts/model/parts.model'; +import {Policy} from '@page/policies/model/policy.model'; +import {PolicyService} from '@shared/service/policy.service'; +import {Observable, Subscription} from 'rxjs'; @Component({ selector: 'app-asset-publisher', @@ -16,7 +16,7 @@ export class AssetPublisherComponent { @Input() isOpen: Observable; isOpenSubscription: Subscription; - @Output() submitted = new EventEmitter(); + @Output() submitted = new EventEmitter(); policiesSubscription: Subscription; policiesList: Policy[] = []; @@ -49,8 +49,8 @@ export class AssetPublisherComponent { this.policyFormControl.reset(); this.selectedAssets = []; this.policyService.publishAssets(selectedAssetIds, this.policyFormControl.value).subscribe({ - next: data => {this.submitted.emit(true);}, - error: error => {this.submitted.emit(false);} + next: data => {this.submitted.emit(null);}, + error: error => {this.submitted.emit(error);} }); } diff --git a/frontend/src/assets/locales/de/common.json b/frontend/src/assets/locales/de/common.json index 72a23a0248..d7d404dc42 100644 --- a/frontend/src/assets/locales/de/common.json +++ b/frontend/src/assets/locales/de/common.json @@ -197,6 +197,10 @@ "severity": "Gefahrenstufe", "severityDescription": "Wählen Sie die Gefahrenstufe für das vorliegende Problem" }, + "requestPublishAssets": { + "success": "Anfrage zur Veröffentlichung der Produkte war erfolgreich", + "error": "" + }, "pagination": { "itemsPerPageLabel": "Artikel pro Seite:", "nextPageLabel": "Nächsten Seite", diff --git a/frontend/src/assets/locales/en/common.json b/frontend/src/assets/locales/en/common.json index 07f8362bef..a97306e724 100644 --- a/frontend/src/assets/locales/en/common.json +++ b/frontend/src/assets/locales/en/common.json @@ -199,6 +199,10 @@ "severity": "Severity", "severityDescription": "Select the severity for the problem at hand" }, + "requestPublishAssets": { + "success": "Request to publish assets was successful", + "error": "" + }, "pagination": { "itemsPerPageLabel": "Items per page:", "nextPageLabel": "Next page",