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 2015/08/04 05:46:28 UTC
incubator-ignite git commit: IGNITE-843 Added support for focus and
enter/esc for detailed tables on cluster screen.
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-843 b52a7dc02 -> 69f3c170e
IGNITE-843 Added support for focus and enter/esc for detailed tables on cluster screen.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/69f3c170
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/69f3c170
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/69f3c170
Branch: refs/heads/ignite-843
Commit: 69f3c170e99efe4501fbd9bdfb636f33c3082f88
Parents: b52a7dc
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Aug 4 10:46:12 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Aug 4 10:46:12 2015 +0700
----------------------------------------------------------------------
.../main/js/controllers/clusters-controller.js | 27 +++++++++++++-------
.../src/main/js/views/includes/controls.jade | 4 +--
2 files changed, 20 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/69f3c170/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 bcbdac2..64588d8 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
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-controlCenterModule.controller('clustersController', ['$scope', '$http', '$common', '$confirm', '$copy', '$table', function ($scope, $http, $common, $confirm, $copy, $table) {
+controlCenterModule.controller('clustersController', ['$scope', '$http', '$common', '$focus', '$confirm', '$copy', '$table', function ($scope, $http, $common, $focus, $confirm, $copy, $table) {
$scope.joinTip = $common.joinTip;
$scope.getModel = $common.getModel;
@@ -95,6 +95,18 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$commo
{value: 'JdkMarshaller', label: 'JdkMarshaller'}
];
+ var simpleTables = {
+ addresses: {msg: 'Such IP address already exists!', id: 'IpAddress'},
+ regions: {msg: 'Such region already exists!', id: 'Region'},
+ zones: {msg: 'Such zone already exists!', id: 'Zone'}
+ };
+
+ function focusInvalidField(index, id) {
+ $focus(index < 0 ? 'new' + id : 'cur' + id);
+
+ return false;
+ }
+
$scope.tableSimpleValid = function (item, field, val, index) {
var model = $common.getModel(item, field)[field.model];
@@ -103,16 +115,13 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$commo
// Found duplicate.
if (idx >= 0 && idx != index) {
- var msg = 'Such IP address already exists!';
-
- if (field.model == 'regions')
- msg = 'Such region already exists!';
- if (field.model == 'zones')
- msg = 'Such zone already exists!';
+ var simpleTable = simpleTables[field.model];
- $common.showError(msg);
+ if (simpleTable) {
+ $common.showError(simpleTable.msg);
- return false;
+ return focusInvalidField(index, simpleTable.id);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/69f3c170/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 7ca9017..acee1d4 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
@@ -155,12 +155,12 @@ mixin details-row
label.labelField {{$index + 1}})
+btn-save('tableSimpleSaveVisible(curValue)', 'tableSimpleSave(tableSimpleValid, backupItem, detail, curValue, $index)')
.input-tip.form-group.has-feedback
- input.form-control(id='{{::detail.focusCurItemId}}' name='{{detail.model}}.edit' type='text' ng-model='curValue' placeholder='{{::detail.placeholder}}' on-escape='tableReset()')&attributes(customValidators)
+ input.form-control(id='{{::detail.focusCurItemId}}' name='{{detail.model}}.edit' type='text' ng-model='curValue' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, detail, curValue, $index)' on-escape='tableReset()')&attributes(customValidators)
+ico-exclamation('{{detail.model}}.edit', 'ipaddress', 'Invalid address, see help for format description.')
button.btn.btn-primary.fieldButton(ng-disabled='!newValue' ng-click='tableSimpleSave(tableSimpleValid, backupItem, detail, newValue, -1)') Add
+tipField('detail.tip')
.input-tip.form-group.has-feedback
- input.form-control(name='{{detail.model}}' type='text' ng-model='newValue' ng-focus='tableNewItem(detail)' placeholder='{{::detail.placeholder}}')&attributes(customValidators)
+ input.form-control(name='{{detail.model}}' type='text' ng-model='newValue' ng-focus='tableNewItem(detail)' placeholder='{{::detail.placeholder}}' on-enter='tableSimpleSave(tableSimpleValid, backupItem, detail, newValue, -1)' on-escape='tableReset()')&attributes(customValidators)
+ico-exclamation('{{detail.model}}', 'ipaddress', 'Invalid address, see help for format description.')
mixin table-db-field-edit(databaseName, databaseType, javaName, javaType, focusId, index)