1e4145f6e86e89f88df97892794d0592fcbb1e33
[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
43     <mat-card class="card" [ngClass]="{'card-dark': darkMode}">
44
45         <mat-form-field *ngIf="!this.policyInstanceId">
46             <mat-label>Select RIC</mat-label>
47             <mat-select id="ricSelector" formControlName="ricSelector" matInput required [(value)]="this.ric">
48                 <mat-option *ngFor="let ric of this.allRics" [value]="ric">
49                     {{ric}}
50                 </mat-option>
51             </mat-select>
52             <div *ngIf="ricSelector.invalid && (ricSelector.dirty || ricSelector.touched)">
53                 <div *ngIf="ricSelector.errors.required">
54                     <mat-error role="alert">A Ric must be selected.</mat-error>
55                 </div>
56             </div>
57         </mat-form-field>
58
59         <h4 class="default-cursor" (click)="toggleVisible('form')">
60             <mat-icon matTooltip="Properties">{{isVisible.form ? 'expand_less' : 'expand_more'}}</mat-icon>
61             Properties
62         </h4>
63         <div *ngIf="isVisible.form" class="json-schema-form" [@expandSection]="true">
64             <div *ngIf="!formActive">{{jsonFormStatusMessage}}</div>
65
66             <json-schema-form *ngIf="formActive" loadExternalAssets="true" [form]="jsonSchemaObject"
67                 [(data)]="jsonObject" [options]="jsonFormOptions" [framework]="'material-design'" [language]="'en'"
68                 (onChanges)="onChanges($event)" (onSubmit)="onSubmit($event)" (isValid)="isValid($event)"
69                 (validationErrors)="validationErrors($event)">
70             </json-schema-form>
71         </div>
72         <hr />
73         <button mat-raised-button (click)="this.onClose()">Close</button>
74         <button mat-raised-button (click)="this.onSubmit()" [disabled]="!this.formIsValid || !this.ric"
75             class="submitBtn">Submit</button>
76         <hr />
77         <h4 [class.text-danger]="!formIsValid && !isVisible.json" [class.default-cursor]="formIsValid || isVisible.json"
78             (click)="toggleVisible('json')">
79             <mat-icon matTooltip="Json">{{isVisible.json ? 'expand_less' : 'expand_more'}}</mat-icon>
80             Json
81         </h4>
82         <div *ngIf="isVisible.json" fxLayout="column" [@expandSection]="true">
83             <div>
84                 <strong *ngIf="formIsValid || prettyValidationErrors" [class.text-muted]="formIsValid"
85                     [class.text-danger]="!formIsValid">
86                     {{formIsValid ? 'Json' : 'Not valid'}}
87                 </strong>
88                 <span *ngIf="!formIsValid && !prettyValidationErrors">Invalid form</span>
89                 <span *ngIf="prettyValidationErrors">— errors:</span>
90                 <div *ngIf="prettyValidationErrors" class="text-danger" [innerHTML]="prettyValidationErrors"></div>
91             </div>
92             <div>
93                 <pre [class.text__dark]="this.darkMode">{{prettyLiveFormData}}</pre>
94             </div>
95         </div>
96
97         <h4 class="default-cursor" (click)="toggleVisible('schema')">
98             <mat-icon matTooltip="Json Schema">{{isVisible.schema ? 'expand_less' : 'expand_more'}}</mat-icon>
99             Json Schema
100         </h4>
101         <div *ngIf="isVisible.schema" fxLayout="column" [@expandSection]="true">
102             <strong class="text-muted">Schema</strong>
103             <pre [class.text__dark]="this.darkMode">{{schemaAsString}}</pre>
104         </div>
105     </mat-card>
106 </div>