diff --git a/CHANGELOG.md b/CHANGELOG.md index 62b17f7665..495c4b610c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ _**For better traceability add the corresponding GitHub issue number in each cha ### Added - #859 added autocomplete on subset of assets in notification creation/edit view +- #997 added publish assets state check to parts table ### Changed - #778 return empty PageResult when no contract agreement Ids are found instead of http 404 in /contacts API diff --git a/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html b/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html index 21996a6783..033b6baba3 100644 --- a/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html +++ b/frontend/src/app/modules/shared/components/parts-table/parts-table.component.html @@ -79,19 +79,19 @@
+ [matTooltipDisabled]="isAllowedToPublish() && atLeastOneSelected() && !isIllegalSelectionToPublish()"> diff --git a/frontend/src/app/modules/shared/components/parts-table/parts-table.component.ts b/frontend/src/app/modules/shared/components/parts-table/parts-table.component.ts index da8c1de965..9ec976ecd5 100644 --- a/frontend/src/app/modules/shared/components/parts-table/parts-table.component.ts +++ b/frontend/src/app/modules/shared/components/parts-table/parts-table.component.ts @@ -41,7 +41,7 @@ import { TableSettingsService } from '@core/user/table-settings.service'; import { UserService } from '@core/user/user.service'; import { MainAspectType } from '@page/parts/model/mainAspectType.enum'; import { Owner } from '@page/parts/model/owner.enum'; -import { Part } from '@page/parts/model/parts.model'; +import { ImportState, Part } from '@page/parts/model/parts.model'; import { MultiSelectAutocompleteComponent } from '@shared/components/multi-select-autocomplete/multi-select-autocomplete.component'; import { TableType } from '@shared/components/multi-select-autocomplete/table-type.model'; import { PartsTableConfigUtils } from '@shared/components/parts-table/parts-table-config.utils'; @@ -185,6 +185,12 @@ export class PartsTableComponent implements OnInit { return this.roleService.hasAccess([ 'admin' ]); } + isIllegalSelectionToPublish(): boolean { + return this.selection.selected.some((part: Part) => { + return part?.importState !== ImportState.TRANSIENT && part?.importState !== ImportState.ERROR; + }); + } + handleKeyDownPublishIconClicked(event: KeyboardEvent): void{ if (event.key === 'Enter') { this.publishIconClicked();