http://git-wip-us.apache.org/repos/asf/ignite/blob/c38b3ba2/modules/web-console/src/main/js/build/system.config.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/build/system.config.js b/modules/web-console/src/main/js/build/system.config.js deleted file mode 100644 index 20af865..0000000 --- a/modules/web-console/src/main/js/build/system.config.js +++ /dev/null @@ -1,424 +0,0 @@ -System.config({ - defaultJSExtensions: true, - transpiler: "babel", - babelOptions: { - "optional": [ - "runtime", - "optimisation.modules.system" - ] - }, - paths: { - "github:*": "build/jspm_packages/github/*", - "npm:*": "build/jspm_packages/npm/*" - }, - separateCSS: true, - - map: { - "ace": "github:ajaxorg/[email protected]", - "angular": "github:angular/[email protected]", - "angular-animate": "github:angular/[email protected]", - "angular-drag-and-drop-lists": "github:marceljuenemann/[email protected]", - "angular-gridster": "github:ManifestWebDesign/[email protected]", - "angular-motion": "github:mgcrea/[email protected]", - "angular-nvd3": "github:krispo/[email protected]", - "angular-retina": "github:jrief/[email protected]", - "angular-sanitize": "github:angular/[email protected]", - "angular-smart-table": "github:lorenzofox3/[email protected]", - "angular-socket-io": "github:btford/[email protected]", - "angular-strap": "github:mgcrea/[email protected]", - "angular-tree-control": "github:wix/[email protected]", - "angular-ui-grid": "github:angular-ui/[email protected]", - "angular-ui-router": "github:angular-ui/[email protected]", - "angular-ui-router-metatags": "github:tinusn/[email protected]", - "babel": "npm:[email protected]", - "babel-runtime": "npm:[email protected]", - "blob": "github:eligrey/Blob.js@master", - "bootstrap-carousel": "github:twbs/[email protected]", - "clean-css": "npm:[email protected]", - "core-js": "npm:[email protected]", - "css": "github:systemjs/[email protected]", - "file-saver": "github:eligrey/FileSaver.js@master", - "font-awesome": "npm:[email protected]", - "jade": "github:johnsoftek/[email protected]", - "jquery": "github:components/[email protected]", - "json": "github:systemjs/[email protected]", - "jszip": "github:Stuk/[email protected]", - "lodash": "github:lodash/[email protected]", - "pdfmake": "github:bpampuch/[email protected]", - "query-command-supported": "github:zenorocha/[email protected]", - "socket.io-client": "github:socketio/[email protected]", - "text": "github:systemjs/[email protected]", - "github:angular-ui/[email protected]": { - "pdfmake": "github:bpampuch/[email protected]" - }, - "github:angular-ui/[email protected]": { - "angular": "github:angular/[email protected]" - }, - "github:angular/[email protected]": { - "angular": "github:angular/[email protected]" - }, - "github:angular/[email protected]": { - "angular": "github:angular/[email protected]" - }, - "github:angular/[email protected]": { - "jquery": "github:components/[email protected]" - }, - "github:btford/[email protected]": { - "socket.io-client": "github:socketio/[email protected]" - }, - "github:eligrey/FileSaver.js@master": { - "blob": "github:eligrey/Blob.js@master" - }, - "github:johnsoftek/[email protected]": { - "jade-compiler": "npm:[email protected]" - }, - "github:jspm/[email protected]": { - "assert": "npm:[email protected]" - }, - "github:jspm/[email protected]": { - "buffer": "npm:[email protected]" - }, - "github:jspm/[email protected]": { - "events": "npm:[email protected]" - }, - "github:jspm/[email protected]": { - "Base64": "npm:[email protected]", - "events": "github:jspm/[email protected]", - "inherits": "npm:[email protected]", - "stream": "github:jspm/[email protected]", - "url": "github:jspm/[email protected]", - "util": "github:jspm/[email protected]" - }, - "github:jspm/[email protected]": { - "https-browserify": "npm:[email protected]" - }, - "github:jspm/[email protected]": { - "os-browserify": "npm:[email protected]" - }, - "github:jspm/[email protected]": { - "path-browserify": "npm:[email protected]" - }, - "github:jspm/[email protected]": { - "process": "npm:[email protected]" - }, - "github:jspm/[email protected]": { - "stream-browserify": "npm:[email protected]" - }, - "github:jspm/[email protected]": { - "tty-browserify": "npm:[email protected]" - }, - "github:jspm/[email protected]": { - "url": "npm:[email protected]" - }, - "github:jspm/[email protected]": { - "util": "npm:[email protected]" - }, - "github:jspm/[email protected]": { - "vm-browserify": "npm:[email protected]" - }, - "github:krispo/[email protected]": { - "d3": "npm:[email protected]", - "nvd3": "npm:[email protected]" - }, - "github:mgcrea/[email protected]": { - "angular": "github:angular/[email protected]", - "css": "github:systemjs/[email protected]" - }, - "github:mgcrea/[email protected]": { - "angular": "github:angular/[email protected]", - "angular-animate": "github:angular/[email protected]", - "angular-motion": "github:mgcrea/[email protected]", - "angular-sanitize": "github:angular/[email protected]" - }, - "github:twbs/[email protected]": { - "jquery": "npm:[email protected]" - }, - "npm:[email protected]": { - "acorn": "npm:[email protected]" - }, - "npm:[email protected]": { - "fs": "github:jspm/[email protected]", - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]", - "stream": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "fs": "github:jspm/[email protected]", - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]", - "stream": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "kind-of": "npm:[email protected]", - "longest": "npm:[email protected]", - "repeat-string": "npm:[email protected]" - }, - "npm:[email protected]": { - "fs": "github:jspm/[email protected]", - "module": "github:jspm/[email protected]", - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "assert": "github:jspm/[email protected]", - "buffer": "github:jspm/[email protected]", - "buffer-shims": "npm:[email protected]", - "process": "github:jspm/[email protected]", - "util": "npm:[email protected]" - }, - "npm:[email protected]": { - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "buffer": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "base64-js": "npm:[email protected]", - "child_process": "github:jspm/[email protected]", - "fs": "github:jspm/[email protected]", - "ieee754": "npm:[email protected]", - "isarray": "npm:[email protected]", - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "align-text": "npm:[email protected]", - "lazy-cache": "npm:[email protected]" - }, - "npm:[email protected]": { - "buffer": "github:jspm/[email protected]", - "commander": "npm:[email protected]", - "fs": "github:jspm/[email protected]", - "http": "github:jspm/[email protected]", - "https": "github:jspm/[email protected]", - "os": "github:jspm/[email protected]", - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]", - "source-map": "npm:[email protected]", - "url": "github:jspm/[email protected]", - "util": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "center-align": "npm:[email protected]", - "right-align": "npm:[email protected]", - "wordwrap": "npm:[email protected]" - }, - "npm:[email protected]": { - "child_process": "github:jspm/[email protected]", - "events": "github:jspm/[email protected]", - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "child_process": "github:jspm/[email protected]", - "events": "github:jspm/[email protected]", - "fs": "github:jspm/[email protected]", - "graceful-readlink": "npm:[email protected]", - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "acorn": "npm:[email protected]" - }, - "npm:[email protected]": { - "fs": "github:jspm/[email protected]", - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]", - "systemjs-json": "github:systemjs/[email protected]" - }, - "npm:[email protected]": { - "buffer": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "assert": "github:jspm/[email protected]", - "css-parse": "npm:[email protected]", - "css-stringify": "npm:[email protected]", - "fs": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "css": "github:systemjs/[email protected]" - }, - "npm:[email protected]": { - "fs": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "http": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "util": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "buffer": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "systemjs-json": "github:systemjs/[email protected]" - }, - "npm:[email protected]": { - "buffer": "github:jspm/[email protected]", - "character-parser": "npm:[email protected]", - "clean-css": "npm:[email protected]", - "commander": "npm:[email protected]", - "constantinople": "npm:[email protected]", - "jstransformer": "npm:[email protected]", - "mkdirp": "npm:[email protected]", - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]", - "systemjs-json": "github:systemjs/[email protected]", - "transformers": "npm:[email protected]", - "uglify-js": "npm:[email protected]", - "void-elements": "npm:[email protected]", - "with": "npm:[email protected]" - }, - "npm:[email protected]": { - "assert": "github:jspm/[email protected]", - "fs": "github:jspm/[email protected]", - "is-promise": "npm:[email protected]", - "promise": "npm:[email protected]" - }, - "npm:[email protected]": { - "buffer": "github:jspm/[email protected]", - "is-buffer": "npm:[email protected]" - }, - "npm:[email protected]": { - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "fs": "github:jspm/[email protected]", - "minimist": "npm:[email protected]", - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "d3": "npm:[email protected]" - }, - "npm:[email protected]": { - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]", - "wordwrap": "npm:[email protected]" - }, - "npm:[email protected]": { - "os": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "assert": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "is-promise": "npm:[email protected]", - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "asap": "npm:[email protected]" - }, - "npm:[email protected]": { - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "buffer": "github:jspm/[email protected]", - "core-util-is": "npm:[email protected]", - "events": "github:jspm/[email protected]", - "inherits": "npm:[email protected]", - "isarray": "npm:[email protected]", - "process": "github:jspm/[email protected]", - "stream-browserify": "npm:[email protected]", - "string_decoder": "npm:[email protected]" - }, - "npm:[email protected]": { - "align-text": "npm:[email protected]" - }, - "npm:[email protected]": { - "amdefine": "npm:[email protected]", - "fs": "github:jspm/[email protected]", - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "amdefine": "npm:[email protected]", - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "events": "github:jspm/[email protected]", - "inherits": "npm:[email protected]", - "readable-stream": "npm:[email protected]" - }, - "npm:[email protected]": { - "buffer": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "css": "npm:[email protected]", - "fs": "github:jspm/[email protected]", - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]", - "promise": "npm:[email protected]", - "uglify-js": "npm:[email protected]", - "vm": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "fs": "github:jspm/[email protected]", - "optimist": "npm:[email protected]", - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]", - "source-map": "npm:[email protected]", - "util": "github:jspm/[email protected]", - "vm": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "async": "npm:[email protected]", - "fs": "github:jspm/[email protected]", - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]", - "source-map": "npm:[email protected]", - "uglify-to-browserify": "npm:[email protected]", - "yargs": "npm:[email protected]" - }, - "npm:[email protected]": { - "fs": "github:jspm/[email protected]", - "stream": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "assert": "github:jspm/[email protected]", - "punycode": "npm:[email protected]", - "querystring": "npm:[email protected]", - "util": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "inherits": "npm:[email protected]", - "process": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "indexof": "npm:[email protected]" - }, - "npm:[email protected]": { - "http": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "process": "github:jspm/[email protected]", - "tty": "github:jspm/[email protected]" - }, - "npm:[email protected]": { - "acorn": "npm:[email protected]", - "acorn-globals": "npm:[email protected]" - }, - "npm:[email protected]": { - "assert": "github:jspm/[email protected]", - "camelcase": "npm:[email protected]", - "cliui": "npm:[email protected]", - "decamelize": "npm:[email protected]", - "fs": "github:jspm/[email protected]", - "path": "github:jspm/[email protected]", - "process": "github:jspm/[email protected]", - "window-size": "npm:[email protected]" - } - } -});
http://git-wip-us.apache.org/repos/asf/ignite/blob/c38b3ba2/modules/web-console/src/main/js/controllers/admin-controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/controllers/admin-controller.js b/modules/web-console/src/main/js/controllers/admin-controller.js index f46bab0..9e5aea7 100644 --- a/modules/web-console/src/main/js/controllers/admin-controller.js +++ b/modules/web-console/src/main/js/controllers/admin-controller.js @@ -16,11 +16,9 @@ */ // Controller for Admin screen. -import consoleModule from 'controllers/common-module'; - -consoleModule.controller('adminController', [ - '$rootScope', '$scope', '$http', '$q', '$common', '$confirm', '$state', 'User', 'IgniteCountries', - ($rootScope, $scope, $http, $q, $common, $confirm, $state, User, Countries) => { +export default ['adminController', [ + '$rootScope', '$scope', '$http', '$q', '$state', 'IgniteMessages', 'IgniteConfirm', 'User', 'IgniteCountries', + ($rootScope, $scope, $http, $q, $state, Messages, Confirm, User, Countries) => { $scope.users = null; const _reloadUsers = () => { @@ -35,7 +33,7 @@ consoleModule.controller('adminController', [ (user.company || '') + ' ' + (user.countryCode || ''); }); }) - .catch((err) => $common.showError(err)); + .catch(Messages.showError); }; _reloadUsers(); @@ -48,11 +46,11 @@ consoleModule.controller('adminController', [ $state.go('base.configuration.clusters'); }) - .catch((errMsg) => $common.showError($common.errorMessage(errMsg))); + .catch(Messages.showError); }; $scope.removeUser = (user) => { - $confirm.confirm('Are you sure you want to remove user: "' + user.userName + '"?') + Confirm.confirm('Are you sure you want to remove user: "' + user.userName + '"?') .then(() => { $http.post('/api/v1/admin/remove', {userId: user._id}) .success(() => { @@ -61,13 +59,13 @@ consoleModule.controller('adminController', [ if (i >= 0) $scope.users.splice(i, 1); - $common.showInfo('User has been removed: "' + user.userName + '"'); + Messages.showInfo('User has been removed: "' + user.userName + '"'); }) - .error((errMsg, status) => { + .error((err, status) => { if (status === 503) - $common.showInfo(errMsg); + Messages.showInfo(err); else - $common.showError('Failed to remove user: "' + $common.errorMessage(errMsg) + '"'); + Messages.showError(Messages.errorMessage('Failed to remove user: ', err)); }); }); }; @@ -82,11 +80,12 @@ consoleModule.controller('adminController', [ .success(() => { user.admin = !user.admin; - $common.showInfo('Admin right was successfully toggled for user: "' + user.userName + '"'); - }).error((err) => { - $common.showError('Failed to toggle admin right for user: "' + $common.errorMessage(err) + '"'); + Messages.showInfo('Admin right was successfully toggled for user: "' + user.userName + '"'); + }) + .error((err) => { + Messages.showError(Messages.errorMessage('Failed to toggle admin right for user: ', err)); }) .finally(() => user.adminChanging = false); }; - }] -); + } +]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/c38b3ba2/modules/web-console/src/main/js/controllers/caches-controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/controllers/caches-controller.js b/modules/web-console/src/main/js/controllers/caches-controller.js index ac4d951..cbd681e 100644 --- a/modules/web-console/src/main/js/controllers/caches-controller.js +++ b/modules/web-console/src/main/js/controllers/caches-controller.js @@ -16,12 +16,10 @@ */ // Controller for Caches screen. -import consoleModule from 'controllers/common-module'; - -consoleModule.controller('cachesController', [ - '$scope', '$http', '$state', '$filter', '$timeout', '$common', '$confirm', '$clone', '$loading', '$cleanup', '$unsavedChangesGuard', - function($scope, $http, $state, $filter, $timeout, $common, $confirm, $clone, $loading, $cleanup, $unsavedChangesGuard) { - $unsavedChangesGuard.install($scope); +export default ['cachesController', [ + '$scope', '$http', '$state', '$filter', '$timeout', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteClone', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', + function($scope, $http, $state, $filter, $timeout, LegacyUtils, Messages, Confirm, Clone, Loading, ModelNormalizer, UnsavedChangesGuard) { + UnsavedChangesGuard.install($scope); const emptyCache = {empty: true}; @@ -36,15 +34,15 @@ consoleModule.controller('cachesController', [ // We need to initialize backupItem with empty object in order to properly used from angular directives. $scope.backupItem = emptyCache; - $scope.ui = $common.formUI(); + $scope.ui = LegacyUtils.formUI(); $scope.ui.activePanels = [0]; $scope.ui.topPanels = [0, 1, 2, 3]; - $scope.hidePopover = $common.hidePopover; - $scope.saveBtnTipText = $common.saveBtnTipText; - $scope.widthIsSufficient = $common.widthIsSufficient; + $scope.hidePopover = LegacyUtils.hidePopover; + $scope.saveBtnTipText = LegacyUtils.saveBtnTipText; + $scope.widthIsSufficient = LegacyUtils.widthIsSufficient; - const showPopoverMessage = $common.showPopoverMessage; + const showPopoverMessage = LegacyUtils.showPopoverMessage; $scope.contentVisible = function() { const item = $scope.backupItem; @@ -55,7 +53,7 @@ consoleModule.controller('cachesController', [ $scope.toggleExpanded = function() { $scope.ui.expanded = !$scope.ui.expanded; - $common.hidePopover(); + LegacyUtils.hidePopover(); }; $scope.caches = []; @@ -79,7 +77,7 @@ consoleModule.controller('cachesController', [ }, []); } - $loading.start('loadingCachesScreen'); + Loading.start('loadingCachesScreen'); // When landing on the page, get caches and show them. $http.post('/api/v1/configuration/caches/list') @@ -131,32 +129,33 @@ consoleModule.controller('cachesController', [ } $scope.$watch('ui.inputForm.$valid', function(valid) { - if (valid && _.isEqual(__original_value, $cleanup($scope.backupItem))) + if (valid && ModelNormalizer.isEqual(__original_value, $scope.backupItem)) $scope.ui.inputForm.$dirty = false; }); $scope.$watch('backupItem', function(val) { const form = $scope.ui.inputForm; - if (form.$pristine || (form.$valid && _.isEqual(__original_value, $cleanup(val)))) + if (form.$pristine || (form.$valid && ModelNormalizer.isEqual(__original_value, val))) form.$setPristine(); else form.$setDirty(); }, true); }) - .catch(function(errMsg) { - $common.showError(errMsg); - }) + .catch(Messages.showError) .finally(function() { $scope.ui.ready = true; $scope.ui.inputForm.$setPristine(); - $loading.finish('loadingCachesScreen'); + Loading.finish('loadingCachesScreen'); }); $scope.selectItem = function(item, backup) { function selectItem() { $scope.selectedItem = item; + if (item && !_.get(item.cacheStoreFactory.CacheJdbcBlobStoreFactory, 'connectVia')) + _.set(item.cacheStoreFactory, 'CacheJdbcBlobStoreFactory.connectVia', 'DataSource'); + try { if (item && item._id) sessionStorage.lastSelectedCache = angular.toJson(item._id); @@ -176,13 +175,13 @@ consoleModule.controller('cachesController', [ $scope.backupItem = angular.merge({}, blank, $scope.backupItem); - __original_value = $cleanup($scope.backupItem); + __original_value = ModelNormalizer.normalize($scope.backupItem); - if ($common.getQueryVariable('new')) + if (LegacyUtils.getQueryVariable('new')) $state.go('base.configuration.caches'); } - $common.confirmUnsavedChanges($scope.backupItem && $scope.ui.inputForm.$dirty, selectItem); + LegacyUtils.confirmUnsavedChanges($scope.backupItem && $scope.ui.inputForm.$dirty, selectItem); }; $scope.linkId = () => $scope.backupItem._id ? $scope.backupItem._id : 'create'; @@ -203,7 +202,7 @@ consoleModule.controller('cachesController', [ // Add new cache. $scope.createItem = function(linkId) { - $timeout(() => $common.ensureActivePanel($scope.ui, 'general', 'cacheName')); + $timeout(() => LegacyUtils.ensureActivePanel($scope.ui, 'general', 'cacheName')); $scope.selectItem(null, prepareNewItem(linkId)); }; @@ -229,7 +228,7 @@ consoleModule.controller('cachesController', [ const failCluster = _.find(clusters, (cluster) => { const caches = clusterCaches(cluster); - checkRes = $common.checkCachesDataSources(caches, $scope.backupItem); + checkRes = LegacyUtils.checkCachesDataSources(caches, $scope.backupItem); return !checkRes.checked; }); @@ -238,8 +237,8 @@ consoleModule.controller('cachesController', [ return showPopoverMessage($scope.ui, 'store', checkRes.firstCache.cacheStoreFactory.kind === 'CacheJdbcPojoStoreFactory' ? 'pojoDialect' : 'blobDialect', 'Found cache "' + checkRes.secondCache.name + '" in cluster "' + failCluster.label + '" ' + 'with the same data source bean name "' + checkRes.firstCache.cacheStoreFactory[checkRes.firstCache.cacheStoreFactory.kind].dataSourceBean + - '" and different database: "' + $common.cacheStoreJdbcDialectsLabel(checkRes.firstDB) + '" in current cache and "' + - $common.cacheStoreJdbcDialectsLabel(checkRes.secondDB) + '" in "' + checkRes.secondCache.name + '"', 10000); + '" and different database: "' + LegacyUtils.cacheStoreJdbcDialectsLabel(checkRes.firstDB) + '" in current cache and "' + + LegacyUtils.cacheStoreJdbcDialectsLabel(checkRes.secondDB) + '" in "' + checkRes.secondCache.name + '"', 10000); } return true; @@ -253,7 +252,7 @@ consoleModule.controller('cachesController', [ const failCluster = _.find(clusters, (cluster) => { const caches = clusterCaches(cluster); - checkRes = $common.checkCacheSQLSchemas(caches, $scope.backupItem); + checkRes = LegacyUtils.checkCacheSQLSchemas(caches, $scope.backupItem); return !checkRes.checked; }); @@ -268,7 +267,7 @@ consoleModule.controller('cachesController', [ } function checkStoreFactoryBean(storeFactory, beanFieldId) { - if (!$common.isValidJavaIdentifier('Data source bean', storeFactory.dataSourceBean, beanFieldId, $scope.ui, 'store')) + if (!LegacyUtils.isValidJavaIdentifier('Data source bean', storeFactory.dataSourceBean, beanFieldId, $scope.ui, 'store')) return false; return checkDataSources(); @@ -302,21 +301,21 @@ consoleModule.controller('cachesController', [ // Check cache logical consistency. function validate(item) { - $common.hidePopover(); + LegacyUtils.hidePopover(); - if ($common.isEmptyString(item.name)) + if (LegacyUtils.isEmptyString(item.name)) return showPopoverMessage($scope.ui, 'general', 'cacheName', 'Cache name should not be empty!'); - if (item.memoryMode === 'ONHEAP_TIERED' && item.offHeapMaxMemory > 0 && !$common.isDefined(item.evictionPolicy.kind)) + if (item.memoryMode === 'ONHEAP_TIERED' && item.offHeapMaxMemory > 0 && !LegacyUtils.isDefined(item.evictionPolicy.kind)) return showPopoverMessage($scope.ui, 'memory', 'evictionPolicyKind', 'Eviction policy should not be configured!'); - if (!$common.checkFieldValidators($scope.ui)) + if (!LegacyUtils.checkFieldValidators($scope.ui)) return false; if (item.memoryMode === 'OFFHEAP_VALUES' && !_.isEmpty(item.domains)) return showPopoverMessage($scope.ui, 'memory', 'memoryMode', 'Query indexing could not be enabled while values are stored off-heap!'); - if (item.memoryMode === 'OFFHEAP_TIERED' && (!$common.isDefined(item.offHeapMaxMemory) || item.offHeapMaxMemory < 0)) + if (item.memoryMode === 'OFFHEAP_TIERED' && (!LegacyUtils.isDefined(item.offHeapMaxMemory) || item.offHeapMaxMemory < 0)) return showPopoverMessage($scope.ui, 'memory', 'offHeapMaxMemory', 'Off-heap max memory should be specified!'); if (!checkSQLSchemas()) @@ -366,18 +365,16 @@ consoleModule.controller('cachesController', [ $scope.selectItem(item); - $common.showInfo('Cache "' + item.name + '" saved.'); + Messages.showInfo('Cache "' + item.name + '" saved.'); }) - .error(function(errMsg) { - $common.showError(errMsg); - }); + .error(Messages.showError); } // Save cache. $scope.saveItem = function() { const item = $scope.backupItem; - angular.extend(item, $common.autoCacheStoreConfiguration(item, cacheDomains(item))); + angular.extend(item, LegacyUtils.autoCacheStoreConfiguration(item, cacheDomains(item))); if (validate(item)) save(item); @@ -392,7 +389,7 @@ consoleModule.controller('cachesController', [ // Clone cache with new name. $scope.cloneItem = function() { if (validate($scope.backupItem)) { - $clone.confirm($scope.backupItem.name, _cacheNames()).then(function(newName) { + Clone.confirm($scope.backupItem.name, _cacheNames()).then(function(newName) { const item = angular.copy($scope.backupItem); delete item._id; @@ -410,13 +407,13 @@ consoleModule.controller('cachesController', [ $scope.removeItem = function() { const selectedItem = $scope.selectedItem; - $confirm.confirm('Are you sure you want to remove cache: "' + selectedItem.name + '"?') + Confirm.confirm('Are you sure you want to remove cache: "' + selectedItem.name + '"?') .then(function() { const _id = selectedItem._id; $http.post('/api/v1/configuration/caches/remove', {_id}) .success(function() { - $common.showInfo('Cache has been removed: ' + selectedItem.name); + Messages.showInfo('Cache has been removed: ' + selectedItem.name); const caches = $scope.caches; @@ -438,19 +435,17 @@ consoleModule.controller('cachesController', [ _.forEach($scope.domains, (domain) => _.remove(domain.meta.caches, (id) => id === _id)); } }) - .error(function(errMsg) { - $common.showError(errMsg); - }); + .error(Messages.showError); }); }; // Remove all caches from db. $scope.removeAllItems = function() { - $confirm.confirm('Are you sure you want to remove all caches?') + Confirm.confirm('Are you sure you want to remove all caches?') .then(function() { $http.post('/api/v1/configuration/caches/remove/all') .success(function() { - $common.showInfo('All caches have been removed'); + Messages.showInfo('All caches have been removed'); $scope.caches = []; @@ -460,18 +455,16 @@ consoleModule.controller('cachesController', [ $scope.backupItem = emptyCache; $scope.ui.inputForm.$setPristine(); }) - .error(function(errMsg) { - $common.showError(errMsg); - }); + .error(Messages.showError); }); }; $scope.resetAll = function() { - $confirm.confirm('Are you sure you want to undo all changes for current cache?') + Confirm.confirm('Are you sure you want to undo all changes for current cache?') .then(function() { $scope.backupItem = $scope.selectedItem ? angular.copy($scope.selectedItem) : prepareNewItem(); $scope.ui.inputForm.$setPristine(); }); }; - }] -); + } +]]; http://git-wip-us.apache.org/repos/asf/ignite/blob/c38b3ba2/modules/web-console/src/main/js/controllers/clusters-controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/src/main/js/controllers/clusters-controller.js b/modules/web-console/src/main/js/controllers/clusters-controller.js index 3277397..5f86d08 100644 --- a/modules/web-console/src/main/js/controllers/clusters-controller.js +++ b/modules/web-console/src/main/js/controllers/clusters-controller.js @@ -16,12 +16,10 @@ */ // Controller for Clusters screen. -import consoleModule from 'controllers/common-module'; - -consoleModule.controller('clustersController', [ - '$rootScope', '$scope', '$http', '$state', '$timeout', '$common', '$confirm', '$clone', '$loading', '$cleanup', '$unsavedChangesGuard', 'igniteEventGroups', 'DemoInfo', '$table', - function($root, $scope, $http, $state, $timeout, $common, $confirm, $clone, $loading, $cleanup, $unsavedChangesGuard, igniteEventGroups, DemoInfo, $table) { - $unsavedChangesGuard.install($scope); +export default ['clustersController', [ + '$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteClone', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'igniteEventGroups', 'DemoInfo', 'IgniteLegacyTable', + function($root, $scope, $http, $state, $timeout, LegacyUtils, Messages, Confirm, Clone, Loading, ModelNormalizer, UnsavedChangesGuard, igniteEventGroups, DemoInfo, LegacyTable) { + UnsavedChangesGuard.install($scope); const emptyCluster = {empty: true}; @@ -45,24 +43,24 @@ consoleModule.controller('clustersController', [ 'collision.JobStealing.stealingAttributes': {id: 'CAttribute', idPrefix: 'Key', searchCol: 'name', valueCol: 'key', dupObjName: 'name', group: 'collision'} }; - const showPopoverMessage = $common.showPopoverMessage; + const showPopoverMessage = LegacyUtils.showPopoverMessage; $scope.tablePairValid = function(item, field, index) { const pairField = pairFields[field.model]; - const pairValue = $table.tablePairValue(field, index); + const pairValue = LegacyTable.tablePairValue(field, index); if (pairField) { const model = _.get(item, field.model); - if ($common.isDefined(model)) { + if (LegacyUtils.isDefined(model)) { const idx = _.findIndex(model, (pair) => { return pair[pairField.searchCol] === pairValue[pairField.valueCol]; }); // Found duplicate by key. if (idx >= 0 && idx !== index) - return showPopoverMessage($scope.ui, pairField.group, $table.tableFieldId(index, pairField.idPrefix + pairField.id), 'Attribute with such ' + pairField.dupObjName + ' already exists!'); + return showPopoverMessage($scope.ui, pairField.group, LegacyTable.tableFieldId(index, pairField.idPrefix + pairField.id), 'Attribute with such ' + pairField.dupObjName + ' already exists!'); } } @@ -70,19 +68,19 @@ consoleModule.controller('clustersController', [ }; $scope.tableSave = function(field, index, stopEdit) { - if ($table.tablePairSaveVisible(field, index)) - return $table.tablePairSave($scope.tablePairValid, $scope.backupItem, field, index, stopEdit); + if (LegacyTable.tablePairSaveVisible(field, index)) + return LegacyTable.tablePairSave($scope.tablePairValid, $scope.backupItem, field, index, stopEdit); return true; }; $scope.tableReset = (trySave) => { - const field = $table.tableField(); + const field = LegacyTable.tableField(); - if (trySave && $common.isDefined(field) && !$scope.tableSave(field, $table.tableEditedRowIndex(), true)) + if (trySave && LegacyUtils.isDefined(field) && !$scope.tableSave(field, LegacyTable.tableEditedRowIndex(), true)) return false; - $table.tableReset(); + LegacyTable.tableReset(); return true; }; @@ -90,32 +88,32 @@ consoleModule.controller('clustersController', [ $scope.tableNewItem = function(field) { if ($scope.tableReset(true)) { if (field.type === 'failoverSpi') { - if ($common.isDefined($scope.backupItem.failoverSpi)) + if (LegacyUtils.isDefined($scope.backupItem.failoverSpi)) $scope.backupItem.failoverSpi.push({}); else $scope.backupItem.failoverSpi = {}; } else - $table.tableNewItem(field); + LegacyTable.tableNewItem(field); } }; - $scope.tableNewItemActive = $table.tableNewItemActive; + $scope.tableNewItemActive = LegacyTable.tableNewItemActive; $scope.tableStartEdit = function(item, field, index) { if ($scope.tableReset(true)) - $table.tableStartEdit(item, field, index, $scope.tableSave); + LegacyTable.tableStartEdit(item, field, index, $scope.tableSave); }; - $scope.tableEditing = $table.tableEditing; + $scope.tableEditing = LegacyTable.tableEditing; $scope.tableRemove = function(item, field, index) { if ($scope.tableReset(true)) - $table.tableRemove(item, field, index); + LegacyTable.tableRemove(item, field, index); }; - $scope.tablePairSave = $table.tablePairSave; - $scope.tablePairSaveVisible = $table.tablePairSaveVisible; + $scope.tablePairSave = LegacyTable.tablePairSave; + $scope.tablePairSaveVisible = LegacyTable.tablePairSaveVisible; $scope.attributesTbl = { type: 'attributes', @@ -144,13 +142,13 @@ consoleModule.controller('clustersController', [ // We need to initialize backupItem with empty object in order to properly used from angular directives. $scope.backupItem = emptyCluster; - $scope.ui = $common.formUI(); + $scope.ui = LegacyUtils.formUI(); $scope.ui.activePanels = [0]; $scope.ui.topPanels = [0]; - $scope.hidePopover = $common.hidePopover; - $scope.saveBtnTipText = $common.saveBtnTipText; - $scope.widthIsSufficient = $common.widthIsSufficient; + $scope.hidePopover = LegacyUtils.hidePopover; + $scope.saveBtnTipText = LegacyUtils.saveBtnTipText; + $scope.widthIsSufficient = LegacyUtils.widthIsSufficient; $scope.contentVisible = function() { const item = $scope.backupItem; @@ -161,7 +159,7 @@ consoleModule.controller('clustersController', [ $scope.toggleExpanded = function() { $scope.ui.expanded = !$scope.ui.expanded; - $common.hidePopover(); + LegacyUtils.hidePopover(); }; $scope.discoveries = [ @@ -193,7 +191,7 @@ consoleModule.controller('clustersController', [ $scope.selectItem($scope.clusters[0]); } - $loading.start('loadingClustersScreen'); + Loading.start('loadingClustersScreen'); // When landing on the page, get clusters and show them. $http.post('/api/v1/configuration/clusters/list') @@ -237,14 +235,14 @@ consoleModule.controller('clustersController', [ } $scope.$watch('ui.inputForm.$valid', function(valid) { - if (valid && _.isEqual(__original_value, $cleanup($scope.backupItem))) + if (valid && ModelNormalizer.isEqual(__original_value, $scope.backupItem)) $scope.ui.inputForm.$dirty = false; }); $scope.$watch('backupItem', function(val) { const form = $scope.ui.inputForm; - if (form.$pristine || (form.$valid && _.isEqual(__original_value, $cleanup(val)))) + if (form.$pristine || (form.$valid && ModelNormalizer.isEqual(__original_value, val))) form.$setPristine(); else form.$setDirty(); @@ -256,13 +254,11 @@ consoleModule.controller('clustersController', [ DemoInfo.show(); } }) - .catch(function(errMsg) { - $common.showError(errMsg); - }) + .catch(Messages.showError) .finally(function() { $scope.ui.ready = true; $scope.ui.inputForm.$setPristine(); - $loading.finish('loadingClustersScreen'); + Loading.finish('loadingClustersScreen'); }); $scope.selectItem = function(item, backup) { @@ -288,13 +284,13 @@ consoleModule.controller('clustersController', [ $scope.backupItem = angular.merge({}, blank, $scope.backupItem); - __original_value = $cleanup($scope.backupItem); + __original_value = ModelNormalizer.normalize($scope.backupItem); - if ($common.getQueryVariable('new')) + if (LegacyUtils.getQueryVariable('new')) $state.go('base.configuration.clusters'); } - $common.confirmUnsavedChanges($scope.backupItem && $scope.ui.inputForm.$dirty, selectItem); + LegacyUtils.confirmUnsavedChanges($scope.backupItem && $scope.ui.inputForm.$dirty, selectItem); }; $scope.linkId = () => $scope.backupItem._id ? $scope.backupItem._id : 'create'; @@ -316,7 +312,7 @@ consoleModule.controller('clustersController', [ // Add new cluster. $scope.createItem = function(linkId) { - $timeout(() => $common.ensureActivePanel($scope.ui, 'general', 'clusterName')); + $timeout(() => LegacyUtils.ensureActivePanel($scope.ui, 'general', 'clusterName')); $scope.selectItem(null, prepareNewItem(linkId)); }; @@ -333,14 +329,14 @@ consoleModule.controller('clustersController', [ function checkCacheDatasources(item) { const caches = clusterCaches(item); - const checkRes = $common.checkCachesDataSources(caches); + const checkRes = LegacyUtils.checkCachesDataSources(caches); if (!checkRes.checked) { return showPopoverMessage($scope.ui, 'general', 'caches', 'Found caches "' + checkRes.firstCache.name + '" and "' + checkRes.secondCache.name + '" ' + 'with the same data source bean name "' + checkRes.firstCache.cacheStoreFactory[checkRes.firstCache.cacheStoreFactory.kind].dataSourceBean + - '" and different databases: "' + $common.cacheStoreJdbcDialectsLabel(checkRes.firstDB) + '" in "' + checkRes.firstCache.name + '" and "' + - $common.cacheStoreJdbcDialectsLabel(checkRes.secondDB) + '" in "' + checkRes.secondCache.name + '"', 10000); + '" and different databases: "' + LegacyUtils.cacheStoreJdbcDialectsLabel(checkRes.firstDB) + '" in "' + checkRes.firstCache.name + '" and "' + + LegacyUtils.cacheStoreJdbcDialectsLabel(checkRes.secondDB) + '" in "' + checkRes.secondCache.name + '"', 10000); } return true; @@ -349,7 +345,7 @@ consoleModule.controller('clustersController', [ function checkCacheSQLSchemas(item) { const caches = clusterCaches(item); - const checkRes = $common.checkCacheSQLSchemas(caches); + const checkRes = LegacyUtils.checkCacheSQLSchemas(caches); if (!checkRes.checked) { return showPopoverMessage($scope.ui, 'general', 'caches', @@ -363,12 +359,12 @@ consoleModule.controller('clustersController', [ function checkBinaryConfiguration(item) { const b = item.binaryConfiguration; - if ($common.isDefined(b)) { + if (LegacyUtils.isDefined(b)) { if (!_.isEmpty(b.typeConfigurations)) { for (let typeIx = 0; typeIx < b.typeConfigurations.length; typeIx++) { const type = b.typeConfigurations[typeIx]; - if ($common.isEmptyString(type.typeName)) + if (LegacyUtils.isEmptyString(type.typeName)) return showPopoverMessage($scope.ui, 'binary', 'typeName' + typeIx, 'Type name should be specified!'); if (_.find(b.typeConfigurations, (t, ix) => ix < typeIx && t.typeName === type.typeName)) @@ -383,12 +379,12 @@ consoleModule.controller('clustersController', [ function checkCommunicationConfiguration(item) { const c = item.communication; - if ($common.isDefined(c)) { - if ($common.isDefined(c.unacknowledgedMessagesBufferSize)) { - if ($common.isDefined(c.messageQueueLimit) && c.unacknowledgedMessagesBufferSize < 5 * c.messageQueueLimit) + if (LegacyUtils.isDefined(c)) { + if (LegacyUtils.isDefined(c.unacknowledgedMessagesBufferSize)) { + if (LegacyUtils.isDefined(c.messageQueueLimit) && c.unacknowledgedMessagesBufferSize < 5 * c.messageQueueLimit) return showPopoverMessage($scope.ui, 'communication', 'unacknowledgedMessagesBufferSize', 'Maximum number of stored unacknowledged messages should be at least 5 * message queue limit!'); - if ($common.isDefined(c.ackSendThreshold) && c.unacknowledgedMessagesBufferSize < 5 * c.ackSendThreshold) + if (LegacyUtils.isDefined(c.ackSendThreshold) && c.unacknowledgedMessagesBufferSize < 5 * c.ackSendThreshold) return showPopoverMessage($scope.ui, 'communication', 'unacknowledgedMessagesBufferSize', 'Maximum number of stored unacknowledged messages should be at least 5 * ack send threshold!'); } @@ -421,7 +417,7 @@ consoleModule.controller('clustersController', [ const sparsity = swap.maximumSparsity; - if ($common.isDefined(sparsity) && (sparsity < 0 || sparsity >= 1)) + if (LegacyUtils.isDefined(sparsity) && (sparsity < 0 || sparsity >= 1)) return showPopoverMessage($scope.ui, 'swap', 'maximumSparsity', 'Maximum sparsity should be more or equal 0 and less than 1!'); const readStripesNumber = swap.readStripesNumber; @@ -436,16 +432,16 @@ consoleModule.controller('clustersController', [ function checkSslConfiguration(item) { const r = item.connector; - if ($common.isDefined(r)) { - if (r.sslEnabled && $common.isEmptyString(r.sslFactory)) + if (LegacyUtils.isDefined(r)) { + if (r.sslEnabled && LegacyUtils.isEmptyString(r.sslFactory)) return showPopoverMessage($scope.ui, 'connector', 'connectorSslFactory', 'SSL factory should not be empty!'); } if (item.sslEnabled) { - if (!$common.isDefined(item.sslContextFactory) || $common.isEmptyString(item.sslContextFactory.keyStoreFilePath)) + if (!LegacyUtils.isDefined(item.sslContextFactory) || LegacyUtils.isEmptyString(item.sslContextFactory.keyStoreFilePath)) return showPopoverMessage($scope.ui, 'sslConfiguration', 'keyStoreFilePath', 'Key store file should not be empty!'); - if ($common.isEmptyString(item.sslContextFactory.trustStoreFilePath) && _.isEmpty(item.sslContextFactory.trustManagers)) + if (LegacyUtils.isEmptyString(item.sslContextFactory.trustStoreFilePath) && _.isEmpty(item.sslContextFactory.trustManagers)) return showPopoverMessage($scope.ui, 'sslConfiguration', 'sslConfiguration-title', 'Trust storage file or managers should be configured!'); } @@ -461,12 +457,12 @@ consoleModule.controller('clustersController', [ // Check cluster logical consistency. function validate(item) { - $common.hidePopover(); + LegacyUtils.hidePopover(); - if ($common.isEmptyString(item.name)) + if (LegacyUtils.isEmptyString(item.name)) return showPopoverMessage($scope.ui, 'general', 'clusterName', 'Cluster name should not be empty!'); - if (!$common.checkFieldValidators($scope.ui)) + if (!LegacyUtils.checkFieldValidators($scope.ui)) return false; if (!checkCacheSQLSchemas(item)) @@ -529,16 +525,16 @@ consoleModule.controller('clustersController', [ $scope.selectItem(item); - $common.showInfo('Cluster "' + item.name + '" saved.'); + Messages.showInfo('Cluster "' + item.name + '" saved.'); }) - .error((err) => $common.showError(err)); + .error(Messages.showError); } // Save cluster. $scope.saveItem = function() { const item = $scope.backupItem; - const swapSpi = $common.autoClusterSwapSpiConfiguration(item, clusterCaches(item)); + const swapSpi = LegacyUtils.autoClusterSwapSpiConfiguration(item, clusterCaches(item)); if (swapSpi) angular.extend(item, swapSpi); @@ -554,7 +550,7 @@ consoleModule.controller('clustersController', [ // Clone cluster with new name. $scope.cloneItem = function() { if (validate($scope.backupItem)) { - $clone.confirm($scope.backupItem.name, _clusterNames()).then(function(newName) { + Clone.confirm($scope.backupItem.name, _clusterNames()).then(function(newName) { const item = angular.copy($scope.backupItem); delete item._id; @@ -569,13 +565,13 @@ consoleModule.controller('clustersController', [ $scope.removeItem = function() { const selectedItem = $scope.selectedItem; - $confirm.confirm('Are you sure you want to remove cluster: "' + selectedItem.name + '"?') + Confirm.confirm('Are you sure you want to remove cluster: "' + selectedItem.name + '"?') .then(function() { const _id = selectedItem._id; $http.post('/api/v1/configuration/clusters/remove', {_id}) .success(function() { - $common.showInfo('Cluster has been removed: ' + selectedItem.name); + Messages.showInfo('Cluster has been removed: ' + selectedItem.name); const clusters = $scope.clusters; @@ -595,19 +591,17 @@ consoleModule.controller('clustersController', [ _.forEach($scope.igfss, (igfs) => _.remove(igfs.igfs.clusters, (id) => id === _id)); } }) - .error(function(errMsg) { - $common.showError(errMsg); - }); + .error(Messages.showError); }); }; // Remove all clusters from db. $scope.removeAllItems = function() { - $confirm.confirm('Are you sure you want to remove all clusters?') + Confirm.confirm('Are you sure you want to remove all clusters?') .then(function() { $http.post('/api/v1/configuration/clusters/remove/all') - .success(function() { - $common.showInfo('All clusters have been removed'); + .success(() => { + Messages.showInfo('All clusters have been removed'); $scope.clusters = []; @@ -617,18 +611,16 @@ consoleModule.controller('clustersController', [ $scope.backupItem = emptyCluster; $scope.ui.inputForm.$setPristine(); }) - .error(function(errMsg) { - $common.showError(errMsg); - }); + .error(Messages.showError); }); }; $scope.resetAll = function() { - $confirm.confirm('Are you sure you want to undo all changes for current cluster?') + Confirm.confirm('Are you sure you want to undo all changes for current cluster?') .then(function() { $scope.backupItem = $scope.selectedItem ? angular.copy($scope.selectedItem) : prepareNewItem(); $scope.ui.inputForm.$setPristine(); }); }; - }] -); + } +]];
