Headless CMS and Content Managment Hub
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.
 
 
 
 
 

85 lines
3.1 KiB

<ng-container *ngIf="!triggerForm.form.controls.handleAll.value">
<table class="table table-middle table-sm table-fixed table-borderless">
<colgroup>
<col style="width: 40%;" />
<col style="width: 60%;" />
<col style="width: 40px;" />
</colgroup>
<tr>
<td>
<label>Schema</label>
</td>
<td>
<label>Condition</label>
</td>
<th></th>
</tr>
<tr *ngFor="let triggerSchema of triggerSchemas">
<td>
<span class="truncate">{{triggerSchema.schema.displayName}}</span>
</td>
<td class="text-center">
<input type="text" class="form-control code" placeholder="Optional condition as javascript expression"
[disabled]="triggerForm.form.disabled"
[ngModelOptions]="{ updateOn: 'blur' }"
[ngModel]="triggerSchema.condition"
(ngModelChange)="updateCondition(triggerSchema.schema, $event)" />
</td>
<td class="text-center">
<button type="button" class="btn btn-text-secondary" (click)="removeSchema(triggerSchema)" [disabled]="triggerForm.form.disabled">
<i class="icon-close"></i>
</button>
</td>
</tr>
</table>
<div class="section" *ngIf="schemasToAdd.length > 0">
<form class="row g-2" (ngSubmit)="addSchema()">
<div class="col">
<select class="form-select schemas-control" [disabled]="triggerForm.form.disabled" [(ngModel)]="schemaToAdd" name="schema">
<option *ngFor="let schema of schemasToAdd; trackBy: trackBySchema" [ngValue]="schema">{{schema.displayName}}</option>
</select>
</div>
<div class="col-auto">
<button type="submit" class="btn btn-success" [disabled]="triggerForm.form.disabled">Add Schema</button>
</div>
</form>
</div>
<div class="help">
<h4>Conditions</h4>
<p>Conditions are javascript expressions that define when to trigger, for example:</p>
<ul class="help-examples">
<li class="help-example">
Specific events:<br/>
<sqx-code>event.type == 'Created' || event.type == 'Published'</sqx-code>
</li>
<li class="help-example">
Content has value:<br/>
<sqx-code>event.data.important.iv === true</sqx-code>
</li>
<li class="help-example">
Updated by user:<br/>
<sqx-code>user.email === 'user@squidex.io'</sqx-code>
</li>
</ul>
</div>
</ng-container>
<div class="form-group" [formGroup]="triggerForm.form">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="handleAll" formControlName="handleAll">
<label class="form-check-label" for="handleAll">
Trigger on all content events
</label>
</div>
</div>