diff options
author | shentao <shentao@chinamobile.com> | 2017-09-01 11:57:47 +0800 |
---|---|---|
committer | shentao <shentao@chinamobile.com> | 2017-09-01 11:57:58 +0800 |
commit | 57dbba269d19bc59fad89160200bb2dbcccb9003 (patch) | |
tree | d466041ceffa2161124ca79a48b3e077777c74b8 /usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services | |
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/DS2-services')
15 files changed, 1950 insertions, 0 deletions
diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/adminMenuService.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/adminMenuService.js new file mode 100644 index 00000000..86bf5cd4 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/adminMenuService.js @@ -0,0 +1,129 @@ +appDS2.factory('AdminMenuService', function ($http, $q) { + return { + getRoleFunctionList: function() { + return $http.get('get_role_functions') + .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); + }); + }, + +getFnMenuItems: function(){ + + return $http.get('admin_fn_menu') + .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); + }); + }, + getCollaborateList: function() { + return $http.get('get_collaborate_list') + .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); + }); + }, +/* saveRoleFunctionList: function(roleData) { + return $http.post('role_function_list/saveRoleFunction',{ + roleData + }) + .then(function(response) { + console.log(response); + if (response.status == 200) { + return response.data; + } else { + console.log('eror'); + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }*/ + saveRoleFunctionList: function(roleData) { + return $http({ + method: "POST", + url: "role_function_list/saveRoleFunction", + data:roleData + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + delRoleFunctionList: function(roleData) { + return $http({ + method: "POST", + url: "role_function_list/removeRoleFunction", + data:roleData + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + clearAdminRegions: function() { + return $http({ + method: "GET", + url: "jcs_admin/clearAll", + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + } + + + + }; +}); diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/adminService.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/adminService.js new file mode 100644 index 00000000..105f0202 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/adminService.js @@ -0,0 +1,453 @@ +appDS2.factory('AdminService', function ($http, $q) { + return { + getRole: function(roleId) { + return $http.get('get_role?role_id=' + roleId) + .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); + }); + }, + getCollaborateList: function() { + return $http.get('get_collaborate_list') + .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); + }); + }, + + getCacheRegions: function() { + return $http.get('get_regions') + .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); + }); + }, + + getUsageList: function() { + return $http.get('get_usage_list') + .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); + }); + }, + +getFnMenuItems: function(){ + + return $http.get('admin_fn_menu') + .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); + }); + }, + +/* saveRoleFunctionList: function(roleData) { + return $http.post('role_function_list/saveRoleFunction',{ + roleData + }) + .then(function(response) { + console.log(response); + if (response.status == 200) { + return response.data; + } else { + console.log('eror'); + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }*/ + + getRoleFunctionList: function() { + return $http.get('get_role_functions') + .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); + }); + }, + saveRoleFunctionList: function(roleData) { + return $http({ + method: "POST", + url: "role_function_list/saveRoleFunction", + data:roleData + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + addRoleFunctionList: function(roleData) { + return $http({ + method: "POST", + url: "role_function_list/addRoleFunction", + data:roleData + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + delRoleFunctionList: function(roleData) { + return $http({ + method: "POST", + url: "role_function_list/removeRoleFunction", + data:roleData + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + clearAdminRegions: function() { + return $http({ + method: "GET", + url: "jcs_admin/clearAll" + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + showRegionDetails: function(cacheName) { + return $http({ + method: "GET", + url: "jcs_admin/showRegionDetails?cacheName="+cacheName, + contentType: 'application/json', + }).then(function(response) { + //var parsed = JSON.stringify(response); + var responseData = JSON.stringify(response); + if (response.status == 200) { + return response; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + console.log('response'+response); + // something went wrong + return $q.reject(response.data); + }); + }, + + clearRegionFunction: function(cacheName) { + return $http({ + method: "GET", + url: "jcs_admin/clearRegion?cacheName="+cacheName + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + clearItemnFunction: function(cacheName, key) { + return $http({ + method: "GET", + url: "jcs_admin/clearItem?keyName="+key+"&cacheName="+cacheName + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + showItemDetails: function(cacheName, key) { + return $http({ + method: "GET", + url: "jcs_admin/showItemDetails?keyName="+key+"&cacheName="+cacheName + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + //role deletion + delRoleList: function(roleData) { + return $http({ + method: "POST", + url: "role_list/removeRole", + data:JSON.stringify({role:roleData}) + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + // activate role + activateRole: function(selected,availableRole){ + return $http({ + method: "POST", + url: "role_list/toggleRole", + data:JSON.stringify({role:availableRole}) + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + // save Role + saveRole: function(role,roleId){ + return $http({ + method: "POST", + url: "role/saveRole.htm?role_id="+roleId, + data:JSON.stringify(role) + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + // activate RoleFun Remove + confirmRoleFunRemove: function(selected,availableRole,id){ + return $http({ + method: "POST", + url: "role/removeRoleFunction.htm?role_id=" + id, + data:JSON.stringify({roleFunction:availableRole}) + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + // activate RoleFun Add + confirmRoleFunAdd: function(selected,availableRole,id){ + return $http({ + method: "POST", + url: "role/addRoleFunction.htm?role_id=" + id, + data:JSON.stringify({roleFunction:availableRole}) + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + // activate RoleChild Remove + confirmRoleChildRemove: function(selected,availableRole,id){ + return $http({ + method: "POST", + url: "role/removeChildRole.htm?role_id=" + id, + data:JSON.stringify({roleFunction:availableRole}) + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + // activate RoleChild Add + confirmRoleChildAdd: function(selected,availableRole,id){ + return $http({ + method: "POST", + url: "role/addChildRole.htm?role_id=" + id, + data:JSON.stringify({roleFunction:availableRole}) + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + //Role Function delete for associated role on Edit Role + removeRoleFunction: function(roleFunction,roleId){ + return $http({ + method: "POST", + url: "role/removeRoleFunction.htm?role_id=" + roleId, + data:JSON.stringify({roleFunction:roleFunction}) + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + } + +/* toggleProfileActiveFunction: function(profileId) { + return $http({ + method: "GET", + url: "jcs_admin/clearRegion?cacheName="+cacheName + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }*/ + }; +}); diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-modal/modalService.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-modal/modalService.js new file mode 100644 index 00000000..061d1ba2 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-modal/modalService.js @@ -0,0 +1,38 @@ +angular.module("modalServices",[]).service('modalService', ['$modal', function ($modal) { + var ModalInstanceCtrl = function ($scope, $modalInstance, items,$rootScope) { + $scope.roleFun=items; + $scope.msg=items; + + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + }; + this.errorPopUp = function (msg) { + var modalInstance = $modal.open({ + templateUrl: 'app/fusion/scripts/DS2-modal/error_modal.html', + controller: ModalInstanceCtrl, + sizeClass: 'modal-small', + resolve: { + items: function () { + return msg; + } + } + }); + }; + this.successPopUp = function (msg) { + var modalInstance = $modal.open({ + templateUrl: 'app/fusion/scripts/DS2-modal/success_modal.html', + controller: ModalInstanceCtrl, + sizeClass: 'modal-small', + resolve: { + items: function () { + var message = { + title: '', + text: msg + }; + return message; + } + } + }); + }; + }]);
\ No newline at end of file diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-profile/selfProfileService.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-profile/selfProfileService.js new file mode 100644 index 00000000..bc18f2c8 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-profile/selfProfileService.js @@ -0,0 +1,114 @@ +appDS2.factory('SelfProfileService', function ($http, $q) { + return { + getProfileDetail: function(profileId) { + return $http({ + method: "GET", + url: "get_profile?profile_id=" + profileId, + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + getSelfProfileDetail: function() { + return $http.get('get_self_profile') + .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); + }); + }, + + addRole: function(roleData,profileId) { + return $http({ + method: "POST", + url: "profile/addNewRole?profile_id=" + profileId, + data:roleData + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + deRole: function(roleData,profileId) { + return $http({ + method: "POST", + url: "profile/removeRole?profile_id=" + profileId, + data:roleData + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + saveProfile: function(data,profileId) { + return $http({ + method: "POST", + url: "profile/saveProfile?profile_id=" + profileId, + data:data + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + removeRole: function(data,profileId) { + return $http({ + method: "POST", + url: "profile/removeRole?profile_id=" + profileId, + data:data + + }).then(function(response) { + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + } + }; +}); diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/raptorReportFactory.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/raptorReportFactory.js new file mode 100644 index 00000000..83c051db --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/raptorReportFactory.js @@ -0,0 +1,595 @@ +appDS2.factory('raptorReportFactory', function($http, $q) { + return { + getDefinitionByReportId: function(reportId) { + return $http({ + method: "GET", + url: "report/wizard/retrieve_def_tab_wise_data/"+reportId, + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getDefinitionByReportId did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getDefinitionByReportId callback failed"); + }); + }, + getDefinitionByReportId: function(reportId) { + return $http({ + method: "GET", + url: "report/wizard/retrieve_def_tab_wise_data/"+reportId, + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getDefinitionByReportId did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getDefinitionByReportId callback failed"); + }); + }, + getDefinitionInSession: function() { + return $http({ + method: "GET", + url: "report/wizard/retrieve_def_tab_wise_data/InSession", + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getDefinitionInSession did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getDefinitionInSession callback failed"); + }); + }, + + createNewDefinition: function() { + return $http({ + method: "GET", + url: "report/wizard/retrieve_def_tab_wise_data/Create", + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: createNewDefinition did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: createNewDefinition callback failed"); + }); + }, + updateDefinition: function(updatedJson,isUpdate) { + return $http({ + method: "POST", + url: (isUpdate?("report/wizard/save_def_tab_data/"+updatedJson.reportId):"report/wizard/save_def_tab_data/Create"), + data: updatedJson + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: updateDefinition did not return a valid JSON object."); + } + return response.data; + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: updateDefinition callback failed"); + }); + }, + saveNewDefinition: function(updatedJson) { + return $http({ + method: "POST", + url: "report/wizard/save_def_tab_data/InSession", + data: updatedJson + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: saveNewDefinition did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: saveNewDefinition callback failed"); + }); + }, + getSqlInSession: function() { + return $http({ + method: "GET", + url: "report/wizard/retrieve_sql_tab_wise_data/InSession", + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getSqlInSession did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getSqlInSession callback failed"); + }); + }, + testRunSQL: function(queryJSON) { + return $http({ + method: "POST", + url: "report/wizard/retrieve_data/true", + data: queryJSON + }).then(function(response) { + if (typeof response.data === 'object') { + return JSON.parse(response.data.data.elements); + } else { + return $q.reject("raptorReportFactory: testRunSQL did not return a valid JSON object."); + } + return response.data; + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: testRunSQL callback failed"); + }); + }, + formFieldVerifySQL: function(queryJSON) { + return $http({ + method: "POST", + url: "report/wizard/retrieve_data/false", + data: queryJSON + }).then(function(response) { + if (typeof response.data === 'object') { + return JSON.parse(response.data.data.elements); + } else { + return $q.reject("raptorReportFactory: formFieldVerifySQL did not return a valid JSON object."); + } + return response.data; + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: formFieldVerifySQL callback failed"); + }); + }, + getColumnList: function() { + return $http({ + method: "GET", + url: "report/wizard/list_columns", + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getColumnList did not return a valid JSON object."); + } + return response.data; + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getColumnList callback failed"); + }); + }, + getDrillDownReportList: function() { + return $http({ + method: "GET", + url: "report/wizard/list_drilldown_reports", + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getDrillDownReportList did not return a valid JSON object."); + } + return response.data; + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getDrillDownReportList callback failed"); + }); + }, + getChildReportFormField: function(reportId) { + return $http({ + method: "GET", + url: "report/wizard/list_child_report_ff/"+reportId, + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getDrillDownReportList did not return a valid JSON object."); + } + return response.data; + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getDrillDownReportList callback failed"); + }); + }, + getChildReportColumn: function(reportId) { + return $http({ + method: "GET", + url: "report/wizard/list_child_report_col/"+reportId, + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getChildReportColumn did not return a valid JSON object."); + } + return response.data; + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getChildReportColumn callback failed"); + }); + }, + getColumnEditInfoById: function(columnId){ + return $http({ + method: "GET", + url: "report/wizard/retrieve_col_tab_wise_data/"+columnId, + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getColumnEditInfoById did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getColumnEditInfoById callback failed"); + }); + }, + saveColumnEditInfo: function(updatedColumnJson){ + return $http({ + method: "POST", + url: "report/wizard/save_col_tab_data", + data: updatedColumnJson + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: saveColumnEditInfo did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: saveColumnEditInfo callback failed"); + }); + }, + postImportXml: function(importXMLJSON){ + return $http({ + method: "POST", + url: "report/wizard/import_report", + data: importXMLJSON + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: importXml did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: importXml callback failed"); + }); + }, + copyReportById: function(reportId) { + return $http({ + method: "GET", + url: "report/wizard/copy_report/"+reportId, + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: copyReportById did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: copyReportById callback failed"); + }); + }, + saveFormFieldEditInfo: function(updatedFormFieldJson){ + return $http({ + method: "POST", + url: "report/wizard/save_formfield_tab_data", + data: updatedFormFieldJson + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: saveFormFieldEditInfo did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: saveFormFieldEditInfo callback failed"); + }); + }, + getFormFieldList: function() { + return $http({ + method: "GET", + url: "report/wizard/list_formfields", + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getFormFieldList did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getFormFieldList callback failed"); + }); + }, + getFormFieldEditInfoById: function(fieldId){ + return $http({ + method: "GET", + url: "report/wizard/retrieve_form_tab_wise_data/"+fieldId, + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getColumnEditInfoById did not return a valid JSON object."); + } + return response.data; + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getFormFieldEditInfoById callback failed"); + }); + }, + deleteFormFieldById: function(fieldId){ + return $http({ + method: "GET", + url: "report/wizard/retrieve_form_tab_wise_data/"+fieldId+"/delete", + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: deleteFormFieldById did not return a valid JSON object."); + } + return response.data; + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: deleteFormFieldById callback failed"); + }); + }, + getColumns: function() { + return $http + .get('raptor.htm?action=report.search.execute&r_page=0') + .then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getColumns did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getColumns callback failed"); + }); + }, + + getSearchData : function() { + return $http + .get('raptor.htm?action=report.search.execute&r_page=0') + .then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getSearchData did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getSearchData callback failed"); + }); + }, + + getSecurityReportOwnerList: function() { + return $http + .get('report/wizard/security/retrieveReportOwner') + .then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getSecurityReportOwnerList did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getSecurityReportOwnerList callback failed"); + }); + }, + getReportRoleList: function() { + return $http + .get('report/wizard/security/retrieveReportRoleList') + .then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getReportRoleList did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getReportRoleList callback failed"); + }); + }, + getReportSecurityInfo: function() { + return $http + .get('report/wizard/security/getReportSecurityInfo') + .then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getReportSecurityInfo did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getReportSecurityInfo callback failed"); + }); + }, + getReportSecurityUsers: function() { + return $http + .get('report/wizard/security/retrieveReportUserList') + .then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getReportSecurityUsers did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getReportSecurityUsers callback failed"); + }); + }, + + getReportSecurityRoles: function() { + return $http + .get('report/wizard/security/getReportSecurityRoles') + .then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getReportSecurityUsers did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getReportSecurityUsers callback failed"); + }); + }, + + + getSearchDataAtPage : function(pageSearchParameter) { + return $http + .get('raptor.htm?action=report.search.execute&r_page='+pageSearchParameter) + .then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getSearchDataAtPage did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getSearchDataAtPage callback failed"); + }); + }, + setDrillDownPopupOptions: function(drillDownURL,drillDownParams) { + this.drillDownURL = drillDownURL; + this.drillDownParams = drillDownParams; + }, + getReportDeleteStatus : function(deleteUrl) { + return $http.get(deleteUrl).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: getReportDeleteStatus did not return a valid JSON object."); + } + + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: getReportDeleteStatus callback failed"); + }); + }, + addReportSecurityUser: function(UserId) { + return $http({ + method: "POST", + url: "report/security/addReportUser", + data: UserId + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: addReportSecurityUser did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: saveNewDefinition callback failed"); + }); + }, + removeReportSecurityUser: function(UserId) { + return $http({ + method: "POST", + url: "report/security/removeReportUser", + data: UserId + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: removeReportSecurityUser did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: saveNewDefinition callback failed"); + }); + }, + addReportSecurityRole: function(RoleId) { + return $http({ + method: "POST", + url: "report/security/addReportRole", + data: RoleId + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: addReportSecurityRole did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: saveNewDefinition callback failed"); + }); + }, + removeReportSecurityRole: function(RoleId) { + return $http({ + method: "POST", + url: "report/security/removeReportRole", + data: RoleId + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: removeReportSecurityRole did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: removeReportSecurityRole callback failed"); + }); + }, + updateReportSecurityInfo: function(securityInfo) { + return $http({ + method: "POST", + url: "report/security/updateReportSecurityInfo", + data: securityInfo + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: updateReportSecurityInfo did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: updateReportSecurityInfo callback failed"); + }); + }, + + toggleUserEditAccess: function(reportUser) { + var readOnly = reportUser.accessAllowed?"N":"Y"; + return $http({ + method: "POST", + url:"report/security/toggleUserEditAccess/"+reportUser.id, + data: readOnly + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: toggleUserEditAccess did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: toggleUserEditAccess callback failed"); + }); + }, + toggleRoleEditAccess: function(reportRole) { + var readOnly = reportRole.accessAllowed?"N":"Y"; + return $http({ + method: "POST", + url:"report/security/toggleRoleEditAccess/"+reportRole.id, + data: readOnly + }).then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject("raptorReportFactory: toggleRoleEditAccess did not return a valid JSON object."); + } + }, function(response) { + // something went wrong + return $q.reject("raptorReportFactory: toggleRoleEditAccess callback failed"); + }); + }, + resetSecurityLoadingCounter: function() { + this.securityPageApiCounter = 0; + this.securityPageApiTotalCount = 5; + }, + icrementSecurityLoadingCounter: function() { + this.securityPageApiCounter = this.securityPageApiCounter+1; + }, + checkSecurityLoadingCounter: function() { + return (this.securityPageApiCounter ==this.securityPageApiTotalCount); + } + }; +}); diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/stepFormFactory.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/stepFormFactory.js new file mode 100644 index 00000000..5c711425 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/stepFormFactory.js @@ -0,0 +1,198 @@ +(function(){ + var stepFormFactory = function($http, $compile, $q, $log) { + + var factory = {}; + + factory.getStepJSONData = function(jsonSrcName) { + $http({ + method: "GET", + url: jsonSrcName, + }).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); + }); + } + + + factory.renderColumnForm = function(scope) { + + } + factory.renderForm = function(jsonSrcName, elem, scope) { + let defer = $q.defer(); + var divStepForm = document.getElementById('stepView'); + var textStyle = "width:300px" + var textAreaStyle = "width:300px" + if(divStepForm) + while(divStepForm && divStepForm.firstChild){ + divStepForm.removeChild(divStepForm.firstChild); + } + $http({ + method: 'GET', + url: jsonSrcName + }).then(function successCallback(response) { + // this callback will be called asynchronously + // when the response is available + if (typeof response.data === 'object') { + var json = response.data; + var step = json.step; + var div =d3.select(elem[0]); + var modelNameDict = {}; + + div.append("h1").attr({"class":"font-color:blue"}).text(json.content.title); + div.append("div").html(json.content.contentHtml); + var sections = json.content.sections; + sections.forEach(function(d, i) { + var sectionDiv = div.append("div"); + sectionDiv.attr("id", "section_"+i); + if(d.title != "finalButton") + sectionDiv.append("h4").text(d.title); + var proj_id_hidden = sectionDiv.append("input"); + proj_id_hidden.attr({"type":"hidden", "value":"", "name": "proj_id", "ng-model":"proj_id", "style": "" }); + + var elements = d.elements; + var buttons = d.buttons; + var elementTable ; + if(elements) { + elements.forEach(function(element, elementIndex) { + + var elementBody ; + if(elementIndex == 0) { + elementTable = sectionDiv.append("table").attr({"border":"0", "cellpadding":"4", "cellspacing":"0"}); + elementBody = elementTable.append("tbody"); + } else { + elementBody = elementTable = sectionDiv.select("tbody"); + } + if(element.input == 'hidden') { + + } else { + var tr = elementBody.append("tr") + var cellWidthStyle = {"width":"50%"} + + if (!(element.spanOverTwoColumns)){ + var td = tr.append("td").attr({"width":"30%","class":"tdLeftColumn"}); + if (element.input=="checkboxGroup") { + td = td.attr({"rowspan":element.checkboxes.length}) + } + td.text(element.displayName); + var cellWidthStyle = {"width":"500px;"} + } + td = tr.append("td").attr(cellWidthStyle); + var model_name_appendix=''; + if (element.name in modelNameDict) { + modelNameDict[element.name]=modelNameDict[element.name]+1 + model_name_appendix ='_'+modelNameDict[element.name] + } else { + modelNameDict[element.name]=0 + } + if(element.input == 'text') { + var inp_text = td.append("input"); + inp_text.attr({"type":"text", "value":element.defaultValue, "name": element.name, "ng-model":element.name+model_name_appendix, "style": (element.style?element.style:textStyle) }); + } + else if(element.input === 'checkbox') { + var temptd= td.append("label").attr({"class":"checkbox"}); + var temptd2= temptd.append("input").attr({"type":"checkbox", "ng-model": element.checkbox.value}); + var temptd3= temptd.append("i").attr({"class":"skin"}) + var temptd3= temptd.append("span").text(element.checkbox.text); + + } else if (element.input === 'radio') { + element.options.forEach(function(d,i) { + td.append("input").attr({"type":"radio", "id":element.name+"_"+d.id, "ng-model":element.name+model_name_appendix, "name": element.name, "value": d.id}); + td.append("label").text(d.name); + }) + } else if (element.input === 'checkboxGroup') { + + element.checkboxes.forEach(function(d,i) { + if (i==0) { + var temptd= td.append("label").attr({"class":"checkbox"}); + var temptd2= temptd.append("input").attr({"type":"checkbox", "ng-model": d.value}); + var temptd3= temptd.append("i").attr({"class":"skin"}) + var temptd3= temptd.append("span").text(d.text); + } else { + var tr = elementBody.append("tr") + td = tr.append("td").attr({"width":"50%"}); + var temptd= td.append("label").attr({"class":"checkbox"}); + var temptd2= temptd.append("input").attr({"type":"checkbox", "ng-model": d.value}); + var temptd3= temptd.append("i").attr({"class":"skin"}) + var temptd3= temptd.append("span").text(d.text); + } + }) + } else if (element.input === 'textarea') { + td.append("textarea").attr({"rows":"4", "cols":"50", "ng-model":element.name+model_name_appendix, "name": element.name, "style": (element.style?element.style:textAreaStyle)}); + } + else if (element.input === 'select') { + var select = td.append("select"); + // need to store options into element name; + select + .attr({"name": element.name,"b2b-dropdown":"","ng-model":element.ngModelName,"style":"width:300px"}) + .attr("placeholder-text","Select"); + + + /* var data = ["Option 1", "Option 2", "Option 3"]*/ + var options = select + .selectAll('option') + .data(element.options).enter() + .append('option').attr("value", function(d) {return d.value}) + .attr("b2b-dropdown-list","") + .text(function (d) { return d.text; }) + ; + } else if (element.input === 'tabletext') { + var colArray = element.columns.split(','); + var table = td.append("table"); + table.attr("border", "1"); + + colArray.forEach(function(d) { + table.append("th").text(d); + }) + + } + } + }) + if (buttons) { + buttons.forEach(function(button, buttonIndex) { + sectionDiv.append("input").attr({"type":"button", "value": button.text, "ng-click":button.ngFunction,"class":"btn btn-alt btn-small"}); + }) + sectionDiv.append("br"); + } + } + else { //if elements + if((json.step != "1")&&(!json.hideBackButton)) + sectionDiv.append("input").attr({"type":"button", "value": "Back", "ng-click":"previous()","class":"btn btn-alt btn-small"}); + if((d.title == "finalButton")&(!json.hideSaveButton)) + sectionDiv.append("input").attr({"type":"button", "value": "Save", "ng-click":"save()", "class":"btn btn-alt btn-small"}); + if(!json.last_step) + sectionDiv.append("input").attr({"type":"button", "value": "Next", "ng-click":"next()", "class":"btn btn-alt btn-small"}); + + } + }) + elem.html(div.html()); + elem.removeAttr("step-form"); + $compile(elem.contents())(scope); + defer.resolve(); + } else { + $log.error + return $q.reject(response.data); + } + }, function errorCallback(response) { + // called asynchronously if an error occurs + // or server returns response with an error status. + $log.error("reponse data is not a valid JSON object"); + defer.resolve(); + }); + //} + return defer.promise; + }; + + return factory; + }; + + stepFormFactory.$inject = ['$http', '$compile', '$q']; + + appDS2.factory('stepFormFactory', stepFormFactory); + +}()) diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-sample-page/droolsService.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-sample-page/droolsService.js new file mode 100644 index 00000000..90c3d00d --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/ds2-sample-page/droolsService.js @@ -0,0 +1,53 @@ +appDS2.factory('DroolsService', function ($http, $q) { + return { + getDroolsList: function() { + return $http.get('getDrools') + .then(function(response) { + console.log(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); + }); + }, + + getDroolDetails: function(selectedFile) { + return $http.get('getDroolDetails'+'?selectedFile=' + selectedFile ) + .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); + }); + }, + executeDrools:function(droolsData) { + return $http({ + method: "POST", + url: "post_drools/execute", + data:droolsData + }).then(function(response) { + console.log(response); + if (response.status == 200) { + return response.data; + } else { + return $q.reject(response.data); + } + return response.data; + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + } + }; +}); diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/headerServiceDS2.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/headerServiceDS2.js new file mode 100644 index 00000000..c9134f62 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/headerServiceDS2.js @@ -0,0 +1,17 @@ +appDS2.factory('HeaderServiceDS2', function ($http,$log, $q) { + return { + getMenu: function() { + return $http.get('get_menu') + .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/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/leftMenuServiceDS2.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/leftMenuServiceDS2.js new file mode 100644 index 00000000..61346c84 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/leftMenuServiceDS2.js @@ -0,0 +1,97 @@ +function isRealValue(obj){ + return obj && obj !== "null" && obj!== "undefined"; +} +appDS2.factory('LeftMenuServiceDS2', function ($http,$log, $q) { + return { + getLeftMenu: function() { + return $http.get('get_menu') + .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); + }); + }, + getAppName: function() { + return $http.get('get_app_name') + .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); + }); + } + + }; +}); + +/* check if the body height has changed */ +function onElementHeightChange(elm, callback){ + if (!elm) { + console.log('onElementHeightChange: null element!'); + return; + } + var lastHeight = elm.clientHeight, newHeight; + (function run(){ + newHeight = elm.clientHeight; + if( lastHeight != newHeight ) + callback(); + lastHeight = newHeight; + + if( elm.onElementHeightChangeTimer ) + clearTimeout(elm.onElementHeightChangeTimer); + elm.onElementHeightChangeTimer = setTimeout(run, 200); + })(); +} + +/*adjust height of left menu*/ +function adjustLeftMenuHeight() { + + try{ + var footerTop = $('.footer-container').offset().top; + var scrollTop = $(window).scrollTop(); + $(".menu-container").css({ + "height" : footerTop- scrollTop, + }); + }catch(err){ + console.log('adjustLeftMenuHeight failed', err) + } +} +/* adjust left menu height on scroll */ +window.onscroll = function (e) { + adjustLeftMenuHeight(); +} + +/* adjust left menu height on page load */ +$(function() { + adjustLeftMenuHeight(); +}); + + +onElementHeightChange(document.body, function(){ + adjustLeftMenuHeight(); +}); + +function getCookie(cname) { + var name = cname + "="; + var decodedCookie = decodeURIComponent(document.cookie); + var ca = decodedCookie.split(';'); + for(var i = 0; i <ca.length; i++) { + var c = ca[i]; + while (c.charAt(0) == ' ') { + c = c.substring(1); + } + if (c.indexOf(name) == 0) { + return c.substring(name.length, c.length); + } + } + return ""; +} diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/manifestService.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/manifestService.js new file mode 100644 index 00000000..27e3a6ec --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/manifestService.js @@ -0,0 +1,24 @@ +appDS2.factory('ManifestService', function ($http, $q, $log) { + return { + // Gets and returns the manifest for the webapp. + getManifest: function() { + // cache control for IE + var cc = "?cc=" + new Date().getTime().toString(); + return $http({ + method: 'GET', + url: 'manifest' + cc, + cache: false, + responseType: 'json'}) + .then(function(response) { + // $log.debug("ManifestService.getManifest: " + JSON.stringify(response)); + if (response.data == null || typeof response.data != 'object') + return $q.reject('ManifestService.getManifest: response.data null or not object'); + else + return response.data; + }, function(error) { + $log.error('ManifestService.getManifest failed: ' + error.data); + return $q.reject(error.data); + }); + } + }; +}); diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/modalService.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/modalService.js new file mode 100644 index 00000000..cb85ffce --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/modalService.js @@ -0,0 +1,57 @@ + +angular.module("template/modalsAndAlerts/window2.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/modalsAndAlerts/window.html", + "<div class=\"modalwrapper active {{windowClass}}\" ng-class=\"{'modal-landscape': isModalLandscape}\" role=\"dialog\" tabindex=\"-1\" aria-labelledby=\"{{title}}\" aria-describedby=\"{{content}}\">\n" + + " <div class=\"modal fade {{sizeClass}}\">sdfdsfsfd</div>\n" + + "</div>"); + }]); + +angular.module('ddh.att.modalsAndAlerts') + +.controller('modalsAndAlertsController', function ($scope, $modal, $log) { + $scope.name='eeee'; + $scope.items = ['item1', 'item2', 'item3']; + $scope.dt = new Date("March 10, 2014 00:00:00"); + $scope.helperText = "The date you selected is $date. Double tap to open calendar. Select a date to close the calendar."; + $scope.open = function (event) { + var modalInstance = $modal.open({ + templateUrl: 'template/modalsAndAlerts/modal-demo.html', + controller: ModalInstanceCtrl, + sizeClass: 'modal-long-adjust', + resolve: { + items: function () { + return $scope.items; + } + } + }); + + modalInstance.result.then(function (selectedItem) { + $scope.selected = selectedItem; + event.target.focus(); + }, function () { + $log.info('Modal dismissed at: ' + new Date()); + event.target.focus(); + }); + }; + $scope.ok = function () { + //add the ok functionality + console.log("ok"); + }; + $scope.cancel = function () { + //add the cancel functionality + console.log("cancel"); + }; +}) + +var ModalInstanceCtrl = function ($scope, $modalInstance, items) { + $scope.items = items; + $scope.selected = { + item: $scope.items[0] + }; + $scope.ok = function () { + $modalInstance.close($scope.selected.item); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; +}; diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/modalServiceDS2.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/modalServiceDS2.js new file mode 100644 index 00000000..d3cd8737 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/modalServiceDS2.js @@ -0,0 +1,31 @@ +angular.module("modalServicesDS2",[]).service('modalService', ['$modal', function ($modal) { + + this.popupConfirmWinWithCancel = function(title, msgBody, callback,dismissCallback){ + debugger; + var modalInstance = $modal.open({ + templateUrl: 'confirmation_informativeDS2.html', + //controller: 'modalpopupControllerDS2', + //size: 'sm', + resolve: { + message: function () { + var message = { + title: title, + text: msgBody + }; + return message; + } + } + }); + var args = Array.prototype.slice.call( arguments, 0 ); + args.splice( 0, 3); + modalInstance.result.then(function(){ + callback.apply(null, args); + }, function() { + dismissCallback(); + })['finally'](function(){ + modalInstance = undefined; + }); + + }; + + }]);
\ No newline at end of file diff --git a/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/profileServiceDS2.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/profileServiceDS2.js new file mode 100644 index 00000000..812e8320 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/profileServiceDS2.js @@ -0,0 +1,93 @@ +appDS2.factory('ProfileServiceDS2', function ($http, $q) { + return { + getProfile: function() { + return $http.get('get_user') + .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); + }); + }, + + getProfilePagination: function(pageNum,viewPerPage) { + return $http.get('get_user_pagination?pageNum=' + pageNum + '&viewPerPage=' + viewPerPage) + .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); + }); + }, + + getPostProfile: function() { + return $http.get('post_search_sample') + .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); + }); + }, + + getProfileDetail: function(profileId) { + return $http.get('get_profile?profile_id='+profileId) + .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); + }); + }, + + getSelfProfileDetail: function() { + return $http.get('get_self_profile') + .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); + }); + }, + + 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/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/sampleService.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/sampleService.js new file mode 100644 index 00000000..d762dc9c --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/sampleService.js @@ -0,0 +1,19 @@ +appDS2.factory('SampleService', function ($http, $q) { + return { + getCollaborateList: function() { + return $http.get('get_collaborate_list') + .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/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/userInfoServiceDS2.js b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/userInfoServiceDS2.js new file mode 100644 index 00000000..cfb12dd5 --- /dev/null +++ b/usecaseui-common/src/main/webapp/app/fusion/scripts/DS2-services/userInfoServiceDS2.js @@ -0,0 +1,32 @@ +appDS2.factory('UserInfoServiceDS2', function ($http, $q,$log) { + return { + getFunctionalMenuStaticDetailShareContext: function(contextId,key) { + var deferred = $q.defer(); + $http({ + method: "GET", + url: "get_userinfo", + }).success( function(res) { + if(res==null || res=='') + $log.error('userInfoServiceDs2: failed to get user info'); + deferred.resolve(res); + }).error( function(status) { + deferred.reject(status); + }); + return deferred.promise; + }, + getFunctionalMenuStaticDetailSession: function() { + var deferred = $q.defer(); + $http({ + method: "GET", + url: "get_topMenuInfo", + }).success(function(res) { + if(res==null || res=='') + $log.error('userInfoServiceDs2: failed to get top menu info'); + deferred.resolve(res); + }).error( function(status) { + deferred.reject(status); + }); + return deferred.promise; + } + }; +}); |