Non-RT RIC Dashboard
[nonrtric.git] / dashboard / webapp-frontend / src / app / policy-control / policy-instance-dialog.component.html
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   -->
20 <div class="text-muted logo" fxLayout="row" fxLayoutGap="50px">
21     <div *ngIf="policyInstanceId">{{policyInstanceId}}</div>
22 </div>
23 <div class="mat-elevation-z8 header row logo">
24     <div class="logo">
25         <img src="../../assets/oran-logo.png" width="30px" height="30px" style="position: relative; z-index: 50" />
26         <svg class="logo__icon" viewBox="150.3 22.2 400 50">
27             <text [ngClass]="{'logo__text-dark': darkModeActive}" class="logo__text" fill="#432c85" font-size="30"
28                 font-weight="600" letter-spacing=".1em" transform="translate(149 56)">
29                 <tspan>Policy editor</tspan>
30                 <tspan *ngIf="jsonSchemaObject.title"> {{this.jsonSchemaObject.title}}</tspan>
31                 <tspan *ngIf="!jsonSchemaObject.title"> {{this.policyTypeName}}</tspan>
32             </text>
33         </svg>
34     </div>
35 </div>
36
37 <!--<div class="text-muted" *ngIf="jsonSchemaObject.description">{{jsonSchemaObject.description}}</div>-->
38
39 <div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-sm="column" fxLayoutAlign.lt-sm="flex-start center">
40     <mat-card class="card">
41         <h4 class="default-cursor" (click)="toggleVisible('form')">
42             <mat-icon matTooltip="Properties">{{isVisible.form ? 'expand_less' : 'expand_more'}}</mat-icon>
43             Properties
44         </h4>
45         <div *ngIf="isVisible.form" class="json-schema-form" [@expandSection]="true">
46             <div *ngIf="!formActive">{{jsonFormStatusMessage}}</div>
47
48             <json-schema-form *ngIf="formActive" loadExternalAssets="true" [form]="jsonSchemaObject"
49                 [(data)]="jsonObject" [options]="jsonFormOptions" [framework]="'material-design'" [language]="'en'"
50                 (onChanges)="onChanges($event)" (onSubmit)="onSubmit($event)" (isValid)="isValid($event)"
51                 (validationErrors)="validationErrors($event)">
52             </json-schema-form>
53         </div>
54         <hr />
55         <button mat-raised-button (click)="this.onSubmit()" [disabled]="!this.formIsValid" class="submitBtn"
56             style="margin-right:10px">Submit</button>
57         <button mat-raised-button (click)="this.onClose()">Close</button>
58         <hr />
59         <h4 [class.text-danger]="!formIsValid && !isVisible.json" [class.default-cursor]="formIsValid || isVisible.json"
60             (click)="toggleVisible('json')">
61             <mat-icon matTooltip="Json">{{isVisible.json ? 'expand_less' : 'expand_more'}}</mat-icon>
62             Json
63         </h4>
64         <div *ngIf="isVisible.json" fxLayout="column" [@expandSection]="true">
65             <div>
66                 <strong *ngIf="formIsValid || prettyValidationErrors" [class.text-muted]="formIsValid"
67                     [class.text-danger]="!formIsValid">
68                     {{formIsValid ? 'Json' : 'Not valid'}}
69                 </strong>
70                 <span *ngIf="!formIsValid && !prettyValidationErrors">Invalid form</span>
71                 <span *ngIf="prettyValidationErrors">— errors:</span>
72                 <div *ngIf="prettyValidationErrors" class="text-danger" [innerHTML]="prettyValidationErrors"></div>
73             </div>
74             <div>
75                 <pre [class.data-good]="!prettyValidationErrors && prettyLiveFormData !== '{}'"
76                     [class.data-bad]="prettyValidationErrors">{{prettyLiveFormData}}
77                 </pre>
78             </div>
79         </div>
80
81         <h4 class="default-cursor" (click)="toggleVisible('schema')">
82             <mat-icon matTooltip="Json Schema">{{isVisible.schema ? 'expand_less' : 'expand_more'}}</mat-icon>
83             Json Schema
84         </h4>
85         <div *ngIf="isVisible.schema" fxLayout="column" [@expandSection]="true">
86             <strong class="text-muted">Schema</strong>
87             <pre>{{schemaAsString}}</pre>
88         </div>
89     </mat-card>
90 </div>