blob: 1dcc9f10ae2cf32d50a5b40c6791dfcb9599cb86 [file] [log] [blame]
<!--
Licensed to the Apache Software
Foundation (ASF) under one or more contributor license agreements. See the
NOTICE file distributed with this work for additional information regarding
copyright ownership. The ASF licenses this file to You under the Apache License,
Version 2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the License.
-->
<div class="metron-slider-pane-edit fill load-left-to-right dialog2x">
<div class="form-title">Schema</div>
<i class="fa fa-times pull-right close-button" aria-hidden="true" (click)="onCancel()"></i>
<form role="form" class="fieldschema-form">
<metron-config-sample-data [topic]="sensorParserConfig.sensorTopic" (onSampleDataChanged)="onSampleDataChanged($event)" (onSampleDataNotAvailable)="onSampleDataNotAvailable()"></metron-config-sample-data>
<br><br>
<div class="metron-bg-inverse">
<div class="p-2">
<div class="row placeholder" *ngIf="fieldSchemaRows.length===0 || (parserResult === {})">
A data sample is need to view/configure the complete schema.
</div>
<div class="row mx-0" *ngIf="fieldSchemaRows.length>0">
<div class="col-md-3 title text-grey"> Field </div>
<div class="col-md-9 title text-grey"> Changes </div>
</div>
<div *ngFor="let fieldSchemaRow of fieldSchemaRows" class="row pb-1 mx-0">
<!-- Readonly Field Schema Row -->
<div class="field-schema-row" *ngIf="!fieldSchemaRow.showConfig" [class.field-suppressed]="fieldSchemaRow.isRemoved">
<div class="col-md-3 field-schema-cell-title"> {{ fieldSchemaRow.outputFieldName }} </div>
<div class="col-md-7 field-schema-cell-value" [innerHtml]="getChanges(fieldSchemaRow)"> </div>
<div class="col-md-2 field-schema-cell icon-blue" style="font-size: 16px">
<i *ngIf="!fieldSchemaRow.isParserGenerated" class="fa fa-trash pull-right" aria-hidden="true" (click)="onDelete(fieldSchemaRow)"></i>
<i class="fa fa-pencil pull-right" aria-hidden="true" (click)="fieldSchemaRow.showConfig=true"></i>
<i *ngIf="!fieldSchemaRow.isRemoved" class="fa fa-ban pull-right" aria-hidden="true" (click)="onRemove(fieldSchemaRow)"></i>
<i *ngIf="fieldSchemaRow.isRemoved" class="fa fa-check-circle-o pull-right" style="color:lightgreen" aria-hidden="true" (click)="onEnable(fieldSchemaRow)"></i>
</div>
</div>
<!-- Editable Enrichments Pane -->
<div class="config container" *ngIf="fieldSchemaRow.showConfig">
<!--Title-->
<div class="row py-1">
<div class="col-md-10 enrichments-edit-title"> {{ fieldSchemaRow.outputFieldName }} </div>
<div class="col-md-2 enrichment-cell">
<i class="fa fa-times-circle pull-right small-close-button" aria-hidden="true" (click)="onCancelChange(fieldSchemaRow)"></i>
</div>
</div>
<!--Input Field Name-->
<div class="form-group px-1 col-md-10" *ngIf="fieldSchemaRow.isNew">
<label>INPUT FIELD</label>
<select [(ngModel)]="fieldSchemaRow.inputFieldName" [ngModelOptions]="{standalone: true}" (ngModelChange)="fieldSchemaRow.outputFieldName=fieldSchemaRow.inputFieldName+'_copy'">
<option [disabled] [selected]> </option>
<option *ngFor="let fieldSchemaRow of fieldSchemaRows" [attr.hidden]="fieldSchemaRow.isNew"> {{ fieldSchemaRow.inputFieldName }} </option>
</select>
</div>
<!-- Output Field Name-->
<div class="form-group px-1 col-md-10" *ngIf="fieldSchemaRow.isNew || !fieldSchemaRow.isParserGenerated">
<label>NAME</label>
<input type="text" class="form-control" [name]="fieldSchemaRow.outputFieldName" [(ngModel)]="fieldSchemaRow.outputFieldName" [ngModelOptions]="{standalone: true}">
</div>
<!-- Transforms -->
<div class="form-group px-1 col-md-12">
<label>TRANSFORMATIONS</label>
<metron-config-multiple-input [type]="'select'" [availableItems]="transformOptions" [(configuredItems)]="fieldSchemaRow.transformConfigured" (onConfigChange)="onTransformsChange(fieldSchemaRow)"> </metron-config-multiple-input>
<div class="edit-pane-readonly rounded col-md-10"> {{ fieldSchemaRow.preview }} </div>
</div>
<!-- Enrichmnets -->
<div class="form-group px-1 col-md-12">
<label>ENRICHMENTS</label>
<metron-config-multiple-input [availableItems]="enrichmentOptions" [(configuredItems)]="fieldSchemaRow.enrichmentConfigured" [allowDuplicates]="false"> </metron-config-multiple-input>
</div>
<!-- Threat Intel -->
<div class="form-group px-1 col-md-12">
<label>THREAT INTEL </label>
<metron-config-multiple-input [availableItems]="threatIntelOptions" [(configuredItems)]="fieldSchemaRow.threatIntelConfigured" [allowDuplicates]="false"> </metron-config-multiple-input>
</div>
<div class="form-group p-1 col-md-12">
<button type="submit" class="btn form-enable-disable-button pull-left" (click)="onSaveChange(fieldSchemaRow)">SAVE</button>
</div>
</div>
</div>
<div class="row mx-0 add-button" *ngIf="fieldSchemaRows.length > 0">
<button type="submit" class="btn form-enable-disable-button" (click)="addNewRule()"><i class="fa fa-plus" aria-hidden="true"></i></button>
</div>
</div>
</div>
</form>
</div>