Create typed policy editor component
[portal/nonrtric-controlpanel.git] / webapp-frontend / src / app / policy / typed-policy-editor / typed-policy-editor.component.html
1 <!--
2  -
3    ========================LICENSE_START=================================
4    O-RAN-SC
5    %%
6    Copyright (C) 2021: Nordix Foundation
7    %%
8    Licensed under the Apache License, Version 2.0 (the "License");
9    you may not use this file except in compliance with the License.
10    You may obtain a copy of the License at
11
12         http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19    ========================LICENSE_END===================================
20
21 -->
22
23 <h4 class="default-cursor" (click)="toggleVisible('form')">
24     <mat-icon matTooltip="Properties">{{isVisible.form ? 'expand_less' : 'expand_more'}}</mat-icon>
25     Properties
26 </h4>
27 <div *ngIf="isVisible.form" class="json-schema-form" [@expandSection]="true">
28     <div *ngIf="!formActive">{{jsonFormStatusMessage}}</div>
29
30     <json-schema-form id="json-schema-form" *ngIf="formActive" [form]="jsonSchemaObject"
31         [(data)]="jsonObject" [options]="jsonFormOptions" [framework]="'material-design'" [language]="'en'"
32         (onChanges)="onChanges($event)" (isValid)="isValid($event)"
33         (validationErrors)="validationErrors($event)">
34     </json-schema-form>
35 </div>
36 <h4 [class.text-danger]="!formIsValid && !isVisible.json" [class.default-cursor]="formIsValid || isVisible.json"
37 (click)="toggleVisible('json')">
38 <mat-icon matTooltip="Json">{{isVisible.json ? 'expand_less' : 'expand_more'}}</mat-icon>
39 Json
40 </h4>
41 <div *ngIf="isVisible.json" fxLayout="column" [@expandSection]="true">
42 <div>
43     <strong *ngIf="formIsValid || prettyValidationErrors" [class.text-muted]="formIsValid"
44         [class.text-danger]="!formIsValid">
45         {{formIsValid ? 'Json' : 'Not valid'}}
46     </strong>
47     <span *ngIf="!formIsValid && !prettyValidationErrors">Invalid form</span>
48     <span *ngIf="prettyValidationErrors">— errors:</span>
49     <div *ngIf="prettyValidationErrors" class="text-danger" [innerHTML]="prettyValidationErrors"></div>
50 </div>
51 <div>
52     <pre [class.text__dark]="darkMode">{{prettyLiveFormData}}</pre>
53 </div>
54 </div>
55
56 <h4 class="default-cursor" (click)="toggleVisible('schema')">
57 <mat-icon matTooltip="Json Schema">{{isVisible.schema ? 'expand_less' : 'expand_more'}}</mat-icon>
58 Json Schema
59 </h4>
60 <div *ngIf="isVisible.schema" fxLayout="column" [@expandSection]="true">
61 <strong class="text-muted">Schema</strong>
62 <pre [class.text__dark]="darkMode">{{schemaAsString}}</pre>
63 </div>