5 changed files with 497 additions and 90 deletions
@ -0,0 +1,46 @@ |
|||
<button mat-raised-button color="primary" |
|||
[disabled]="(isLoading$ | async)" |
|||
(click)="onDeleteRuleNode($event)" |
|||
[fxShow]="!isEdit && !isReadOnly"> |
|||
{{'rulenode.delete' | translate }} |
|||
</button> |
|||
<div class="mat-padding" fxLayout="column"> |
|||
<form #ruleNodeForm="ngForm" [formGroup]="ruleNodeFormGroup"> |
|||
<fieldset [disabled]="(isLoading$ | async) || !isEdit || isReadOnly"> |
|||
<section *ngIf="ruleNode.component.type !== ruleNodeType.RULE_CHAIN"> |
|||
<section fxLayout="column" fxLayout.gt-sm="row"> |
|||
<mat-form-field class="mat-block"> |
|||
<mat-label translate>rulenode.name</mat-label> |
|||
<input matInput formControlName="name" required> |
|||
<mat-error *ngIf="ruleNodeFormGroup.get('name').hasError('required')"> |
|||
{{ 'rulenode.name-required' | translate }} |
|||
</mat-error> |
|||
</mat-form-field> |
|||
<mat-checkbox formControlName="debugMode"> |
|||
{{ 'rulenode.debug-mode' | translate }} |
|||
</mat-checkbox> |
|||
</section> |
|||
TODO: tb-rule-node-config |
|||
<div formGroupName="additionalInfo" fxLayout="column"> |
|||
<mat-form-field class="mat-block"> |
|||
<mat-label translate>rulenode.description</mat-label> |
|||
<textarea matInput formControlName="description" rows="2"></textarea> |
|||
</mat-form-field> |
|||
</div> |
|||
</section> |
|||
<section *ngIf="ruleNode.component.type === ruleNodeType.RULE_CHAIN"> |
|||
<tb-entity-autocomplete required |
|||
[excludeEntityIds]="[ruleChainId]" |
|||
[entityType]="entityType.RULE_CHAIN" |
|||
formControlName="targetRuleChainId"> |
|||
</tb-entity-autocomplete> |
|||
<div formGroupName="additionalInfo" fxLayout="column"> |
|||
<mat-form-field class="mat-block"> |
|||
<mat-label translate>rulenode.description</mat-label> |
|||
<textarea matInput formControlName="description" rows="2"></textarea> |
|||
</mat-form-field> |
|||
</div> |
|||
</section> |
|||
</fieldset> |
|||
</form> |
|||
</div> |
|||
@ -0,0 +1,70 @@ |
|||
import { |
|||
AfterViewInit, |
|||
Component, |
|||
EventEmitter, |
|||
Input, |
|||
OnInit, |
|||
Output, |
|||
ViewChild, |
|||
ViewEncapsulation |
|||
} from '@angular/core'; |
|||
import { PageComponent } from '@shared/components/page.component'; |
|||
import { HasDirtyFlag } from '@core/guards/confirm-on-exit.guard'; |
|||
import { ISearchableComponent } from '@home/models/searchable-component.models'; |
|||
import { Store } from '@ngrx/store'; |
|||
import { AppState } from '@core/core.state'; |
|||
import { FormBuilder, FormGroup, NgForm } from '@angular/forms'; |
|||
import { FcRuleNode } from './rulechain-page.models'; |
|||
import { RuleNodeType } from '@shared/models/rule-node.models'; |
|||
import { EntityType } from '@shared/models/entity-type.models'; |
|||
|
|||
@Component({ |
|||
selector: 'tb-rule-node', |
|||
templateUrl: './rule-node-details.component.html', |
|||
styleUrls: [] |
|||
}) |
|||
export class RuleNodeDetailsComponent extends PageComponent implements OnInit { |
|||
|
|||
@ViewChild('ruleNodeForm', {static: true}) ruleNodeForm: NgForm; |
|||
|
|||
ruleNodeValue: FcRuleNode; |
|||
|
|||
@Input() |
|||
set ruleNode(ruleNode: FcRuleNode) { |
|||
this.ruleNodeValue = ruleNode; |
|||
} |
|||
|
|||
@Input() |
|||
ruleChainId: string; |
|||
|
|||
@Input() |
|||
isEdit: boolean; |
|||
|
|||
@Input() |
|||
isReadOnly: boolean; |
|||
|
|||
@Output() |
|||
deleteRuleNode = new EventEmitter(); |
|||
|
|||
ruleNodeType = RuleNodeType; |
|||
entityType = EntityType; |
|||
|
|||
ruleNodeFormGroup: FormGroup; |
|||
|
|||
constructor(protected store: Store<AppState>, |
|||
private fb: FormBuilder) { |
|||
super(store); |
|||
this.ruleNodeFormGroup = this.fb.group({}); |
|||
} |
|||
|
|||
private buildForm() { |
|||
} |
|||
|
|||
ngOnInit(): void { |
|||
} |
|||
|
|||
onDeleteRuleNode(event) { |
|||
this.deleteRuleNode.emit(); |
|||
} |
|||
|
|||
} |
|||
Loading…
Reference in new issue