Actually complete Automatic Actions behaviors
This commit is contained in:
parent
460d683e49
commit
dfb2f05772
@ -7,7 +7,8 @@ class ActionType extends Enum {
|
||||
const ADD_CATEGORY = 3;
|
||||
const CLEAR_ALL_CATEGORIES = 4;
|
||||
const SET_ASSIGNEE = 5;
|
||||
const CLEAR_DUE_DATE = 6;
|
||||
const ALTER_COLOR_BY_POINTS= 7;
|
||||
const ADD_ASSIGNEE = 6;
|
||||
const CLEAR_DUE_DATE = 7;
|
||||
const ALTER_COLOR_BY_POINTS= 8;
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,7 @@
|
||||
<td>
|
||||
<select [disabled]="newAction.board_id === null"
|
||||
[(ngModel)]="newAction.trigger"
|
||||
|
||||
(change)="updateTriggerSources()">
|
||||
<option *ngFor="let trigger of triggers"
|
||||
[ngValue]="trigger[0]">{{ trigger[1] }}</option>
|
||||
@ -98,7 +99,8 @@
|
||||
(change)="checkAddDisabled()"
|
||||
*ngIf="newAction.type === 2 ||
|
||||
newAction.type === 3 ||
|
||||
newAction.type === 5">
|
||||
newAction.type === 5 ||
|
||||
newAction.type === 6">
|
||||
<option *ngFor="let source of actionSources"
|
||||
[ngValue]="source[0]">{{ source[1] }}</option>
|
||||
</select>
|
||||
|
@ -63,6 +63,7 @@ export class AutoActions {
|
||||
[ ActionType.AddCategory, 'Add item category' ],
|
||||
[ ActionType.ClearAllCategories, 'Clear item categories' ],
|
||||
[ ActionType.SetAssignee, 'Set item assignee' ],
|
||||
[ ActionType.AddAssignee, 'Add item assignee' ],
|
||||
[ ActionType.ClearDueDate, 'Clear item due date' ]
|
||||
];
|
||||
this.types = this.typesList;
|
||||
@ -93,6 +94,7 @@ export class AutoActions {
|
||||
updateTriggerSources(): void {
|
||||
this.triggerSources = [];
|
||||
this.newAction.source_id = null;
|
||||
this.newAction.change_to = '#000000';
|
||||
|
||||
this.types = this.typesList;
|
||||
|
||||
@ -134,6 +136,7 @@ export class AutoActions {
|
||||
'Category', 'categories');
|
||||
break;
|
||||
case ActionType.SetAssignee:
|
||||
case ActionType.AddAssignee:
|
||||
this.buildSourcesArray('actionSources',
|
||||
'Assignee', 'users', 'username');
|
||||
break;
|
||||
@ -148,17 +151,20 @@ export class AutoActions {
|
||||
checkAddDisabled(): void {
|
||||
this.isAddDisabled = false;
|
||||
|
||||
if (this.newAction.board_id !== null) {
|
||||
if (this.newAction.source_id === null) {
|
||||
this.isAddDisabled =
|
||||
(this.newAction.trigger !== ActionTrigger.PointsChanged);
|
||||
}
|
||||
if (this.newAction.board_id === null) {
|
||||
this.isAddDisabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.isAddDisabled && this.newAction.change_to === null) {
|
||||
this.isAddDisabled =
|
||||
(this.newAction.type !== ActionType.ClearAllCategories &&
|
||||
this.newAction.type !== ActionType.ClearDueDate);
|
||||
}
|
||||
if (this.newAction.source_id === null) {
|
||||
this.isAddDisabled =
|
||||
(this.newAction.trigger !== ActionTrigger.PointsChanged);
|
||||
}
|
||||
|
||||
if (!this.isAddDisabled && this.newAction.change_to === null) {
|
||||
this.isAddDisabled =
|
||||
(this.newAction.type !== ActionType.ClearAllCategories &&
|
||||
this.newAction.type !== ActionType.ClearDueDate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ export enum ActionType {
|
||||
AddCategory,
|
||||
ClearAllCategories,
|
||||
SetAssignee,
|
||||
AddAssignee,
|
||||
ClearDueDate,
|
||||
AlterColorByPoints
|
||||
}
|
||||
|
Reference in New Issue
Block a user