diff options
5 files changed, 65 insertions, 1 deletions
diff --git a/usecaseui-portal/src/app/core/services/intentBase.service.ts b/usecaseui-portal/src/app/core/services/intentBase.service.ts index 5ee8424a..a9c4187b 100644 --- a/usecaseui-portal/src/app/core/services/intentBase.service.ts +++ b/usecaseui-portal/src/app/core/services/intentBase.service.ts @@ -32,6 +32,7 @@ export class intentBaseService { deleteIntentInstance: this.baseUrl + "/intent/deleteIntentInstance", activeIntentInstance: this.baseUrl + "/intent/activeIntentInstance", invalidIntentInstance: this.baseUrl + "/intent/invalidIntentInstance", + updateIntentInstance: this.baseUrl + "/intent/updateCCVPNInstance", queryAccessNodeInfo: this.baseUrl + "/intent/queryAccessNodeInfo", intentInstancePredict: this.baseUrl + "/intent/predict", intentBasedUnifyPredict: this.baseUrl + "/intent/unifyPredict", @@ -80,6 +81,10 @@ export class intentBaseService { return this.http.post<any>(this.url["invalidIntentInstance"], requestBody); } + updateIntentInstance(requestBody) { + return this.http.post<any>(this.url["updateIntentInstance"], requestBody); + } + queryAccessNodeInfo() { return this.http.get<any>(this.url["queryAccessNodeInfo"]); } diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html index c746e30f..d563e0b4 100644 --- a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html +++ b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html @@ -27,6 +27,7 @@ nz-tooltip [id]="item.key" [name]="item.key" + [disabled]="isUpdateFlag" *ngIf="item.type === 'input'" [(ngModel)]="cloud_leased_line_info[item.key]" [placeholder]="item.placeholder ? item.placeholder : ''" @@ -34,6 +35,7 @@ </nz-tooltip> <nz-select [name]="item.key" + [disabled]="isUpdateFlag" [(ngModel)]="cloud_leased_line_info[item.key]" *ngIf="item.type === 'select'" > @@ -60,6 +62,7 @@ <span>{{item.nodeName}}:</span> <nz-select [name]="item.nodeName" + [disabled]="isUpdateFlag" [(ngModel)]="cloud_leased_line_info[item.key].name" > <nz-option @@ -73,6 +76,7 @@ </div> <nz-radio-group [name]="item.key" + [disabled]="isUpdateFlag" [(ngModel)]="cloud_leased_line_info[item.key]" *ngIf="item.type === 'radio'" > diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.ts b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.ts index 77c9f0dd..b48cd3f0 100644 --- a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.ts +++ b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.ts @@ -21,7 +21,7 @@ export class CloudLeasedLineModalComponent implements OnInit { @Input() cloudLeasedLineShowFlag: boolean; @Output() cancelEmitter = new EventEmitter<boolean>(); comunicationFormItems = COMMUNICATION_FORM_ITEMS; - isLoadingOne = false; + isUpdateFlag: boolean = false; nodeLists: any[] = []; cloudPointOptions: any[] = []; cloud_leased_line_info = { @@ -40,6 +40,7 @@ export class CloudLeasedLineModalComponent implements OnInit { ngOnChanges() { if (this.cloudLeasedLineShowFlag) { if (this.modelParams) { + this.isUpdateFlag = this.modelParams.isUpdateFlag; this.cloud_leased_line_info = { ...this.modelParams }; } else { this.getInstanceId(); @@ -104,6 +105,35 @@ export class CloudLeasedLineModalComponent implements OnInit { } } + if (this.isUpdateFlag) { + this.updateIntentInstance(); + return; + } + this.createIntentInstance(); + } + + updateIntentInstance(): void { + const { accessPointOne: { bandwidth } } = this.cloud_leased_line_info; + this.myHttp.updateIntentInstance({ + instanceId: this.modelParams.instanceId, + bandwidth + }).subscribe( + (response) => { + const { code, message } = response; + if (code !== 200) { + this.nzMessage.error(message); + return; + } + this.nzMessage.success('Update IntentInstance Success!'); + this.cancel(); + }, + (err) => { + console.log(err); + } + ) + } + + createIntentInstance(): void { this.myHttp.createIntentInstance({ ...this.cloud_leased_line_info }).subscribe( @@ -124,6 +154,7 @@ export class CloudLeasedLineModalComponent implements OnInit { cancel(): void { this.cloudLeasedLineShowFlag = false + this.isUpdateFlag = false this.cloud_leased_line_info = { name: '', instanceId: '', diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.html b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.html index ae733c5f..78f752c6 100644 --- a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.html +++ b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.html @@ -77,6 +77,14 @@ nz-button nzType="primary" class="buy-button" + (click)="modifyCloudLeasedLine(data)" + > + Modify + </button> + <button + nz-button + nzType="primary" + class="buy-button" (click)="deleteCloudLeasedLine(data)" > Delete diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.ts b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.ts index a9d239df..dd044e7e 100644 --- a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.ts +++ b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.ts @@ -130,6 +130,7 @@ export class CloudLeasedLineComponent implements OnInit { this.cloudLeasedLineShowFlag = false; this.pageIndex = 1; this.pageSize = 10; + this.resolveResult = null; this.getCloudLeasedLineList(); } // smart dialog show @@ -187,6 +188,21 @@ export class CloudLeasedLineComponent implements OnInit { }); } + modifyCloudLeasedLine(row): void { + this.resolveResult = { + name: row.name, + instanceId: row.instanceId, + protect: row.protectStatus ? true : false, + accessPointOne: { + name: row.accessPointOneName, + bandwidth: row.accessPointOneBandWidth + }, + cloudPointName: row.cloudPointName, + isUpdateFlag: true + }; + this.cloudLeasedLineShowFlag = true; + } + deleteCloudLeasedLine(row): void { this.myHttp.deleteIntentInstance(row.instanceId).subscribe((data) => { const { code, message } = data; |