Skip to content

Commit

Permalink
Add sorting to workflow next states (comma-list, menu) (#2983)
Browse files Browse the repository at this point in the history
  • Loading branch information
reiterl authored Nov 10, 2023
1 parent 561d8fe commit bcc71f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h2 *ngIf="workflow">
<div class="inner-table">
<div *ngIf="!state.next_states.length">-</div>
<div *ngIf="state.next_states.length">
<os-comma-separated-listing [list]="state.next_states">
<os-comma-separated-listing [list]="sortedNextStates(state)">
<ng-template let-next>{{ next.name }}</ng-template>
</os-comma-separated-listing>
</div>
Expand Down Expand Up @@ -217,7 +217,7 @@ <h1 mat-dialog-title>
<!-- select next states menu -->
<mat-menu matMenuContent #nextStatesMenu="matMenu">
<ng-template let-state="state" matMenuContent>
<div *ngFor="let nextState of workflow.states">
<div *ngFor="let nextState of getWorkflowStates()">
<button mat-menu-item *ngIf="nextState.name !== state.name" (click)="onSetNextState(nextState, state)">
<mat-icon *ngIf="state.next_state_ids?.includes(nextState.id)">check</mat-icon>
<span>{{ nextState.name }}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,10 @@ Note: Does not affect the visibility of change recommendations.`
return (<any>state)[perm.selector];
}

public sortedNextStates(state: ViewMotionState): ViewMotionState[] {
return state.next_states.sort((a, b) => a.weight - b.weight);
}

private async deleteWorkflowState(state: ViewMotionState): Promise<void> {
const title = this.translate.instant(`Are you sure you want to delete this state?`);
const content = `${state.name}`;
Expand Down

0 comments on commit bcc71f1

Please sign in to comment.