Repository: ambari
Updated Branches:
  refs/heads/trunk bb6ba25f9 -> 74517116a


AMBARI-15436. Supportability: Create 'Reset UI' button in Ambari's experimental 
page. (Joe Wang via yusaku)


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

Branch: refs/heads/trunk
Commit: 74517116a666a5d9d72d27efb73c02309fca0b05
Parents: bb6ba25
Author: Yusaku Sako <yus...@hortonworks.com>
Authored: Fri Mar 18 17:15:34 2016 -0700
Committer: Yusaku Sako <yus...@hortonworks.com>
Committed: Fri Mar 18 17:15:34 2016 -0700

----------------------------------------------------------------------
 ambari-web/app/controllers/experimental.js   | 20 ++++++++++++++++++++
 ambari-web/app/mappers/server_data_mapper.js | 12 ++++++++++++
 ambari-web/app/messages.js                   |  5 ++++-
 ambari-web/app/templates/experimental.hbs    | 17 ++++++++++++++---
 4 files changed, 50 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/74517116/ambari-web/app/controllers/experimental.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/experimental.js 
b/ambari-web/app/controllers/experimental.js
index 9fa6da5..3642cd9 100644
--- a/ambari-web/app/controllers/experimental.js
+++ b/ambari-web/app/controllers/experimental.js
@@ -53,5 +53,25 @@ App.ExperimentalController = 
Em.Controller.extend(App.UserPref, {
 
   doCancel: function () {
     App.router.transitionTo('root.index');
+  },
+
+  doResetUIStates: function () {
+    var self = this;
+    return App.ModalPopup.show({
+      header: Em.I18n.t('reset.ui.states'),
+      bodyClass: Ember.View.extend({
+        template: Ember.Handlebars.compile(Em.I18n.t('reset.ui.states.body'))
+      }),
+      primary: Em.I18n.t('yes'),
+      onPrimary: function () {
+        var router = App.router;
+        App.db.cleanUp();
+        router.clearAllSteps();
+        App.cache.clear();
+        App.clusterStatus.setClusterStatus({});
+        this.hide();
+        router.transitionTo('root.index');
+      }
+    });
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/74517116/ambari-web/app/mappers/server_data_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/server_data_mapper.js 
b/ambari-web/app/mappers/server_data_mapper.js
index 1e08161..da25212 100644
--- a/ambari-web/app/mappers/server_data_mapper.js
+++ b/ambari-web/app/mappers/server_data_mapper.js
@@ -30,6 +30,18 @@ App.cache = {
   'currentConfigVersions': {}
 };
 
+App.cache.clear = function () {
+  var clear = App.cache.clear;
+  App.cache = {
+    'previousHostStatuses': {},
+    'previousComponentStatuses': {},
+    'previousComponentPassiveStates': {},
+    'services': [],
+    'currentConfigVersions': {}
+  };
+  App.cache.clear = clear;
+};
+
 App.ServerDataMapper = Em.Object.extend({
   jsonKey: false,
   map: function (json) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/74517116/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 9289fc2..421143a 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -3013,5 +3013,8 @@ Em.I18n.translations = {
   'admin.serviceAutoStart.save.popup.body': 'You are changing the auto-start 
configuration.' +
       'Click <b>Save</b> to commit the change or <b>Discard</b> to revert your 
changes',
   'admin.serviceAutoStart.save.popup.transition.title': 'Warning',
-  'admin.serviceAutoStart.save.popup.transition.body': 'You have unsaved 
changes'
+  'admin.serviceAutoStart.save.popup.transition.body': 'You have unsaved 
changes',
+
+  'reset.ui.states': 'Reset UI State',
+  'reset.ui.states.body': 'You should proceed only if the UI is misbehaving 
(such as incorrect navigation upon login, UI is stuck and won&apos;t load, 
etc.).  Are you sure you want to reset the UI state?'
 };

http://git-wip-us.apache.org/repos/asf/ambari/blob/74517116/ambari-web/app/templates/experimental.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/experimental.hbs 
b/ambari-web/app/templates/experimental.hbs
index 2873679..5fec5ca 100644
--- a/ambari-web/app/templates/experimental.hbs
+++ b/ambari-web/app/templates/experimental.hbs
@@ -48,12 +48,23 @@
                    {{/each}}
     </tbody>
     </table>
-    <div class="control-group" style="margin-bottom: 100px;">
-           <div class="controls pull-right">
+    <div class="control-group" style="margin-bottom: 70px;">
+        <div class="controls pull-right">
              <button class="btn" {{action doCancel target="controller"}}>{{t 
form.cancel}}</button>
              <button class="btn btn-primary" {{action doSave 
target="controller"}}>{{t common.save}}</button>
            </div>
-         </div>
+       </div>
+    <hr>
+    <div class="control-group" style="margin-bottom: 100px;">
+      {{#isAuthorized "CLUSTER.MANAGE_USER_PERSISTED_DATA"}}
+        <div class="controls pull-left" style="margin-bottom: 100px;">
+          <button class="btn btn-danger" {{action doResetUIStates 
target="controller"}}>{{t reset.ui.states}}</button>
+          <p class="pull-right" style="margin-left: 10px; padding-top: 5px;">
+              Reset UI state locally and on the server
+          </p>
+        </div>
+      {{/isAuthorized}}
+    </div>
   {{else}}
     <div class="alert alert-error">
       No application supports found. Please login to Ambari and revisit this 
page.

Reply via email to