Added support for showing typeless Policies
[portal/nonrtric-controlpanel.git] / 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" fxLayoutAlign="space-around center">
21     <div *ngIf="policyInstanceId">{{policyInstanceId}}</div>
22 </div>
23 <div class="mat-elevation-z8 header row" [ngClass]="{'header-dark': darkMode}">
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 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)">
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
36 <div class="text-muted" *ngIf="jsonSchemaObject.description">{{jsonSchemaObject.description}}</div>
37
38 <div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-sm="column" fxLayoutAlign.lt-sm="flex-start center">
39
40
41     <mat-card class="card" [ngClass]="{'card-dark': darkMode}">
42
43         <mat-form-field *ngIf="!this.policyInstanceId">
44             <mat-label [class.text-danger]="!this.ric">Select RIC</mat-label>
45             <mat-select [(value)]="this.ric">
46                 <mat-option *ngFor="let ric of this.allRics" [value]="ric">
47                     {{ric}}
48                 </mat-option>
49             </mat-select>
50         </mat-form-field>
51
52         <h4 class="default-cursor" (click)="toggleVisible('form')">
53             <mat-icon matTooltip="Properties">{{isVisible.form ? 'expand_less' : 'expand_more'}}</mat-icon>
54             Properties
55         </h4>
56         <div *ngIf="isVisible.form" class="json-schema-form" [@expandSection]="true">
57             <div *ngIf="!formActive">{{jsonFormStatusMessage}}</div>
58
59             <json-schema-form *ngIf="formActive" loadExternalAssets="true" [form]="jsonSchemaObject"
60                 [(data)]="jsonObject" [options]="jsonFormOptions" [framework]="'material-design'" [language]="'en'"
61                 (onChanges)="onChanges($event)" (onSubmit)="onSubmit($event)" (isValid)="isValid($event)"
62                 (validationErrors)="validationErrors($event)">
63             </json-schema-form>
64         </div>
65         <hr />
66         <button mat-raised-button (click)="this.onSubmit()" [disabled]="!this.formIsValid || !this.ric"
67             class="submitBtn">Submit</button>
68         <button mat-raised-button (click)="this.onClose()">Close</button>
69         <hr />
70         <h4 [class.text-danger]="!formIsValid && !isVisible.json" [class.default-cursor]="formIsValid || isVisible.json"
71             (click)="toggleVisible('json')">
72             <mat-icon matTooltip="Json">{{isVisible.json ? 'expand_less' : 'expand_more'}}</mat-icon>
73             Json
74         </h4>
75         <div *ngIf="isVisible.json" fxLayout="column" [@expandSection]="true">
76             <div>
77                 <strong *ngIf="formIsValid || prettyValidationErrors" [class.text-muted]="formIsValid"
78                     [class.text-danger]="!formIsValid">
79                     {{formIsValid ? 'Json' : 'Not valid'}}
80                 </strong>
81                 <strong class="text-danger" *ngIf="!formIsValid && !prettyValidationErrors">Not submittable</strong>
82                 <span *ngIf="prettyValidationErrors">— errors:</span>
83                 <div *ngIf="prettyValidationErrors" class="text-danger" [innerHTML]="prettyValidationErrors"></div>
84             </div>
85             <div>
86                 <pre [class.text__dark]='this.darkMode'>{{prettyLiveFormData}}</pre>
87             </div>
88         </div>
89
90         <h4 class="default-cursor" (click)="toggleVisible('schema')">
91             <mat-icon matTooltip="Json Schema">{{isVisible.schema ? 'expand_less' : 'expand_more'}}</mat-icon>
92             Json Schema
93         </h4>
94         <div *ngIf="isVisible.schema" fxLayout="column" [@expandSection]="true">
95             <strong class="text-muted">Schema</strong>
96             <pre [class.text__dark]='this.darkMode'>{{schemaAsString}}</pre>
97         </div>
98     </mat-card>
99 </div>