feat:add protect param 43/127643/1
authorliuwh7 <liuwh7@asiainfo.com>
Thu, 10 Mar 2022 09:18:47 +0000 (17:18 +0800)
committerliuwh7 <liuwh7@asiainfo.com>
Thu, 10 Mar 2022 09:18:58 +0000 (17:18 +0800)
Signed-off-by: liuwh7 <liuwh7@asiainfo.com>
Change-Id: I46af7e2a48ebf571341a9b58514785413157fb17
Issue-ID: REQ-1075

usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html
usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.ts
usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.html
usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.less
usecaseui-portal/src/app/views/services/intent-based-services/constants.ts

index b436bf3..c746e30 100644 (file)
                   </nz-select>
                 </div>
               </div>
+              <nz-radio-group
+                [name]="item.key"
+                [(ngModel)]="cloud_leased_line_info[item.key]"
+                *ngIf="item.type === 'radio'"
+              >
+                <label
+                  nz-radio
+                  [nzValue]="option.key"
+                  *ngFor="let option of item.options"
+                >
+                  {{ option.title }}
+                </label>
+              </nz-radio-group>
             </nz-form-control>
         </nz-form-item>
     </form>
index a8c617a..77c9f0d 100644 (file)
@@ -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
index 9a54a49..6c3941c 100644 (file)
@@ -26,6 +26,22 @@ export const COMMUNICATION_FORM_ITEMS = [
                type: "text",
                required: true,
        },
+  {
+               title: "Resource Protect Level",
+               key: "protect",
+               type: "radio",
+               required: true,
+               options: [
+                       {
+                               title: "Protect",
+                               key: true,
+                       },
+                       {
+                               title: "Non-Protect",
+                               key: false,
+                       },
+               ],
+       },
        {
                title: "Access Point 1",
     nodeName: 'Name',