import * as policytypes1 from './mock/policy-type1.json';
import * as policyinstanceedit from './mock/policy-instance-edit.json';
import * as rics from './mock/rics.json';
+import * as ric1 from './mock/ric1.json';
+import * as ric2 from './mock/ric2.json';
const urls = [
{
url: '/a1-policy/v2/policies/2000?ric=ric1&type=1',
json: ''
},
+ {
+ url: '/a1-policy/v2/rics?policytype_id=1',
+ json: ric1
+ },
+ {
+ url: '/a1-policy/v2/rics?policytype_id=',
+ json: ric2
+ },
{
url: 'api/enrichment/eijobs',
json: eijobs
--- /dev/null
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2021 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===================================
+ */
+
+// Models of data used by the Policy Control
+
+export interface Ric {
+ ric_id: string;
+ managed_element_ids: any[];
+ policytype_ids: any[];
+ state: string;
+}
--- /dev/null
+{
+ "rics": [
+ {
+ "ric_id": "ric1",
+ "managed_element_ids": [
+ "kista_1",
+ "kista_2"
+ ],
+ "policytype_ids": [
+ "1"
+ ],
+ "state": "AVAILABLE"
+ }
+ ]
+}
\ No newline at end of file
--- /dev/null
+{
+ "rics": [
+ {
+ "ric_id": "ric2",
+ "managed_element_ids": [
+ "kista_1",
+ "kista_2"
+ ],
+ "policytype_ids": [
+ ""
+ ],
+ "state": "AVAILABLE"
+ }
+ ]
+}
\ No newline at end of file
<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 *ngFor="let ric of this.allRics.rics" [value]="ric">
+ {{ric.ric_id}}
</mat-option>
</mat-select>
<div *ngIf="ricSelector.invalid && (ricSelector.dirty || ricSelector.touched)" class="alert mat-error"
import { HttpErrorResponse } from '@angular/common/http';
import { ErrorDialogService } from '../services/ui/error-dialog.service';
import * as uuid from 'uuid';
+import { Ric } from '../interfaces/ric';
@Component({
selector: 'rd-no-type-policy-instance-dialog',
policyJson: string;
darkMode: boolean;
ric: string;
- allRics: string[];
+ allRics: Ric[];
constructor(
private policySvc: PolicyService,
const self: NoTypePolicyInstanceDialogComponent = this;
this.policySvc.getRics('').subscribe(
{
- next(value) {
+ next(value:Ric[]) {
self.allRics = value;
console.log(value);
},
}
private isSchemaEmpty(policyTypeSchema: PolicyTypeSchema): boolean {
- return Object.keys(policyTypeSchema.schemaObject).length === 0;
+ return policyTypeSchema.schemaObject === '{}';
}
getPolicyTypeInfo(policyTypeSchema: PolicyTypeSchema): PolicyTypeInfo {
<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 *ngFor="let ric of this.allRics.rics" [value]="ric">
+ {{ric.ric_id}}
</mat-option>
</mat-select>
<div *ngIf="ricSelector.invalid && (ricSelector.dirty || ricSelector.touched)">
import { HttpErrorResponse } from '@angular/common/http';
import { FormGroup, FormControl, Validators } from '@angular/forms';
import { ChangeDetectorRef } from '@angular/core';
+import { Ric } from '../interfaces/ric';
@Component({
policyTypeName: string;
darkMode: boolean;
ric: string;
- allRics: string[];
+ allRics: Ric[];
private fetchRics() {
console.log('fetchRics ' + this.policyTypeName);
const self: PolicyInstanceDialogComponent = this;
this.dataService.getRics(this.policyTypeName).subscribe(
{
- next(value) {
+ next(value:Ric[]) {
self.allRics = value;
console.log(value);
},
import { map } from 'rxjs/operators';
import { PolicyInstance, PolicyInstanceAck, PolicyInstances, PolicyStatus, PolicyType, PolicyTypes } from '../../interfaces/policy.types';
import { ControlpanelSuccessTransport } from '../../interfaces/controlpanel.types';
+import { Ric } from 'src/app/interfaces/ric';
/**
* Services for calling the policy endpoints.
}
- getRics(policyTypeId: string): Observable<string[]> {
- const url = this.buildPath('rics') + '?policyType=' + policyTypeId;
+ getRics(policyTypeId: string): Observable<Ric[]> {
+ const url = this.buildPath('rics') + '?policytype_id=' + policyTypeId;
return this.httpClient.get<any>(url);
}
}