PatrikBuhr | a2bc79c | 2019-10-29 13:39:00 +0100 | [diff] [blame] | 1 | <!-- |
| 2 | ========================LICENSE_START================================= |
| 3 | O-RAN-SC |
| 4 | %% |
| 5 | Copyright (C) 2019 Nordix Foundation |
| 6 | %% |
| 7 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | you may not use this file except in compliance with the License. |
| 9 | You may obtain a copy of the License at |
| 10 | |
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
| 13 | Unless required by applicable law or agreed to in writing, software |
| 14 | distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | See the License for the specific language governing permissions and |
| 17 | limitations under the License. |
| 18 | ========================LICENSE_END=================================== |
| 19 | --> |
PatrikBuhr | dbb8eba | 2019-11-15 14:12:11 +0100 | [diff] [blame] | 20 | <div class="text-muted logo" fxLayout="row" fxLayoutGap="50px" fxLayoutAlign="space-around center"> |
PatrikBuhr | a2bc79c | 2019-10-29 13:39:00 +0100 | [diff] [blame] | 21 | <div *ngIf="policyInstanceId">{{policyInstanceId}}</div> |
| 22 | </div> |
PatrikBuhr | dbb8eba | 2019-11-15 14:12:11 +0100 | [diff] [blame] | 23 | <div class="mat-elevation-z8 header row" [ngClass]="{'header-dark': darkMode}"> |
PatrikBuhr | a2bc79c | 2019-10-29 13:39:00 +0100 | [diff] [blame] | 24 | <div class="logo"> |
| 25 | <img src="../../assets/oran-logo.png" width="30px" height="30px" style="position: relative; z-index: 50" /> |
PatrikBuhr | dbb8eba | 2019-11-15 14:12:11 +0100 | [diff] [blame] | 26 | <svg class="logo__icon" viewBox="150.3 22.2 1000 50"> |
| 27 | <text class="logo__text" [ngClass]="{'logo__text-dark': darkMode}" font-size="30" font-weight="600" |
| 28 | letter-spacing=".1em" transform="translate(149 56)"> |
PatrikBuhr | a2bc79c | 2019-10-29 13:39:00 +0100 | [diff] [blame] | 29 | <tspan *ngIf="jsonSchemaObject.title"> {{this.jsonSchemaObject.title}}</tspan> |
| 30 | <tspan *ngIf="!jsonSchemaObject.title"> {{this.policyTypeName}}</tspan> |
| 31 | </text> |
| 32 | </svg> |
| 33 | </div> |
| 34 | </div> |
| 35 | |
PatrikBuhr | 592589c | 2019-11-20 15:00:31 +0100 | [diff] [blame] | 36 | <div class="text-muted" *ngIf="jsonSchemaObject.description">{{jsonSchemaObject.description}}</div> |
PatrikBuhr | a2bc79c | 2019-10-29 13:39:00 +0100 | [diff] [blame] | 37 | |
| 38 | <div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-sm="column" fxLayoutAlign.lt-sm="flex-start center"> |
PatrikBuhr | dbb8eba | 2019-11-15 14:12:11 +0100 | [diff] [blame] | 39 | <mat-card class="card" [ngClass]="{'card-dark': darkMode}"> |
PatrikBuhr | a2bc79c | 2019-10-29 13:39:00 +0100 | [diff] [blame] | 40 | <h4 class="default-cursor" (click)="toggleVisible('form')"> |
| 41 | <mat-icon matTooltip="Properties">{{isVisible.form ? 'expand_less' : 'expand_more'}}</mat-icon> |
| 42 | Properties |
| 43 | </h4> |
| 44 | <div *ngIf="isVisible.form" class="json-schema-form" [@expandSection]="true"> |
| 45 | <div *ngIf="!formActive">{{jsonFormStatusMessage}}</div> |
| 46 | |
| 47 | <json-schema-form *ngIf="formActive" loadExternalAssets="true" [form]="jsonSchemaObject" |
| 48 | [(data)]="jsonObject" [options]="jsonFormOptions" [framework]="'material-design'" [language]="'en'" |
| 49 | (onChanges)="onChanges($event)" (onSubmit)="onSubmit($event)" (isValid)="isValid($event)" |
| 50 | (validationErrors)="validationErrors($event)"> |
| 51 | </json-schema-form> |
| 52 | </div> |
| 53 | <hr /> |
| 54 | <button mat-raised-button (click)="this.onSubmit()" [disabled]="!this.formIsValid" class="submitBtn" |
| 55 | style="margin-right:10px">Submit</button> |
| 56 | <button mat-raised-button (click)="this.onClose()">Close</button> |
| 57 | <hr /> |
| 58 | <h4 [class.text-danger]="!formIsValid && !isVisible.json" [class.default-cursor]="formIsValid || isVisible.json" |
| 59 | (click)="toggleVisible('json')"> |
| 60 | <mat-icon matTooltip="Json">{{isVisible.json ? 'expand_less' : 'expand_more'}}</mat-icon> |
| 61 | Json |
| 62 | </h4> |
| 63 | <div *ngIf="isVisible.json" fxLayout="column" [@expandSection]="true"> |
| 64 | <div> |
| 65 | <strong *ngIf="formIsValid || prettyValidationErrors" [class.text-muted]="formIsValid" |
| 66 | [class.text-danger]="!formIsValid"> |
| 67 | {{formIsValid ? 'Json' : 'Not valid'}} |
| 68 | </strong> |
| 69 | <span *ngIf="!formIsValid && !prettyValidationErrors">Invalid form</span> |
| 70 | <span *ngIf="prettyValidationErrors">— errors:</span> |
| 71 | <div *ngIf="prettyValidationErrors" class="text-danger" [innerHTML]="prettyValidationErrors"></div> |
| 72 | </div> |
| 73 | <div> |
PatrikBuhr | dbb8eba | 2019-11-15 14:12:11 +0100 | [diff] [blame] | 74 | <pre [class.text__dark]='this.darkMode'>{{prettyLiveFormData}}</pre> |
PatrikBuhr | a2bc79c | 2019-10-29 13:39:00 +0100 | [diff] [blame] | 75 | </div> |
| 76 | </div> |
| 77 | |
| 78 | <h4 class="default-cursor" (click)="toggleVisible('schema')"> |
| 79 | <mat-icon matTooltip="Json Schema">{{isVisible.schema ? 'expand_less' : 'expand_more'}}</mat-icon> |
| 80 | Json Schema |
| 81 | </h4> |
| 82 | <div *ngIf="isVisible.schema" fxLayout="column" [@expandSection]="true"> |
| 83 | <strong class="text-muted">Schema</strong> |
PatrikBuhr | dbb8eba | 2019-11-15 14:12:11 +0100 | [diff] [blame] | 84 | <pre [class.text__dark]='this.darkMode'>{{schemaAsString}}</pre> |
PatrikBuhr | a2bc79c | 2019-10-29 13:39:00 +0100 | [diff] [blame] | 85 | </div> |
| 86 | </mat-card> |
| 87 | </div> |