ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [42/45] git commit: AMBARI-7061 Config History: View, Compare, and Make Current buttons should be disabled in certain cases. (atkach)
Date Thu, 28 Aug 2014 17:50:17 GMT
AMBARI-7061 Config History: View, Compare, and Make Current buttons should be disabled in certain
cases. (atkach)


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

Branch: refs/heads/branch-alerts-dev
Commit: 86d4083972567347c0092288e9a131d4e9a7e705
Parents: c4f1e16
Author: atkach <atkach@hortonworks.com>
Authored: Thu Aug 28 19:27:32 2014 +0300
Committer: atkach <atkach@hortonworks.com>
Committed: Thu Aug 28 19:27:32 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/messages.js                          |  3 +++
 ambari-web/app/models/service_config_version.js     | 16 +++++++++++++++-
 ambari-web/app/styles/application.less              |  4 ++++
 .../common/configs/config_history_flow.hbs          | 12 ++++++------
 4 files changed, 28 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/86d40839/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 36bfa10..11c2015 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2004,6 +2004,9 @@ Em.I18n.translations = {
   'dashboard.configHistory.info-bar.makeCurrent.popup.title': 'Make Current Confirmation',
   'dashboard.configHistory.info-bar.save.popup.placeholder': 'What did you change?',
   'dashboard.configHistory.info-bar.revert.button': 'Make current',
+  'dashboard.configHistory.info-bar.view.button.disabled': 'You are currently viewing this
version.',
+  'dashboard.configHistory.info-bar.compare.button.disabled': 'You cannot compare against
the same version.',
+  'dashboard.configHistory.info-bar.revert.button.disabled': 'This is the current version.',
 
 
   'timeRange.presets.1hour':'1h',

http://git-wip-us.apache.org/repos/asf/ambari/blob/86d40839/ambari-web/app/models/service_config_version.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service_config_version.js b/ambari-web/app/models/service_config_version.js
index 807d76f..93da4aa 100644
--- a/ambari-web/app/models/service_config_version.js
+++ b/ambari-web/app/models/service_config_version.js
@@ -56,7 +56,21 @@ App.ServiceConfigVersion = DS.Model.extend({
   isRequested: DS.attr('boolean'),
   isRestartRequired: function () {
     return this.get('service.isRestartRequired') && this.get('isCurrent');
-  }.property('service.isRestartRequired', 'isCurrent')
+  }.property('service.isRestartRequired', 'isCurrent'),
+  disabledActionMessages: function () {
+    return {
+      view: (this.get('isDisplayed')) ? Em.I18n.t('dashboard.configHistory.info-bar.view.button.disabled')
: '',
+      compare: (this.get('isDisplayed')) ? Em.I18n.t('dashboard.configHistory.info-bar.compare.button.disabled')
: '',
+      revert: (this.get('isCurrent')) ? Em.I18n.t('dashboard.configHistory.info-bar.revert.button.disabled')
: ''
+    }
+  }.property('isDisplayed', 'isCurrent'),
+  disabledActionAttr: function () {
+    return {
+      view: (this.get('isDisplayed')) ? 'disabled' : false,
+      compare: (this.get('isDisabled') || this.get('isDisplayed')) ? 'disabled' : false,
+      revert: (this.get('isDisabled') || this.get('isCurrent')) ? 'disabled' : false
+    }
+  }.property('isDisplayed', 'isCurrent', 'isDisabled')
 });
 
 App.ServiceConfigVersion.FIXTURES = [];

http://git-wip-us.apache.org/repos/asf/ambari/blob/86d40839/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 0570220..a5843eb 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -6808,6 +6808,10 @@ i.icon-asterisks {
   border: 0;
 }
 
+.not-allowed-cursor {
+  cursor: not-allowed !important;
+}
+
 #flume-summary {
   text-align:left !important;
   max-height: 490px;

http://git-wip-us.apache.org/repos/asf/ambari/blob/86d40839/ambari-web/app/templates/common/configs/config_history_flow.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/config_history_flow.hbs b/ambari-web/app/templates/common/configs/config_history_flow.hbs
index 55e622f..5dabe52 100644
--- a/ambari-web/app/templates/common/configs/config_history_flow.hbs
+++ b/ambari-web/app/templates/common/configs/config_history_flow.hbs
@@ -44,9 +44,9 @@
               <div class="notes">{{serviceVersion.briefNotes}}</div>
             </div>
             <div>
-              <button class="btn" {{action switchVersion serviceVersion target="view"}}><i
class="icon-search"></i>&nbsp;{{t common.view}}</button>
-              <button class="btn" {{bindAttr disabled="serviceVersion.isDisabled"}} {{action
compare serviceVersion target="view"}}><i class="icon-copy"></i>&nbsp;{{t
common.compare}}</button>
-              <button class="btn" {{bindAttr disabled="serviceVersion.isDisabled"}} {{action
revert serviceVersion target="view"}}>{{t dashboard.configHistory.info-bar.revert.button}}</button>
+                <button {{bindAttr disabled="serviceVersion.disabledActionAttr.view" class=":btn
serviceVersion.isDisplayed:not-allowed-cursor" title="serviceVersion.disabledActionMessages.view"}}
{{action switchVersion serviceVersion target="view"}}><i class="icon-search"></i>&nbsp;{{t
common.view}}</button>
+                <button {{bindAttr disabled="serviceVersion.disabledActionAttr.compare"
class=":btn serviceVersion.isDisplayed:not-allowed-cursor" title="serviceVersion.disabledActionMessages.compare"}}
{{action compare serviceVersion target="view"}}><i class="icon-copy"></i>&nbsp;{{t
common.compare}}</button>
+                <button {{bindAttr disabled="serviceVersion.disabledActionAttr.revert"
class=":btn serviceVersion.isCurrent:not-allowed-cursor" title="serviceVersion.disabledActionMessages.revert"}}
{{action revert serviceVersion target="view"}}>{{t dashboard.configHistory.info-bar.revert.button}}</button>
             </div>
           </div>
         </div>
@@ -99,9 +99,9 @@
                                     <div class="notes">{{serviceVersion.briefNotes}}</div>
                                 </div>
                                 <div>
-                                    <button class="btn" {{action switchVersion serviceVersion
target="view"}}><i class="icon-search"></i>&nbsp;{{t common.view}}</button>
-                                    <button class="btn" {{bindAttr disabled="serviceVersion.isDisabled"}}
{{action compare serviceVersion target="view"}}><i class="icon-copy"></i>&nbsp;{{t
common.compare}}</button>
-                                    <button class="btn" {{bindAttr disabled="serviceVersion.isDisabled"}}
{{action revert serviceVersion target="view"}}>{{t dashboard.configHistory.info-bar.revert.button}}</button>
+                                    <button {{bindAttr disabled="serviceVersion.disabledActionAttr.view"
class=":btn serviceVersion.isDisplayed:not-allowed-cursor" title="serviceVersion.disabledActionMessages.view"}}
{{action switchVersion serviceVersion target="view"}}><i class="icon-search"></i>&nbsp;{{t
common.view}}</button>
+                                    <button {{bindAttr disabled="serviceVersion.disabledActionAttr.compare"
class=":btn serviceVersion.isDisplayed:not-allowed-cursor" title="serviceVersion.disabledActionMessages.compare"}}
{{action compare serviceVersion target="view"}}><i class="icon-copy"></i>&nbsp;{{t
common.compare}}</button>
+                                    <button {{bindAttr disabled="serviceVersion.disabledActionAttr.revert"
class=":btn serviceVersion.isCurrent:not-allowed-cursor" title="serviceVersion.disabledActionMessages.revert"}}
{{action revert serviceVersion target="view"}}>{{t dashboard.configHistory.info-bar.revert.button}}</button>
                                 </div>
                             </ul>
                         </li>


Mime
View raw message