blob: e9b6ff070b222c38154aa8475b67057b271ec870 [file] [log] [blame]
<!--
========================LICENSE_START=================================
O-RAN-SC
%%
Copyright (C) 2019 Nordix Foundation
%%
Licensed 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.
========================LICENSE_END===================================
-->
<div class="text-muted logo" fxLayout="row" fxLayoutGap="50px" fxLayoutAlign="space-around center">
<div *ngIf="policyInstanceId">{{policyInstanceId}}</div>
</div>
<div class="mat-elevation-z8 header row" [ngClass]="{'header-dark': darkMode}">
<div class="logo">
<img src="../../assets/oran-logo.png" width="30px" height="30px" style="position: relative; z-index: 50" />
<svg class="logo__icon" viewBox="150.3 22.2 1000 50">
<text class="logo__text" [ngClass]="{'logo__text-dark': darkMode}" font-size="30" font-weight="600"
letter-spacing=".1em" transform="translate(149 56)">
<tspan>Policy editor</tspan>
<tspan *ngIf="jsonSchemaObject.title"> {{this.jsonSchemaObject.title}}</tspan>
<tspan *ngIf="!jsonSchemaObject.title"> {{this.policyTypeName}}</tspan>
</text>
</svg>
</div>
</div>
<!--<div class="text-muted" *ngIf="jsonSchemaObject.description">{{jsonSchemaObject.description}}</div>-->
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-sm="column" fxLayoutAlign.lt-sm="flex-start center">
<mat-card class="card" [ngClass]="{'card-dark': darkMode}">
<h4 class="default-cursor" (click)="toggleVisible('form')">
<mat-icon matTooltip="Properties">{{isVisible.form ? 'expand_less' : 'expand_more'}}</mat-icon>
Properties
</h4>
<div *ngIf="isVisible.form" class="json-schema-form" [@expandSection]="true">
<div *ngIf="!formActive">{{jsonFormStatusMessage}}</div>
<json-schema-form *ngIf="formActive" loadExternalAssets="true" [form]="jsonSchemaObject"
[(data)]="jsonObject" [options]="jsonFormOptions" [framework]="'material-design'" [language]="'en'"
(onChanges)="onChanges($event)" (onSubmit)="onSubmit($event)" (isValid)="isValid($event)"
(validationErrors)="validationErrors($event)">
</json-schema-form>
</div>
<hr />
<button mat-raised-button (click)="this.onSubmit()" [disabled]="!this.formIsValid" class="submitBtn"
style="margin-right:10px">Submit</button>
<button mat-raised-button (click)="this.onClose()">Close</button>
<hr />
<h4 [class.text-danger]="!formIsValid && !isVisible.json" [class.default-cursor]="formIsValid || isVisible.json"
(click)="toggleVisible('json')">
<mat-icon matTooltip="Json">{{isVisible.json ? 'expand_less' : 'expand_more'}}</mat-icon>
Json
</h4>
<div *ngIf="isVisible.json" fxLayout="column" [@expandSection]="true">
<div>
<strong *ngIf="formIsValid || prettyValidationErrors" [class.text-muted]="formIsValid"
[class.text-danger]="!formIsValid">
{{formIsValid ? 'Json' : 'Not valid'}}
</strong>
<span *ngIf="!formIsValid && !prettyValidationErrors">Invalid form</span>
<span *ngIf="prettyValidationErrors">— errors:</span>
<div *ngIf="prettyValidationErrors" class="text-danger" [innerHTML]="prettyValidationErrors"></div>
</div>
<div>
<pre [class.text__dark]='this.darkMode'>{{prettyLiveFormData}}</pre>
</div>
</div>
<h4 class="default-cursor" (click)="toggleVisible('schema')">
<mat-icon matTooltip="Json Schema">{{isVisible.schema ? 'expand_less' : 'expand_more'}}</mat-icon>
Json Schema
</h4>
<div *ngIf="isVisible.schema" fxLayout="column" [@expandSection]="true">
<strong class="text-muted">Schema</strong>
<pre [class.text__dark]='this.darkMode'>{{schemaAsString}}</pre>
</div>
</mat-card>
</div>