public ResponseEntity<String> putPolicy(String policyTypeIdString, String policyInstanceId, Object json,
String ric) {
database.putInstance(policyTypeIdString, policyInstanceId, json, ric);
- return new ResponseEntity<>("Policy was put successfully", HttpStatus.OK);
+ return new ResponseEntity<>(HttpStatus.OK);
}
@Override
public ResponseEntity<String> deletePolicy(String policyInstanceId) {
database.deleteInstance(policyInstanceId);
- return new ResponseEntity<>("Policy was deleted successfully", HttpStatus.NO_CONTENT);
+ return new ResponseEntity<>(HttpStatus.OK);
}
@Override
"@kubernetes/client-node": "^0.10.3",
"@material/radio": "^2.3.0",
"@types/chart.js": "^2.9.11",
+ "@types/uuid": "^7.0.3",
"angular-bootstrap-md": "^7.5.4",
- "angular6-json-schema-form": "^7.3.0",
+ "angular6-json-schema-form": "^8.0.0",
"bootstrap": "^4.4.1",
"chart.js": "^2.9.3",
"core-js": "^2.6.11",
========================LICENSE_END===================================
-->
+<div class="text-muted logo" fxLayout="row" fxLayoutGap="50px" fxLayoutAlign="space-around center">
+ <div *ngIf="policyInstanceId">{{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>
</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>
+<br/>
+<div class="text-muted">Enter policy statements (JSON).</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-label>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">
+ class="alert mat-error">
<div *ngIf="ricSelector.errors.required">
A Ric must be selected.
</div>
cdkAutosizeMinRows="10" required>
</textarea>
<div *ngIf="policyJsonTextArea.invalid && (policyJsonTextArea.dirty || policyJsonTextArea.touched)"
- class="alert alert-danger">
+ class="alert mat-error">
<div *ngIf="policyJsonTextArea.errors.required">
The policy body is required.
</div>
</div>
</mat-form-field>
</div>
- <div mat-dialog-actions class="modal-footer justify-content-center">
+ <div mat-dialog-actions>
<button mat-raised-button (click)="this.onSubmit()" class="submitBtn" [disabled]="!instanceForm.valid">
Submit
</button>
styleUrls: ['./no-type-policy-instance-dialog.component.scss']
})
export class NoTypePolicyInstanceDialogComponent implements OnInit {
-
- // Declare following variables as Public variable. Private variables should not be used in template HTML
instanceForm: FormGroup;
policyInstanceId: string; // null if not yet created
limitations under the License.
========================LICENSE_END===================================
-->
+
<div class="text-muted logo" fxLayout="row" fxLayoutGap="50px" fxLayoutAlign="space-around center">
<div *ngIf="policyInstanceId">{{policyInstanceId}}</div>
</div>
<div class="text-muted" *ngIf="jsonSchemaObject.description">{{jsonSchemaObject.description}}</div>
-<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-sm="column" fxLayoutAlign.lt-sm="flex-start center">
+<div [formGroup]="instanceForm" fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-sm="column"
+ fxLayoutAlign.lt-sm="flex-start center">
<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 [(value)]="this.ric">
+ <mat-label>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>
<div *ngIf="prettyValidationErrors" class="text-danger" [innerHTML]="prettyValidationErrors"></div>
</div>
<div>
- <pre [class.text__dark]='this.darkMode'>{{prettyLiveFormData}}</pre>
+ <pre [class.text__dark]="this.darkMode">{{prettyLiveFormData}}</pre>
</div>
</div>
</h4>
<div *ngIf="isVisible.schema" fxLayout="column" [@expandSection]="true">
<strong class="text-muted">Schema</strong>
- <pre [class.text__dark]='this.darkMode'>{{schemaAsString}}</pre>
+ <pre [class.text__dark]="this.darkMode">{{schemaAsString}}</pre>
</div>
</mat-card>
</div>
\ No newline at end of file
import { NotificationService } from './../services/ui/notification.service';
import { UiService } from '../services/ui/ui.service';
import { HttpErrorResponse } from '@angular/common/http';
+import { FormGroup, FormControl, Validators } from '@angular/forms';
@Component({
],
})
export class PolicyInstanceDialogComponent implements OnInit, AfterViewInit {
+ instanceForm: FormGroup;
+
formActive = false;
isVisible = {
this.ui.darkModeState.subscribe((isDark) => {
this.darkMode = isDark;
});
+ this.instanceForm = new FormGroup({
+ 'ricSelector': new FormControl(this.ric, [
+ Validators.required
+ ])
+ });
if (!this.policyInstanceId) {
this.fetchRics();
}
this.liveFormData = formData;
}
- get prettyLiveFormData() {
+ get prettyLiveFormData(): string {
return JSON.stringify(this.liveFormData, null, 2);
}
- get schemaAsString() {
+ get schemaAsString(): string {
return JSON.stringify(this.jsonSchemaObject, null, 2);
}
- get jsonAsString() {
+ get jsonAsString(): string {
return JSON.stringify(this.jsonObject, null, 2);
}