ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject ignite git commit: IGNITE-843 Hide reset button if nothing to reset.
Date Mon, 14 Sep 2015 08:36:33 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 050968083 -> cefd00952


IGNITE-843 Hide reset button if nothing to reset.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cefd0095
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cefd0095
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cefd0095

Branch: refs/heads/ignite-843
Commit: cefd009525dcabf7a625afcfe42162b350560ca7
Parents: 0509680
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Mon Sep 14 15:37:13 2015 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Mon Sep 14 15:37:13 2015 +0700

----------------------------------------------------------------------
 .../main/js/controllers/caches-controller.js    |  9 ++++
 .../main/js/controllers/clusters-controller.js  |  9 ++++
 .../src/main/js/controllers/common-module.js    | 47 +++++++++++++++++---
 .../main/js/controllers/metadata-controller.js  |  9 ++++
 .../src/main/js/views/includes/controls.jade    |  2 +-
 5 files changed, 70 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cefd0095/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 a0862ee..db8ee4f 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
@@ -566,6 +566,15 @@ controlCenterModule.controller('cachesController', [
                 );
             };
 
+            $scope.resetItemVisible = function (group) {
+                var resetTo = $scope.selectedItem;
+
+                if (!$common.isDefined(resetTo))
+                    resetTo = prepareNewItem();
+
+                return $common.resetItemVisible(group, $scope.backupItem, resetTo);
+            };
+
             $scope.resetItem = function (group) {
                 var resetTo = $scope.selectedItem;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/cefd0095/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 0009069..4f5a46d 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
@@ -485,6 +485,15 @@ controlCenterModule.controller('clustersController', ['$scope', '$controller',
'
             );
         };
 
+        $scope.resetItemVisible = function (group) {
+            var resetTo = $scope.selectedItem;
+
+            if (!$common.isDefined(resetTo))
+                resetTo = prepareNewItem();
+
+            return $common.resetItemVisible(group, $scope.backupItem, resetTo);
+        };
+
         $scope.resetItem = function (group) {
             var resetTo = $scope.selectedItem;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/cefd0095/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 7c1fc48..0c33785 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
@@ -483,12 +483,11 @@ controlCenterModule.service('$common', [
             var newPopover = $popover(el, {content: message});
 
             $timeout(function () {
-                // Workaround for FireFox browser.
-                newPopover.$options.container;
+                if (isDefined(newPopover.$options.container)) {
+                    newPopover.show();
 
-                newPopover.show();
-
-                popover = newPopover;
+                    popover = newPopover;
+                }
             }, 100);
 
             $timeout(function () { newPopover.hide() }, 5000);
@@ -704,6 +703,44 @@ controlCenterModule.service('$common', [
 
                 document.body.removeChild(file);
             },
+            resetItemVisible: function (group, curItem, srcItem) {
+                function _compareField(field) {
+                    var curModel = getModel(curItem, field);
+                    var srcModel = getModel(srcItem, field);
+
+                    if (field.model == 'kind' && isDefined(curModel.kind)) {
+                        if (curModel.kind != srcModel.kind)
+                            return true;
+
+                        if (_compareFields(field.details[curModel.kind].fields))
+                            return true;
+                    }
+
+                    var curValue = curModel[field.model];
+                    var srcValue = srcModel[field.model];
+
+                    var isCur = isDefined(curValue);
+                    var isSrc = isDefined(srcValue);
+
+                    if ((isCur && !isSrc) || (!isCur && isSrc) || (isCur
&& isSrc && !_.isEqual(curValue, srcValue)))
+                        return true;
+
+                    return false;
+                }
+
+                function _compareFields(fields) {
+                    for (var fldIx = 0; fldIx < fields.length; fldIx++) {
+                        var field = fields[fldIx];
+
+                        if (_compareField(field))
+                            return true;
+                    }
+
+                    return false;
+                }
+
+                return _compareFields(group.fields);
+            },
             resetItem: function (backupItem, selectedItem, groups, group) {
                 function restoreFields(fields) {
                     // Reset fields by one.

http://git-wip-us.apache.org/repos/asf/ignite/blob/cefd0095/modules/control-center-web/src/main/js/controllers/metadata-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/metadata-controller.js b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
index 0a9b456..c151054 100644
--- a/modules/control-center-web/src/main/js/controllers/metadata-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
@@ -1152,6 +1152,15 @@ controlCenterModule.controller('metadataController', [
                 $scope.ui.markDirty();
             };
 
+            $scope.resetItemVisible = function (group) {
+                var resetTo = $scope.selectedItem;
+
+                if (!$common.isDefined(resetTo))
+                    resetTo = prepareNewItem();
+
+                return $common.resetItemVisible(group, $scope.backupItem, resetTo);
+            };
+
             $scope.resetItem = function (group) {
                 var resetTo = $scope.selectedItem;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/cefd0095/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 569c28b..92746f1 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
@@ -444,7 +444,7 @@ mixin groups(groups, dataSource)
             label(id='{{::group.group + "-title"}}')
             i.tipLabel.fa.fa-question-circle(ng-if='group.tip' bs-tooltip='joinTip(group.tip)'
type='button')
             i.tipLabel.fa.fa-question-circle.blank(ng-if='!group.tip')
-            i.pull-right.fa.fa-undo(ng-click='resetItem(group.group);$event.stopPropagation()'
bs-tooltip data-title='Undo unsaved changes')
+            i.pull-right.fa.fa-undo(ng-show='resetItemVisible(group)' ng-click='resetItem(group.group);$event.stopPropagation()'
bs-tooltip data-title='Undo unsaved changes')
         .panel-collapse(role='tabpanel' bs-collapse-target id='{{::group.group}}' number='{{::group.number}}')
             .panel-body
                 .col-sm-6(id='{{::group.group + "-left"}}')


Mime
View raw message