From 57dbba269d19bc59fad89160200bb2dbcccb9003 Mon Sep 17 00:00:00 2001 From: shentao Date: Fri, 1 Sep 2017 11:57:47 +0800 Subject: Upload Monitor function code Change-Id: I33ad76221b4cb771a298ff240245fc24be664efb Issue-Id: USECASEUI-6 Signed-off-by: shentao --- .../ds2-sample/drools-controller.js | 53 ++++++++++++++++++++++ .../ds2-sample/nbook-framecontroller.js | 15 ++++++ .../ds2-sample/notebook-controller.js | 37 +++++++++++++++ .../ds2-sample/notebookFrameController.js | 24 ++++++++++ 4 files changed, 129 insertions(+) create mode 100644 usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/drools-controller.js create mode 100644 usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/nbook-framecontroller.js create mode 100644 usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/notebook-controller.js create mode 100644 usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/notebookFrameController.js (limited to 'usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample') diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/drools-controller.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/drools-controller.js new file mode 100644 index 00000000..1d4659e3 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/drools-controller.js @@ -0,0 +1,53 @@ +appDS2.controller('droolsController', function($scope, $modal, $routeParams, DroolsService, modalService) { + $scope.tableDate=[]; + $scope.resultsString = ""; + $scope.postDroolsBean={ + droolsFile:'', + className:'', + selectedRules:'' + }; + $scope.filenameFromUrl = $routeParams.filename; + if($scope.filenameFromUrl!='' && $scope.filenameFromUrl!='0') + $scope.postDroolsBean.droolsFile = $scope.filenameFromUrl + $scope.execute = function(postDroolsBean) { + if($scope.postDroolsBean.droolsFile=='' ||$scope.postDroolsBean.className=='' || $scope.postDroolsBean.selectedRules=='' ){ + modalService.errorPopUp ("Required fields cannot be empty"); + return; + } + var uuu = "post_drools/execute"; + var postData={postDroolsBean:postDroolsBean}; + DroolsService.executeDrools(postData).then(function(data){ + $scope.resultsString=data.resultsString; + modalService.successPopUp($scope.resultsString); + },function(error){ + modalService.errorPopUp (error); + }); + }; +}); + +appDS2.controller('droolsListController', function($scope, $modal, DroolsService, modalService) { + $scope.tableDate=[]; + $scope.resultsString = ""; + $scope.postDroolsBean=""; + + $scope.getDroolsList = function(){ + DroolsService.getDroolsList().then(function(data){ + var j = data; + $scope.tableData = JSON.parse(j.data); + $scope.buildTable(); + },function(error){ + modalService.errorPopUp (error); + }); + } + + $scope.buildTable = function(){ + 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; + } + } + +}); + diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/nbook-framecontroller.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/nbook-framecontroller.js new file mode 100644 index 00000000..ab88aed9 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/nbook-framecontroller.js @@ -0,0 +1,15 @@ +appDS2.config(function($routeProvider) { + $routeProvider + + //.when('/notebook-frame/:id/:key/:value',{ + //.when('/notebook-frame/:nid/:qprms',{ + /*.when('/notebook-frame',{ + templateUrl: 'app/fusion/notebook-integration/scripts/view-models/notebook-frame.html', + controller: 'notebookFrameController' + })*/ + + .otherwise({ + templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-samplePages/notebook-viz.html', + controller: 'notebookFrameController' + }); +}) \ No newline at end of file diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/notebook-controller.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/notebook-controller.js new file mode 100644 index 00000000..efd22f0f --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/notebook-controller.js @@ -0,0 +1,37 @@ +appDS2.controller('nbookController', ['$scope', '$location','$window','$http', function ($scope,$location,$window,$http) { + $scope.keyValueList = [{}]; + $scope.submitParameters = function() { + $scope.iframevisibility = false; + $scope.postData = {}; + $scope.additionalqueryParams = {}; + //Use this if there is only one 1 query param key value pair + $scope.additionalqueryParams.paramKey = $scope.qparamKey; + $scope.additionalqueryParams.paramVal = $scope.qparamVal; + var qryStr = ''; + for(var i = 0; i < $scope.keyValueList.length; i++) { + var obj = $scope.keyValueList[i]; + if (obj.qK != undefined && obj.qV != undefined) { + if (qryStr!='') + qryStr = qryStr+'&'+obj.qK+'='+obj.qV; + else + qryStr = obj.qK+'='+obj.qV; + } + } + var queryurl = 'nbooktest.htm?nid='+$scope.notebookvalue+'&'+qryStr; + window.open (queryurl,'_self',false); + } + $scope.addKeyValuePairs = function (kv) { + if ($scope.keyValueList.length < 9) { + $scope.keyValueList.push({ + }); + } else { + document.getElementById("addbtn")["disabled"] = true; + } + } + $scope.removeKeyValuePairs = function (index) { + $scope.keyValueList.splice(index, 1); + if ($scope.keyValueList.length == 8) { + document.getElementById("addbtn")["disabled"] = false; + } + } +}]); \ No newline at end of file diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/notebookFrameController.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/notebookFrameController.js new file mode 100644 index 00000000..95489918 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-sample/notebookFrameController.js @@ -0,0 +1,24 @@ +appDS2.controller('notebookFrameController', function ($scope,$location,$window,$http,$routeParams) { + var nid = $window.location.search.substr($window.location.search.indexOf("=")+1); + $scope.additionalqueryParams={}; + if ($window.location.search.substr($window.location.search.indexOf("=")+1)) { + $scope.queryParams = $window.location.search; + if($window.location.search.substring(0, $window.location.search.length-1).indexOf("&")!=-1) { + $scope.notebookparam = $window.location.search.substring($window.location.search.indexOf("?")+1,$window.location.search.indexOf("&")); + $scope.additionalqueryParams = JSON.parse('{"' + decodeURI($scope.queryParams.substr($scope.queryParams.indexOf("&")+1).replace(/&/g, "\",\"").replace(/=/g,"\":\"")) + '"}'); + } + else { + $scope.notebookparam1 = $window.location.search.substr($window.location.search.indexOf("?")+1); + $scope.notebookparam = $scope.notebookparam1.substring(0, $scope.notebookparam1.length - 1); + } + $scope.notebookvalue = $scope.notebookparam.substr($scope.notebookparam.indexOf("=")+1); + } + else { + $scope.notebookvalue = '833c0a69ec1433fbb2f8752af733cf0e'; + } + $http({method:'POST', url:'rNotebookFE/authCr', data: $scope.notebookvalue, params:{'qparams' : $scope.additionalqueryParams}, transformResponse: [function (data) { + // Do whatever you want! + document.getElementById('itestframe').src = data; + return data; + }]}) +}); -- cgit 1.2.3-korg