fix service scaling bug 79/47579/1
authorzhangab <zhanganbing@chinamobile.com>
Tue, 15 May 2018 09:51:02 +0000 (17:51 +0800)
committerzhangab <zhanganbing@chinamobile.com>
Tue, 15 May 2018 09:51:57 +0000 (17:51 +0800)
Change-Id: Ibc7ab6a671d755df5ca10ae16fa088b41afea33b
Issue-ID: USECASEUI-115
Signed-off-by: zhangab <zhanganbing@chinamobile.com>
usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js
usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/scale-service-dialog.html [moved from usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/view-models/scale-service-dialog.html with 93% similarity]

index a7091f8..9d404c8 100644 (file)
@@ -488,38 +488,36 @@ app.controller('lcmCtrl', ['$scope', '$uibModal', '$log', '$http', '$timeout', '
       console.log(customer);
       console.log(serviceType);
       console.log(serviceInstance);
-        
+  
       ServiceTemplateService.getScaleServiceDialog(customer.name,serviceType.name,serviceInstance.serviceInstanceId,function(data){
         console.log(data.data);
         ctrl.nsData = data.data;
         // console.log(ctrl)
       })
       ctrl.scaleTypes = ["SCALE_NS","SCALE_VNF"];
-      ctrl.scaleType = "";
       ctrl.scalingDirections = ["SCALE_IN","SCALE_OUT"];
-      ctrl.scalingDirection = "";
-      ctrl.aspectId = null;
-      ctrl.numberOfStep = null;
 
       ctrl.ok = function () {
+        let resources = [];
+        ctrl.nsData.forEach(function(item){
+          resources.push({
+            "resourceInstanceId": item.netWorkServiceId,
+            "scaleType": item.scaleType,
+            "scaleNsData": {
+              "scaleNsByStepsData": {
+                "aspectId": item.aspectId,
+                "numberOfSteps": item.numberOfStep,
+                "scalingDirection": item.scalingDirection
+              }
+            }            
+          })
+        })
         var requestBody = {
           "service":{
             "serviceInstanceName": serviceInstance.serviceInstanceName,
-            "serviceType": serviceType,
+            "serviceType": serviceType.value,
             "globalSubscriberId": serviceInstance.serviceInstanceId,
-            "resources": [
-              {
-                "resourceInstanceId": "ns111",
-                "scaleType": ctrl.scaleType,
-                "scaleNsData": {
-                  "scaleNsByStepsData": {
-                    "aspectId": ctrl.aspectId,
-                    "numberOfSteps": ctrl.numberOfStep,
-                    "scalingDirection": ctrl.scalingDirection
-                  }
-                }
-              }
-            ]
+            "resources": resources
           } 
         };
         var errorMessage = function () {
@@ -34,7 +34,7 @@
                 <span class="required">*</span>
               </label>
               <div class="col-sm-7">
-                <input type="text" id="svcName" name="svcName" class="form-control" placeholder="aspectId" maxlength="256" ng-model="ctrl.aspectId"/>
+                <input type="text" id="svcName" name="svcName" class="form-control" placeholder="aspectId" maxlength="256" ng-model="nsdata.aspectId"/>
               </div>
             </div>
             <div class="mT15 form-group" style="margin-left:25px;">
@@ -43,7 +43,7 @@
                 <span class="required">*</span>
               </label>
               <div class="col-sm-7">
-                <input type="text" id="svcDesc" name="" class="form-control" placeholder="numberOfStep" maxlength="256" ng-model="ctrl.numberOfStep"/>
+                <input type="text" id="svcDesc" name="" class="form-control" placeholder="numberOfStep" maxlength="256" ng-model="nsdata.numberOfStep"/>
               </div>
             </div>
             <div class="form-group" style="margin-left:25px;margin-bottom:15px;">
@@ -52,7 +52,7 @@
                 <span class="required">*</span>
               </label>
               <div class="col-sm-7">
-                <select class="form-control" style="padding-top: 0px;padding-bottom: 0px;" id="svcTempl" name="svcTempl" ng-change="" ng-model="ctrl.scaleType" ng-options="template for template in ctrl.scaleTypes">
+                <select class="form-control" style="padding-top: 0px;padding-bottom: 0px;" id="svcTempl" name="svcTempl" ng-change="" ng-model="nsdata.scaleType" ng-options="template for template in ctrl.scaleTypes">
                   <option value="">--select--</option>
                 </select>
               </div>
@@ -63,7 +63,7 @@
                 <span class="required">*</span>
               </label>
               <div class="col-sm-7">
-                <select class="form-control" style="padding-top: 0px;padding-bottom: 0px;" id="svcTempl" name="svcTempl" ng-change="" ng-model="ctrl.scalingDirection" ng-options="template for template in ctrl.scalingDirections">
+                <select class="form-control" style="padding-top: 0px;padding-bottom: 0px;" id="svcTempl" name="svcTempl" ng-change="" ng-model="nsdata.scalingDirection" ng-options="template for template in ctrl.scalingDirections">
                   <option value="">--select--</option>
                 </select>
               </div>