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/14 13:30:07 UTC
[3/3] incubator-ignite git commit: IGNITE-843: Validation with
popover for cluster screen.
IGNITE-843: Validation with popover for 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/3a1c1529
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3a1c1529
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3a1c1529
Branch: refs/heads/ignite-843
Commit: 3a1c1529d6fe7a8425cd53042e21a0f16fddd8e7
Parents: 14287f6
Author: AKuznetsov <ak...@gridgain.com>
Authored: Fri Aug 14 18:30:17 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Fri Aug 14 18:30:17 2015 +0700
----------------------------------------------------------------------
.../main/js/controllers/clusters-controller.js | 68 +++++++++++++++-----
.../src/main/js/controllers/common-module.js | 16 +++--
.../src/main/js/public/stylesheets/style.scss | 1 +
.../js/views/configuration/metadata-load.jade | 2 +-
.../src/main/js/views/includes/controls.jade | 6 +-
5 files changed, 68 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a1c1529/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 6c2ead5..98f8c90 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,8 +15,8 @@
* limitations under the License.
*/
-controlCenterModule.controller('clustersController', ['$scope', '$http', '$popover', '$common', '$focus', '$confirm', '$copy', '$table',
- function ($scope, $http, $popover, $common, $focus, $confirm, $copy, $table) {
+controlCenterModule.controller('clustersController', ['$scope', '$http', '$popover', '$timeout', '$common', '$focus', '$confirm', '$copy', '$table',
+ function ($scope, $http, $popover, $timeout, $common, $focus, $confirm, $copy, $table) {
$scope.joinTip = $common.joinTip;
$scope.getModel = $common.getModel;
@@ -222,30 +222,64 @@ controlCenterModule.controller('clustersController', ['$scope', '$http', '$popov
});
};
- $scope.popover = {
- "title": "Title",
- "content": "Hello Popover<br />This is a multiline message!"
- };
+ var popover = null;
+
+ function showPopoverMessage(panelIndex, id, message) {
+ $common.ensureActivePanel($scope.panels, panelIndex);
+
+ var el = $('body').find('#' + id);
+
+ if (popover)
+ popover.hide();
+
+ var newPopover = $popover(el, {content: message});
+
+ $timeout(function () {
+ $focus(id);
+ }, 50);
+
+ $timeout(function () {
+ newPopover.show();
+
+ popover = newPopover;
+ }, 100);
+
+ $timeout(function () { newPopover.hide() }, 3000);
+
+ return false;
+ }
// Check cluster logical consistency.
function validate(item) {
- if ($common.isEmptyString(item.name)) {
- $common.ensureActivePanel($scope.panels, 0);
+ if ($common.isEmptyString(item.name))
+ return showPopoverMessage(0, 'clusterName', 'Name should not be empty');
- var el = $('body').find('#clusterName');
+ if (item.discovery.kind == 'Vm' && item.discovery.Vm.addresses.length == 0)
+ return showPopoverMessage(0, 'addresses', 'Addresses are not specified');
- var myPopover = $popover(el, {content: 'Name should not be empty'});
+ if (item.discovery.kind == 'S3' && $common.isEmptyString(item.discovery.S3.bucketName))
+ return showPopoverMessage(0, 'bucketName', 'Bucket name should not be empty');
- myPopover.$promise.then(function () {
- myPopover.show();
+ if (item.discovery.kind == 'Cloud') {
+ if ($common.isEmptyString(item.discovery.Cloud.identity))
+ return showPopoverMessage(0, 'identity', 'Identity should not be empty');
- $focus('clusterName');
- });
+ if ($common.isEmptyString(item.discovery.Cloud.provider))
+ return showPopoverMessage(0, 'provider', 'Provider should not be empty');
+ }
+
+ if (item.discovery.kind == 'GoogleStorage') {
+ if ($common.isEmptyString(item.discovery.GoogleStorage.projectName))
+ return showPopoverMessage(0, 'projectName', 'Project name should not be empty');
+
+ if ($common.isEmptyString(item.discovery.GoogleStorage.bucketName))
+ return showPopoverMessage(0, 'bucketName', 'Bucket name should not be empty');
- //window.setInterval(function() { myPopover.hide() }, 3000)
+ if ($common.isEmptyString(item.discovery.GoogleStorage.serviceAccountP12FilePath))
+ return showPopoverMessage(0, 'serviceAccountP12FilePath', 'Private key path should not be empty');
- //return $common.showError('Name should not be empty!', 'zzz', '#div_to_show');
- return false;
+ if ($common.isEmptyString(item.discovery.GoogleStorage.accountId))
+ return showPopoverMessage(0, 'accountId', 'Account ID should not be empty');
}
if (!item.swapSpaceSpi || !item.swapSpaceSpi.kind && item.caches) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a1c1529/modules/control-center-web/src/main/js/controllers/common-module.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js
index 2ead841..7c15038 100644
--- a/modules/control-center-web/src/main/js/controllers/common-module.js
+++ b/modules/control-center-web/src/main/js/controllers/common-module.js
@@ -943,16 +943,24 @@ controlCenterModule.directive('retainSelection', function ($timeout) {
});
// Factory function to focus element.
-controlCenterModule.factory('$focus', function ($timeout, $window) {
+controlCenterModule.factory('$focus', function ($timeout) {
return function (id) {
// Timeout makes sure that is invoked after any other event has been triggered.
// E.g. click events that need to run before the focus or inputs elements that are
// in a disabled state but are enabled when those events are triggered.
$timeout(function () {
- var elem = $window.document.getElementById(id);
+ var elem = $('#' + id);
- if (elem)
- elem.focus();
+ if (elem.length > 0) {
+ var offset = elem.offset();
+
+ if(offset.top < window.pageYOffset)
+ $('html, body').animate({
+ scrollTop: offset.top - 20
+ }, 10);
+
+ elem[0].focus();
+ }
});
};
});
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a1c1529/modules/control-center-web/src/main/js/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/public/stylesheets/style.scss b/modules/control-center-web/src/main/js/public/stylesheets/style.scss
index 5debf53..28a3de7 100644
--- a/modules/control-center-web/src/main/js/public/stylesheets/style.scss
+++ b/modules/control-center-web/src/main/js/public/stylesheets/style.scss
@@ -919,6 +919,7 @@ button .caret, .btn .caret {
.popover {
color: $ignite-red;
+ max-width: 400px;
}
.popover-content {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a1c1529/modules/control-center-web/src/main/js/views/configuration/metadata-load.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/metadata-load.jade b/modules/control-center-web/src/main/js/views/configuration/metadata-load.jade
index 5768a7d..05ae0e4 100644
--- a/modules/control-center-web/src/main/js/views/configuration/metadata-load.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/metadata-load.jade
@@ -24,7 +24,7 @@ include ../includes/controls
h4.modal-title Load metadata from database
.metadata-download(ng-show='loadMeta.action == "download"')
|Connection to Web Agent is not established!<br/><br/>
- |How to extract metadata from database:
+ |How to load metadata from database:
ul
li Download Web Agent.
li Unzip Web Agent to some folder.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3a1c1529/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 e57e085..74f11a0 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
@@ -128,7 +128,7 @@ mixin details-row
.col-sm-8
+tipField('detail.tip')
.input-tip
- input.form-control(type='text' placeholder='{{::detail.placeholder}}')&attributes(detailCommon)
+ input.form-control(id='{{::detail.model}}' type='text' placeholder='{{::detail.placeholder}}')&attributes(detailCommon)
div(ng-switch-when='number')
label(class=lblDetailClasses ng-class='{required: detail.required}') {{::detail.label}}:
.col-sm-8
@@ -151,7 +151,7 @@ mixin details-row
.input-tip
button.form-control(bs-select data-multiple='1' data-placeholder='{{::detail.placeholder}}' bs-options='item.value as item.label for item in {{detail.items}}')&attributes(detailCommon)
.section(ng-switch-when='table-simple')&attributes(detailCommon)
- .col-sm-12.group
+ .col-sm-12.group(id='{{::detail.model}}')
.group-legend
label {{::detail.label}}:
+group-tip('detail.tableTip')
@@ -435,7 +435,7 @@ mixin group(title, fields, dataSource)
+form-row(dataSource)
mixin groups(groups, dataSource)
- .panel.panel-default(ng-repeat='group in #{groups}')
+ .panel.panel-default(ng-repeat='group in #{groups}' ng-click='triggerDigest=true')
.panel-heading
h3
a(bs-collapse-toggle) {{::group.label}}