Skip to content

Commit

Permalink
chore(uux): #997 added publish assets state check to parts table
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-mmaul committed May 21, 2024
1 parent 76068d8 commit 2733a8c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@


<div class="action-button-tile"
matTooltip="{{(isAllowedToPublish() ? 'requestNotification.modifyNotAllowed' : 'routing.unauthorized') | i18n}}"
matTooltip="{{(isAllowedToPublish() ? (atLeastOneSelected() ? 'routing.illegalAssetStateToPublish' :'requestNotification.modifyNotAllowed') : 'routing.unauthorized') | i18n}}"
matTooltipClass="table--header--tooltip"
matTooltipPosition="above"
[class.mdc-tooltip--multiline]="true"
[matTooltipShowDelay]="500"
[matTooltipDisabled]="isAllowedToPublish() && atLeastOneSelected()">
[matTooltipDisabled]="isAllowedToPublish() && atLeastOneSelected() && !isIllegalSelectionToPublish()">
<app-button
iconName="published_with_changes"
class="action-button-tile"
matTooltip="{{'actions.publishAssets'| i18n}}"
[matTooltipShowDelay]="500"
matTooltipPosition="above"
[isDisabled]="!isAllowedToPublish() || !atLeastOneSelected()"
[isDisabled]="!isAllowedToPublish() || !atLeastOneSelected() || isIllegalSelectionToPublish()"
(click)="publishIconClicked()"
(keydown)="handleKeyDownPublishIconClicked($event)"
></app-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 2733a8c

Please sign in to comment.