diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src')
5 files changed, 115 insertions, 40 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-chart-controller.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-chart-controller.js index fc36b73d..8fa14643 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-chart-controller.js +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-chart-controller.js @@ -187,7 +187,8 @@ appDS2.controller('reportChartController', function ($scope, $rootScope, $timeou $scope.reportRunJson.categoryAxisJSON = {}; $scope.reportRunJson.categoryAxisJSON.value = -1; } - + //add the remove list to the json + $scope.reportRunJson.rangeAxisRemoveList= $scope.rangeAxisRemoveList; $http.post("save_chart", JSON.stringify($scope.reportRunJson)).success(function(data, status) { $scope.successSubmit=true; $scope.showLoader = false; @@ -201,8 +202,9 @@ appDS2.controller('reportChartController', function ($scope, $rootScope, $timeou $scope.reportRunJson.barChartOptions.timeAxis =$scope.reportRunJson.barChartOptions.timeAxis+""; $scope.reportRunJson.barChartOptions.verticalOrientation = $scope.reportRunJson.barChartOptions.verticalOrientation +""; $scope.reportRunJson.barChartOptions.xAxisDateType = $scope.reportRunJson.barChartOptions.xAxisDateType +""; - } - }) + } + $scope.populateChrtWzdFields(); + }) } @@ -211,14 +213,17 @@ appDS2.controller('reportChartController', function ($scope, $rootScope, $timeou }); }; - $scope.removeRangeAxisRow = function (index) { - $scope.reportRunJson.rangeAxisList.splice(index, 1); + $scope.rangeAxisRemoveList= []; + $scope.removeRangeAxisRow = function (index) { + $scope.rangeAxisRemoveList.push($scope.reportRunJson.rangeAxisList[index]); + $scope.reportRunJson.rangeAxisList[index].removed="true"; }; $scope.init = function () { if ($scope) { $scope.populateChrtWzdFields(); + $scope.reportRunJson.rangeAxisRemoveList= []; } }; diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/profile-search-controller-DS2.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/profile-search-controller-DS2.js index 57e2e80b..5236001f 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/profile-search-controller-DS2.js +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/profile-search-controller-DS2.js @@ -1,10 +1,12 @@ -appDS2.controller('profileSearchCtrlDS2', function($scope, $http,ProfileServiceDS2){ +appDS2.controller('profileSearchCtrlDS2', function($scope, $log, $modal, ProfileServiceDS2){ $scope.showInput = true; - $scope.totalPages1 = 5; + $scope.totalPages1 = 0; $scope.viewPerPage1 = 8; $scope.currentPage1 = 1; $scope.showLoader = false; + var debug = false; + $scope.$watch('viewPerPage1', function(val) { $scope.showLoader = true; ProfileServiceDS2.getProfilePagination($scope.currentPage1, val).then(function(data){ @@ -12,15 +14,9 @@ appDS2.controller('profileSearchCtrlDS2', function($scope, $http,ProfileServiceD $scope.data = JSON.parse(j.data); $scope.tableData =JSON.parse($scope.data.profileList); $scope.totalPages1 =JSON.parse($scope.data.totalPage); - for(x in $scope.tableData){ - if($scope.tableData[x].active_yn=='Y') - $scope.tableData[x].active_yn=true; - else - $scope.tableData[x].active_yn=false; - } $scope.showLoader = false; },function(error){ - console.log("failed"); + console.log("watch of viewPerPage1 failed"); reloadPageOnce(); }); @@ -34,15 +30,9 @@ appDS2.controller('profileSearchCtrlDS2', function($scope, $http,ProfileServiceD $scope.data = JSON.parse(j.data); $scope.tableData =JSON.parse($scope.data.profileList); $scope.totalPages1 =JSON.parse($scope.data.totalPage); - for(x in $scope.tableData){ - if($scope.tableData[x].active_yn=='Y') - $scope.tableData[x].active_yn=true; - else - $scope.tableData[x].active_yn=false; - } $scope.showLoader = false; },function(error){ - console.log("failed"); + console.log("customHandler failed"); reloadPageOnce(); }); @@ -52,13 +42,52 @@ appDS2.controller('profileSearchCtrlDS2', function($scope, $http,ProfileServiceD window.location = 'userProfile#/profile/' + profileId; }; + var ModalInstanceCtrl = function ($scope, $log, $modalInstance, items) { + $scope.msg = items; + + $scope.toggleUserStatus = function(id) { + if (debug) + $log.debug('profileSearchCtrlDS2:ModalInstanceCtrl:toggleUserStatus: data is ' + id); + ProfileServiceDS2.toggleProfileStatus(id); + $modalInstance.close(); + }; + + $scope.cancelUserStatusToggle = function(rowData) { + if (debug) + $log.debug('profileSearchCtrlDS2:ModalInstanceCtrl: cancelUserStatusToggle: data is ' + JSON.stringify(rowData)); + // Undo the toggle of the checkbox + rowData.active = ! rowData.active; + $modalInstance.dismiss('cancel'); + } + + } + + // user activation/deactivation $scope.toggleProfileActive = function(rowData) { - modalService.popupConfirmWinWithCancel("Confirm","You are about to change user's active status. Do you want to continue?", - function(){ - $http.get("profile/toggleProfileActive?profile_id="+rowData.id).success(function(){}); - }, - function(){ - rowData.active=!rowData.active; - }) - }; + if (debug) + $log.debug('profileSearchCtrlDS2:toggleProfileActive: id is ' + rowData.id + + ', active is ' + rowData.active); + var toggleType = null; + // The checkbox is already in the desired state, + // so the sense of the "if" is reversed here. + if (rowData.active) + toggleType = "activate"; + else + toggleType = "deactivate"; + var modalInstance = $modal.open({ + templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-profile/modals/profile-confirm-toggle.html', + controller: ModalInstanceCtrl, + sizeClass: 'modal-small', + resolve: { + items: function () { + var message = { + text : toggleType, + rowData : rowData + }; + return message; + } + } + }); + }; + }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-services/profileServiceDS2.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-services/profileServiceDS2.js index 1ca373f9..812e8320 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-services/profileServiceDS2.js +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-services/profileServiceDS2.js @@ -73,6 +73,21 @@ appDS2.factory('ProfileServiceDS2', function ($http, $q) { // something went wrong return $q.reject(response.data); }); + }, + + toggleProfileStatus: function(id) { + return $http.get('profile/toggleProfileActive?profile_id=' + id) + .then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject(response.data); + } + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); } + }; }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-profile/modals/profile-confirm-toggle.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-profile/modals/profile-confirm-toggle.html new file mode 100644 index 00000000..0fe37686 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-profile/modals/profile-confirm-toggle.html @@ -0,0 +1,23 @@ +<div> + <div class="b2b-modal-header ng-scope in"> + <h1><i class="icon-primary-alert"></i></h1> + <h2 id="myModalLabel" modal-title="">Confirm</h2> + <div class="corner-button in"> + <button type="button" class="close" aria-label="Close" + ng-click="$dismiss('cancel')"></button> + </div> + </div> + <div class="b2b-modal-body ng-scope ng-isolate-scope in" tabindex="0" + role="region" aria-label="Modal header text content" + style="height: 55px;"> + You are about to {{msg.text}} the user with ID {{msg.rowData.id}}. Do you want to continue? + </div> + <div class="b2b-modal-footer ng-scope ng-isolate-scope in"> + <div class="cta-button-group in"> + <button class="btn btn-alt btn-medium" type="button" + ng-click="toggleUserStatus(msg.rowData.id);">Ok</button> + <button class="btn btn-clear btn-medium" type="button" + ng-click="cancelUserStatusToggle(msg.rowData);">Cancel</button> + </div> + </div> +</div> diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/report-chart-wizard.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/report-chart-wizard.html index 3fae62f1..8558729e 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/report-chart-wizard.html +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/report-chart-wizard.html @@ -138,29 +138,32 @@ table{ <tbody> <tr> <td> - <select name="chartType" b2b-dropdown ng-model="rangeReport.rangeAxisLabelJSON.value" placeholder-text="Select"> + <select name="chartType" b2b-dropdown ng-model="rangeReport.rangeAxisLabelJSON.value" placeholder-text="Select" ng-disabled="rangeReport.removed=='true'"> <option b2b-dropdown-list option-repeat="d in reportRunJson.chartColumnJSONList" value="{{d.value}}">{{d.title}}</option> - </select> + </select> </td> <td> - <input type="text" name="displayName" ng-model="rangeReport.rangeYAxis" style="width:100px;"> + <input type="text" name="displayName" ng-model="rangeReport.rangeYAxis" ng-disabled="rangeReport.removed=='true'" style="width:100px;"> </td> <td> - <input type="text" name="displayName" ng-model="rangeReport.rangeChartGroup" style="width:150px;"> + <input type="text" name="displayName" ng-model="rangeReport.rangeChartGroup" ng-disabled="rangeReport.removed=='true'" style="width:150px;"> </td> <td> - <select name="chartType" b2b-dropdown ng-model="rangeReport.rangeColor"> + <select name="chartType" b2b-dropdown ng-model="rangeReport.rangeColor" ng-disabled="rangeReport.removed=='true'"> <option b2b-dropdown-list option-repeat="d in rangeColors" value="{{d.value}}">{{d.title}}</option> - </select> + </select> </td> <td> - <select name="lineType" b2b-dropdown ng-model="rangeReport.rangeLineType"> - <option b2b-dropdown-list option-repeat="d in lineTypes" value="{{d.value}}">{{d.title}}</option> - </select> + <select name="lineType" b2b-dropdown ng-model="rangeReport.rangeLineType" ng-disabled="rangeReport.removed=='true'"> + <option b2b-dropdown-list option-repeat="d in lineTypes" value="{{d.value}}">{{d.title}}</option> + </select> </td> <td> <button ng-show="$index==0" type="submit" style="width: 90px; height:35px;margin-left:5px;" class="btn btn-secondary btn-small" ng-click="addRangeAxisRow()">Add</button> - <button ng-hide="$index==0" type="submit" style="width: 90px; height:35px;margin-left:5px;" class="btn btn-secondary btn-small" ng-click="removeRangeAxisRow($index)">Remove</button> + <span ng-hide="$index==0"> + <button ng-if="rangeReport.removed!='true'" type="submit" style="width: 90px; height:35px;margin-left:5px;" class="btn btn-secondary btn-small" ng-click="removeRangeAxisRow($index)">Remove</button> + <button ng-if="rangeReport.removed=='true'" type="submit" style="width: 90px; height:35px;margin-left:5px;" class="btn btn-secondary btn-small" disabled="disabled">Removed</button> + </span> </td> </tr> @@ -891,4 +894,4 @@ table{ <button type="submit" style="width: 90px; height:35px;margin-top:20px; margin-left:5px;" class="btn btn-alt btn-small">Run</button> </a> </div> -</div>
\ No newline at end of file +</div> |