From b44075625fe5d092e0f7048b254edc986dd26c0a Mon Sep 17 00:00:00 2001 From: liuwh7 Date: Thu, 10 Mar 2022 17:18:47 +0800 Subject: feat:add protect param Signed-off-by: liuwh7 Change-Id: I46af7e2a48ebf571341a9b58514785413157fb17 Issue-ID: REQ-1075 --- .../cloud-leased-line-modal.component.html | 13 +++++++++++++ .../cloud-leased-line-modal.component.ts | 19 +++++++++++++++++-- .../cloud-leased-line.component.html | 2 +- .../cloud-leased-line.component.less | 4 ++++ .../views/services/intent-based-services/constants.ts | 16 ++++++++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-) (limited to 'usecaseui-portal/src/app/views') 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 b436bf32..c746e30f 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 @@ -71,6 +71,19 @@ + + + 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 a8c617ae..77c9f0dd 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 @@ -27,6 +27,7 @@ export class CloudLeasedLineModalComponent implements OnInit { cloud_leased_line_info = { name: '', instanceId: '', + protect: false, accessPointOne: { name: '', bandwidth: '' @@ -82,6 +83,9 @@ export class CloudLeasedLineModalComponent implements OnInit { submit(): void { const paramOnj = { ...this.cloud_leased_line_info }; for (const iterator in paramOnj) { + if (this.isBoolean(paramOnj[iterator])) { + continue; + } if (this.isString(paramOnj[iterator]) && !paramOnj[iterator]) { this.nzMessage.error(`Please enter ${iterator}`); return; @@ -103,7 +107,12 @@ export class CloudLeasedLineModalComponent implements OnInit { this.myHttp.createIntentInstance({ ...this.cloud_leased_line_info }).subscribe( - (data) => { + (response) => { + const { code, message } = response; + if (code !== 200) { + this.nzMessage.error(message); + return; + } this.nzMessage.success('Create IntentInstance Success!'); this.cancel(); }, @@ -118,6 +127,7 @@ export class CloudLeasedLineModalComponent implements OnInit { this.cloud_leased_line_info = { name: '', instanceId: '', + protect: false, accessPointOne: { name: '', bandwidth: '' @@ -128,6 +138,11 @@ export class CloudLeasedLineModalComponent implements OnInit { } isString(val) { - return Object.prototype.toString.call(val) === '[object String]'; + return typeof val === 'string' || typeof val === 'number'; + //return Object.prototype.toString.call(val) === '[object String]'; + } + + isBoolean(val) { + return typeof val === 'boolean'; } } \ No newline at end of file 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 331eb7b0..f4dd029f 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 @@ -1,4 +1,4 @@ -
+