Merge "Possibility to create and edit typeless policies"
[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="mat-elevation-z8 header row" [ngClass]="{'header-dark': darkMode}">
22     <div class="logo">
23         <img src="../../assets/oran-logo.png" width="30px" height="30px" style="position: relative; z-index: 50" />
24         <svg class="logo__icon" viewBox="150.3 22.2 1000 50">
25             <text class="logo__text" [ngClass]="{'logo__text-dark': darkMode}" font-size="30" font-weight="600"
26                 letter-spacing=".1em" transform="translate(149 56)">
27                 <tspan>Policy with no type</tspan>
28             </text>
29         </svg>
30     </div>
31 </div>
32
33 <div class="text-muted">Since this is a policy type without a schema, the user will have to make sure that the content
34     of the policy has the necessary content. This dialog will only validate that it is a valid JSON string.</div>
35
36 <form [formGroup]="instanceForm" novalidate autocomplete="off">
37     <div mat-dialog-content>
38         <mat-form-field *ngIf="!this.policyInstanceId">
39             <mat-label [class.text-danger]="!this.ric">Select RIC</mat-label>
40             <mat-select id="ricSelector" formControlName="ricSelector" matInput required [(value)]="this.ric">
41                 <mat-option *ngFor="let ric of this.allRics" [value]="ric">
42                     {{ric}}
43                 </mat-option>
44             </mat-select>
45             <div *ngIf="ricSelector.invalid && (ricSelector.dirty || ricSelector.touched)"
46                 class="alert alert-danger">
47                 <div *ngIf="ricSelector.errors.required">
48                     A Ric must be selected.
49                 </div>
50             </div>
51         </mat-form-field>
52
53         <mat-form-field style="width: 800px;">
54             <mat-label>Policy content</mat-label>
55             <textarea id="policyJsonTextArea" formControlName="policyJsonTextArea" matInput cdkTextareaAutosize
56                 cdkAutosizeMinRows="10" required>
57             </textarea>
58             <div *ngIf="policyJsonTextArea.invalid && (policyJsonTextArea.dirty || policyJsonTextArea.touched)"
59                 class="alert alert-danger">
60                 <div *ngIf="policyJsonTextArea.errors.required">
61                     The policy body is required.
62                 </div>
63                 <div *ngIf="policyJsonTextArea.errors.invalidJson">
64                     The policy body must be a valid JSON.
65                 </div>
66             </div>
67         </mat-form-field>
68     </div>
69     <div mat-dialog-actions class="modal-footer justify-content-center">
70         <button mat-raised-button (click)="this.onSubmit()" class="submitBtn" [disabled]="!instanceForm.valid">
71             Submit
72         </button>
73         <button mat-raised-button class="mat-raised-button" [mat-dialog-close]="false">Close</button>
74     </div>
75 </form>