Add heading for Ric in instance dialogs
[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
21 <div class="text-muted logo" fxLayout="row" fxLayoutGap="50px" fxLayoutAlign="space-around center">
22     <div *ngIf="policyInstanceId">{{policyInstanceId}}</div>
23 </div>
24 <div class="mat-elevation-z8 header row" [ngClass]="{'header-dark': darkMode}">
25     <div class="logo">
26         <img src="../../assets/oran-logo.png" width="30px" height="30px" style="position: relative; z-index: 50" />
27         <svg class="logo__icon" viewBox="150.3 22.2 1000 50">
28             <text class="logo__text" [ngClass]="{'logo__text-dark': darkMode}" font-size="30" font-weight="600"
29                 letter-spacing=".1em" transform="translate(149 56)">
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 [formGroup]="instanceForm" fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-sm="column"
40     fxLayoutAlign.lt-sm="flex-start center">
41
42     <mat-card class="card" [ngClass]="{'card-dark': darkMode}">
43         <h4>
44             Near-RT RIC
45         </h4>
46         <mat-form-field *ngIf="!this.policyInstanceId">
47             <mat-select id="ricSelector" formControlName="ricSelector" matInput required [(value)]="this.ric"
48                 placeholder="Select Near-RT RIC">
49                 <mat-option *ngFor="let ric of this.allRics" [value]="ric">
50                     {{ric}}
51                 </mat-option>
52             </mat-select>
53             <div *ngIf="ricSelector.invalid && (ricSelector.dirty || ricSelector.touched)">
54                 <div *ngIf="ricSelector.errors.required">
55                     <mat-error role="alert">A Near-RT RIC must be selected.</mat-error>
56                 </div>
57             </div>
58         </mat-form-field>
59         <div *ngIf="this.policyInstanceId">
60             {{this.ric}}
61         </div>
62
63         <h4 class="default-cursor" (click)="toggleVisible('form')">
64             <mat-icon matTooltip="Properties">{{isVisible.form ? 'expand_less' : 'expand_more'}}</mat-icon>
65             Properties
66         </h4>
67         <div *ngIf="isVisible.form" class="json-schema-form" [@expandSection]="true">
68             <div *ngIf="!formActive">{{jsonFormStatusMessage}}</div>
69
70             <json-schema-form *ngIf="formActive" loadExternalAssets="true" [form]="jsonSchemaObject"
71                 [(data)]="jsonObject" [options]="jsonFormOptions" [framework]="'material-design'" [language]="'en'"
72                 (onChanges)="onChanges($event)" (onSubmit)="onSubmit($event)" (isValid)="isValid($event)"
73                 (validationErrors)="validationErrors($event)">
74             </json-schema-form>
75         </div>
76         <hr />
77         <button mat-raised-button (click)="this.onClose()">Close</button>
78         <button mat-raised-button (click)="this.onSubmit()" [disabled]="!this.formIsValid || !this.ric"
79             class="submitBtn">Submit</button>
80         <hr />
81         <h4 [class.text-danger]="!formIsValid && !isVisible.json" [class.default-cursor]="formIsValid || isVisible.json"
82             (click)="toggleVisible('json')">
83             <mat-icon matTooltip="Json">{{isVisible.json ? 'expand_less' : 'expand_more'}}</mat-icon>
84             Json
85         </h4>
86         <div *ngIf="isVisible.json" fxLayout="column" [@expandSection]="true">
87             <div>
88                 <strong *ngIf="formIsValid || prettyValidationErrors" [class.text-muted]="formIsValid"
89                     [class.text-danger]="!formIsValid">
90                     {{formIsValid ? 'Json' : 'Not valid'}}
91                 </strong>
92                 <span *ngIf="!formIsValid && !prettyValidationErrors">Invalid form</span>
93                 <span *ngIf="prettyValidationErrors">— errors:</span>
94                 <div *ngIf="prettyValidationErrors" class="text-danger" [innerHTML]="prettyValidationErrors"></div>
95             </div>
96             <div>
97                 <pre [class.text__dark]="this.darkMode">{{prettyLiveFormData}}</pre>
98             </div>
99         </div>
100
101         <h4 class="default-cursor" (click)="toggleVisible('schema')">
102             <mat-icon matTooltip="Json Schema">{{isVisible.schema ? 'expand_less' : 'expand_more'}}</mat-icon>
103             Json Schema
104         </h4>
105         <div *ngIf="isVisible.schema" fxLayout="column" [@expandSection]="true">
106             <strong class="text-muted">Schema</strong>
107             <pre [class.text__dark]="this.darkMode">{{schemaAsString}}</pre>
108         </div>
109     </mat-card>
110 </div>