From 9dfd7e28c1eb348fcb4a2de8c6faae2a01b34942 Mon Sep 17 00:00:00 2001 From: Ofir Sonsino Date: Wed, 20 Sep 2017 13:20:42 +0300 Subject: Global Read only role, Support VID specific Roles Issue-ID: VID-46 , VID-47 Change-Id: Ib100d20ac40a65d39e27a6e2741b19a173a2b8ea Signed-off-by: Ofir Sonsino --- .../scripts/controller/InstantiationController.js | 18 +- .../scripts/controller/ServiceModelController.js | 100 +- .../scripts/controller/aaiSubscriberController.js | 1561 +++++++++++--------- .../scripts/controller/creationDialogController.js | 14 +- .../scripts/controller/deletionDialogController.js | 4 + .../scripts/controller/previousVersionContoller.js | 40 + .../controller/previousVersionDialogController.js | 40 + .../scripts/controller/statusDialogController.js | 2 +- .../app/vid/scripts/controller/subscriberSearch.js | 2 +- 9 files changed, 1039 insertions(+), 742 deletions(-) create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/controller/previousVersionContoller.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/controller/previousVersionDialogController.js (limited to 'vid-app-common/src/main/webapp/app/vid/scripts/controller') diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js index dcbf3e6e..b0fcb11e 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js @@ -33,8 +33,9 @@ $scope.defaultBaseUrl = ""; $scope.responseTimeoutMsec = 60000; $scope.properties = UtilityService.getProperties(); - $scope.init = function() { + $scope.isPermitted = $location.search().isPermitted; + $scope.init = function() { /* * These 2 statements should be included in non-test code. */ @@ -46,7 +47,7 @@ var polls = PropertyService.retrieveMsoMaxPolls(); PropertyService.setMsoMaxPolls(polls); - PropertyService.setServerResponseTimeoutMsec(10000); + PropertyService.setServerResponseTimeoutMsec(30000); /* * Common parameters that shows an example of how the view edit screen @@ -224,11 +225,17 @@ console.log("Removing Service " + $scope.service.instance.name); - DataService.setALaCarte (true); + if ( $scope.isMacro() ) { + DataService.setALaCarte (false); + } + else { + DataService.setALaCarte (true); + } + DataService.setMacro($scope.isMacro()); DataService.setInventoryItem(serviceInstance); DataService.setModelInfo(COMPONENT.SERVICE, { - "modelInvariantId": serviceInstance[FIELD.ID.MODEL_INVAR_ID], + "modelInvariantId": $scope.service.model.service.invariantUuid, "modelVersion": $scope.service.model.service.version, "modelNameVersionId": $scope.service.model.service.uuid, "modelName": $scope.service.model.service.name, @@ -345,6 +352,9 @@ $scope.deleteVnf = function(serviceObject, vnf) { + + debugger; + console.log("Removing VNF " + vnf.name); var serviceInstance = serviceObject.object; diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js index dd2cf73f..731c2f2e 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js @@ -39,8 +39,9 @@ $http.get(pathQuery) .then(function successCallback(response) { $scope.services = []; - if (angular.isArray(response.data)) { - $scope.services = response.data; + if (angular.isArray(response.data.services)) { + wholeData = response.data.services; + $scope.services = $scope.filterDataWithHigerVersion(wholeData); $scope.viewPerPage=10; $scope.totalPage=$scope.services.length/$scope.viewPerPage; $scope.sortBy=COMPONENT.NAME; @@ -56,11 +57,72 @@ $scope.error = true; $scope.isSpinnerVisible = false; } + $scope.deployButtonType = response.data.readOnly ? 'disabled' : 'primary'; }, function errorCallback(response) { console.log("Error: " + response); }); } - + $scope.isFiltered=function(arr,obj){ + var filtered = false; + if(arr.length>0){ + for(var i=0;i=parseFloat(serviceData[i].version.trim()))){ + var data = $scope.isThisHigher(fiterDataServices,serviceData[j]); + if(data.isHigher){ + fiterDataServices[data.index] = serviceData[j]; + } + } + } + } + } + return fiterDataServices; + } + + $scope.isThisHigher = function(arr,obj){ + var returnObj = { + isHigher:false, + index:0 + }; + if(arr.length>0){ + var isNotMatched = true; + for(var i=0;i0){ + for(var i=0;i=parseFloat(serviceData[i]['extra-properties']['extra-property'][6]['property-value']))){ + var data = $scope.isThisHigher(fiterDataServices,serviceData[j]); + if(data.isHigher){ + fiterDataServices[data.index] = serviceData[j]; } - $scope.service.instance[FIELD.ID.NETWORKS].push(l3Network); } - - if (subInventoryResponseItem[FIELD.ID.GENERIC_VNF] != null) { - var genericVnfObject = subInventoryResponseItem[FIELD.ID.GENERIC_VNF]; - - var genericVnf = { - "name": genericVnfObject[FIELD.ID.VNF_NAME], - "id": $scope.counter++, - "itemType": COMPONENT.VNF, - "nodeType": genericVnfObject[FIELD.ID.VNF_TYPE], - "nodeId": genericVnfObject[FIELD.ID.VNF_ID], - "nodeStatus": genericVnfObject[FIELD.ID.ORCHESTRATION_STATUS], - "object": genericVnfObject, - "vfModules": [], - "volumeGroups": [], - "availableVolumeGroups": [] - }; - $scope.service.instance[FIELD.ID.VNFS].push(genericVnf); - - // look for volume-groups - if (subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS] != null) { - angular.forEach(subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS][FIELD.ID.INVENTORY_RESPONSE_ITEM], function(vfmodules, key) { - - if (vfmodules[FIELD.ID.VOLUME_GROUP] != null) { - var volumeGroupObject = vfmodules[FIELD.ID.VOLUME_GROUP]; - var volumeGroup = { "id": $scope.counter++, - "name": volumeGroupObject[FIELD.ID.VOLUME_GROUP_NAME], - "itemType": FIELD.ID.VOLUME_GROUP, - "nodeId": volumeGroupObject[FIELD.ID.VOLUME_GROUP_ID], - "nodeType": volumeGroupObject[FIELD.ID.VNF_TYPE], - "nodeStatus": volumeGroupObject[FIELD.ID.ORCHESTRATION_STATUS], - "object": volumeGroupObject, - "nodes": [] - }; - genericVnf[FIELD.ID.VOLUMEGROUPS].push(volumeGroup); - genericVnf[FIELD.ID.AVAILABLEVOLUMEGROUPS].push(volumeGroup); - } - }); - } - // now we've loaded up the availableVolumeGroups, we can use it - if (subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS] != null) { - angular.forEach(subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS][FIELD.ID.INVENTORY_RESPONSE_ITEM], function(vfmodules, key) { - - if (vfmodules[FIELD.ID.VF_MODULE] != null) { - var vfModuleObject = vfmodules[FIELD.ID.VF_MODULE]; - var vfModule = { "id": $scope.counter++, - "name": vfModuleObject[FIELD.ID.VF_MODULE_NAME], - "itemType": FIELD.ID.VF_MODULE, - "nodeType": FIELD.ID.VF_MODULE, - "nodeStatus": vfModuleObject[FIELD.ID.ORCHESTRATION_STATUS], - "volumeGroups": [], - "object": vfModuleObject, - "networks": [] - }; - genericVnf[FIELD.ID.VF_MODULES].push(vfModule); - if (vfmodules[FIELD.ID.INVENTORY_RESPONSE_ITEMS] != null) { - angular.forEach(vfmodules[FIELD.ID.INVENTORY_RESPONSE_ITEMS][FIELD.ID.INVENTORY_RESPONSE_ITEM], function(networks, key) { - if (networks[FIELD.ID.L3_NETWORK] != null) { - var l3NetworkObject = networks[FIELD.ID.L3_NETWORK]; - var l3Network = { "id": $scope.counter++, - "name": l3NetworkObject[FIELD.ID.NETWORK_NAME], - "itemType": FIELD.ID.L3_NETWORK, - "nodeId": l3NetworkObject[FIELD.ID.NETWORK_ID], - "nodeType": l3NetworkObject[FIELD.ID.NETWORK_TYPE], - "nodeStatus": l3NetworkObject[FIELD.ID.ORCHESTRATION_STATUS], - "object": l3NetworkObject, - "nodes": [] - }; - vfModule[FIELD.ID.NETWORKS].push(l3Network); - } - if (networks[FIELD.ID.VOLUME_GROUP] != null) { - var volumeGroupObject = networks[FIELD.ID.VOLUME_GROUP]; - - var volumeGroup = { "id": $scope.counter++, - "name": volumeGroupObject[FIELD.ID.VOLUME_GROUP_NAME], - "itemType": FIELD.ID.VOLUME_GROUP, - "nodeId": volumeGroupObject[FIELD.ID.VOLUME_GROUP_ID], - "nodeType": volumeGroupObject[FIELD.ID.VNF_TYPE], - "nodeStatus": volumeGroupObject[FIELD.ID.ORCHESTRATION_STATUS], - "object": volumeGroupObject, - "nodes": [] - }; - var tmpVolGroup = []; - - angular.forEach(genericVnf[FIELD.ID.AVAILABLEVOLUMEGROUPS], function(avgroup, key) { - if (avgroup.name != volumeGroup.name) { - tmpVolGroup.push(avgroup); - } - }); - - genericVnf[FIELD.ID.AVAILABLEVOLUMEGROUPS] = tmpVolGroup; - - vfModule[FIELD.ID.VOLUMEGROUPS].push(volumeGroup); - } - - }); - } - } - }); - } - } - }); + } } - }); - }); - } - - $scope.handleInitialResponse = function(response) { - try { - $scope.enableCloseButton(true); - $scope.updateLog(response); - if (response.data.status < 200 || response.data.status > 202) { - $scope.showError(FIELD.ERROR.MSO); - $scope.status = FIELD.ERROR.AAI_FETCHING_CUST_DATA + response.data.status; - - return; } - - $scope.setProgress(100); // done - $scope.status = FIELD.STATUS.DONE; - $scope.isSpinnerVisible = false; - - $scope.customer = response.data.customer; // get data from json - - $scope.customerList = []; - - angular.forEach($scope.customer, function(subVal, subKey) { - var cust = { "globalCustomerId": subVal[FIELD.ID.GLOBAL_CUSTOMER_ID], "subscriberName": subVal[FIELD.ID.SUBNAME] }; - $scope.customerList.push(cust); - }); - - } catch (error) { - $scope.showContentError(error); + return fiterDataServices; } - } - - $scope.autoGetSubs = function() { - /* - * Optionally comment in / out one of these method calls (or add a similar - * entry) to auto-invoke an entry when the test screen is redrawn. - */ - $scope.getSubs(); - - } - $scope.updateLog = function(response) { -// $scope.log = UtilityService.getCurrentTime() + " HTTP Status: " + -// UtilityService.getHttpStatusText(response.data.status) + "\n" + -// angular.toJson(response.data.entity, true) + "\n\n" + $scope.log; -// UtilityService.checkUndefined("entity", response.data.entity); -// UtilityService.checkUndefined("status", response.data.status); - } - - $scope.handleServerError = function(response, status) { - $scope.enableCloseButton(true); - var message = UtilityService.getHttpErrorMessage(response); - if (message != ""){ - message = " (" + message + ")"; - } - $scope.showError(FIELD.ERROR.SYSTEM_ERROR + message); - } - - $scope.showContentError = function(message) { - // $log.debug(message); - console.log(message); - if (UtilityService.hasContents(message)) { - $scope.showError("System failure (" + message + ")"); - } else { - $scope.showError(FIELD.ERROR.SYSTEM_ERROR); - } - } - - $scope.showError = function(message) { - $scope.isSpinnerVisible = false; - $scope.isProgressVisible = false; - $scope.error = message; - $scope.status = FIELD.STATUS.ERROR; - } - - $scope.close = function() { - if ($scope.timer != undefined) { - $timeout.cancel($scope.timer); + $scope.isThisHigher = function(arr,obj){ + var returnObj = { + isHigher:false, + index:0 + }; + if(arr.length>0){ + var isNotMatched = true; + for(var i=0;i 202) { + $scope.showError(FIELD.ERROR.MSO); + $scope.status = FIELD.ERROR.AAI_FETCHING_CUST_DATA + response.data.status; - if (isEnabled) { - $(selector).addClass(FIELD.STYLE.BTN_PRIMARY).removeClass(FIELD.STYLE.BTN_INACTIVE).attr(FIELD.STYLE.BTN_TYPE, FIELD.STYLE.PRIMARY); - } else { - $(selector).removeClass(FIELD.STYLE.BTN_PRIMARY).addClass(FIELD.STYLE.BTN_INACTIVE).attr(FIELD.STYLE.BTN_TYPE, FIELD.STYLE.DISABLED); - } - } + return; + } - $scope.resetProgress = function() { - $scope.percentProgress = 0; - $scope.progressClass = FIELD.STYLE.PROGRESS_BAR_INFO; - } + $scope.setProgress(100); // done + $scope.status = FIELD.STATUS.DONE; + $scope.isSpinnerVisible = false; - $scope.setProgress = function(percentProgress) { - percentProgress = parseInt(percentProgress); - if (percentProgress >= 100) { - $scope.progressClass = FIELD.STYLE.PROGRESS_BAR_SUCCESS; - } + $scope.customer = response.data.customer; // get data from json - if (percentProgress < $scope.percentProgress) { - return; - } + $scope.customerList = []; - $scope.percentProgress = percentProgress; - $scope.progressWidth = {width: percentProgress + "%"}; - if (percentProgress >= 5) { - $scope.progressText = percentProgress + " %"; - } else { - // Hidden since color combination is barely visible when progress portion is narrow. - $scope.progressText = ""; - } - } + angular.forEach($scope.customer, function (subVal, subKey) { + var cust = { + "globalCustomerId": subVal[FIELD.ID.GLOBAL_CUSTOMER_ID], + "subscriberName": subVal[FIELD.ID.SUBNAME], + "isPermitted": subVal[FIELD.ID.IS_PERMITTED] + }; - $scope.reloadRoute = function() { - $route.reload(); - } + $scope.customerList.push(cust); + }); - $scope.prevPage = function() { - $scope.currentPage--; - } + } catch (error) { + $scope.showContentError(error); + } + } - $scope.nextPage = function() { - $scope.currentPage++; - } - $scope.serviceInstanceses = [{"sinstance":FIELD.NAME.SERVICE_INSTANCE_Id},{"sinstance":FIELD.NAME.SERVICE_INSTANCE_NAME}] - $scope.getSubscriberDet = function(selectedCustomer,selectedserviceinstancetype,selectedServiceInstance){ - - var sintype =selectedserviceinstancetype; - if (selectedServiceInstance != "" && selectedServiceInstance != undefined) { - selectedServiceInstance.trim(); - - // check with A&AI - $http.get(COMPONENT.AAI_GET_SERVICE_INSTANCE_PATH + selectedServiceInstance+"/"+sintype + "?r=" + Math.random(), { - - },{ - timeout: $scope.responseTimeoutMsec - }).then(function(response) { - var notFound = true; - if (angular.isArray(response.data[FIELD.ID.RESULT_DATA])) { - var item = []; - var urlParts = []; - item = response.data[FIELD.ID.RESULT_DATA][0]; - var url = item[FIELD.ID.RESOURCE_LINK]; - var globalCustomerId = ""; - var serviceSubscription = ""; - // split it and find the customer Id and service-subscription - urlParts = url.split("/"); - if (urlParts[7] === FIELD.ID.CUSTOMER) { - globalCustomerId = urlParts[8]; - } - if (urlParts[10] === FIELD.ID.SERVICE_SUBSCRIPTION) { - serviceSubscription = urlParts[11]; - } + $scope.autoGetSubs = function () { + /* + * Optionally comment in / out one of these method calls (or add a similar + * entry) to auto-invoke an entry when the test screen is redrawn. + */ + $scope.getSubs(); - if (globalCustomerId !== "") { - notFound = false; - window.location.href = COMPONENT.SELECTED_SERVICE_SUB_PATH + serviceSubscription + COMPONENT.SELECTEDSUBSCRIBER_SUB_PATH + globalCustomerId + COMPONENT.SELECTEDSERVICEINSTANCE_SUB_PATH + selectedServiceInstance; - } - } - if (notFound) { - alert(FIELD.ERROR.SERVICE_INST_DNE); - } - }); // add a failure callback... - } else if (selectedCustomer != null) { - window.location.href = COMPONENT.SELECTED_SUB_PATH + selectedCustomer; - } else { - alert(FIELD.ERROR.SELECT); - } - }; - }]).directive('restrictInput', function(){ - - return { - - restrict: 'A', - require: 'ngModel', - link: function($scope, element, attr, ctrl){ - ctrl.$parsers.unshift(function(viewValue){ - - var types = $scope.$eval(attr.restrictInput); - if(!types.regex && types.type){ - - switch(types.type){ - case 'Service Instance Name' : types.regex = '^[a-zA-Z0-9-_]*$'; break; - default: types.regex= ''; - } - } - var reg = new RegExp(types.regex); - if(reg.test(viewValue)){ - return viewValue; - } else { - var overrideValue = (reg.test(viewValue) ? viewValue : ''); - element.val(overrideValue); - return overrideValue; - } - }); - } - }; + } + $scope.updateLog = function (response) { +// $scope.log = UtilityService.getCurrentTime() + " HTTP Status: " + +// UtilityService.getHttpStatusText(response.data.status) + "\n" + +// angular.toJson(response.data.entity, true) + "\n\n" + $scope.log; +// UtilityService.checkUndefined("entity", response.data.entity); +// UtilityService.checkUndefined("status", response.data.status); + } + + $scope.handleServerError = function (response, status) { + $scope.enableCloseButton(true); + var message = UtilityService.getHttpErrorMessage(response); + if (message != "") { + message = " (" + message + ")"; + } + $scope.showError(FIELD.ERROR.SYSTEM_ERROR + message); + } + + $scope.showContentError = function (message) { + // $log.debug(message); + console.log(message); + if (UtilityService.hasContents(message)) { + $scope.showError("System failure (" + message + ")"); + } else { + $scope.showError(FIELD.ERROR.SYSTEM_ERROR); + } + } + + $scope.showError = function (message) { + $scope.isSpinnerVisible = false; + $scope.isProgressVisible = false; + $scope.error = message; + $scope.status = FIELD.STATUS.ERROR; + } + + $scope.close = function () { + if ($scope.timer != undefined) { + $timeout.cancel($scope.timer); + } + $scope.isPopupVisible = false; + } + + + /* + * Consider converting the progress bar mechanism, the disabled button handling + * and the following methods to generic Angular directive(s) and/or approach. + */ + + $scope.enableCloseButton = function (isEnabled) { + var selector = FIELD.STYLE.MSO_CTRL_BTN; + + $scope.isCloseEnabled = isEnabled; + + if (isEnabled) { + $(selector).addClass(FIELD.STYLE.BTN_PRIMARY).removeClass(FIELD.STYLE.BTN_INACTIVE).attr(FIELD.STYLE.BTN_TYPE, FIELD.STYLE.PRIMARY); + } else { + $(selector).removeClass(FIELD.STYLE.BTN_PRIMARY).addClass(FIELD.STYLE.BTN_INACTIVE).attr(FIELD.STYLE.BTN_TYPE, FIELD.STYLE.DISABLED); + } + } + + $scope.resetProgress = function () { + $scope.percentProgress = 0; + $scope.progressClass = FIELD.STYLE.PROGRESS_BAR_INFO; + } + + $scope.setProgress = function (percentProgress) { + percentProgress = parseInt(percentProgress); + if (percentProgress >= 100) { + $scope.progressClass = FIELD.STYLE.PROGRESS_BAR_SUCCESS; + } + + if (percentProgress < $scope.percentProgress) { + return; + } + + $scope.percentProgress = percentProgress; + $scope.progressWidth = {width: percentProgress + "%"}; + if (percentProgress >= 5) { + $scope.progressText = percentProgress + " %"; + } else { + // Hidden since color combination is barely visible when progress portion is narrow. + $scope.progressText = ""; + } + } + + $scope.reloadRoute = function () { + $route.reload(); + } + + $scope.prevPage = function () { + $scope.currentPage--; + } + + $scope.nextPage = function () { + $scope.currentPage++; + } + $scope.serviceInstanceses = [{"sinstance": FIELD.NAME.SERVICE_INSTANCE_Id}, {"sinstance": FIELD.NAME.SERVICE_INSTANCE_NAME}] + $scope.getSubscriberDet = function (selectedCustomer, selectedserviceinstancetype, selectedServiceInstance) { + + var sintype = selectedserviceinstancetype; + if (selectedServiceInstance != "" && selectedServiceInstance != undefined) { + selectedServiceInstance.trim(); + + // check with A&AI + $http.get(COMPONENT.AAI_GET_SERVICE_INSTANCE_PATH + selectedServiceInstance + "/" + sintype + "?r=" + Math.random(), {}, { + timeout: $scope.responseTimeoutMsec + }).then(function (response) { + var notFound = true; + if (angular.isArray(response.data[FIELD.ID.RESULT_DATA])) { + var item = []; + var urlParts = []; + item = response.data[FIELD.ID.RESULT_DATA][0]; + var url = item[FIELD.ID.RESOURCE_LINK]; + var globalCustomerId = ""; + var serviceSubscription = ""; + // split it and find the customer Id and service-subscription + urlParts = url.split("/"); + if (urlParts[7] === FIELD.ID.CUSTOMER) { + globalCustomerId = urlParts[8]; + } + if (urlParts[10] === FIELD.ID.SERVICE_SUBSCRIPTION) { + serviceSubscription = urlParts[11]; + } + + if (globalCustomerId !== "") { + notFound = false; + window.location.href = COMPONENT.SELECTED_SERVICE_SUB_PATH + serviceSubscription + COMPONENT.SELECTEDSUBSCRIBER_SUB_PATH + globalCustomerId + COMPONENT.SELECTEDSERVICEINSTANCE_SUB_PATH + selectedServiceInstance; + } + } + if (notFound) { + alert(FIELD.ERROR.SERVICE_INST_DNE); + } + }); // add a failure callback... + } else if (selectedCustomer != null) { + window.location.href = COMPONENT.SELECTED_SUB_PATH + selectedCustomer; + } else { + alert(FIELD.ERROR.SELECT); + } + }; + }]).directive('restrictInput', function () { + + return { + + restrict: 'A', + require: 'ngModel', + link: function ($scope, element, attr, ctrl) { + ctrl.$parsers.unshift(function (viewValue) { + + var types = $scope.$eval(attr.restrictInput); + if (!types.regex && types.type) { + + switch (types.type) { + case 'Service Instance Name' : + types.regex = '^[a-zA-Z0-9-_]*$'; + break; + default: + types.regex = ''; + } + } + var reg = new RegExp(types.regex); + if (reg.test(viewValue)) { + return viewValue; + } else { + var overrideValue = (reg.test(viewValue) ? viewValue : ''); + element.val(overrideValue); + return overrideValue; + } }); + } + }; + +}); appDS2.controller('TreeCtrl', ['$scope', function ($scope) { - $scope.remove = function (scope) { - scope.remove(); - }; - - $scope.toggle = function (scope) { - scope.toggle(); - }; - - $scope.moveLastToTheBeginning = function () { - var a = $scope.data.pop(); - $scope.data.splice(0, 0, a); - }; - - $scope.newSubItem = function (scope) { - var nodeData = scope.$modelValue; - nodeData.nodes.push({ - id: nodeData.id * 10 + nodeData.nodes.length, - title: nodeData.title + '.' + (nodeData.nodes.length + 1), - nodes: [] - }); - }; - - $scope.collapseAll = function () { - $scope.$broadcast(FIELD.ID.ANGULAR_UI_TREE_COLLAPSEALL); - }; - - $scope.expandAll = function () { - $scope.$broadcast(FIELD.ID.ANGULAR_UI_TREE_EXPANDALL); - }; + $scope.remove = function (scope) { + scope.remove(); + }; + + $scope.toggle = function (scope) { + scope.toggle(); + }; + + $scope.moveLastToTheBeginning = function () { + var a = $scope.data.pop(); + $scope.data.splice(0, 0, a); + }; + + $scope.newSubItem = function (scope) { + var nodeData = scope.$modelValue; + nodeData.nodes.push({ + id: nodeData.id * 10 + nodeData.nodes.length, + title: nodeData.title + '.' + (nodeData.nodes.length + 1), + nodes: [] + }); + }; + + $scope.collapseAll = function () { + $scope.$broadcast(FIELD.ID.ANGULAR_UI_TREE_COLLAPSEALL); + }; + + $scope.expandAll = function () { + $scope.$broadcast(FIELD.ID.ANGULAR_UI_TREE_EXPANDALL); + }; }]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js index b400cc6e..3d8cba5c 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js @@ -111,16 +111,21 @@ var creationDialogController = function( COMPONENT, FIELD, PARAMETER, $scope, $h var isUploadAvailable = false; var uploadIndex =0; var paramList = $scope.userProvidedControl.getList(); - + var isAnyError = false; for (var i = 0; i < paramList.length; i++) { if (paramList[i].id === FIELD.ID.SUPPLEMENTORY_DATA_FILE) { isUploadAvailable = true; uploadIndex=i; - break; + } + if (paramList[i].id === FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE && paramList[i].value && document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE).value=='' ) { + isAnyError = true; } } - if(isUploadAvailable){ + if(isUploadAvailable && isAnyError ){ + showError(FIELD.ERROR.MISSING_DATA, FIELD.ERROR.MISSING_FILE); + return; + }else if(isUploadAvailable && document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE).value!='' ){ var errorMsg = ""; var fileInput = document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE); var file = fileInput.files[0]; @@ -128,8 +133,7 @@ var creationDialogController = function( COMPONENT, FIELD, PARAMETER, $scope, $h reader.onload = function(e) { try{ paramList[uploadIndex].value = JSON.parse(reader.result); - FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE['value'] = JSON.stringify(paramList[uploadIndex].value); - $scope.userProvidedControl.updateList([ FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE ]); + FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE['value'] = paramList[uploadIndex].value; var instanceName = ""; diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/deletionDialogController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/deletionDialogController.js index 137673d4..499a1ec0 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/deletionDialogController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/deletionDialogController.js @@ -80,6 +80,10 @@ var deletionDialogController = function( COMPONENT, FIELD, $scope, $http, $timeo var requestDetails = DeletionService.getMsoRequestDetails($scope.userProvidedControl.getList()); + + if(DeletionService.isMacro === true){ + requestDetails.requestParameters.aLaCarte = false; + } $scope.isDialogVisible = false; diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/previousVersionContoller.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/previousVersionContoller.js new file mode 100644 index 00000000..eb0dac64 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/previousVersionContoller.js @@ -0,0 +1,40 @@ +"use strict"; + +var previousVersionContoller = function( COMPONENT, FIELD, $scope, $http, $timeout, $log, + CreationService, UtilityService, DataService,VIDCONFIGURATION) { + $scope.isTableDialogVisible = false; + $scope.summaryControl = {}; + $scope.userProvidedControl = {}; + + var callbackFunction = undefined; + var componentId = undefined; + + $scope.$on("createTableComponent", function(event, request) { + + $scope.isTableSpinnerVisible = true; + $scope.isTableErrorVisible = false; + $scope.isTableDialogVisible = true; + $scope.popup.isTablePopUpVisible = true; + componentId = request.componentId; + CreationService.initializeComponent(request.componentId); + callbackFunction = request.callbackFunction; + CreationService.setHttpErrorHandler(function(response) { + showError("System failure", UtilityService + .getHttpErrorMessage(response)); + }); + $scope.isTableSpinnerVisible = false; + }); + + + $scope.cancelTable = function(){ + $scope.isTableDialogVisible = false; + $scope.popup.isTablePopUpVisible = false; + } + + +} + +app + .controller("previousVersionContoller", [ "COMPONENT", "FIELD", "$scope", "$http", + "$timeout", "$log", "CreationService", "UtilityService", "DataService","VIDCONFIGURATION", + previousVersionContoller ]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/previousVersionDialogController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/previousVersionDialogController.js new file mode 100644 index 00000000..d11f432e --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/previousVersionDialogController.js @@ -0,0 +1,40 @@ +"use strict"; + +var previousVersionDialogController = function( COMPONENT, FIELD, $scope, $http, $timeout, $log, + CreationService, UtilityService, DataService,VIDCONFIGURATION) { + $scope.isTableDialogVisible = false; + $scope.summaryControl = {}; + $scope.userProvidedControl = {}; + + var callbackFunction = undefined; + var componentId = undefined; + + $scope.$on("createTableComponent", function(event, request) { + + $scope.isTableSpinnerVisible = true; + $scope.isTableErrorVisible = false; + $scope.isTableDialogVisible = true; + $scope.popup.isTablePopUpVisible = true; + componentId = request.componentId; + CreationService.initializeComponent(request.componentId); + callbackFunction = request.callbackFunction; + CreationService.setHttpErrorHandler(function(response) { + showError("System failure", UtilityService + .getHttpErrorMessage(response)); + }); + $scope.isTableSpinnerVisible = false; + }); + + + $scope.cancelTable = function(){ + $scope.isTableDialogVisible = false; + $scope.popup.isTablePopUpVisible = false; + } + + +} + +app + .controller("previousVersionDialogController", [ "COMPONENT", "FIELD", "$scope", "$http", + "$timeout", "$log", "CreationService", "UtilityService", "DataService","VIDCONFIGURATION", + previousVersionDialogController ]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/statusDialogController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/statusDialogController.js index de156667..0d067ff1 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/statusDialogController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/statusDialogController.js @@ -130,7 +130,7 @@ var statusDialogController = function(COMPONENT, FIELD, $scope, $http, $timeout, var polls = PropertyService.retrieveMsoMaxPolls(); PropertyService.setMsoMaxPolls(polls); - PropertyService.setServerResponseTimeoutMsec(10000) + PropertyService.setServerResponseTimeoutMsec(30000); $scope.isSpinnerVisible = true; diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js index 06cbf058..029860f8 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js @@ -64,7 +64,7 @@ appDS2.controller("aaiSubscriberSearchController", [ "$scope", "$timeout", "$log var polls = PropertyService.retrieveMsoMaxPolls(); PropertyService.setMsoMaxPolls(polls); - PropertyService.setServerResponseTimeoutMsec(10000); + PropertyService.setServerResponseTimeoutMsec(30000); // These two properties only added for testing properties.msoDefaultBaseUrl = $scope.baseUrl; -- cgit 1.2.3-korg