diff options
author | 2017-09-01 11:57:47 +0800 | |
---|---|---|
committer | 2017-09-01 11:57:58 +0800 | |
commit | 57dbba269d19bc59fad89160200bb2dbcccb9003 (patch) | |
tree | d466041ceffa2161124ca79a48b3e077777c74b8 /usecaseui-common/src/main/webapp/app/fusion/scripts/controllers | |
parent | 4ff32341a0af1972b44a7410e76e9b231131e7ab (diff) |
Upload Monitor function code
Change-Id: I33ad76221b4cb771a298ff240245fc24be664efb
Issue-Id: USECASEUI-6
Signed-off-by: shentao <shentao@chinamobile.com>
Diffstat (limited to 'usecaseui-common/src/main/webapp/app/fusion/scripts/controllers')
8 files changed, 260 insertions, 0 deletions
diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/admin-closed-cloop.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/admin-closed-cloop.js new file mode 100644 index 00000000..39ef50e8 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/admin-closed-cloop.js @@ -0,0 +1,28 @@ +app.controller('adminClosedLoopController', ['$scope','$http','$q','$log',function ($scope, $http,$q, $log){ + $scope.camunda_cockpit_url = ''; + var deferred = $q.defer(); + $http({ + method: "GET", + url: "get_camunda_cockpit_link", + }).success( function(res) { + // if the returned response is error HTML page in string format + if(res.link_defined=='false'){ + $log.error('Retrieval of camunda cockpit link failed. Please make sure the variable "camunda_cockpit_url" is defined in the system.properties file.'); + deferred.reject(status); + } + // valid cockpit url + else if(res.camunda_cockpit_link!=null & res.camunda_cockpit_link!= '') { + $scope.camunda_cockpit_url = res.camunda_cockpit_link; + deferred.resolve(res); + // if the defined url is empty; + } else { + $log.error('Please ensure the variable "camunda_cockpit_url" is properly defined in system.properties file (i.e., neither null nor empty).'); + deferred.reject(status); + } + // API call fails + }).error( function(status) { + $log.error('get_camunda_cockpit_link RestAPI call failed.'); + deferred.reject(status); + }); + return deferred.promise; +}]);
\ No newline at end of file diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/admin-whitelist.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/admin-whitelist.js new file mode 100644 index 00000000..5eed3003 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/admin-whitelist.js @@ -0,0 +1,3 @@ +app.config(function ($sceDelegateProvider) { + $sceDelegateProvider.resourceUrlWhitelist(['self','**']); +});
\ No newline at end of file diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/ase-controller.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/ase-controller.js new file mode 100644 index 00000000..3d92220f --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/ase-controller.js @@ -0,0 +1,3 @@ +app.controller('aseCtrl', function ($scope){ +/* do nothing yet*/ +});
\ No newline at end of file diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/broadcast-controller.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/broadcast-controller.js new file mode 100644 index 00000000..a6cde5ae --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/broadcast-controller.js @@ -0,0 +1,60 @@ +app.controller('broadcastController', function ($scope, modalService, $modal,AdminService,$routeParams){ + //$scope.broadcastMessage=${broadcastMessage}; + //$scope.broadcastSites=${broadcastSites}; + //console.log($scope.broadcastMessage); + $scope.broadcastMessage=[]; + $scope.broadcastSites=[]; + AdminService.getBroadcast($routeParams.messageLocationId, $routeParams.messageLocation, $routeParams.messageId).then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.broadcastMessage=JSON.parse($scope.data.broadcastMessage); + $scope.broadcastSites=JSON.parse($scope.data.broadcastSites); + console.log($scope.broadcastMessage); + console.log($scope.broadcastMessage.id); + console.log($scope.broadcastSites); + //$scope.resetMenu(); + + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + $scope.save = function() { + var uuu = "broadcast/save"; + var postData={broadcastMessage: $scope.broadcastMessage}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + window.location.href = "admin#/broadcast_list"; + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + }; + + $scope.close = function() { + window.location.href = "admin#/broadcast_list"; +}; + +}); + +$(function() { + $( "#startDatepicker" ).datepicker(); + $( "#endDatepicker" ).datepicker(); + + $( "#startDatepicker" ).change(function() { + var tempStartDate = moment($( "#startDatepicker" ).val()).format('YYYY-MM-DD hh:mm:ss.S'); + $( "#startDateHidden" ).val(tempStartDate.toString()); + //alert( $( "#startDateHidden" ).val() ); + }); + $( "#endDatepicker" ).change(function() { + var tempEndDate = moment($( "#endDatepicker" ).val()).format('YYYY-MM-DD hh:mm:ss.S'); + $( "#endDateHidden" ).val(tempEndDate.toString()); + //alert( $( "#endDateHidden" ).val() ); + }); +}); diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/broadcast-list-controller.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/broadcast-list-controller.js new file mode 100644 index 00000000..0af15b78 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/broadcast-list-controller.js @@ -0,0 +1,101 @@ +app.controller('broadcastListController', function ($scope, modalService, $modal,AdminService){ + //$scope.broadcastMessage=${broadcastMessage}; + //$scope.broadcastSites=${broadcastSites}; + //console.log($scope.broadcastMessage); + var messagesMap = {}; + AdminService.getBroadcastList().then(function(data){ + + var j = data; + $scope.data = JSON.parse(j.data); + $scope.messagesList=(($scope.data.messagesList===null) ? [""]:$scope.data.messagesList); + $scope.messageLocations=(($scope.data.messageLocations===null) ? [""]:$scope.data.messageLocations); + console.log("messages: "+$scope.messagesList); + console.log("location: "+$scope.messageLocations); + $.each($scope.messageLocations, function(i, a){ + //var result = []; + angular.forEach($scope.messagesList, function(value, key) { + if (key+'' === a.value+'') { + //var objsJSON = JSON.parse(value); + + $.each(value, function(i, a){ + var startDateLong = a.startDate; + var tempStartDate = new Date(startDateLong); + tempStartDate = moment(tempStartDate).format('DD MMM YYYY hh:mmA zz');//03 Jun 2013 04:15PM EDT + a.displayStartDate=tempStartDate.toString(); + + var endDateLong = a.endDate; + var tempEndDate = new Date(endDateLong); + tempEndDate = moment(tempEndDate).format('DD MMM YYYY hh:mmA zz');//03 Jun 2013 04:15PM EDT + a.displayEndDate=tempEndDate.toString(); + }); + a.messages = value; + } + }); + console.log(a.messages); + }); + + //$scope.resetMenu(); + + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + + $scope.editMessage = function(location) { + + editMessage(location.value, location.label); + }; + + $scope.toggleActive = function(broadcastMessage) { + + //alert('deleted'+role.name); + var uuu = "broadcast_list/toggleActive"; + var postData={broadcastMessage:broadcastMessage}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + //window.location.reload(); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while toggling: "+ data.responseText); + + } + }); + + + }; + + $scope.remove = function(broadcastMessage) { + + //alert('deleted'+role.name); + var uuu = "broadcast_list/remove"; + var postData={broadcastMessage:broadcastMessage}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + window.location.reload(); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + + }; + +}); + +function editMessage(messageLocationId, messageLocation, messageId) { + window.location='admin#/broadcast/'+messageLocationId + '/' + messageLocation + ((messageId != null) ? '/' + messageId : ''); +} diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/collaborate-list-controller.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/collaborate-list-controller.js new file mode 100644 index 00000000..a1831b7e --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/collaborate-list-controller.js @@ -0,0 +1,44 @@ +app.controller("collaborateListController", function ($scope,$http,modalService, $modal,AdminService) { + // Table Data + AdminService.getCollaborateList().then(function(data){ + + var j = data; + $scope.tableData = JSON.parse(j.data); + //$scope.resetMenu(); + + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + $scope.viewPerPage = 20; + $scope.scrollViewsPerPage = 2; + $scope.currentPage = 1; + $scope.totalPage; + $scope.searchCategory = ""; + $scope.searchString = ""; + /* modalService.showSuccess('','Modal Sample') ; */ + 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.openCollaboration = function(chatId){ + openInNewTab('openCollaboration?chat_id=' + chatId); + } + + $scope.toggleProfileActive = function(profileId) { + modalService.popupConfirmWin("Confirm","You are about to change user's active status. Do you want to continue?", + function(){ + $http.get("profile/toggleProfileActive?profile_id="+profileId).success(function(){}); + + }) + }; + +}); + +function openInNewTab(url) { + var win = window.open(url, '_blank'); + win.focus(); +};
\ No newline at end of file diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/dummy.txt b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/dummy.txt new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/dummy.txt diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/modelpopupController.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/modelpopupController.js new file mode 100644 index 00000000..48fbbc03 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/controllers/modelpopupController.js @@ -0,0 +1,21 @@ +var modalpopupController = function ($scope, $modalInstance, message){ + + $scope.message = message; + + + $scope.hello = function () { + $modalInstance.close($scope.digitPattern); + }; + $modalInstance.ok = function() { + //add the ok functionality + alert("Logout"); + }; + $modalInstance.cancel = function() { + //add the cancel functionality + alert("Keep Log in"); + }; + $modalInstance.cancelbutton = function() { + //add the cancel functionality + alert("Modal Waring popup close event"); + }; +}
\ No newline at end of file |