mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.4 KiB
64 lines
1.4 KiB
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
|
import { ActionsDto, fadeAnimation, ModalModel, RuleDto, RulesState, TriggersDto } from '@app/shared';
|
|
|
|
@Component({
|
|
selector: 'sqx-rule',
|
|
styleUrls: ['./rule.component.scss'],
|
|
templateUrl: './rule.component.html',
|
|
animations: [
|
|
fadeAnimation,
|
|
],
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
})
|
|
export class RuleComponent {
|
|
@Input()
|
|
public ruleTriggers: TriggersDto;
|
|
|
|
@Input()
|
|
public ruleActions: ActionsDto;
|
|
|
|
@Input()
|
|
public rule: RuleDto;
|
|
|
|
public dropdown = new ModalModel();
|
|
|
|
public get isManual() {
|
|
return this.rule.triggerType === 'Manual';
|
|
}
|
|
|
|
constructor(
|
|
private readonly rulesState: RulesState,
|
|
) {
|
|
}
|
|
|
|
public delete() {
|
|
this.rulesState.delete(this.rule);
|
|
}
|
|
|
|
public run() {
|
|
this.rulesState.run(this.rule);
|
|
}
|
|
|
|
public runFromSnapshots() {
|
|
this.rulesState.runFromSnapshots(this.rule);
|
|
}
|
|
|
|
public rename(name: string) {
|
|
this.rulesState.update(this.rule, { name });
|
|
}
|
|
|
|
public toggle() {
|
|
this.rulesState.update(this.rule, { isEnabled: !this.rule.isEnabled });
|
|
}
|
|
|
|
public trigger() {
|
|
this.rulesState.trigger(this.rule);
|
|
}
|
|
}
|
|
|