Add dropbox to edit unis' profiles 28/52828/1
authorElisha Oren <elisha.oren@hpe.com>
Tue, 24 Jan 2017 11:33:10 +0000 (13:33 +0200)
committerElisha Oren <elisha.oren@hpe.com>
Sun, 5 Mar 2017 12:23:29 +0000 (14:23 +0200)
Change-Id: I933cb4465d02c0d032b4a810da80c7e7ecb3d78f
Signed-off-by: Elisha Oren <elisha.oren@hpe.com>
dlux/cpeui/cpeui-module/src/main/resources/cpeui/services/cpeui.services.js
dlux/cpeui/cpeui-module/src/main/resources/cpeui/tenant.controller.js
dlux/cpeui/cpeui-module/src/main/resources/cpeui/tenant.tpl.html

index a75b98d12ef9420ccb9290ea96ad62a338b40902..e5297434269d2537e37670a0b1f32d61f53af10f 100644 (file)
@@ -112,6 +112,24 @@ define(['app/cpeui/cpeui.module'],function(cpeui) {
           });
       };
 
+      svc.changeUniProfile = function(svcId,svcType, uniKey, profileName, callback) {
+          $http({
+              method:'GET',
+              url:'/restconf/config/mef-services:mef-services/mef-service/'+svcId+'/'+svcType+'/unis/uni/' + uniKey,
+          }).then(function successCallback(response) {
+              response.data["uni"][0]['ingress-bw-profile'] = profileName;
+              $http({
+                  method:'PUT',
+                  url:'/restconf/config/mef-services:mef-services/mef-service/'+svcId+'/'+svcType+'/unis/uni/' + uniKey,
+                  data:response.data
+              }).then(function successCallback(response) {
+                  if (callback != undefined) {
+                      callback();
+                  }
+              });
+          });
+      }
+
         // CEs
         svc.addCe = function(id, name, callback) {
             $http({
index d79c92b3c573e9a1f90bf8b2c3e9c4760dbf5fc7..a231654ed7032953932ecc5a8e8d992d40275983 100644 (file)
@@ -223,6 +223,18 @@ define([ 'app/cpeui/cpeui.module' ], function(cpeui) {
           });
     }, addEvcController);
 
+    $scope.changeProfile = function(svcId, svcType, uni, profile) {
+        var uniKey = (svcType == 'evc') ? uni['uni-id'] : (uni['uni-id'] +'/' + uni['ip-uni-id']);
+        CpeuiDialogs.customConfirm("Are you sure?",
+                "This will change " + uniKey + " bandwidth profile.",
+                function() {
+                    CpeuiSvc.changeUniProfile(svcId, svcType, uniKey, profile);
+                },function() {
+                    uni.selectedProfile = uni['ingress-bw-profile']
+                });
+    }
+
+
     $scope.ipvcDialog = new CpeuiDialogs.Dialog('AddIpvc', {}, function(obj) {
       CpeuiSvc.addIpvc(obj, $scope.curTenant, function() {
             $scope.updateEvcView();
index e43cba112af2fb25a04ccb12888ac0f14a3dc2ec..316c2f5f96732af2c561f542c2ff1fbb7bddb0ee 100644 (file)
                                         {{ uni.vlans.join(', ') }} {{item.evc['preserve-ce-vlan-id'] ? '(Preserved)' : ''}}
                                         </td>
                                         <td class="minimal-width" ng-if="item.isTree">{{ uni['role'] }}</td>
-                                        <td >{{ uni['ingress-bw-profile'] }}</td>
+                                        <td >
+                                               <md-input-container class="md-block">
+                                                                   <label>Profile</label>
+                                                                   <md-select name="profile" ng-change="changeProfile(item['svc-id'],'evc',uni,uni.selectedProfile)" ng-model="uni.selectedProfile" ng-init="uni.selectedProfile = uni['ingress-bw-profile']">
+                                                                       <md-option ng-value="undefined" default></md-option>
+                                                                       <md-option ng-repeat="profile in profiles" ng-value="profile['bw-profile']">{{profile['bw-profile']}} (CIR:{{profile.cir}}, CBS: {{profile.cbs}})</md-option>
+                                                                   </md-select>
+                                                               </md-input-container>
+                                        </td>
                                         <td class="minimal-width" style="white-space: nowrap;">
                                         <button class="btn btn-md btn-danger" ng-click="deleteEvcUni(item['svc-id'], uni['uni-id'])"> <i class="icon-trash"></i> </button>
                                         </td>
                 </thead>
                 <tbody id="l2_table">
                     <tr ng-repeat="ipvc in ipvcs | orderBy : 'name'">
-                        <td class="minimal-width">{{ ipvc.ipvc['ipvc-id'] }}</td>
+                        <td class="minimal-width">{{ ipvc['svc-id'] }}</td>
                         <td class="minimal-width">{{ ipvc['name'] }}</td>
                         <td>
                             <table class="footable table table-striped inner-table" ng-if="ipvc.ipvc.unis.uni" ng-init="expandFlags.L3[ipvc.ipvc['ipvc-id']] = true">
                                         <td class="minimal-width">{{ ipuni.prettyID }}</td>
                                         <td>{{serviceIpuni.vlan}}</td>
                                         <td class="minimal-width">{{serviceIpuni['ip-address']}}</td>
-                                        <td>{{ ipuni['ingress-bw-profile'] }}</td>
+                                        <td>
+                                            <md-input-container class="md-block">
+                                                <label>Profile</label>
+                                                <md-select name="profile" ng-change="changeProfile(ipvc['svc-id'],'ipvc',ipuni, ipuni.selectedProfile)" ng-model="ipuni.selectedProfile" ng-init="ipuni.selectedProfile = ipuni['ingress-bw-profile']">
+                                                    <md-option ng-value="undefined" default></md-option>
+                                                    <md-option ng-repeat="profile in profiles" ng-value="profile['bw-profile']">{{profile['bw-profile']}} (CIR:{{profile.cir}}, CBS: {{profile.cbs}})</md-option>
+                                                </md-select>
+                                            </md-input-container>
+                                        </td>
                                         <td class="minimal-width"><button class="btn btn-md btn-danger" ng-click="deleteIpvcUni(ipvc['svc-id'], ipuni['uni-id'], ipuni['ip-uni-id'])"> <i class="icon-trash"></i> </button></td>
                                     </tr>
                                 </tbody>