http://git-wip-us.apache.org/repos/asf/ignite/blob/6b19f87d/modules/control-center-web/src/main/js/controllers/common-module.js ---------------------------------------------------------------------- diff --cc modules/control-center-web/src/main/js/controllers/common-module.js index 440fb15,4985022..b235796 --- a/modules/control-center-web/src/main/js/controllers/common-module.js +++ b/modules/control-center-web/src/main/js/controllers/common-module.js @@@ -19,7 -19,8 +19,9 @@@ var consoleModule = angular.module('ign [ 'ngAnimate', 'ngSanitize', 'mgcrea.ngStrap', 'smart-table', 'ui.ace', 'treeControl', 'darthwade.dwLoading', 'agGrid', 'nvd3', 'dndLists' /* ignite:modules */ + , 'ignite-console' + , 'ignite-web-console.navbar' + , 'ignite-web-console.configuration.sidebar' /* endignite */ /* ignite:plugins */ /* endignite */ @@@ -665,16 -654,14 +667,14 @@@ consoleModule.service('$common', return { getModel: getModel, joinTip: function (arr) { - if (!arr) { + if (!arr) return arr; - } - var lines = arr.map(function (line) { + var lines = _.map(arr, function (line) { var rtrimmed = line.replace(/\s+$/g, ''); - if (rtrimmed.indexOf('>', this.length - 1) === -1) { - if (rtrimmed.indexOf('>', this.length - 1) == -1) ++ if (rtrimmed.indexOf('>', this.length - 1) === -1) rtrimmed = rtrimmed + '<br/>'; - } return rtrimmed; }); @@@ -1034,16 -1037,6 +1034,16 @@@ consoleModule.service('$unsavedChangesG window.onbeforeunload = null; }); + var unbind = $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { + if ($scope.ui && $scope.ui.isDirty()) { + if (!confirm('You have unsaved changes.\n\nAre you sure you want to discard them?')) { - event.preventDefault(); ++ event.preventDefault(); + } else { + unbind(); + } + } + }); + window.onbeforeunload = function(){ return $scope.ui && $scope.ui.isDirty() ? 'You have unsaved changes.\n\nAre you sure you want to discard them?'
http://git-wip-us.apache.org/repos/asf/ignite/blob/6b19f87d/modules/control-center-web/src/main/js/controllers/summary-controller.js ---------------------------------------------------------------------- diff --cc modules/control-center-web/src/main/js/controllers/summary-controller.js index b6fcfb9,d4d3c58..bd2f424 --- a/modules/control-center-web/src/main/js/controllers/summary-controller.js +++ b/modules/control-center-web/src/main/js/controllers/summary-controller.js @@@ -99,10 -101,10 +99,10 @@@ consoleModule.controller('summaryContro function selectPojoClass(config) { if ($scope.selectedItem) _.forEach($scope.selectedItem.metadatas, function(meta) { -- if (meta.keyType == config.pojoClass) ++ if (meta.keyType === config.pojoClass) return config.pojoClassBody = meta.keyClass; -- if (meta.valueType == config.pojoClass) ++ if (meta.valueType === config.pojoClass) return config.pojoClassBody = meta.valueClass; }); } @@@ -121,7 -123,7 +121,7 @@@ function restoreSelected(selected, config, tabs, metadatas) { if (!$common.isDefined(selected) || _.findIndex(metadatas, function (meta) { -- return meta.keyType == selected || meta.valueType == selected; ++ return meta.keyType === selected || meta.valueType === selected; }) < 0) { if (metadatas.length > 0) { if ($common.isDefined(metadatas[0].keyType)) @@@ -132,7 -134,7 +132,7 @@@ else { config.pojoClass = undefined; -- if (tabs.activeTab == 2) ++ if (tabs.activeTab === 2) tabs.activeTab = 0; } } @@@ -262,7 -262,7 +260,7 @@@ if (restoredId) { var idx = _.findIndex($scope.clusters, function (cluster) { -- return cluster._id == restoredId; ++ return cluster._id === restoredId; }); if (idx >= 0) http://git-wip-us.apache.org/repos/asf/ignite/blob/6b19f87d/modules/control-center-web/src/main/js/helpers/generator/generator-common.js ---------------------------------------------------------------------- diff --cc modules/control-center-web/src/main/js/helpers/generator/generator-common.js index 9fcd784,c0bbdea..1030956 --- a/modules/control-center-web/src/main/js/helpers/generator/generator-common.js +++ b/modules/control-center-web/src/main/js/helpers/generator/generator-common.js @@@ -20,7 -20,7 +20,7 @@@ $generatorCommon = {} // Add leading zero. $generatorCommon.addLeadingZero = function (numberStr, minSize) { -- if (typeof (numberStr) != 'string') ++ if (typeof (numberStr) !== 'string') numberStr = '' + numberStr; while (numberStr.length < minSize) { @@@ -120,7 -127,7 +127,6 @@@ $generatorCommon.builder = function (de return res; }; -- res.startBlock = function (s) { if (s) { if (this.needEmptyLine) @@@ -172,7 -179,7 +178,7 @@@ var shortName = dotIdx > 0 ? fullClassName.substr(dotIdx + 1) : fullClassName; if (this.imports[shortName]) { -- if (this.imports[shortName] != fullClassName) ++ if (this.imports[shortName] !== fullClassName) return fullClassName; // Short class names conflict. Return full name. } else @@@ -188,13 -195,13 +194,13 @@@ var res = []; for (var clsName in this.imports) { -- if (this.imports.hasOwnProperty(clsName) && this.imports[clsName].lastIndexOf('java.lang.', 0) != 0) ++ if (this.imports.hasOwnProperty(clsName) && this.imports[clsName].lastIndexOf('java.lang.', 0) !== 0) res.push('import ' + this.imports[clsName] + ';'); } res.sort(); -- return res.join('\n') ++ return res.join('\n'); }; return res;
