Merge pull request #5271 from tsiegleauq/reset-workflow-reco
Allow empty input values in recommendation
This commit is contained in:
commit
eadc09dc56
@ -34,7 +34,10 @@
|
|||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container [matColumnDef]="getColumnDef(state)" *ngFor="let state of workflow.states; trackBy: trackByIndex">
|
<ng-container
|
||||||
|
[matColumnDef]="getColumnDef(state)"
|
||||||
|
*ngFor="let state of workflow.states; trackBy: trackByIndex"
|
||||||
|
>
|
||||||
<th mat-header-cell *matHeaderCellDef (click)="onClickStateName(state)">
|
<th mat-header-cell *matHeaderCellDef (click)="onClickStateName(state)">
|
||||||
<div class="clickable-cell stretch-to-fill-parent">
|
<div class="clickable-cell stretch-to-fill-parent">
|
||||||
<div class="inner-table">
|
<div class="inner-table">
|
||||||
@ -49,16 +52,14 @@
|
|||||||
(change)="onToggleStatePerm(state, perm.selector, $event)"
|
(change)="onToggleStatePerm(state, perm.selector, $event)"
|
||||||
></mat-checkbox>
|
></mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div *ngIf="perm.type === 'input'">
|
||||||
*ngIf="perm.type === 'input'"
|
|
||||||
>
|
|
||||||
<div class="inner-table">
|
<div class="inner-table">
|
||||||
{{ (state[perm.selector] | translate) || '–' }}
|
{{ (state[perm.selector] | translate) || '–' }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="clickable-cell stretch-to-fill-parent"
|
class="clickable-cell stretch-to-fill-parent"
|
||||||
(click)="onClickInputPerm(perm, state)"
|
(click)="onClickInputPerm(perm, state)"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="inner-table" *ngIf="perm.type === 'color'">
|
<div class="inner-table" *ngIf="perm.type === 'color'">
|
||||||
<mat-basic-chip
|
<mat-basic-chip
|
||||||
@ -104,8 +105,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div *ngIf="state.restriction.length">
|
<div *ngIf="state.restriction.length">
|
||||||
<div *ngFor="let restriction of state.restriction; let last = last">
|
<div *ngFor="let restriction of state.restriction; let last = last">
|
||||||
{{ getRestrictionLabel(restriction) | translate
|
{{ getRestrictionLabel(restriction) | translate }}
|
||||||
}}<span *ngIf="!last">, </span>
|
<span *ngIf="!last">, </span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -138,7 +139,7 @@
|
|||||||
<div mat-dialog-actions>
|
<div mat-dialog-actions>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
[disabled]="dialogData.value === ''"
|
[disabled]="dialogData.value === '' && !dialogData.allowEmpty"
|
||||||
mat-button
|
mat-button
|
||||||
color="primary"
|
color="primary"
|
||||||
[mat-dialog-close]="{ action: 'update', value: dialogData.value }"
|
[mat-dialog-close]="{ action: 'update', value: dialogData.value }"
|
||||||
|
@ -27,6 +27,7 @@ interface DialogData {
|
|||||||
description: string;
|
description: string;
|
||||||
value: string;
|
value: string;
|
||||||
deletable?: boolean;
|
deletable?: boolean;
|
||||||
|
allowEmpty?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -256,7 +257,10 @@ export class WorkflowDetailComponent extends BaseViewComponent implements OnInit
|
|||||||
* @param state The selected workflow state
|
* @param state The selected workflow state
|
||||||
*/
|
*/
|
||||||
public onClickInputPerm(perm: StatePerm, state: ViewState): void {
|
public onClickInputPerm(perm: StatePerm, state: ViewState): void {
|
||||||
this.openEditDialog(state[perm.selector], 'Edit', perm.name).subscribe(result => {
|
this.openEditDialog(state[perm.selector], 'Edit', perm.name, false, true).subscribe(result => {
|
||||||
|
if (result.value === '') {
|
||||||
|
result.value = null;
|
||||||
|
}
|
||||||
if (result && result.action === 'update') {
|
if (result && result.action === 'update') {
|
||||||
this.stateRepo.update({ [perm.selector]: result.value }, state).then(() => {}, this.raiseError);
|
this.stateRepo.update({ [perm.selector]: result.value }, state).then(() => {}, this.raiseError);
|
||||||
}
|
}
|
||||||
@ -347,18 +351,21 @@ export class WorkflowDetailComponent extends BaseViewComponent implements OnInit
|
|||||||
* @param title The title of the dialog
|
* @param title The title of the dialog
|
||||||
* @param description The description of the dialog
|
* @param description The description of the dialog
|
||||||
* @param deletable determine if a delete button should be offered
|
* @param deletable determine if a delete button should be offered
|
||||||
|
* @param allowEmpty to allow empty values
|
||||||
*/
|
*/
|
||||||
private openEditDialog(
|
private openEditDialog(
|
||||||
value: string,
|
value: string,
|
||||||
title?: string,
|
title?: string,
|
||||||
description?: string,
|
description?: string,
|
||||||
deletable?: boolean
|
deletable?: boolean,
|
||||||
|
allowEmpty?: boolean
|
||||||
): Observable<DialogResult> {
|
): Observable<DialogResult> {
|
||||||
this.dialogData = {
|
this.dialogData = {
|
||||||
title: title || '',
|
title: title || '',
|
||||||
description: description || '',
|
description: description || '',
|
||||||
value: value,
|
value: value,
|
||||||
deletable: deletable
|
deletable: deletable,
|
||||||
|
allowEmpty: allowEmpty
|
||||||
};
|
};
|
||||||
|
|
||||||
const dialogRef = this.dialog.open(this.workflowDialog, infoDialogSettings);
|
const dialogRef = this.dialog.open(this.workflowDialog, infoDialogSettings);
|
||||||
|
Loading…
Reference in New Issue
Block a user