5605271117ba6cf8899c60383142d687ed6595a9
[portal/nonrtric-controlpanel.git] / webapp-frontend / src / app / policy-control / no-type-policy-instance-dialog.component.html
1 <!--
2   ========================LICENSE_START=================================
3   O-RAN-SC
4   %%
5   Copyright (C) 2020 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">[{{this.ric}}] Instance ID: {{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="!this.policyInstanceId">Create new policy instance of </tspan>
31                 <tspan>< No type></tspan>
32             </text>
33         </svg>
34     </div>
35 </div>
36
37 <div [formGroup]="instanceForm" fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-sm="column"
38     fxLayoutAlign.lt-sm="flex-start center">
39
40     <mat-card class="card" [ngClass]="{'card-dark': darkMode}">
41         <mat-form-field *ngIf="!this.policyInstanceId" appearance="fill">
42             <mat-select id="ricSelector" formControlName="ricSelector" matInput required [(value)]="this.ric"
43                 placeholder="Target"
44                 matTooltip="Element where the policy instance resides, e.g. a gNodeB or Near-RT RIC">
45                 <mat-option *ngFor="let ric of this.allRics.rics" [value]="ric">
46                     {{ric.ric_id}}
47                 </mat-option>
48             </mat-select>
49             <div *ngIf="ricSelector.invalid && (ricSelector.dirty || ricSelector.touched)" class="alert mat-error"
50                 style="width: 300px;">
51                 <div *ngIf="ricSelector.errors.required">
52                     <mat-error role="alert">
53                         This field is required.
54                     </mat-error>
55                 </div>
56             </div>
57         </mat-form-field>
58         <h4>
59             Properties
60         </h4>
61         <mat-form-field style="width: 800px;"  appearance="fill">
62             <textarea id="policyJsonTextArea" formControlName="policyJsonTextArea" matInput cdkTextareaAutosize
63                 cdkAutosizeMinRows="10" required [(value)]="this.policyJson" placeholder="Policy properties"
64                 matTooltip="The properties of the policy instance, in JSON format" matTooltipPosition="before">
65             </textarea>
66             <div *ngIf="policyJsonTextArea.invalid && (policyJsonTextArea.dirty || policyJsonTextArea.touched)">
67                 <div *ngIf="policyJsonTextArea.errors.required">
68                     <mat-error role="alert">
69                         This field is required.
70                     </mat-error>
71                 </div>
72                 <div *ngIf="policyJsonTextArea.errors.invalidJson">
73                     <mat-error role="alert">
74                         The policy properties must be a valid JSON.
75                     </mat-error>
76                 </div>
77             </div>
78         </mat-form-field>
79         <div mat-dialog-actions>
80             <button (click)="formatJsonInput();" class="mat-raised-button" [disabled]="!policyJsonTextArea.valid">
81                 Format JSON
82             </button>
83             <button mat-raised-button class="mat-raised-button" [mat-dialog-close]="false">Close</button>
84             <button mat-raised-button (click)="this.onSubmit()" class="submitBtn" [disabled]="!instanceForm.valid">
85                 Submit
86             </button>
87         </div>
88     </mat-card>
89 </div>