From 5359df130922118780a7220353cf2bfb0325489d Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Tue, 8 Aug 2017 03:12:26 -0700 Subject: Rework the javascript file of the UI (part3) Rework the javascript file of the UI (part3) Change-Id: I9fd6eab33f1c222c0bd61218ee31fece7a5e7af3 Issue-Id: CLAMP-1 Signed-off-by: Determe, Sebastien (sd378r) --- .../designer/scripts/FileUploadService.js | 3 +- .../designer/scripts/GlobalPropertiesCtrl.js | 23 +- .../resources/designer/scripts/ImportSchemaCtrl.js | 24 +- .../designer/scripts/SetDefaultValueCtrl.js | 30 - .../META-INF/resources/designer/scripts/aOnBoot.js | 90 +- .../META-INF/resources/designer/scripts/app.js | 2899 +++++++++++--------- .../resources/designer/scripts/authcontroller.js | 58 +- .../resources/designer/scripts/common_variables.js | 4 + .../designer/scripts/importSchemaService.js | 3 +- .../designer/scripts/propertyExplorerCtrl.js | 195 +- 10 files changed, 1751 insertions(+), 1578 deletions(-) (limited to 'src/main') diff --git a/src/main/resources/META-INF/resources/designer/scripts/FileUploadService.js b/src/main/resources/META-INF/resources/designer/scripts/FileUploadService.js index 7cfa7a97..51c8971e 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/FileUploadService.js +++ b/src/main/resources/META-INF/resources/designer/scripts/FileUploadService.js @@ -20,7 +20,6 @@ * =================================================================== * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ - app.directive('fileModel', ['$parse', function ($parse) { console.log("////////fileModel"); return { @@ -96,4 +95,4 @@ app.service('fileUpload', ['$http', '$q', function ($http, $q) { return def.promise; }; -}]); +}]); \ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/scripts/GlobalPropertiesCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/GlobalPropertiesCtrl.js index efd127fa..fb810027 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/GlobalPropertiesCtrl.js +++ b/src/main/resources/META-INF/resources/designer/scripts/GlobalPropertiesCtrl.js @@ -20,31 +20,34 @@ * =================================================================== * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ - app.controller('GlobalPropertiesCtrl', ['$scope', '$rootScope', '$modalInstance','cldsModelService', '$location', 'dialogs','cldsTemplateService', - function($scope, $rootScope, $modalInstance, cldsModelService, $location,dialogs,cldsTemplateService) { - console.log("////////GlobalPropertiesCtrl"); + function($scope, $rootScope, $modalInstance, cldsModelService, $location,dialogs,cldsTemplateService) { //cldsModelService.getASDCServices().then(function(pars) { $scope.$watch('name', function(newValue, oldValue) { - console.log("name"); - if(readOnly){ - $("select,input,.nav-tabs .close").attr("disabled",""); - } var services=asdc_Services - console.log(asdc_Services) setASDCFields() for(k in services){ $("#service").append("") } var el = elementMap["global"]; - console.log(elementMap["global"]) if (el !== undefined) { for (var i = 0; i < el.length; i++) { $("#" + el[i].name).val(el[i].value); } } setMultiSelect(); + + if(readOnly||readMOnly){ + $("#savePropsBtn").attr("disabled", ""); + $('select[multiple] option').each(function() { + var input = $('input[value="' + $(this).val() + '"]'); + input.prop('disabled', true); + input.parent('li').addClass('disabled'); + }); + $('input[value="multiselect-all"]').prop('disabled', true).parent('li').addClass('disabled'); + ($("select:not([multiple])")).multiselect("disable"); + } }); $scope.retry = function(){ console.log("retry"); @@ -56,4 +59,4 @@ app.controller('GlobalPropertiesCtrl', }; } ] -); +); \ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/scripts/ImportSchemaCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/ImportSchemaCtrl.js index 839eefe9..bbe2c3b5 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/ImportSchemaCtrl.js +++ b/src/main/resources/META-INF/resources/designer/scripts/ImportSchemaCtrl.js @@ -36,10 +36,30 @@ app.controller('ImportSchemaCtrl', ['$scope', '$rootScope','$modalInstance','dat $rootScope.updateServiceFault; $rootScope.updateServiceInputPartInfo; $rootScope.updateSchemElemant1; + + +// Below code is added to get the policyNames + for ( var polElement in elementMap) { + if (polElement.indexOf('Policy_') === 0) { + var obj = elementMap[polElement]; + if (!($.isEmptyObject(obj))) { + allPolicies = jQuery.extend({}, obj); + $scope.policyNames = []; + for ( var policy in allPolicies) { + $scope.policyNames.push(policy); + } + } + break; + } + } + + setTimeout(function(){ + console.log("setTimeout"); + setMultiSelect(); }, 100); $scope.init = function() { console.log("init"); - $scope.schemaLocation = 'svn://svnrepo:3690'; + $scope.schemaLocation = 'svn://svnrepo:3690'; $scope.upgrade_schemaLocation = 'svn://svnrepo:3690'; $scope.userID = 'user_id'; $scope.password = 'password'; @@ -312,4 +332,4 @@ app.controller('ImportSchemaCtrl', ['$scope', '$rootScope','$modalInstance','dat }; -}]); +}]); \ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/scripts/SetDefaultValueCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/SetDefaultValueCtrl.js index 4aaf595b..ed81a152 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/SetDefaultValueCtrl.js +++ b/src/main/resources/META-INF/resources/designer/scripts/SetDefaultValueCtrl.js @@ -174,33 +174,3 @@ app.directive('inputInfoDVClassMember', function ($compile) { } } }); - -/*app.controller('SetDefaultValueCtrl', ['$scope', '$rootScope','$modalInstance','$location', function($scope,$rootScope,$modalInstance,$location){ - console.log("SetDefaultValueCtrl"); - $scope.utmSchemaExts = {}; - - $scope.init = function () { - console.log("init"); - //console.log("$rootScope.defValuesObject :: " + JSON.stringify(list_model_schema_extensions[selected_model])); - if(list_model_schema_extensions[selected_model] != null && list_model_schema_extensions[selected_model].utmSchemaExtentionMap != null) { - $scope.utmSchemaExts = list_model_schema_extensions[selected_model].utmSchemaExtentionMap; - $scope.previous_utmSchemaExts = angular.copy($scope.utmSchemaExts); - //console.log("$scope.defaultValuesObject :: " + $scope.utmSchemaExts); - } - }; - - $scope.init(); - - $scope.setDefaultValue= function(){ - console.log("setDefaultValue"); - list_model_schema_extensions[selected_model].utmSchemaExtentionMap = $scope.utmSchemaExts; - $rootScope.isModel = true; - $modalInstance.close("closed"); - }; - - $scope.close = function(){ - console.log("close"); - list_model_schema_extensions[selected_model].utmSchemaExtentionMap = $scope.previous_utmSchemaExts; - $modalInstance.close("closed"); - }; -}]);*/ diff --git a/src/main/resources/META-INF/resources/designer/scripts/aOnBoot.js b/src/main/resources/META-INF/resources/designer/scripts/aOnBoot.js index 6c58570a..f97ed1fa 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/aOnBoot.js +++ b/src/main/resources/META-INF/resources/designer/scripts/aOnBoot.js @@ -59,27 +59,42 @@ var isObject = function(a) { return (!!a) && (a.constructor === Object); }; -function loadPropertyWindow(type) { - if (readOnly) { +function loadPropertyWindow(type) { + if (readOnly||readMOnly) { if ($("#add_one_more").length == 1) { $("#add_one_more").off(); $("#add_one_more").click(function(event) { event.preventDefault(); }) } - $("select,input").attr("disabled", ""); + $("input,#savePropsBtn").attr("disabled", ""); + $(".modal-body button").attr("disabled", ""); + ($("select:not([multiple])")).multiselect("disable"); + } + + if (readTOnly){ + $("textarea").attr("disabled",""); + $("#savePropsBtn").attr("disabled", ""); } var props = defaults_props[type]; for (p in props) { - if (isObject(props[p])) { + if (isObject(props[p])) { var mySelect = $('#' + p); - $.each(props[p], function(val, text) { - mySelect.append( - $('').val(val).html(text) - ); - }); + if (p=="operator"){ + $.each(props[p], function(val, text) { + mySelect.append( + $('').val(val).html(val) + ); + }); + } else { + $.each(props[p], function(val, text) { + mySelect.append( + $('').val(val).html(text) + ); + }); + } } else { if (p=="pname"){ var ms = new Date().getTime(); @@ -89,8 +104,9 @@ function loadPropertyWindow(type) { } } setTimeout(function(){ - - setMultiSelect(type); }, 100); + setMultiSelect(type); }, 100); + + } @@ -153,18 +169,18 @@ function setMultiSelect() { //refeshMultiSelect(); } function loadSharedPropertyByService(onChangeUUID,refresh, callBack) { - var uuid = onChangeUUID + var uuid = onChangeUUID; if (uuid === undefined){ uuid = elementMap["global"] && elementMap["global"].length>0 ? elementMap["global"][0].value : ""; } else if (uuid === "") { vf_Services = null if ($("#vf").length > 0) - $("#vf").empty(); + $("#vf").empty().multiselect("refresh"); if ($("#location").length > 0) - $("#location").empty(); + $("#location").empty().multiselect("refresh"); if ($("#alarmCondition").length > 0) - $("#alarmCondition").empty(); + $("#alarmCondition").empty().multiselect("refresh"); return true; } var share = null, @@ -180,10 +196,10 @@ function loadSharedPropertyByService(onChangeUUID,refresh, callBack) { success: function(data) { vf_Services = data; setASDCFields() - if(refresh){ + if(refresh){ $("#paramsWarnrefresh").hide(); } - if($("#paramsWarn")){ + if($("#paramsWarn")){ $("#paramsWarn").hide(); } if(callBack && _.isFunction(callBack)){ @@ -209,6 +225,7 @@ function loadSharedPropertyByService(onChangeUUID,refresh, callBack) { timeout: 100000 }); + //vf_Services=share['shared']['byService'][uuid]; //location_values = share['global']['location']; } @@ -241,42 +258,60 @@ function setASDCFields() { loadSharedPropertyByService() } else { try { - $("#vf").empty(); - $("#location").empty(); - $("#vfc").empty(); + $("#vf").empty().multiselect("refresh"); + $("#location").empty().multiselect("refresh"); + $("#actionSet").empty().multiselect("refresh"); + $("#vfc").empty().multiselect("refresh"); $("#paramsWarn").hide(); var uuid = Object.keys(vf_Services['shared']['byService'])[0]; + var vf_values = vf_Services['shared']['byService'][uuid] && vf_Services['shared']['byService'][uuid]['vf'] && _.keys(vf_Services['shared']['byService'][uuid]['vf']).length > 0 ? vf_Services['shared']['byService'][uuid]['vf'] : null; + var selectedVF = {} for (let e in elementMap["global"]) { if (elementMap['global'][e].name === "vf") { selectedVF = elementMap['global'][e].value[0] } } - var location_values = vf_Services['global']['location']; + var vfc_values2 = selectedVF && vf_Services['shared']['byVf'][selectedVF] && vf_Services['shared']['byVf'][selectedVF]['vfc'] && _.keys(vf_Services['shared']['byVf'][selectedVF]['vfc']).length > 0 ? vf_Services['shared']['byVf'][selectedVF]['vfc'] : null; - + if (vf_values) { for (key in vf_values) { if ($("#vf").length > 0) { $("#vf").append("