From 1dac51bfc12c0eb84894c5aff4c970554a42e72c Mon Sep 17 00:00:00 2001 From: liuwh7 Date: Wed, 23 Mar 2022 09:39:00 +0800 Subject: feat: modify intent instance Signed-off-by: liuwh7 Change-Id: I212e71ad60c81f8135d46eae784c558cafed6d88 Issue-ID: REQ-1075 --- .../src/app/core/services/intentBase.service.ts | 5 ++++ .../cloud-leased-line-modal.component.html | 4 +++ .../cloud-leased-line-modal.component.ts | 33 +++++++++++++++++++++- .../cloud-leased-line.component.html | 8 ++++++ .../cloud-leased-line.component.ts | 16 +++++++++++ 5 files changed, 65 insertions(+), 1 deletion(-) (limited to 'usecaseui-portal/src') 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(this.url["invalidIntentInstance"], requestBody); } + updateIntentInstance(requestBody) { + return this.http.post(this.url["updateIntentInstance"], requestBody); + } + queryAccessNodeInfo() { return this.http.get(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 @@ @@ -60,6 +62,7 @@ {{item.nodeName}}: 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(); 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 @@ -73,6 +73,14 @@ > Inactive +