From: Determe, Sebastien (sd378r) Date: Mon, 2 Jul 2018 11:06:26 +0000 (+0200) Subject: Remove useless libraries X-Git-Tag: 3.0.0~58^2~3 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=819ec14e4a0263b2f2e05c71ff31e252c18c8b74;p=clamp.git Remove useless libraries Remove Angular-dropdown-multiselect and angular-highlightjs.js Issue-ID: CLAMP-191 Change-Id: Iec1f1600f597008e9cd643e1f8cc014ab109014b Signed-off-by: Determe, Sebastien (sd378r) --- diff --git a/src/main/resources/META-INF/resources/designer/index.html b/src/main/resources/META-INF/resources/designer/index.html index 7c81cb51..59322953 100644 --- a/src/main/resources/META-INF/resources/designer/index.html +++ b/src/main/resources/META-INF/resources/designer/index.html @@ -117,16 +117,11 @@ - - - - - diff --git a/src/main/resources/META-INF/resources/designer/lib/angular-highlightjs.js b/src/main/resources/META-INF/resources/designer/lib/angular-highlightjs.js deleted file mode 100644 index 1ded24b6..00000000 --- a/src/main/resources/META-INF/resources/designer/lib/angular-highlightjs.js +++ /dev/null @@ -1,380 +0,0 @@ -/*! angular-highlightjs -version: 0.4.1 -build date: 2015-02-03 -author: Chih-Hsuan Fan -https://github.com/pc035860/angular-highlightjs.git */ - -/* commonjs package manager support (eg componentjs) */ -if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){ - module.exports = 'hljs'; -} - -(function (window, angular, undefined) { -/*global angular*/ - -function shouldHighlightStatics(attrs) { - var should = true; - angular.forEach([ - 'source', 'include' - ], function (name) { - if (attrs[name]) { - should = false; - } - }); - return should; -} - - -var ngModule = angular.module('hljs', []); - -/** - * hljsService service - */ -ngModule.provider('hljsService', function () { - var _hljsOptions = {}; - - return { - setOptions: function (options) { - angular.extend(_hljsOptions, options); - }, - getOptions: function () { - return angular.copy(_hljsOptions); - }, - $get: ['$window', function ($window) { - ($window.hljs.configure || angular.noop)(_hljsOptions); - return $window.hljs; - }] - }; -}); - -/** - * hljsCache service - */ -ngModule.factory('hljsCache', [ - '$cacheFactory', -function ($cacheFactory) { - return $cacheFactory('hljsCache'); -}]); - -/** - * HljsCtrl controller - */ -ngModule.controller('HljsCtrl', [ - 'hljsCache', 'hljsService', -function HljsCtrl (hljsCache, hljsService) { - var ctrl = this; - - var _elm = null, - _lang = null, - _code = null, - _hlCb = null; - - ctrl.init = function (codeElm) { - _elm = codeElm; - }; - - ctrl.setLanguage = function (lang) { - _lang = lang; - - if (_code) { - ctrl.highlight(_code); - } - }; - - ctrl.highlightCallback = function (cb) { - _hlCb = cb; - }; - - ctrl.highlight = function (code) { - if (!_elm) { - return; - } - - var res, cacheKey; - - _code = code; - - if (_lang) { - // language specified - cacheKey = ctrl._cacheKey(_lang, _code); - res = hljsCache.get(cacheKey); - - if (!res) { - res = hljsService.highlight(_lang, hljsService.fixMarkup(_code), true); - hljsCache.put(cacheKey, res); - } - } - else { - // language auto-detect - cacheKey = ctrl._cacheKey(_code); - res = hljsCache.get(cacheKey); - - if (!res) { - res = hljsService.highlightAuto(hljsService.fixMarkup(_code)); - hljsCache.put(cacheKey, res); - } - } - - _elm.html(res.value); - // language as class on the tag - _elm.addClass(res.language); - - if (_hlCb !== null && angular.isFunction(_hlCb)) { - _hlCb(); - } - }; - - ctrl.clear = function () { - if (!_elm) { - return; - } - _code = null; - _elm.text(''); - }; - - ctrl.release = function () { - _elm = null; - }; - - ctrl._cacheKey = function () { - var args = Array.prototype.slice.call(arguments), - glue = "!angular-highlightjs!"; - return args.join(glue); - }; -}]); - - -var hljsDir, languageDirFactory, sourceDirFactory, includeDirFactory; - -/** - * hljs directive - */ -hljsDir = ['$compile', '$parse', function ($compile, $parse) { - return { - restrict: 'EA', - controller: 'HljsCtrl', - compile: function(tElm, tAttrs, transclude) { - // get static code - // strip the starting "new line" character - var staticHTML = tElm[0].innerHTML.replace(/^(\r\n|\r|\n)/m, ''), - staticText = tElm[0].textContent.replace(/^(\r\n|\r|\n)/m, ''); - - // put template - tElm.html('
'); - - return function postLink(scope, iElm, iAttrs, ctrl) { - var compileCheck, escapeCheck; - - if (angular.isDefined(iAttrs.compile)) { - compileCheck = $parse(iAttrs.compile); - } - - if (angular.isDefined(iAttrs.escape)) { - escapeCheck = $parse(iAttrs.escape); - } else if (angular.isDefined(iAttrs.noEscape)) { - escapeCheck = $parse('false'); - } - - ctrl.init(iElm.find('code')); - - if (iAttrs.onhighlight) { - ctrl.highlightCallback(function () { - scope.$eval(iAttrs.onhighlight); - }); - } - - if ((staticHTML || staticText) && shouldHighlightStatics(iAttrs)) { - - var code; - - // Auto-escape check - // default to "true" - if (escapeCheck && !escapeCheck(scope)) { - code = staticText; - } - else { - code = staticHTML; - } - - ctrl.highlight(code); - - // Check if the highlight result needs to be compiled - if (compileCheck && compileCheck(scope)) { - // compile the new DOM and link it to the current scope. - // NOTE: we only compile .childNodes so that - // we don't get into infinite loop compiling ourselves - $compile(iElm.find('code').contents())(scope); - } - } - - scope.$on('$destroy', function () { - ctrl.release(); - }); - }; - } - }; -}]; - -/** - * language directive - */ -languageDirFactory = function (dirName) { - return [function () { - return { - require: '?hljs', - restrict: 'A', - link: function (scope, iElm, iAttrs, ctrl) { - if (!ctrl) { - return; - } - iAttrs.$observe(dirName, function (lang) { - if (angular.isDefined(lang)) { - ctrl.setLanguage(lang); - } - }); - } - }; - }]; -}; - -/** - * source directive - */ -sourceDirFactory = function (dirName) { - return ['$compile', '$parse', function ($compile, $parse) { - return { - require: '?hljs', - restrict: 'A', - link: function(scope, iElm, iAttrs, ctrl) { - var compileCheck; - - if (!ctrl) { - return; - } - - if (angular.isDefined(iAttrs.compile)) { - compileCheck = $parse(iAttrs.compile); - } - - scope.$watch(iAttrs[dirName], function (newCode, oldCode) { - if (newCode) { - ctrl.highlight(newCode); - - // Check if the highlight result needs to be compiled - if (compileCheck && compileCheck(scope)) { - // compile the new DOM and link it to the current scope. - // NOTE: we only compile .childNodes so that - // we don't get into infinite loop compiling ourselves - $compile(iElm.find('code').contents())(scope); - } - } - else { - ctrl.clear(); - } - }); - } - }; - }]; -}; - -/** - * include directive - */ -includeDirFactory = function (dirName) { - return [ - '$http', '$templateCache', '$q', '$compile', '$parse', - function ($http, $templateCache, $q, $compile, $parse) { - return { - require: '?hljs', - restrict: 'A', - compile: function(tElm, tAttrs, transclude) { - var srcExpr = tAttrs[dirName]; - - return function postLink(scope, iElm, iAttrs, ctrl) { - var changeCounter = 0, compileCheck; - - if (!ctrl) { - return; - } - - if (angular.isDefined(iAttrs.compile)) { - compileCheck = $parse(iAttrs.compile); - } - - scope.$watch(srcExpr, function (src) { - var thisChangeId = ++changeCounter; - - if (src && angular.isString(src)) { - var templateCachePromise, dfd; - - templateCachePromise = $templateCache.get(src); - if (!templateCachePromise) { - dfd = $q.defer(); - $http.get(src, { - cache: $templateCache, - transformResponse: function(data, headersGetter) { - // Return the raw string, so $http doesn't parse it - // if it's json. - return data; - } - }).success(function (code) { - if (thisChangeId !== changeCounter) { - return; - } - dfd.resolve(code); - }).error(function() { - if (thisChangeId === changeCounter) { - ctrl.clear(); - } - dfd.resolve(); - }); - templateCachePromise = dfd.promise; - } - - $q.when(templateCachePromise) - .then(function (code) { - if (!code) { - return; - } - - // $templateCache from $http - if (angular.isArray(code)) { - // 1.1.5 - code = code[1]; - } - else if (angular.isObject(code)) { - // 1.0.7 - code = code.data; - } - - code = code.replace(/^(\r\n|\r|\n)/m, ''); - ctrl.highlight(code); - - // Check if the highlight result needs to be compiled - if (compileCheck && compileCheck(scope)) { - // compile the new DOM and link it to the current scope. - // NOTE: we only compile .childNodes so that - // we don't get into infinite loop compiling ourselves - $compile(iElm.find('code').contents())(scope); - } - }); - } - else { - ctrl.clear(); - } - }); - }; - } - }; - }]; -}; - -/** - * Add directives - */ -ngModule -.directive('hljs', hljsDir) -.directive('language', languageDirFactory('language')) -.directive('source', sourceDirFactory('source')) -.directive('include', includeDirFactory('include')); -})(window, window.angular); \ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/lib/angularjs-dropdown-multiselect-new.js b/src/main/resources/META-INF/resources/designer/lib/angularjs-dropdown-multiselect-new.js deleted file mode 100644 index 6675e495..00000000 --- a/src/main/resources/META-INF/resources/designer/lib/angularjs-dropdown-multiselect-new.js +++ /dev/null @@ -1,296 +0,0 @@ -'use strict'; - -var directiveModule = angular.module('angularjs-dropdown-multiselect-new', ['vs-repeat']); - -directiveModule.directive('ngDropdownMultiselectNew', ['$filter', '$document', '$compile', '$parse', - function ($filter, $document, $compile, $parse) { - - return { - restrict: 'AE', - scope: { - selectedModel: '=', - options: '=', - extraSettings: '=', - events: '=', - searchFilter: '=?', - translationTexts: '=', - groupBy: '@' - }, - template: function (element, attrs) { - var checkboxes = attrs.checkboxes ? true : false; - var groups = attrs.groupBy ? true : false; - - var template = ''; - - element.html(template); - }, - link: function ($scope, $element, $attrs) { - var $dropdownTrigger = $element.children()[0]; - - $scope.toggleDropdown = function () { - $scope.open = !$scope.open; - }; - - $scope.checkboxClick = function ($event, id) { - $scope.setSelectedItem(id); - $event.stopImmediatePropagation(); - }; - - $scope.externalEvents = { - onItemSelect: angular.noop, - onItemDeselect: angular.noop, - onSelectAll: angular.noop, - onDeselectAll: angular.noop, - onInitDone: angular.noop, - onMaxSelectionReached: angular.noop - }; - - $scope.settings = { - dynamicTitle: true, - scrollable: false, - scrollableHeight: '300px', - closeOnBlur: true, - displayProp: 'label', - idProp: 'id', - externalIdProp: 'id', - enableSearch: false, - selectionLimit: 0, - showCheckAll: false, - showUncheckAll: false, - closeOnSelect: false, - buttonClasses: 'btn btn-default', - closeOnDeselect: false, - groupBy: $attrs.groupBy || undefined, - groupByTextProvider: null, - smartButtonMaxItems: 0, - smartButtonTextConverter: angular.noop - }; - - $scope.texts = { - checkAll: 'Check All', - uncheckAll: 'Uncheck All', - selectionCount: 'checked', - selectionOf: '/', - searchPlaceholder: 'Search...', - buttonDefaultText: 'Select', - dynamicButtonTextSuffix: 'checked' - }; - - $scope.searchFilter = $scope.searchFilter || ''; - - if (angular.isDefined($scope.settings.groupBy)) { - $scope.$watch('options', function (newValue) { - if (angular.isDefined(newValue)) { - $scope.orderedItems = $filter('orderBy')(newValue, $scope.settings.groupBy); - } - }); - } - - angular.extend($scope.settings, $scope.extraSettings || []); - angular.extend($scope.externalEvents, $scope.events || []); - angular.extend($scope.texts, $scope.translationTexts); - - $scope.singleSelection = $scope.settings.selectionLimit === 1; - - function getFindObj(id) { - var findObj = {}; - - if ($scope.settings.externalIdProp === '') { - findObj[$scope.settings.idProp] = id; - } else { - findObj[$scope.settings.externalIdProp] = id; - } - - return findObj; - } - - function clearObject(object) { - for (var prop in object) { - delete object[prop]; - } - } - - if ($scope.singleSelection) { - if (angular.isArray($scope.selectedModel) && $scope.selectedModel.length === 0) { - clearObject($scope.selectedModel); - } - } - - if ($scope.settings.closeOnBlur) { - $document.on('click', function (e) { - var target = e.target.parentElement; - var parentFound = false; - - while (angular.isDefined(target) && target !== null && !parentFound) { - if (_.contains(target.className.split(' '), 'multiselect-parent') && !parentFound) { - if(target === $dropdownTrigger) { - parentFound = true; - } - } - target = target.parentElement; - } - - if (!parentFound) { - $scope.$apply(function () { - $scope.open = false; - }); - } - }); - } - - $scope.getGroupTitle = function (groupValue) { - if ($scope.settings.groupByTextProvider !== null) { - return $scope.settings.groupByTextProvider(groupValue); - } - - return groupValue; - }; - - $scope.getButtonText = function () { - if ($scope.settings.dynamicTitle && ($scope.selectedModel.length > 0 || (angular.isObject($scope.selectedModel) && _.keys($scope.selectedModel).length > 0))) { - if ($scope.settings.smartButtonMaxItems > 0) { - var itemsText = []; - - angular.forEach($scope.options, function (optionItem) { - if ($scope.isChecked($scope.getPropertyForObject(optionItem, $scope.settings.idProp))) { - var displayText = $scope.getPropertyForObject(optionItem, $scope.settings.displayProp); - var converterResponse = $scope.settings.smartButtonTextConverter(displayText, optionItem); - - itemsText.push(converterResponse ? converterResponse : displayText); - } - }); - - if ($scope.selectedModel.length > $scope.settings.smartButtonMaxItems) { - itemsText = itemsText.slice(0, $scope.settings.smartButtonMaxItems); - itemsText.push('...'); - } - - return itemsText.join(', '); - } else { - var totalSelected; - - if ($scope.singleSelection) { - totalSelected = ($scope.selectedModel !== null && angular.isDefined($scope.selectedModel[$scope.settings.idProp])) ? 1 : 0; - } else { - totalSelected = angular.isDefined($scope.selectedModel) ? $scope.selectedModel.length : 0; - } - - if (totalSelected === 0) { - return $scope.texts.buttonDefaultText; - } else { - return totalSelected + ' ' + $scope.texts.dynamicButtonTextSuffix; - } - } - } else { - return $scope.texts.buttonDefaultText; - } - }; - - $scope.getPropertyForObject = function (object, property) { - if (angular.isDefined(object) && object.hasOwnProperty(property)) { - return object[property]; - } - - return ''; - }; - - $scope.selectAll = function () { - $scope.deselectAll(false); - $scope.externalEvents.onSelectAll(); - - angular.forEach($scope.options, function (value) { - $scope.setSelectedItem(value[$scope.settings.idProp], true); - }); - }; - - $scope.deselectAll = function (sendEvent) { - sendEvent = sendEvent || true; - - if (sendEvent) { - $scope.externalEvents.onDeselectAll(); - } - - if ($scope.singleSelection) { - clearObject($scope.selectedModel); - } else { - $scope.selectedModel.splice(0, $scope.selectedModel.length); - } - }; - - $scope.setSelectedItem = function (id, dontRemove) { - var findObj = getFindObj(id); - var finalObj = null; - - if ($scope.settings.externalIdProp === '') { - finalObj = _.find($scope.options, findObj); - } else { - finalObj = findObj; - } - - if ($scope.singleSelection) { - clearObject($scope.selectedModel); - angular.extend($scope.selectedModel, finalObj); - $scope.externalEvents.onItemSelect(finalObj); - - return; - } - - dontRemove = dontRemove || false; - - var exists = _.findIndex($scope.selectedModel, findObj) !== -1; - - if (!dontRemove && exists) { - $scope.selectedModel.splice(_.findIndex($scope.selectedModel, findObj), 1); - $scope.externalEvents.onItemDeselect(findObj); - } else if (!exists && ($scope.settings.selectionLimit === 0 || $scope.selectedModel.length < $scope.settings.selectionLimit)) { - $scope.selectedModel.push(finalObj); - $scope.externalEvents.onItemSelect(finalObj); - } - }; - - $scope.isChecked = function (id) { - if ($scope.singleSelection) { - return $scope.selectedModel !== null && angular.isDefined($scope.selectedModel[$scope.settings.idProp]) && $scope.selectedModel[$scope.settings.idProp] === getFindObj(id)[$scope.settings.idProp]; - } - - return _.findIndex($scope.selectedModel, getFindObj(id)) !== -1; - }; - - $scope.externalEvents.onInitDone(); - } - }; -}]); diff --git a/src/main/resources/META-INF/resources/designer/lib/angularjs-dropdown-multiselect-old.js b/src/main/resources/META-INF/resources/designer/lib/angularjs-dropdown-multiselect-old.js deleted file mode 100644 index 7a67bae0..00000000 --- a/src/main/resources/META-INF/resources/designer/lib/angularjs-dropdown-multiselect-old.js +++ /dev/null @@ -1,433 +0,0 @@ -'use strict'; - -var directiveModule = angular.module('angularjs-dropdown-multiselect-old', ['ngRoute', - 'ngResource', - 'hljs', - 'ui.bootstrap', - 'angular-loading-bar', - 'ngAnimate', - 'dialogs.main', - 'ui.grid', - 'ui.grid.resizeColumns', - 'ui.grid.paging', - 'ui.grid.selection', - 'ui.grid.cellNav', - 'ui.grid.pinning', - 'ngSanitize','vs-repeat']); - -directiveModule.directive('ngDropdownMultiselectOld', ['$filter', '$document', '$compile', '$parse','$rootScope', '$resource', '$http','$location', - function ($filter, $document, $compile, $parse, $rootScope, $resource, $http,$location) - { - - //console.log($http); - - return { - restrict: 'AE', - scope: { - selectedModel: '=', - options: '=', - extraSettings: '=', - events: '=', - searchFilter: '=?', - translationTexts: '=', - groupBy: '@' - }, - template: function (element, attrs) - { - var checkboxes = attrs.checkboxes ? true : false; - var groups = attrs.groupBy ? true : false; - - var template = ''; - - element.html(template); - }, - link: function ($scope, $element, $attrs) - { - var $dropdownTrigger = $element.children()[0]; - - - $scope.toggleDropdown = function () { - $scope.open = !$scope.open; - - - - - }; - - $scope.checkboxClick = function ($event, id) { - $scope.setSelectedItem(id); - $event.stopImmediatePropagation(); - }; - - $scope.externalEvents = - { - onItemSelect: angular.noop, - onItemDeselect: angular.noop, - onSelectAll: angular.noop, - onDeselectAll: angular.noop, - onInitDone: angular.noop, - onMaxSelectionReached: angular.noop - }; - - $scope.settings = { - dynamicTitle: true, - scrollable: false, - scrollableHeight: '300px', - closeOnBlur: true, - displayProp: 'id', - idProp: 'id', - externalIdProp: 'id', - enableSearch: false, - selectionLimit: 0, - showCheckAll: true, - showUncheckAll: true, - closeOnSelect: false, - buttonClasses: 'btn btn-default', - closeOnDeselect: false, - groupBy: $attrs.groupBy || undefined, - groupByTextProvider: null, - smartButtonMaxItems: 0, - smartButtonTextConverter: angular.noop - }; - - $scope.texts = { - checkAll: 'Check All', - uncheckAll: 'Uncheck All', - selectionCount: 'checked', - selectionOf: '/', - searchPlaceholder: 'Search...', - buttonDefaultText: 'Select', - dynamicButtonTextSuffix: 'checked' - }; - - $scope.searchFilter = $scope.searchFilter || ''; - - if (angular.isDefined($scope.settings.groupBy)) - { - $scope.$watch('options', function (newValue) - { - if (angular.isDefined(newValue)) - { - $scope.orderedItems = $filter('orderBy')(newValue, $scope.settings.groupBy); - } - }); - } - - angular.extend($scope.settings, $scope.extraSettings || []); - angular.extend($scope.externalEvents, $scope.events || []); - angular.extend($scope.texts, $scope.translationTexts); - - $scope.singleSelection = $scope.settings.selectionLimit === 1; - - function getFindObj(id) - { - var findObj = {}; - - if ($scope.settings.externalIdProp === '') - { - findObj[$scope.settings.idProp] = id; - } - else - { - findObj[$scope.settings.externalIdProp] = id; - } - - return findObj; - } - - function clearObject(object) - { - for (var prop in object) - { - delete object[prop]; - } - } - - if ($scope.singleSelection) - { - if (angular.isArray($scope.selectedModel) && $scope.selectedModel.length === 0) - { - clearObject($scope.selectedModel); - } - } - - if ($scope.settings.closeOnBlur) - { - $document.on('click', function (e) - { - var target = e.target.parentElement; - var parentFound = false; - - while (angular.isDefined(target) && target !== null && !parentFound) - { - try - { - if (_.contains(target.className.split(' '), 'multiselect-parent') && !parentFound) - { - if(target === $dropdownTrigger) - { - parentFound = true; - } - } - - target = target.parentElement; - - }catch(e){break;} - - } - - if (!parentFound) { - $scope.$apply(function () { - $scope.open = false; - }); - } - }); - } - - $scope.getGroupTitle = function (groupValue) { - if ($scope.settings.groupByTextProvider !== null) { - return $scope.settings.groupByTextProvider(groupValue); - } - - return groupValue; - }; - - $scope.getButtonText = function () { - if ($scope.settings.dynamicTitle && ($scope.selectedModel.length > 0 || (angular.isObject($scope.selectedModel) && _.keys($scope.selectedModel).length > 0))) { - if ($scope.settings.smartButtonMaxItems > 0) { - var itemsText = []; - - angular.forEach($scope.options, function (optionItem) { - if ($scope.isChecked($scope.getPropertyForObject(optionItem, $scope.settings.idProp))) { - var displayText = $scope.getPropertyForObject(optionItem, $scope.settings.displayProp); - var converterResponse = $scope.settings.smartButtonTextConverter(displayText, optionItem); - - itemsText.push(converterResponse ? converterResponse : displayText); - } - }); - - if ($scope.selectedModel.length > $scope.settings.smartButtonMaxItems) { - itemsText = itemsText.slice(0, $scope.settings.smartButtonMaxItems); - itemsText.push('...'); - } - - return itemsText.join(', '); - } else { - var totalSelected; - - if ($scope.singleSelection) { - totalSelected = ($scope.selectedModel !== null && angular.isDefined($scope.selectedModel[$scope.settings.idProp])) ? 1 : 0; - } else { - totalSelected = angular.isDefined($scope.selectedModel) ? $scope.selectedModel.length : 0; - } - - if (totalSelected === 0) { - return $scope.texts.buttonDefaultText; - } else { - return totalSelected + ' ' + $scope.texts.dynamicButtonTextSuffix; - } - } - } else { - return $scope.texts.buttonDefaultText; - } - }; - - $scope.getPropertyForObject = function (object, property) - { - if (angular.isDefined(object) && object.hasOwnProperty(property)) { - return object[property]; - } - - return ''; - }; - - $scope.selectAll = function () - { - $scope.deselectAll(false,true); - $scope.externalEvents.onSelectAll(); - - var len = $scope.selectedModel.length; - - angular.forEach($scope.options, function (value) - { - if(value[$scope.settings.idProp]=="All") - { - if(len > 1) - { - $scope.setSelectedItem(value[$scope.settings.idProp], true, true); - } - else - { - $scope.setSelectedItem(value[$scope.settings.idProp], true, true); - } - } - }); - }; - - $scope.deselectAll = function (sendEvent,ignore) - { - var len = $scope.selectedModel.length; - - sendEvent = sendEvent || true; - - if (sendEvent) - { - $scope.externalEvents.onDeselectAll(); - } - - if ($scope.singleSelection) - { - clearObject($scope.selectedModel); - } - else - { - $scope.selectedModel.splice(0, $scope.selectedModel.length); - } - - if(ignore!=true || ignore==undefined) - { - if(len > 1) - { - $scope.setSelectedItem("All", true, true); - } - else - { - $scope.setSelectedItem("All", true, true); - } - } - - - }; - - $scope.setSelectedItem = function (id, dontRemove, refresh) - { - var findObj = getFindObj(id); - var finalObj = null; - - if ($scope.settings.externalIdProp === '') - { - finalObj = _.find($scope.options, findObj); - } - else - { - finalObj = findObj; - } - - - if ($scope.singleSelection) - { - clearObject($scope.selectedModel); - angular.extend($scope.selectedModel, finalObj); - $scope.externalEvents.onItemSelect(finalObj); - - if ($scope.settings.closeOnSelect) $scope.open = false; - - return; - } - - dontRemove = dontRemove || false; - - - var exists = _.findIndex($scope.selectedModel, findObj) !== -1; - - if (!dontRemove && exists) { - $scope.selectedModel.splice(_.findIndex($scope.selectedModel, findObj), 1); - $scope.externalEvents.onItemDeselect(findObj); - } else if (!exists && ($scope.settings.selectionLimit === 0 || $scope.selectedModel.length < $scope.settings.selectionLimit)) { - $scope.selectedModel.push(finalObj); - $scope.externalEvents.onItemSelect(finalObj); - } - - if ($scope.settings.closeOnSelect) $scope.open = false; - - if(refresh || refresh==undefined) - { - if("/dashboard"==$location.path()) - { - $rootScope.ReLoadDashboardComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - } - else if("/api_portfolio"==$location.path()) - { - $rootScope.ReLoadAPIPortfolioComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - } - else if("/project_portfolio"==$location.path()) - { - $rootScope.ReLoadProjectPortFolioComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - } - else if("/installed_bundle_versions"==$location.path()) - { - $rootScope.ReLoadInstalledBundleComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - }else if("/adapter_inventory"==$location.path()) - { - $rootScope.ReLoadAdapterInventoryComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - } - else if("/api_taxonomy"==$location.path()) - { - $rootScope.ReLoadAPITaxonomyComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - }else if("/defects"==$location.path()) - { - $rootScope.ReLoadDefectReportComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - } else if("/environment_configurations"==$location.path()) - { - $rootScope.ReLoadEnvConfigComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - } - else if("/federated_qc_coverage"==$location.path()) { - $rootScope.ReLoadQcCodeCoverageComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - } - - - - - - - } - - }; - - $scope.isChecked = function (id) { - if ($scope.singleSelection) { - return $scope.selectedModel !== null && angular.isDefined($scope.selectedModel[$scope.settings.idProp]) && $scope.selectedModel[$scope.settings.idProp] === getFindObj(id)[$scope.settings.idProp]; - } - - return _.findIndex($scope.selectedModel, getFindObj(id)) !== -1; - }; - - $scope.externalEvents.onInitDone(); - } - }; -}]); diff --git a/src/main/resources/META-INF/resources/designer/lib/angularjs-dropdown-multiselect.js b/src/main/resources/META-INF/resources/designer/lib/angularjs-dropdown-multiselect.js deleted file mode 100644 index 126cc2f6..00000000 --- a/src/main/resources/META-INF/resources/designer/lib/angularjs-dropdown-multiselect.js +++ /dev/null @@ -1,436 +0,0 @@ -'use strict'; - -var directiveModule = angular.module('angularjs-dropdown-multiselect', ['ngRoute', - 'ngResource', - 'hljs', - 'ui.bootstrap', - 'angular-loading-bar', - 'ngAnimate', - 'dialogs.main', - 'ui.grid', - 'ui.grid.resizeColumns', - 'ui.grid.paging', - 'ui.grid.selection', - 'ui.grid.cellNav', - 'ui.grid.pinning', - 'ngSanitize','vs-repeat']); - -directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$compile', '$parse','$rootScope', '$resource', '$http','$location', - function ($filter, $document, $compile, $parse, $rootScope, $resource, $http,$location) - { - - //console.log($http); - - return { - restrict: 'AE', - scope: { - selectedModel: '=', - options: '=', - extraSettings: '=', - events: '=', - searchFilter: '=?', - translationTexts: '=', - groupBy: '@' - }, - template: function (element, attrs) - { - var checkboxes = attrs.checkboxes ? true : false; - var groups = attrs.groupBy ? true : false; - - var template = ''; - - element.html(template); - }, - link: function ($scope, $element, $attrs) - { - var $dropdownTrigger = $element.children()[0]; - - $scope.toggleDropdown = function () { - $scope.open = !$scope.open; - if ($('#left').height()<$('#right').height()){ - $('#left').height($('#right').height()); - } - setTimeout(function(){ $('#left').scrollTop($('#left')[0].scrollHeight); }, 1); - }; - - $scope.checkboxClick = function ($event, id) { - $scope.setSelectedItem(id); - $event.stopImmediatePropagation(); - }; - - $scope.externalEvents = - { - onItemSelect: angular.noop, - onItemDeselect: angular.noop, - onSelectAll: angular.noop, - onDeselectAll: angular.noop, - onInitDone: angular.noop, - onMaxSelectionReached: angular.noop - }; - - $scope.settings = { - dynamicTitle: true, - scrollable: false, - scrollableHeight: '300px', - closeOnBlur: true, - displayProp: 'id', - idProp: 'id', - externalIdProp: 'id', - enableSearch: false, - selectionLimit: 0, - showCheckAll: true, - showUncheckAll: true, - closeOnSelect: false, - buttonClasses: 'btn btn-default', - closeOnDeselect: false, - groupBy: $attrs.groupBy || undefined, - groupByTextProvider: null, - smartButtonMaxItems: 0, - smartButtonTextConverter: angular.noop - }; - - $scope.texts = { - checkAll: 'Check All', - uncheckAll: 'Uncheck All', - selectionCount: 'checked', - selectionOf: '/', - searchPlaceholder: 'Search...', - buttonDefaultText: 'Select', - dynamicButtonTextSuffix: 'checked' - }; - - $scope.searchFilter = $scope.searchFilter || ''; - - if (angular.isDefined($scope.settings.groupBy)) - { - $scope.$watch('options', function (newValue) - { - if (angular.isDefined(newValue)) - { - $scope.orderedItems = $filter('orderBy')(newValue, $scope.settings.groupBy); - } - }); - } - - angular.extend($scope.settings, $scope.extraSettings || []); - angular.extend($scope.externalEvents, $scope.events || []); - angular.extend($scope.texts, $scope.translationTexts); - - $scope.singleSelection = $scope.settings.selectionLimit === 1; - - function getFindObj(id) - { - var findObj = {}; - - if ($scope.settings.externalIdProp === '') - { - findObj[$scope.settings.idProp] = id; - } - else - { - findObj[$scope.settings.externalIdProp] = id; - } - - return findObj; - } - - function clearObject(object) - { - for (var prop in object) - { - delete object[prop]; - } - } - - if ($scope.singleSelection) - { - if (angular.isArray($scope.selectedModel) && $scope.selectedModel.length === 0) - { - clearObject($scope.selectedModel); - } - } - - if ($scope.settings.closeOnBlur) - { - $document.on('click', function (e) - { - var target = e.target.parentElement; - var parentFound = false; - - while (angular.isDefined(target) && target !== null && !parentFound) - { - try - { - if (_.contains(target.className.split(' '), 'multiselect-parent') && !parentFound) - { - if(target === $dropdownTrigger) - { - parentFound = true; - } - } - - target = target.parentElement; - - }catch(e){break;} - - } - - if (!parentFound) { - $scope.$apply(function () { - $scope.open = false; - }); - } - }); - } - - $scope.getGroupTitle = function (groupValue) { - if ($scope.settings.groupByTextProvider !== null) { - return $scope.settings.groupByTextProvider(groupValue); - } - - return groupValue; - }; - - $scope.getButtonText = function () { - if ($scope.settings.dynamicTitle && ($scope.selectedModel.length > 0 || (angular.isObject($scope.selectedModel) && _.keys($scope.selectedModel).length > 0))) { - if ($scope.settings.smartButtonMaxItems > 0) { - var itemsText = []; - - angular.forEach($scope.options, function (optionItem) { - if ($scope.isChecked($scope.getPropertyForObject(optionItem, $scope.settings.idProp))) { - var displayText = $scope.getPropertyForObject(optionItem, $scope.settings.displayProp); - var converterResponse = $scope.settings.smartButtonTextConverter(displayText, optionItem); - - itemsText.push(converterResponse ? converterResponse : displayText); - } - }); - - if ($scope.selectedModel.length > $scope.settings.smartButtonMaxItems) { - itemsText = itemsText.slice(0, $scope.settings.smartButtonMaxItems); - itemsText.push('...'); - } - - return itemsText.join(', '); - } else { - var totalSelected; - - if ($scope.singleSelection) { - totalSelected = ($scope.selectedModel !== null && angular.isDefined($scope.selectedModel[$scope.settings.idProp])) ? 1 : 0; - } else { - totalSelected = angular.isDefined($scope.selectedModel) ? $scope.selectedModel.length : 0; - } - - if (totalSelected === 0) { - return $scope.texts.buttonDefaultText; - } else { - return totalSelected + ' ' + $scope.texts.dynamicButtonTextSuffix; - } - } - } else { - return $scope.texts.buttonDefaultText; - } - }; - - $scope.getPropertyForObject = function (object, property) - { - if (angular.isDefined(object) && object.hasOwnProperty(property)) { - return object[property]; - } - - return ''; - }; - - $scope.selectAll = function () - { - $scope.deselectAll(false,true); - $scope.externalEvents.onSelectAll(); - - var len = $scope.selectedModel.length; - - angular.forEach($scope.options, function (value) - { - if(value[$scope.settings.idProp]=="All") - { - if(len > 1) - { - $scope.setSelectedItem(value[$scope.settings.idProp], true, true); - } - else - { - $scope.setSelectedItem(value[$scope.settings.idProp], true, true); - } - } - }); - }; - - $scope.deselectAll = function (sendEvent,ignore) - { - var len = $scope.selectedModel.length; - - sendEvent = sendEvent || true; - - if (sendEvent) - { - $scope.externalEvents.onDeselectAll(); - } - - if ($scope.singleSelection) - { - clearObject($scope.selectedModel); - } - else - { - $scope.selectedModel.splice(0, $scope.selectedModel.length); - } - - if(ignore!=true || ignore==undefined) - { - if(len > 1) - { - $scope.setSelectedItem("All", true, true); - } - else - { - $scope.setSelectedItem("All", true, true); - } - } - - - }; - - $scope.setSelectedItem = function (id, dontRemove, refresh) - { - var findObj = getFindObj(id); - var finalObj = null; - - if ($scope.settings.externalIdProp === '') - { - finalObj = _.find($scope.options, findObj); - } - else - { - finalObj = findObj; - } - - - if ($scope.singleSelection) - { - clearObject($scope.selectedModel); - angular.extend($scope.selectedModel, finalObj); - $scope.externalEvents.onItemSelect(finalObj); - - if ($scope.settings.closeOnSelect) $scope.open = false; - - return; - } - - dontRemove = dontRemove || false; - - - var exists = _.findIndex($scope.selectedModel, findObj) !== -1; - - if (!dontRemove && exists) { - $scope.selectedModel.splice(_.findIndex($scope.selectedModel, findObj), 1); - $scope.externalEvents.onItemDeselect(findObj); - } else if (!exists && ($scope.settings.selectionLimit === 0 || $scope.selectedModel.length < $scope.settings.selectionLimit)) { - $scope.selectedModel.push(finalObj); - $scope.externalEvents.onItemSelect(finalObj); - } - - if ($scope.settings.closeOnSelect) $scope.open = false; - - if(refresh || refresh==undefined) - { - if("/dashboard"==$location.path()) - { - $rootScope.ReLoadDashboardComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - } - else if("/api_portfolio"==$location.path()) - { - $rootScope.ReLoadAPIPortfolioComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - } - else if("/project_portfolio"==$location.path()) - { - $rootScope.ReLoadProjectPortFolioComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - } - else if("/installed_bundle_versions"==$location.path()) - { - $rootScope.ReLoadInstalledBundleComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - }else if("/adapter_inventory"==$location.path()) - { - $rootScope.ReLoadAdapterInventoryComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - } - else if("/api_taxonomy"==$location.path()) - { - $rootScope.ReLoadAPITaxonomyComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - }else if("/defects"==$location.path()) - { - $rootScope.ReLoadDefectReportComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - } else if("/environment_configurations"==$location.path()) - { - $rootScope.ReLoadEnvConfigComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - } - else if("/qc_coverage_report"==$location.path()) { - $rootScope.ReLoadQcCodeCoverageComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - }else if("/func_test_exec_status"==$location.path()) { - $rootScope.ReLoadFunTestResultComboBox($scope.translationTexts.buttonDefaultText,finalObj.id); - } - else if("/api_schema"==$location.path()) { - - $rootScope.reloadApiSchemaPage($scope.translationTexts.buttonDefaultText,finalObj.id); - } - - - - - - } - - }; - - $scope.isChecked = function (id) { - if ($scope.singleSelection) { - return $scope.selectedModel !== null && angular.isDefined($scope.selectedModel[$scope.settings.idProp]) && $scope.selectedModel[$scope.settings.idProp] === getFindObj(id)[$scope.settings.idProp]; - } - - return _.findIndex($scope.selectedModel, getFindObj(id)) !== -1; - }; - - $scope.externalEvents.onInitDone(); - } - }; -}]); diff --git a/src/main/resources/META-INF/resources/designer/scripts/app.js b/src/main/resources/META-INF/resources/designer/scripts/app.js index 93f94c23..71fd9812 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/app.js +++ b/src/main/resources/META-INF/resources/designer/scripts/app.js @@ -27,9 +27,6 @@ var app = angular.module('clds-app', ['ngRoute', 'ngResource', - 'angularjs-dropdown-multiselect', - 'angularjs-dropdown-multiselect-new', - 'hljs', 'ui.bootstrap', 'angular-loading-bar', 'ngAnimate',