Browse Source

Revert "AMBARI-3746. Some clean up for previous commits. (xiwang)"

This reverts commit 5fe89e76bac17cf6d53fa51d2ea106cfa9fbb54b.
Yusaku Sako 11 years ago
parent
commit
4b84ed171d

+ 37 - 38
ambari-web/app/controllers/application.js

@@ -58,59 +58,58 @@ App.ApplicationController = Em.Controller.extend({
   },
   },
   persistKey: function () {
   persistKey: function () {
     var loginName = App.router.get('loginName');
     var loginName = App.router.get('loginName');
-    return 'app-settings-show-bg-' + loginName;
+    return 'admin-settings-show-bg-' + loginName;
   },
   },
   currentPrefObject: null,
   currentPrefObject: null,
-
   /**
   /**
    * get persist value from server with persistKey
    * get persist value from server with persistKey
    */
    */
-  getUserPref: function(key){
-    App.ajax.send({
-      name: 'settings.get.user_pref',
-      sender: this,
-      data: {
-        key: key
-      },
-      success: 'getUserPrefSuccessCallback',
-      error: 'getUserPrefErrorCallback'
-    });
-  },
-  getUserPrefSuccessCallback: function (response, request, data) {
-    if (response != null) {
-      console.log('Got persist value from server with key ' + data.key + '. Value is: ' + response);
-      this.set('currentPrefObject', response);
-      return response;
-    }
-  },
-  getUserPrefErrorCallback: function (request, ajaxOptions, error) {
-    // this user is first time login
-    if (request.status == 404) {
-      console.log('Persist did NOT find the key');
-      this.set('currentPrefObject', null);
-      return null;
-    }
+  getUserPref: function (key) {
+    var self = this;
+    var url = App.apiPrefix + '/persist/' + key;
+    jQuery.ajax(
+      {
+        url: url,
+        context: this,
+        async: false,
+        success: function (response) {
+          if (response) {
+            var value = jQuery.parseJSON(response);
+            console.log('Got persist value from server with key: ' + key + '. Value is: ' + response);
+            self.set('currentPrefObject', value);
+            return value;
+          }
+        },
+        error: function (xhr) {
+          // this user is first time login
+          if (xhr.status == 404) {
+            console.log('Persist did NOT find the key: '+ key);
+            self.set('currentPrefObject', null);
+            return null;
+          }
+        },
+        statusCode: require('data/statusCodes')
+      }
+    );
   },
   },
-
   /**
   /**
    * post persist key/value to server, value is object
    * post persist key/value to server, value is object
    */
    */
   postUserPref: function (key, value) {
   postUserPref: function (key, value) {
+    var url = App.apiPrefix + '/persist/';
     var keyValuePair = {};
     var keyValuePair = {};
     keyValuePair[key] = JSON.stringify(value);
     keyValuePair[key] = JSON.stringify(value);
-    App.ajax.send({
-      'name': 'settings.post.user_pref',
-      'sender': this,
-      'beforeSend': 'postUserPrefBeforeSend',
-      'data': {
-        'keyValuePair': keyValuePair
+    jQuery.ajax({
+      async: false,
+      context: this,
+      type: "POST",
+      url: url,
+      data: JSON.stringify(keyValuePair),
+      beforeSend: function () {
+        console.log('BeforeSend to persist: persistKeyValues', keyValuePair);
       }
       }
     });
     });
   },
   },
-  postUserPrefBeforeSend: function(request, ajaxOptions, data){
-    console.log('BeforeSend to persist: persistKeyValues', data.keyValuePair);
-  },
-
   showSettingsPopup: function() {
   showSettingsPopup: function() {
     var self = this;
     var self = this;
     var initValue = this.loadShowBgChecked();
     var initValue = this.loadShowBgChecked();

+ 1 - 1
ambari-web/app/controllers/wizard/step3_controller.js

@@ -562,7 +562,7 @@ App.WizardStep3Controller = Em.Controller.extend({
     });
     });
     if (hostsContext.length > 0) { // warning exist
     if (hostsContext.length > 0) { // warning exist
       var repoWarning = {
       var repoWarning = {
-        name:  Em.I18n.t('installer.step3.hostWarningsPopup.repositories.name'),
+        name: 'Repository for OS not available',
         hosts: hostsContext,
         hosts: hostsContext,
         category: 'repositories',
         category: 'repositories',
         onSingleHost: false
         onSingleHost: false

+ 1 - 2
ambari-web/app/messages.js

@@ -348,7 +348,7 @@ Em.I18n.translations = {
   'installer.step3.hosts.remove.popup.body':'Are you sure you want to remove the selected host(s)?',
   'installer.step3.hosts.remove.popup.body':'Are you sure you want to remove the selected host(s)?',
   'installer.step3.hostInformation.popup.header':'Error in retrieving host Information',
   'installer.step3.hostInformation.popup.header':'Error in retrieving host Information',
   'installer.step3.hostInformation.popup.body' : 'All bootstrapped hosts registered but unable to retrieve cpu and memory related information',
   'installer.step3.hostInformation.popup.body' : 'All bootstrapped hosts registered but unable to retrieve cpu and memory related information',
-  'installer.step3.hostOsTypeCheck.popup.body' : 'Host registered successfully, but the host operating system type NOT match the selected group in "Select Stack" step: Advanced Repository Option. You can go back to "Select Stack" step OR remove this host.' +
+  'installer.step3.hostOsTypeCheck.popup.body' : 'Host registered successfully, but the host operating system type NOT match the selected group in step 1:Advanced Repository Option.<br> You can go back to step 1 OR remove this host. <br>' +
     'The host type is {0}, but you selected group {1} in step 1.',
     'The host type is {0}, but you selected group {1} in step 1.',
   'installer.step3.hostWarningsPopup.report':'Show Report',
   'installer.step3.hostWarningsPopup.report':'Show Report',
   'installer.step3.hostWarningsPopup.report.header': '<p style="font-family: monospace">######################################<br># Host Checks Report<br>#<br># Generated: ',
   'installer.step3.hostWarningsPopup.report.header': '<p style="font-family: monospace">######################################<br># Host Checks Report<br>#<br># Generated: ',
@@ -366,7 +366,6 @@ Em.I18n.translations = {
     '<div class="alert alert-warn"><b>Note</b>: To clean up in interactive mode, remove <b>--silent</b> option. To clean up all resources, including <i>users</i>, remove <b>--skip=users</b> option. Use <b>--help</b> for a list of available options.</div>',
     '<div class="alert alert-warn"><b>Note</b>: To clean up in interactive mode, remove <b>--silent</b> option. To clean up all resources, including <i>users</i>, remove <b>--skip=users</b> option. Use <b>--help</b> for a list of available options.</div>',
   'installer.step3.hostWarningsPopup.summary':'{0} on {1}',
   'installer.step3.hostWarningsPopup.summary':'{0} on {1}',
   'installer.step3.hostWarningsPopup.firewall':'Firewall Issues',
   'installer.step3.hostWarningsPopup.firewall':'Firewall Issues',
-  'installer.step3.hostWarningsPopup.repositories.name':'Repository for OS not available',
   'installer.step3.hostWarningsPopup.repositories':'Repositories Issues',
   'installer.step3.hostWarningsPopup.repositories':'Repositories Issues',
   'installer.step3.hostWarningsPopup.repositories.context':'Host ({0}) has a {1} OS type, But the repositories chosen in "Select Stack" step was {2}.',
   'installer.step3.hostWarningsPopup.repositories.context':'Host ({0}) has a {1} OS type, But the repositories chosen in "Select Stack" step was {2}.',
   'installer.step3.hostWarningsPopup.repositories.message':'The following registered hosts have different Operating System types from the local repositories chosen in "Select Stack" step. You can go back to "Select Stack" step to select another os group OR remove related host.',
   'installer.step3.hostWarningsPopup.repositories.message':'The following registered hosts have different Operating System types from the local repositories chosen in "Select Stack" step. You can go back to "Select Stack" step to select another os group OR remove related host.',

+ 1 - 1
ambari-web/app/templates/common/modal_popup.hbs

@@ -49,7 +49,7 @@
       <div class="modal-footer">
       <div class="modal-footer">
         {{#if view.hasFooterCheckbox}}
         {{#if view.hasFooterCheckbox}}
           <label id="footer-checkbox">{{view Ember.Checkbox classNames="checkbox" checkedBinding="view.isNotShowBgChecked"}} &nbsp;
           <label id="footer-checkbox">{{view Ember.Checkbox classNames="checkbox" checkedBinding="view.isNotShowBgChecked"}} &nbsp;
-          {{t app.settings.notShowBgOperations}}</label>
+          {{t admin.userSettings.notShowBgOperations}}</label>
         {{/if}}
         {{/if}}
         {{#if view.secondary}}
         {{#if view.secondary}}
           <a class="btn" {{action onSecondary target="view"}}>{{view.secondary}}</a>
           <a class="btn" {{action onSecondary target="view"}}>{{view.secondary}}</a>

+ 1 - 22
ambari-web/app/utils/ajax.js

@@ -556,7 +556,7 @@ var urls = {
     'type': 'GET',
     'type': 'GET',
     'format': function (data, opt) {
     'format': function (data, opt) {
       return {
       return {
-        data: data.data
+        async: false
       };
       };
     }
     }
   },
   },
@@ -856,27 +856,6 @@ var urls = {
     'real': '/clusters/{cluster}/requests/{requestId}?fields=tasks/*',
     'real': '/clusters/{cluster}/requests/{requestId}?fields=tasks/*',
     'mock': '/data/wizard/{mock}'
     'mock': '/data/wizard/{mock}'
   },
   },
-  'settings.get.user_pref': {
-    'real': '/persist/{key}',
-    'mock': '',
-    'type': 'GET',
-    'format': function (data, opt) {
-      return {
-        async: false
-      };
-    }
-  },
-  'settings.post.user_pref': {
-    'real': '/persist',
-    'mock': '',
-    'type': 'POST',
-    'format': function (data) {
-      return {
-        async: false,
-        data: JSON.stringify(data.keyValuePair)
-      }
-    }
-  },
   'wizard.advanced_repositories.valid_url': {
   'wizard.advanced_repositories.valid_url': {
     'real': '/stacks2/{stackName}/versions/{stackVersion}/operatingSystems/{osType}/repositories/{nameVersionCombo}',
     'real': '/stacks2/{stackName}/versions/{stackVersion}/operatingSystems/{osType}/repositories/{nameVersionCombo}',
     'mock': '',
     'mock': '',