You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2016/02/24 10:25:44 UTC
[9/9] ignite git commit: IGNITE-2612 WIP reworking caches screen to
Angular directives.
IGNITE-2612 WIP reworking caches screen to Angular directives.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ade3c4a5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ade3c4a5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ade3c4a5
Branch: refs/heads/ignite-2612
Commit: ade3c4a52528030b1cde4fb5e882034491394b1a
Parents: 28b4038
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Feb 24 16:25:51 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Feb 24 16:25:51 2016 +0700
----------------------------------------------------------------------
.../form-field-cache-mode.jade | 2 +-
.../configuration/caches/concurrency.jade | 2 +-
.../states/configuration/caches/general.jade | 51 +++-
.../states/configuration/caches/memory.jade | 2 +-
.../states/configuration/caches/query.jade | 2 +-
.../states/configuration/caches/rebalance.jade | 2 +-
.../configuration/caches/server-near-cache.jade | 2 +-
.../states/configuration/caches/statistics.jade | 2 +-
.../states/configuration/caches/store.jade | 2 +-
.../states/configuration/clusters/atomic.jade | 2 +-
.../main/js/controllers/caches-controller.js | 287 ++++---------------
.../main/js/controllers/clusters-controller.js | 12 +-
.../src/main/js/views/configuration/caches.jade | 34 +--
.../main/js/views/configuration/clusters.jade | 2 +-
14 files changed, 126 insertions(+), 278 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ade3c4a5/modules/control-center-web/src/main/js/app/directives/form-field-cache-mode/form-field-cache-mode.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/directives/form-field-cache-mode/form-field-cache-mode.jade b/modules/control-center-web/src/main/js/app/directives/form-field-cache-mode/form-field-cache-mode.jade
index 526dee6..3fca594 100644
--- a/modules/control-center-web/src/main/js/app/directives/form-field-cache-mode/form-field-cache-mode.jade
+++ b/modules/control-center-web/src/main/js/app/directives/form-field-cache-mode/form-field-cache-mode.jade
@@ -19,7 +19,7 @@ div
ignite-form-field-label
| Cache mode:
ignite-form-field-tooltip
- | Cache modes:#[br]
+ | Cache modes:
ul: li Partitioned - in this mode the overall key set will be divided into partitions and all partitions will be split equally between participating nodes
li Replicated - in this mode all the keys are distributed to all participating nodes
li Local - in this mode caches residing on different grid nodes will not know about each other
http://git-wip-us.apache.org/repos/asf/ignite/blob/ade3c4a5/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/concurrency.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/concurrency.jade b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/concurrency.jade
index f0b8370..f1a58d1 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/concurrency.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/concurrency.jade
@@ -72,7 +72,7 @@ form.panel.panel-default(name='concurrency' novalidate)
ignite-form-field-label
| Cache mode:
ignite-form-field-tooltip
- | Cache modes:#[br]
+ | Cache modes:
ul: li Partitioned - in this mode the overall key set will be divided into partitions and all partitions will be split equally between participating nodes
li Replicated - in this mode all the keys are distributed to all participating nodes
li Local - in this mode caches residing on different grid nodes will not know about each other
http://git-wip-us.apache.org/repos/asf/ignite/blob/ade3c4a5/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/general.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/general.jade b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/general.jade
index 689b036..761e037 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/general.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/general.jade
@@ -72,20 +72,51 @@ form.panel.panel-default(name='general' novalidate)
ignite-form-field-label
| Cache mode:
ignite-form-field-tooltip
- | Cache modes:#[br]
+ | Cache modes:
ul: li Partitioned - in this mode the overall key set will be divided into partitions and all partitions will be split equally between participating nodes
li Replicated - in this mode all the keys are distributed to all participating nodes
li Local - in this mode caches residing on different grid nodes will not know about each other
ignite-form-field-dropdown(
- data-id='cacheMode'
- data-name='cacheMode'
- data-options='[\
- {value: "LOCAL", label: "LOCAL"},\
- {value: "REPLICATED", label: "REPLICATED"},\
- {value: "PARTITIONED", label: "PARTITIONED"}\
- ]'
- data-ng-model='#{model}.cacheMode'
- data-placeholder='PARTITIONED'
+ data-id='cacheMode'
+ data-name='cacheMode'
+ data-options='[\
+ {value: "LOCAL", label: "LOCAL"},\
+ {value: "REPLICATED", label: "REPLICATED"},\
+ {value: "PARTITIONED", label: "PARTITIONED"}\
+ ]'
+ data-ng-model='#{model}.cacheMode'
+ data-placeholder='PARTITIONED'
+ )
+ .settings-row
+ ignite-form-field
+ ignite-form-field-label
+ | Atomicity:
+ ignite-form-field-tooltip
+ | Atomicity:
+ ul: li Atomic - in this mode distributed transactions and distributed locking are not supported
+ li Transactional - in this mode specified fully ACID-compliant transactional cache behavior
+ ignite-form-field-dropdown(
+ data-id='atomicityMode'
+ data-name='atomicityMode'
+ data-options='[\
+ {value: "ATOMIC", label: "ATOMIC"},\
+ {value: "TRANSACTIONAL", label: "TRANSACTIONAL"}\
+ ]'
+ data-ng-model='#{model}.atomicityMode'
+ data-placeholder='ATOMIC'
+ )
+ .settings-row(data-ng-show='#{model}.cacheMode === "PARTITIONED"')
+ ignite-form-field
+ ignite-form-field-label
+ | Backups:
+ ignite-form-field-tooltip
+ | Number of nodes used to back up single partition for partitioned cache
+ ignite-form-field-input-number(
+ data-id='backups'
+ data-name='backups'
+ data-ng-model='#{model}.backups'
+ data-placeholder='0'
+ data-min='0'
)
ignite-ui-ace.col-sm-6
.preview-panel(ng-init='mode = false')
http://git-wip-us.apache.org/repos/asf/ignite/blob/ade3c4a5/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/memory.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/memory.jade b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/memory.jade
index e073dcd..e31f094 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/memory.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/memory.jade
@@ -72,7 +72,7 @@ form.panel.panel-default(name='memory' novalidate)
ignite-form-field-label
| Cache mode:
ignite-form-field-tooltip
- | Cache modes:#[br]
+ | Cache modes:
ul: li Partitioned - in this mode the overall key set will be divided into partitions and all partitions will be split equally between participating nodes
li Replicated - in this mode all the keys are distributed to all participating nodes
li Local - in this mode caches residing on different grid nodes will not know about each other
http://git-wip-us.apache.org/repos/asf/ignite/blob/ade3c4a5/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/query.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/query.jade b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/query.jade
index 6bb78c1..84c76d8 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/query.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/query.jade
@@ -72,7 +72,7 @@ form.panel.panel-default(name='query' novalidate)
ignite-form-field-label
| Cache mode:
ignite-form-field-tooltip
- | Cache modes:#[br]
+ | Cache modes:
ul: li Partitioned - in this mode the overall key set will be divided into partitions and all partitions will be split equally between participating nodes
li Replicated - in this mode all the keys are distributed to all participating nodes
li Local - in this mode caches residing on different grid nodes will not know about each other
http://git-wip-us.apache.org/repos/asf/ignite/blob/ade3c4a5/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/rebalance.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/rebalance.jade b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/rebalance.jade
index ff2eed8..9016235 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/rebalance.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/rebalance.jade
@@ -72,7 +72,7 @@ form.panel.panel-default(name='rebalance' novalidate)
ignite-form-field-label
| Cache mode:
ignite-form-field-tooltip
- | Cache modes:#[br]
+ | Cache modes:
ul: li Partitioned - in this mode the overall key set will be divided into partitions and all partitions will be split equally between participating nodes
li Replicated - in this mode all the keys are distributed to all participating nodes
li Local - in this mode caches residing on different grid nodes will not know about each other
http://git-wip-us.apache.org/repos/asf/ignite/blob/ade3c4a5/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/server-near-cache.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/server-near-cache.jade b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/server-near-cache.jade
index 206fcb8..2b89823 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/server-near-cache.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/server-near-cache.jade
@@ -72,7 +72,7 @@ form.panel.panel-default(name='server-near-cache' novalidate)
ignite-form-field-label
| Cache mode:
ignite-form-field-tooltip
- | Cache modes:#[br]
+ | Cache modes:
ul: li Partitioned - in this mode the overall key set will be divided into partitions and all partitions will be split equally between participating nodes
li Replicated - in this mode all the keys are distributed to all participating nodes
li Local - in this mode caches residing on different grid nodes will not know about each other
http://git-wip-us.apache.org/repos/asf/ignite/blob/ade3c4a5/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/statistics.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/statistics.jade b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/statistics.jade
index f335184..5fddfcb 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/statistics.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/statistics.jade
@@ -72,7 +72,7 @@ form.panel.panel-default(name='store' novalidate)
ignite-form-field-label
| Cache mode:
ignite-form-field-tooltip
- | Cache modes:#[br]
+ | Cache modes:
ul: li Partitioned - in this mode the overall key set will be divided into partitions and all partitions will be split equally between participating nodes
li Replicated - in this mode all the keys are distributed to all participating nodes
li Local - in this mode caches residing on different grid nodes will not know about each other
http://git-wip-us.apache.org/repos/asf/ignite/blob/ade3c4a5/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/store.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/store.jade b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/store.jade
index f335184..5fddfcb 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/store.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/caches/store.jade
@@ -72,7 +72,7 @@ form.panel.panel-default(name='store' novalidate)
ignite-form-field-label
| Cache mode:
ignite-form-field-tooltip
- | Cache modes:#[br]
+ | Cache modes:
ul: li Partitioned - in this mode the overall key set will be divided into partitions and all partitions will be split equally between participating nodes
li Replicated - in this mode all the keys are distributed to all participating nodes
li Local - in this mode caches residing on different grid nodes will not know about each other
http://git-wip-us.apache.org/repos/asf/ignite/blob/ade3c4a5/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/atomic.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/atomic.jade b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/atomic.jade
index d442d5c..919168e 100644
--- a/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/atomic.jade
+++ b/modules/control-center-web/src/main/js/app/modules/states/configuration/clusters/atomic.jade
@@ -32,7 +32,7 @@ form.panel.panel-default(name='atomics' novalidate)
ignite-form-field-label
| Cache mode:
ignite-form-field-tooltip
- | Cache modes:#[br]
+ | Cache modes:
ul: li Partitioned - in this mode the overall key set will be divided into partitions and all partitions will be split equally between participating nodes
li Replicated - in this mode all the keys are distributed to all participating nodes
li Local - in this mode caches residing on different grid nodes will not know about each other
http://git-wip-us.apache.org/repos/asf/ignite/blob/ade3c4a5/modules/control-center-web/src/main/js/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/caches-controller.js b/modules/control-center-web/src/main/js/controllers/caches-controller.js
index 7709aa4..72aa8e1 100644
--- a/modules/control-center-web/src/main/js/controllers/caches-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/caches-controller.js
@@ -17,10 +17,18 @@
// Controller for Caches screen.
consoleModule.controller('cachesController', [
- '$scope', '$state', '$controller', '$filter', '$http', '$timeout', '$common', '$focus', '$confirm', '$clone', '$table', '$preview', '$loading', '$unsavedChangesGuard',
- function ($scope, $state, $controller, $filter, $http, $timeout, $common, $focus, $confirm, $clone, $table, $preview, $loading, $unsavedChangesGuard) {
+ '$scope', '$state', '$controller', '$filter', '$http', '$timeout', '$common', '$confirm', '$clone', '$loading', '$cleanup', '$unsavedChangesGuard',
+ function ($scope, $state, $controller, $filter, $http, $timeout, $common, $confirm, $clone, $loading, $cleanup, $unsavedChangesGuard) {
$unsavedChangesGuard.install($scope);
+ var __original_value;
+
+ var blank = {
+ evictionPolicy: {},
+ cacheStoreFactory: {},
+ nearConfiguration: {}
+ };
+
// Initialize the super class and extend it.
angular.extend(this, $controller('save-remove', {$scope: $scope}));
@@ -28,150 +36,25 @@ consoleModule.controller('cachesController', [
$scope.ui.activePanels = [0];
$scope.ui.topPanels = [0, 1, 2, 3];
- $scope.selectedItemWatchGuard = false;
-
- $scope.joinTip = $common.joinTip;
- $scope.getModel = $common.getModel;
- $scope.javaBuiltInClasses = $common.javaBuiltInClasses;
- $scope.compactJavaName = $common.compactJavaName;
- $scope.widthIsSufficient = $common.widthIsSufficient;
- $scope.saveBtnTipText = $common.saveBtnTipText;
- $scope.panelExpanded = $common.panelExpanded;
-
- $scope.tableVisibleRow = $table.tableVisibleRow;
-
- $scope.tableSave = function (field, index, stopEdit) {
- switch (field.type) {
- case 'table-simple':
- if ($table.tableSimpleSaveVisible(field, index))
- return $table.tableSimpleSave($scope.tableSimpleValid, $scope.backupItem, field, index, stopEdit);
-
- break;
- }
-
- return true;
- };
-
- $scope.tableReset = function (save) {
- var field = $table.tableField();
-
- if (!save || !$common.isDefined(field) || $scope.tableSave(field, $table.tableEditedRowIndex(), true)) {
- $table.tableReset();
-
- return true;
- }
-
- return false;
- };
-
- $scope.tableNewItem = function (field) {
- if ($scope.tableReset(true))
- $table.tableNewItem(field);
- };
-
- $scope.tableNewItemActive = $table.tableNewItemActive;
-
- $scope.tableStartEdit = function (item, field, index) {
- if ($scope.tableReset(true))
- $table.tableStartEdit(item, field, index);
- };
-
- $scope.tableEditing = $table.tableEditing;
-
- $scope.tableRemove = function (item, field, index) {
- if ($scope.tableReset(true))
- $table.tableRemove(item, field, index);
- };
-
- $scope.tableSimpleSave = $table.tableSimpleSave;
- $scope.tableSimpleSaveVisible = $table.tableSimpleSaveVisible;
-
- $scope.tableSimpleUp = function (item, field, index) {
- if ($scope.tableReset(true))
- $table.tableSimpleUp(item, field, index);
- };
-
- $scope.tableSimpleDown = function (item, field, index) {
- if ($scope.tableReset(true))
- $table.tableSimpleDown(item, field, index);
- };
-
- $scope.tableSimpleDownVisible = $table.tableSimpleDownVisible;
-
- $scope.tablePairSave = $table.tablePairSave;
- $scope.tablePairSaveVisible = $table.tablePairSaveVisible;
-
- $scope.tableEditedRowIndex = $table.tableEditedRowIndex;
-
- var previews = [];
-
- $scope.previewInit = function (preview) {
- previews.push(preview);
-
- $preview.previewInit(preview);
- };
-
- $scope.previewChanged = $preview.previewChanged;
-
$scope.hidePopover = $common.hidePopover;
var showPopoverMessage = $common.showPopoverMessage;
- $scope.atomicities = $common.mkOptions(['ATOMIC', 'TRANSACTIONAL']);
-
- $scope.cacheModes = $common.mkOptions(['PARTITIONED', 'REPLICATED', 'LOCAL']);
-
- $scope.atomicWriteOrderModes = $common.mkOptions(['CLOCK', 'PRIMARY']);
-
- $scope.writeSynchronizationMode = $common.mkOptions(['FULL_SYNC', 'FULL_ASYNC', 'PRIMARY_SYNC']);
-
- $scope.memoryModes = $common.mkOptions(['ONHEAP_TIERED', 'OFFHEAP_TIERED', 'OFFHEAP_VALUES']);
-
- $scope.evictionPolicies = [
- {value: 'LRU', label: 'LRU'},
- {value: 'FIFO', label: 'FIFO'},
- {value: 'SORTED', label: 'Sorted'},
- {value: undefined, label: 'Not set'}
- ];
-
- $scope.rebalanceModes = $common.mkOptions(['SYNC', 'ASYNC', 'NONE']);
-
- $scope.cacheStoreFactories = [
- {value: 'CacheJdbcPojoStoreFactory', label: 'JDBC POJO store factory'},
- {value: 'CacheJdbcBlobStoreFactory', label: 'JDBC BLOB store factory'},
- {value: 'CacheHibernateBlobStoreFactory', label: 'Hibernate BLOB store factory'},
- {value: undefined, label: 'Not set'}
- ];
-
- $scope.jdbcBlobStoreConnections = [
- {value: 'URL', label: 'URL'},
- {value: 'DataSource', label: 'Data source'}
- ];
-
- $scope.cacheStoreJdbcDialects = $common.cacheStoreJdbcDialects;
-
$scope.toggleExpanded = function () {
$scope.ui.expanded = !$scope.ui.expanded;
$common.hidePopover();
};
- $scope.general = [];
- $scope.advanced = [];
- $scope.caches = [];
- $scope.domains = [];
+ $scope.contentVisible = function () {
+ var item = $scope.backupItem;
- $scope.preview = {
- general: {xml: '', java: '', allDefaults: true},
- memory: {xml: '', java: '', allDefaults: true},
- query: {xml: '', java: '', allDefaults: true},
- store: {xml: '', java: '', allDefaults: true},
- concurrency: {xml: '', java: '', allDefaults: true},
- rebalance: {xml: '', java: '', allDefaults: true},
- serverNearCache: {xml: '', java: '', allDefaults: true},
- statistics: {xml: '', java: '', allDefaults: true}
+ return item && (!item._id || _.find($scope.displayedRows, {_id: item._id}));
};
+ $scope.caches = [];
+ $scope.domains = [];
+
function _cacheLbl(cache) {
return cache.name + ', ' + cache.cacheMode + ', ' + cache.atomicityMode;
}
@@ -312,84 +195,27 @@ consoleModule.controller('cachesController', [
};
}), 'label');
- // Load page descriptor.
- $http.get('/models/caches.json')
- .success(function (data) {
- $scope.general = data.general;
- $scope.advanced = data.advanced;
+ if ($state.params.id)
+ $scope.createItem($state.params.id);
+ else {
+ var lastSelectedCache = angular.fromJson(sessionStorage.lastSelectedCache);
- $scope.ui.addGroups(data.general, data.advanced);
+ if (lastSelectedCache) {
+ var idx = _.findIndex($scope.caches, function (cache) {
+ return cache._id === lastSelectedCache;
+ });
- if ($state.params.id)
- $scope.createItem($state.params.id);
+ if (idx >= 0)
+ $scope.selectItem($scope.caches[idx]);
else {
- var lastSelectedCache = angular.fromJson(sessionStorage.lastSelectedCache);
-
- if (lastSelectedCache) {
- var idx = _.findIndex($scope.caches, function (cache) {
- return cache._id === lastSelectedCache;
- });
+ sessionStorage.removeItem('lastSelectedCache');
- if (idx >= 0)
- $scope.selectItem($scope.caches[idx]);
- else {
- sessionStorage.removeItem('lastSelectedCache');
-
- selectFirstItem();
- }
- }
- else
- selectFirstItem();
+ selectFirstItem();
}
-
- $scope.$watch('backupItem', function (val) {
- if (val) {
- var srcItem = $scope.selectedItem ? $scope.selectedItem : prepareNewItem();
-
- $scope.ui.checkDirty(val, srcItem);
-
- var domains = cacheDomains(val);
- var varName = $commonUtils.toJavaName('cache', val.name);
-
- $scope.preview.general.xml = $generatorXml.cacheDomains(domains, $generatorXml.cacheGeneral(val)).asString();
- $scope.preview.general.java = $generatorJava.cacheDomains(domains, varName, $generatorJava.cacheGeneral(val, varName)).asString();
- $scope.preview.general.allDefaults = $common.isEmptyString($scope.preview.general.xml);
-
- $scope.preview.memory.xml = $generatorXml.cacheMemory(val).asString();
- $scope.preview.memory.java = $generatorJava.cacheMemory(val, varName).asString();
- $scope.preview.memory.allDefaults = $common.isEmptyString($scope.preview.memory.xml);
-
- $scope.preview.query.xml = $generatorXml.cacheQuery(val).asString();
- $scope.preview.query.java = $generatorJava.cacheQuery(val, varName).asString();
- $scope.preview.query.allDefaults = $common.isEmptyString($scope.preview.query.xml);
-
- var storeFactory = $generatorXml.cacheStore(val, domains);
-
- $scope.preview.store.xml = $generatorXml.generateDataSources(storeFactory.datasources).asString() + storeFactory.asString();
- $scope.preview.store.java = $generatorJava.cacheStore(val, domains, varName).asString();
- $scope.preview.store.allDefaults = $common.isEmptyString($scope.preview.store.xml);
-
- $scope.preview.concurrency.xml = $generatorXml.cacheConcurrency(val).asString();
- $scope.preview.concurrency.java = $generatorJava.cacheConcurrency(val, varName).asString();
- $scope.preview.concurrency.allDefaults = $common.isEmptyString($scope.preview.concurrency.xml);
-
- $scope.preview.rebalance.xml = $generatorXml.cacheRebalance(val).asString();
- $scope.preview.rebalance.java = $generatorJava.cacheRebalance(val, varName).asString();
- $scope.preview.rebalance.allDefaults = $common.isEmptyString($scope.preview.rebalance.xml);
-
- $scope.preview.serverNearCache.xml = $generatorXml.cacheServerNearCache(val).asString();
- $scope.preview.serverNearCache.java = $generatorJava.cacheServerNearCache(val, varName).asString();
- $scope.preview.serverNearCache.allDefaults = $common.isEmptyString($scope.preview.serverNearCache.xml);
-
- $scope.preview.statistics.xml = $generatorXml.cacheStatistics(val).asString();
- $scope.preview.statistics.java = $generatorJava.cacheStatistics(val, varName).asString();
- $scope.preview.statistics.allDefaults = $common.isEmptyString($scope.preview.statistics.xml);
- }
- }, true);
- })
- .error(function (errMsg) {
- $common.showError(errMsg);
- });
+ }
+ else
+ selectFirstItem();
+ }
})
.error(function (errMsg) {
$common.showError(errMsg);
@@ -401,22 +227,17 @@ consoleModule.controller('cachesController', [
$scope.selectItem = function (item, backup) {
function selectItem() {
- $table.tableReset();
-
- $scope.selectedItemWatchGuard = true;
- $scope.selectedItem = angular.copy(item);
+ $scope.selectedItem = item;
try {
- if (item)
+ if (item && item._id)
sessionStorage.lastSelectedCache = angular.toJson(item._id);
else
sessionStorage.removeItem('lastSelectedCache');
}
- catch (error) { }
-
- _.forEach(previews, function (preview) {
- preview.attractAttention = false;
- });
+ catch (ignored) {
+ // No-op.
+ }
if (backup)
$scope.backupItem = backup;
@@ -425,11 +246,15 @@ consoleModule.controller('cachesController', [
else
$scope.backupItem = undefined;
+ $scope.backupItem = angular.merge({}, blank, $scope.backupItem);
+
+ __original_value = JSON.stringify($cleanup($scope.backupItem));
+
if ($common.getQueryVariable('new'))
$state.go('base.configuration.caches');
}
- $common.confirmUnsavedChanges($scope.ui.isDirty(), selectItem);
+ $common.confirmUnsavedChanges($scope.backupItem && $scope.ui.inputForm.$dirty, selectItem);
};
function prepareNewItem(id) {
@@ -448,13 +273,11 @@ consoleModule.controller('cachesController', [
// Add new cache.
$scope.createItem = function (id) {
- if ($scope.tableReset(true)) {
- $timeout(function () {
- $common.ensureActivePanel($scope.ui, 'general', 'cacheName');
- });
+ $timeout(function () {
+ $common.ensureActivePanel($scope.ui, 'general', 'cacheName');
+ });
- $scope.selectItem(undefined, prepareNewItem(id));
- }
+ $scope.selectItem(undefined, prepareNewItem(id));
};
function checkDataSources() {
@@ -609,14 +432,12 @@ consoleModule.controller('cachesController', [
// Save cache.
$scope.saveItem = function () {
- if ($scope.tableReset(true)) {
- var item = $scope.backupItem;
+ var item = $scope.backupItem;
- angular.extend(item, $common.autoCacheStoreConfiguration(item, cacheDomains(item)));
+ angular.extend(item, $common.autoCacheStoreConfiguration(item, cacheDomains(item)));
- if (validate(item))
- save(item);
- }
+ if (validate(item))
+ save(item);
};
function _cacheNames() {
@@ -627,7 +448,7 @@ consoleModule.controller('cachesController', [
// Save cache with new name.
$scope.cloneItem = function () {
- if ($scope.tableReset(true) && validate($scope.backupItem)) {
+ if (validate($scope.backupItem)) {
$clone.confirm($scope.backupItem.name, _cacheNames()).then(function (newName) {
var item = angular.copy($scope.backupItem);
@@ -643,8 +464,6 @@ consoleModule.controller('cachesController', [
// Remove cache from db.
$scope.removeItem = function () {
- $table.tableReset();
-
var selectedItem = $scope.selectedItem;
$confirm.confirm('Are you sure you want to remove cache: "' + selectedItem.name + '"?')
@@ -678,8 +497,6 @@ consoleModule.controller('cachesController', [
// Remove all caches from db.
$scope.removeAllItems = function () {
- $table.tableReset();
-
$confirm.confirm('Are you sure you want to remove all caches?')
.then(function () {
$http.post('/api/v1/configuration/caches/remove/all')
@@ -707,8 +524,6 @@ consoleModule.controller('cachesController', [
};
$scope.resetAll = function () {
- $table.tableReset();
-
$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();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ade3c4a5/modules/control-center-web/src/main/js/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/clusters-controller.js b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
index 8f44788..08f2180 100644
--- a/modules/control-center-web/src/main/js/controllers/clusters-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
@@ -16,8 +16,9 @@
*/
// Controller for Clusters screen.
-consoleModule.controller('clustersController', function ($http, $timeout, $scope, $state, $controller,
- $common, $focus, $confirm, $clone, $loading, $unsavedChangesGuard, $cleanup, igniteEventGroups) {
+consoleModule.controller('clustersController', [
+ '$http', '$timeout', '$scope', '$state', '$controller', '$common', '$confirm', '$clone', '$loading', '$unsavedChangesGuard', '$cleanup', 'igniteEventGroups',
+ function ($http, $timeout, $scope, $state, $controller, $common, $confirm, $clone, $loading, $unsavedChangesGuard, $cleanup, igniteEventGroups) {
$unsavedChangesGuard.install($scope);
var __original_value;
@@ -126,7 +127,6 @@ consoleModule.controller('clustersController', function ($http, $timeout, $scope
return {value: igfs._id, label: igfs.name, igfs: igfs};
});
- // Load page descriptor.
if ($state.params.id)
$scope.createItem($state.params.id);
else {
@@ -183,7 +183,9 @@ consoleModule.controller('clustersController', function ($http, $timeout, $scope
else
sessionStorage.removeItem('lastSelectedCluster');
}
- catch (error) { }
+ catch (ignored) {
+ // No-op.
+ }
if (backup)
$scope.backupItem = backup;
@@ -540,5 +542,5 @@ consoleModule.controller('clustersController', function ($http, $timeout, $scope
$scope.ui.inputForm.$setPristine();
});
};
- }
+ }]
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ade3c4a5/modules/control-center-web/src/main/js/views/configuration/caches.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/caches.jade b/modules/control-center-web/src/main/js/views/configuration/caches.jade
index 62d4da2..42277e8 100644
--- a/modules/control-center-web/src/main/js/views/configuration/caches.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/caches.jade
@@ -31,20 +31,20 @@ include ../includes/infos
+save-remove-buttons('cache')
hr
.bs-affix-fix
- form.form-horizontal(name='ui.inputForm' ng-show='backupItem && tableVisibleRow(displayedRows, selectedItem)' novalidate)
- .panel-group(bs-collapse ng-model='ui.activePanels' data-allow-multiple='true')
- ignite-configuration-caches-general
- ignite-configuration-caches-memory
- ignite-configuration-caches-query
- ignite-configuration-caches-store
-
- ignite-advanced-options-toggle
-
- div(ng-show='ui.expanded')
- ignite-configuration-caches-concurrency
- ignite-configuration-caches-rebalance
- ignite-configuration-caches-server-near-cache
- ignite-configuration-caches-statistics
-
- ignite-advanced-options-hide
-
+ div(bs-collapse='' data-allow-multiple='true' ng-model='ui.activePanels')
+ form.form-horizontal(name='ui.inputForm' ng-show='contentVisible()' novalidate)
+ .panel-group
+ ignite-configuration-caches-general
+ ignite-configuration-caches-memory
+ ignite-configuration-caches-query
+ ignite-configuration-caches-store
+
+ ignite-advanced-options-toggle
+
+ div(ng-show='ui.expanded')
+ ignite-configuration-caches-concurrency
+ ignite-configuration-caches-rebalance
+ ignite-configuration-caches-server-near-cache
+ ignite-configuration-caches-statistics
+
+ ignite-advanced-options-hide
http://git-wip-us.apache.org/repos/asf/ignite/blob/ade3c4a5/modules/control-center-web/src/main/js/views/configuration/clusters.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/clusters.jade b/modules/control-center-web/src/main/js/views/configuration/clusters.jade
index 3a6ab07..ec28e36 100644
--- a/modules/control-center-web/src/main/js/views/configuration/clusters.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/clusters.jade
@@ -51,7 +51,7 @@ include ../includes/infos
.bs-affix-fix
div(bs-collapse='' data-allow-multiple='true' ng-model='ui.activePanels')
form.form-horizontal(name='ui.inputForm' ng-show='contentVisible()' novalidate)
- .panel-group(ng-click='triggerDigest = true')
+ .panel-group
ignite-configuration-clusters-general
ignite-advanced-options-toggle