Improvements in the GUI
[portal/nonrtric-controlpanel.git] / webapp-frontend / src / app / policy-control / no-type-policy-instance-dialog.component.html
index 393d40b..30d1777 100644 (file)
   ========================LICENSE_END===================================
   -->
 
+<div class="text-muted logo" fxLayout="row" fxLayoutGap="50px" fxLayoutAlign="space-around center">
+    <div *ngIf="policyInstanceId">[{{this.ric}}] {{policyInstanceId}}</div>
+</div>
 <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>
+                <tspan>< 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>
+<div [formGroup]="instanceForm" fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-sm="column"
+    fxLayoutAlign.lt-sm="flex-start center">
 
-<form [formGroup]="instanceForm" novalidate autocomplete="off">
-    <div mat-dialog-content>
+    <mat-card class="card" [ngClass]="{'card-dark': darkMode}">
         <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-select id="ricSelector" formControlName="ricSelector" matInput required [(value)]="this.ric"
+                placeholder="Target"
+                matTooltip="Element where the policy instance resides, e.g. a gNodeB or Near-RT 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.invalid && (ricSelector.dirty || ricSelector.touched)" class="alert mat-error"
+                style="width: 300px;">
                 <div *ngIf="ricSelector.errors.required">
-                    A Ric must be selected.
+                    <mat-error role="alert">
+                        This field is required.
+                    </mat-error>
                 </div>
             </div>
         </mat-form-field>
-
+        <h4>
+            Properties
+        </h4>
         <mat-form-field style="width: 800px;">
-            <mat-label>Policy content</mat-label>
             <textarea id="policyJsonTextArea" formControlName="policyJsonTextArea" matInput cdkTextareaAutosize
-                cdkAutosizeMinRows="10" required>
+                cdkAutosizeMinRows="10" required [(value)]="this.policyJson" placeholder="Policy properties"
+                matTooltip="The properties of the policy instance, in JSON format" matTooltipPosition="before">
             </textarea>
-            <div *ngIf="policyJsonTextArea.invalid && (policyJsonTextArea.dirty || policyJsonTextArea.touched)"
-                class="alert alert-danger">
+            <div *ngIf="policyJsonTextArea.invalid && (policyJsonTextArea.dirty || policyJsonTextArea.touched)">
                 <div *ngIf="policyJsonTextArea.errors.required">
-                    The policy body is required.
+                    <mat-error role="alert">
+                        This field is required.
+                    </mat-error>
                 </div>
                 <div *ngIf="policyJsonTextArea.errors.invalidJson">
-                    The policy body must be a valid JSON.
+                    <mat-error role="alert">
+                        The policy properties must be a valid JSON.
+                    </mat-error>
                 </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
+        <div mat-dialog-actions>
+            <button (click)="formatJsonInput();" class="mat-raised-button" [disabled]="!policyJsonTextArea.valid">
+                Format JSON
+            </button>
+            <button mat-raised-button class="mat-raised-button" [mat-dialog-close]="false">Close</button>
+            <button mat-raised-button (click)="this.onSubmit()" class="submitBtn" [disabled]="!instanceForm.valid">
+                Submit
+            </button>
+        </div>
+    </mat-card>
+</div>
\ No newline at end of file