Possibility to create and edit typeless policies
[portal/nonrtric-controlpanel.git] / webapp-frontend / src / app / policy-control / no-type-policy-instance-dialog.component.html
diff --git a/webapp-frontend/src/app/policy-control/no-type-policy-instance-dialog.component.html b/webapp-frontend/src/app/policy-control/no-type-policy-instance-dialog.component.html
new file mode 100644 (file)
index 0000000..393d40b
--- /dev/null
@@ -0,0 +1,75 @@
+<!--
+  ========================LICENSE_START=================================
+  O-RAN-SC
+  %%
+  Copyright (C) 2020 Nordix Foundation
+  %%
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  ========================LICENSE_END===================================
+  -->
+
+<div class="mat-elevation-z8 header row" [ngClass]="{'header-dark': darkMode}">
+    <div class="logo">
+        <img src="../../assets/oran-logo.png" width="30px" height="30px" style="position: relative; z-index: 50" />
+        <svg class="logo__icon" viewBox="150.3 22.2 1000 50">
+            <text class="logo__text" [ngClass]="{'logo__text-dark': darkMode}" font-size="30" font-weight="600"
+                letter-spacing=".1em" transform="translate(149 56)">
+                <tspan>Policy with no type</tspan>
+            </text>
+        </svg>
+    </div>
+</div>
+
+<div class="text-muted">Since this is a policy type without a schema, the user will have to make sure that the content
+    of the policy has the necessary content. This dialog will only validate that it is a valid JSON string.</div>
+
+<form [formGroup]="instanceForm" novalidate autocomplete="off">
+    <div mat-dialog-content>
+        <mat-form-field *ngIf="!this.policyInstanceId">
+            <mat-label [class.text-danger]="!this.ric">Select RIC</mat-label>
+            <mat-select id="ricSelector" formControlName="ricSelector" matInput required [(value)]="this.ric">
+                <mat-option *ngFor="let ric of this.allRics" [value]="ric">
+                    {{ric}}
+                </mat-option>
+            </mat-select>
+            <div *ngIf="ricSelector.invalid && (ricSelector.dirty || ricSelector.touched)"
+                class="alert alert-danger">
+                <div *ngIf="ricSelector.errors.required">
+                    A Ric must be selected.
+                </div>
+            </div>
+        </mat-form-field>
+
+        <mat-form-field style="width: 800px;">
+            <mat-label>Policy content</mat-label>
+            <textarea id="policyJsonTextArea" formControlName="policyJsonTextArea" matInput cdkTextareaAutosize
+                cdkAutosizeMinRows="10" required>
+            </textarea>
+            <div *ngIf="policyJsonTextArea.invalid && (policyJsonTextArea.dirty || policyJsonTextArea.touched)"
+                class="alert alert-danger">
+                <div *ngIf="policyJsonTextArea.errors.required">
+                    The policy body is required.
+                </div>
+                <div *ngIf="policyJsonTextArea.errors.invalidJson">
+                    The policy body must be a valid JSON.
+                </div>
+            </div>
+        </mat-form-field>
+    </div>
+    <div mat-dialog-actions class="modal-footer justify-content-center">
+        <button mat-raised-button (click)="this.onSubmit()" class="submitBtn" [disabled]="!instanceForm.valid">
+            Submit
+        </button>
+        <button mat-raised-button class="mat-raised-button" [mat-dialog-close]="false">Close</button>
+    </div>
+</form>
\ No newline at end of file