ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiw...@apache.org
Subject [1/2] git commit: AMBARI-5605. Usability UX: Default key actions for dialog boxes.(xiwang)
Date Wed, 07 May 2014 18:54:33 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 9eb4aaa23 -> 3f929c697


AMBARI-5605. Usability UX: Default key actions for dialog boxes.(xiwang)


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

Branch: refs/heads/trunk
Commit: 3f929c697eb7b0d25e64de14e32852c8aa77b014
Parents: 6d2743b
Author: Xi Wang <xiwang@apache.org>
Authored: Mon Apr 28 17:13:22 2014 -0700
Committer: Xi Wang <xiwang@apache.org>
Committed: Wed May 7 11:53:44 2014 -0700

----------------------------------------------------------------------
 ambari-web/app/styles/application.less     |  5 +++--
 ambari-web/app/views/application.js        | 29 ++++++++++++++++++++++++-
 ambari-web/app/views/common/modal_popup.js |  1 +
 3 files changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3f929c69/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 7599c7f..22f50a2 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+
 @space-s: 5px;
 @space-m: 10px;
 @space-l: 20px;
@@ -129,6 +130,7 @@ footer {
       background-image: -webkit-linear-gradient(top, @top-nav-bg-color-from, @top-nav-bg-color-to);
       background-image: -o-linear-gradient(top, @top-nav-bg-color-from, @top-nav-bg-color-to);
       background-image: linear-gradient(to bottom, @top-nav-bg-color-from, @top-nav-bg-color-to);
+      filter: progid:DXImageTransform.Microsoft.gradient(startColorstr= @top-nav-bg-color-from,
endColorstr=@top-nav-bg-color-to); //for IE9-
       -webkit-box-shadow: inset 0 0 0 rgba(0, 0, 0, 0.1), 0 1px 10px rgba(0, 0, 0, 0.1);
       -moz-box-shadow: inset 0 0 0 rgba(0, 0, 0, 0.1), 0 1px 10px rgba(0, 0, 0, 0.1);
       box-shadow: inset 0 0 0 rgba(0, 0, 0, 0.1), 0 1px 10px rgba(0, 0, 0, 0.1);
@@ -156,7 +158,7 @@ footer {
     .brand.cluster-name {
       margin-left: 10px;
 
-      .operations-count {
+      .label.operations-count {
         background-color: #006DCC;
         -webkit-animation-name: greenPulse;
         -webkit-animation-duration: 1s;
@@ -167,7 +169,6 @@ footer {
         animation-name: greenPulse;
         animation-duration: 1s;
         animation-iteration-count: infinite;
-        //margin: 2px;
       }
       .label  {
          padding: 3px 5px 3px;

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f929c69/ambari-web/app/views/application.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/application.js b/ambari-web/app/views/application.js
index d0a7950..afe38f2 100644
--- a/ambari-web/app/views/application.js
+++ b/ambari-web/app/views/application.js
@@ -20,5 +20,32 @@
 var App = require('app');
 
 App.ApplicationView = Em.View.extend({
-    templateName: require('templates/application')
+  templateName: require('templates/application'),
+
+  didInsertElement: function () {
+    // on 'Enter' pressed, trigger modal window primary button if primary button is enabled(green)
+    // on 'Esc' pressed, close the modal
+    $(document).keydown(function(event){
+      if (event.which == 13 || event.keyCode == 13 ) {
+        var primaryButton = $(document).find('#modal > .modal-footer > .btn-success').first();
+        if (primaryButton.length > 0 && primaryButton.attr('disabled') != 'disabled')
{
+          event.preventDefault();
+          primaryButton.click();
+          return false;
+        }
+      }
+      return true;
+    });
+    $(document).keyup(function(event){
+      if (event.which == 27 || event.keyCode == 27) {
+        var closeButton = $(document).find('#modal > .modal-header > .close').first();
+        if (closeButton.length > 0) {
+          event.preventDefault();
+          closeButton.click();
+          return false;
+        }
+      }
+      return true;
+    });
+  }
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f929c69/ambari-web/app/views/common/modal_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popup.js b/ambari-web/app/views/common/modal_popup.js
index c8ed229..9be6050 100644
--- a/ambari-web/app/views/common/modal_popup.js
+++ b/ambari-web/app/views/common/modal_popup.js
@@ -169,6 +169,7 @@ App.showConfirmationFeedBackPopup = function (primary, bodyMessage, secondary)
{
       this.set('disablePrimary', true);
       this.set('disableSecondary', true);
       this.set('statusMessage', Em.I18n.t('popup.confirmationFeedBack.sending'));
+      this.hide();
       primary(this.get('query'));
     },
     statusMessage: function () {


Mime
View raw message