X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fsrc%2Fapp%2Fpolicy-control%2Fpolicy-instance.component.ts;h=36c00fc2d70583ac180e1da2a8f70176c9d1d227;hb=refs%2Fchanges%2F68%2F5668%2F5;hp=bc8aa324762f91947f17c598af5fca56c46f9072;hpb=7443264a661235f08797ebf0dbb6a512f6485756;p=portal%2Fnonrtric-controlpanel.git diff --git a/webapp-frontend/src/app/policy-control/policy-instance.component.ts b/webapp-frontend/src/app/policy-control/policy-instance.component.ts index bc8aa32..36c00fc 100644 --- a/webapp-frontend/src/app/policy-control/policy-instance.component.ts +++ b/webapp-frontend/src/app/policy-control/policy-instance.component.ts @@ -18,7 +18,7 @@ * ========================LICENSE_END=================================== */ -import { MatSort } from '@angular/material'; +import { MatSort } from '@angular/material/sort'; import { Component, OnInit, ViewChild, Input, AfterViewInit } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { PolicyTypeSchema } from '../interfaces/policy.types'; @@ -36,7 +36,7 @@ import { Observable } from 'rxjs'; import { UiService } from '../services/ui/ui.service'; @Component({ - selector: 'rd-policy-instance', + selector: 'nrcp-policy-instance', templateUrl: './policy-instance.component.html', styleUrls: ['./policy-instance.component.scss'] }) @@ -59,7 +59,7 @@ export class PolicyInstanceComponent implements OnInit, AfterViewInit { } ngOnInit() { - this.instanceDataSource = new PolicyInstanceDataSource(this.policySvc, this.sort, this.notificationService,this.policyTypeSchema); + this.instanceDataSource = new PolicyInstanceDataSource(this.policySvc, this.sort, this.notificationService, this.policyTypeSchema); this.expanded.subscribe((isExpanded: boolean) => this.onExpand(isExpanded)); this.ui.darkModeState.subscribe((isDark) => { this.darkMode = isDark; @@ -77,28 +77,28 @@ export class PolicyInstanceComponent implements OnInit, AfterViewInit { } private isSchemaEmpty(): boolean { - return Object.keys(this.policyTypeSchema.schemaObject).length === 0; + return this.policyTypeSchema.schemaObject === '{}'; } modifyInstance(instance: PolicyInstance): void { - this.policySvc.getPolicy(this.policyTypeSchema.name, instance.policy_id).subscribe( + this.policySvc.getPolicyInstance(instance.policy_id).subscribe( (refreshedJson: any) => { - instance.policy_data = JSON.stringify(refreshedJson); + instance = refreshedJson; if (this.isSchemaEmpty()) { this.dialog.open( NoTypePolicyInstanceDialogComponent, getPolicyDialogProperties(this.policyTypeSchema, instance, this.darkMode)).afterClosed().subscribe( - (_: any) => { + (_: any) => { this.instanceDataSource.getPolicyInstances(); - } + } ); } else { this.dialog.open( PolicyInstanceDialogComponent, getPolicyDialogProperties(this.policyTypeSchema, instance, this.darkMode)).afterClosed().subscribe( - (_: any) => { + (_: any) => { this.instanceDataSource.getPolicyInstances(); - } + } ); } @@ -126,11 +126,11 @@ export class PolicyInstanceComponent implements OnInit, AfterViewInit { .afterClosed().subscribe( (res: any) => { if (res) { - this.policySvc.deletePolicy(this.policyTypeSchema.name, instance.policy_id) + this.policySvc.deletePolicy(instance.policy_id) .subscribe( (response: HttpResponse) => { switch (response.status) { - case 200: + case 204: this.notificationService.success('Delete succeeded!'); this.instanceDataSource.getPolicyInstances(); break;