Repository: incubator-ignite Updated Branches: refs/heads/ignite-843 7f915a5f5 -> cc29f79ad
IGNITE-843: Caches validation. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/cc29f79a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cc29f79a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cc29f79a Branch: refs/heads/ignite-843 Commit: cc29f79adf41fd89895e42d0f05df1b476d490bf Parents: 7f915a5 Author: AKuznetsov <akuznet...@gridgain.com> Authored: Tue Aug 18 15:42:42 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Tue Aug 18 15:42:42 2015 +0700 ---------------------------------------------------------------------- .../main/js/controllers/caches-controller.js | 49 ++++++++++++++++---- .../src/main/js/controllers/models/caches.json | 12 +++-- .../main/js/controllers/models/clusters.json | 4 +- .../src/main/js/views/configuration/caches.jade | 4 +- .../src/main/js/views/includes/controls.jade | 10 ++-- 5 files changed, 58 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc29f79a/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 604a39e..17932f4 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 @@ -40,6 +40,8 @@ controlCenterModule.controller('cachesController', [ $scope.compactJavaName = $common.compactJavaName; + $scope.hidePopover = $common.hidePopover; + $scope.atomicities = $common.mkOptions(['ATOMIC', 'TRANSACTIONAL']); $scope.modes = $common.mkOptions(['PARTITIONED', 'REPLICATED', 'LOCAL']); @@ -78,6 +80,8 @@ controlCenterModule.controller('cachesController', [ $scope.toggleExpanded = function () { $scope.ui.expanded = !$scope.ui.expanded; + + $common.hidePopover(); }; $scope.panels = {activePanels: [0]}; @@ -279,24 +283,51 @@ controlCenterModule.controller('cachesController', [ // Check cache logical consistency. function validate(item) { + if ($common.isEmptyString(item.name)) + return $common.showPopoverMessage($scope.panels, 'general-data', 'cacheName', 'Name should not be empty'); + + if (item.memoryMode == 'OFFHEAP_TIERED' && item.offHeapMaxMemory == null) + return $common.showPopoverMessage($scope.panels, 'memory-data', 'offHeapMaxMemory', + 'Off-heap max memory should be specified'); + var cacheStoreFactorySelected = item.cacheStoreFactory && item.cacheStoreFactory.kind; - if (cacheStoreFactorySelected && !(item.readThrough || item.writeThrough)) { - $common.showError('Store is configured but read/write through are not enabled!'); + if (cacheStoreFactorySelected) { + if (item.cacheStoreFactory.kind == 'CacheJdbcPojoStoreFactory') { + if ($common.isEmptyString(item.cacheStoreFactory.CacheJdbcPojoStoreFactory.dataSourceBean)) + return $common.showPopoverMessage($scope.panels, 'store-data', 'dataSourceBean', + 'Data source bean should not be empty'); + + if (!item.cacheStoreFactory.CacheJdbcPojoStoreFactory.dialect) + return $common.showPopoverMessage($scope.panels, 'store-data', 'dialect', + 'Dialect should not be empty'); + } + + if (item.cacheStoreFactory.kind == 'CacheJdbcBlobStoreFactory') { + if ($common.isEmptyString(item.cacheStoreFactory.CacheJdbcBlobStoreFactory.user)) + return $common.showPopoverMessage($scope.panels, 'store-data', 'user', + 'User should not be empty'); - return false; + if ($common.isEmptyString(item.cacheStoreFactory.CacheJdbcBlobStoreFactory.dataSourceBean)) + return $common.showPopoverMessage($scope.panels, 'store-data', 'dataSourceBean', + 'Data source bean should not be empty'); + } } - if ((item.readThrough || item.writeThrough) && !cacheStoreFactorySelected) { - $common.showError('Read / write through are enabled but store is not configured!'); - return false; + if (cacheStoreFactorySelected && !(item.readThrough || item.writeThrough)) { + return $common.showPopoverMessage($scope.panels, 'store-data', 'readThrough', + 'Store is configured but read/write through are not enabled!'); } - if (item.writeBehindEnabled && !cacheStoreFactorySelected) { - $common.showError('Write behind enabled but store is not configured!'); + if ((item.readThrough || item.writeThrough) && !cacheStoreFactorySelected) { + return $common.showPopoverMessage($scope.panels, 'store-data', 'cacheStoreFactory', + 'Read / write through are enabled but store is not configured!'); + } - return false; + if (item.writeBehindEnabled && !cacheStoreFactorySelected) { + return $common.showPopoverMessage($scope.panels, 'store-data', 'cacheStoreFactory', + 'Write behind enabled but store is not configured!'); } return true; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc29f79a/modules/control-center-web/src/main/js/controllers/models/caches.json ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/models/caches.json b/modules/control-center-web/src/main/js/controllers/models/caches.json index b34dcea..9162a85 100644 --- a/modules/control-center-web/src/main/js/controllers/models/caches.json +++ b/modules/control-center-web/src/main/js/controllers/models/caches.json @@ -24,11 +24,11 @@ "fields": [ { "label": "Name", + "id": "cacheName", "type": "text", "model": "name", "required": true, - "placeholder": "Input name", - "id": "cacheName" + "placeholder": "Input name" }, { "label": "Clusters", @@ -117,6 +117,7 @@ }, { "label": "Memory", + "id": "memory-data", "tip": [ "Cache memory settings." ], @@ -143,6 +144,7 @@ }, { "label": "Off-heap max memory", + "id": "offHeapMaxMemory", "type": "number", "model": "offHeapMaxMemory", "min": -1, @@ -398,6 +400,7 @@ "fields": [ { "label": "Store factory", + "id": "cacheStoreFactory", "type": "dropdown-details", "settings": true, "path": "cacheStoreFactory", @@ -424,6 +427,7 @@ }, { "label": "Dialect", + "id": "dialect", "type": "dropdown", "path": "cacheStoreFactory.CacheJdbcPojoStoreFactory", "model": "dialect", @@ -459,7 +463,8 @@ "expanded": true, "fields": [ { - "label": "user", + "label": "User", + "id": "user", "type": "text", "path": "cacheStoreFactory.CacheJdbcBlobStoreFactory", "model": "user", @@ -470,6 +475,7 @@ }, { "label": "Data source bean", + "id": "dataSourceBean", "type": "text", "path": "cacheStoreFactory.CacheJdbcBlobStoreFactory", "model": "dataSourceBean", http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc29f79a/modules/control-center-web/src/main/js/controllers/models/clusters.json ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/models/clusters.json b/modules/control-center-web/src/main/js/controllers/models/clusters.json index a8884d2..67dbd33 100644 --- a/modules/control-center-web/src/main/js/controllers/models/clusters.json +++ b/modules/control-center-web/src/main/js/controllers/models/clusters.json @@ -29,11 +29,11 @@ "fields": [ { "label": "Name", + "id": "clusterName", "type": "text", "model": "name", "required": true, - "placeholder": "Input name", - "id": "clusterName" + "placeholder": "Input name" }, { "label": "Caches", http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc29f79a/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 3608ccb..27b2832 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 @@ -39,6 +39,6 @@ block content +groups('advanced', 'backupItem') +advanced-options-top .section - button.btn.btn-primary(ng-disabled='inputForm.$invalid' ng-click='saveItem()') Save - button.btn.btn-primary(ng-show='backupItem._id' ng-disabled='inputForm.$invalid' ng-click='saveItemAs()') Copy + button.btn.btn-primary(ng-click='saveItem()') Save + button.btn.btn-primary(ng-show='backupItem._id' ng-click='saveItemAs()') Copy button.btn.btn-primary(ng-show='backupItem._id' ng-click='removeItem()') Remove http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc29f79a/modules/control-center-web/src/main/js/views/includes/controls.jade ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/views/includes/controls.jade b/modules/control-center-web/src/main/js/views/includes/controls.jade index 4308eea..5c6adb5 100644 --- a/modules/control-center-web/src/main/js/views/includes/controls.jade +++ b/modules/control-center-web/src/main/js/views/includes/controls.jade @@ -136,7 +136,7 @@ mixin details-row .col-sm-8 +tipField('detail.tip') .input-tip - input.form-control(name='{{detail.model}}' type='number' ng-disabled=detailDisabled placeholder='{{::detail.placeholder}}' min='{{detail.min ? detail.min : 0}}' max='{{detail.max ? detail.max : Number.MAX_VALUE}}')&attributes(detailCommon) + input.form-control(id='{{::detail.id}}' name='{{detail.model}}' type='number' ng-disabled=detailDisabled placeholder='{{::detail.placeholder}}' min='{{detail.min ? detail.min : 0}}' max='{{detail.max ? detail.max : Number.MAX_VALUE}}')&attributes(detailCommon) +ico-exclamation('{{detail.model}}', 'min', 'Value is less than allowable minimum.') +ico-exclamation('{{detail.model}}', 'max', 'Value is more than allowable maximum.') +ico-exclamation('{{detail.model}}', 'number', 'Invalid value. Only numbers allowed.') @@ -145,8 +145,8 @@ mixin details-row .col-sm-8 +tipField('detail.tip') .input-tip - button.form-control(bs-select data-placeholder='{{::detail.placeholder}}' bs-options='item.value as item.label for item in {{detail.items}}' tabindex='0')&attributes(detailCommon) - div(ng-switch-when='dropdown-multiple') + button.form-control(id='{{::detail.id}}' bs-select data-placeholder='{{::detail.placeholder}}' bs-options='item.value as item.label for item in {{detail.items}}' tabindex='0')&attributes(detailCommon) + div(ng-switch-when='dropdown-multiple') label(class=lblDetailClasses ng-class='{required: detail.required}') {{::detail.label}}: .col-sm-8 +tipField('detail.tip') @@ -287,7 +287,7 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource) div(class=fieldClasses) +tipField('field.tip') .input-tip - input.form-control(name='{{field.model}}' type='number' ng-disabled=fieldDisabled placeholder='{{::field.placeholder}}' ng-focus='tableReset()' min='{{field.min ? field.min : 0}}' max='{{field.max ? field.max : Number.MAX_VALUE}}')&attributes(fieldCommon) + input.form-control(id='{{::field.id}}' name='{{field.model}}' type='number' ng-disabled=fieldDisabled placeholder='{{::field.placeholder}}' ng-focus='tableReset()' min='{{field.min ? field.min : 0}}' max='{{field.max ? field.max : Number.MAX_VALUE}}')&attributes(fieldCommon) +ico-exclamation('{{field.model}}', 'min', 'Value is less than allowable minimum.') +ico-exclamation('{{field.model}}', 'max', 'Value is more than allowable maximum.') +ico-exclamation('{{field.model}}', 'number', 'Invalid value. Only numbers allowed.') @@ -296,7 +296,7 @@ mixin form-row-custom(lblClasses, fieldClasses, dataSource) div(class=fieldClasses) +tipField('field.tip') .input-tip - button.form-control(bs-select ng-disabled=fieldDisabled data-placeholder='{{::field.placeholder}}' bs-options='item.value as item.label for item in {{field.items}}' tabindex='0')&attributes(fieldCommon) + button.form-control(id='{{::field.id}}' bs-select ng-disabled=fieldDisabled data-placeholder='{{::field.placeholder}}' bs-options='item.value as item.label for item in {{field.items}}' tabindex='0')&attributes(fieldCommon) div(ng-switch-when='dropdown-multiple' ng-hide=fieldHide) label(class=lblClasses ng-class=fieldRequiredClass) {{::field.label}}: div(class=fieldClasses)