ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject [05/41] ambari git commit: AMBARI-20665 Merge duplicated logic of Persist. (atkach)
Date Thu, 06 Apr 2017 09:33:26 GMT
AMBARI-20665 Merge duplicated logic of Persist. (atkach)


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

Branch: refs/heads/branch-3.0-perf
Commit: 1352fa908c5b07d5a8e44fa0b67da2beb382ba90
Parents: 88b82fe
Author: Andrii Tkach <atkach@apache.org>
Authored: Mon Apr 3 19:32:31 2017 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Thu Apr 6 12:32:56 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |   1 +
 ambari-web/app/controllers/application.js       |   2 +-
 ambari-web/app/controllers/experimental.js      |   2 +-
 .../global/errors_handler_controller.js         |   2 +-
 .../global/user_settings_controller.js          |   2 +-
 .../global/wizard_watcher_controller.js         |   2 +-
 ambari-web/app/controllers/installer.js         |   2 +-
 ambari-web/app/controllers/wizard.js            |   7 +-
 ambari-web/app/mixins.js                        |   3 +-
 ambari-web/app/mixins/common/persist.js         | 166 +++++++++++++++++++
 ambari-web/app/mixins/common/persist_mixin.js   |  45 -----
 ambari-web/app/mixins/common/userPref.js        | 126 --------------
 ambari-web/app/models/cluster_states.js         |   3 +-
 ambari-web/app/utils/ajax/ajax.js               |  24 +--
 ambari-web/app/utils/persist.js                 | 101 -----------
 .../configs/service_configs_by_category_view.js |   2 +-
 ambari-web/app/views/common/table_view.js       |   2 +-
 ambari-web/app/views/main/dashboard/widgets.js  |   2 +-
 .../app/views/main/service/info/summary.js      |   2 +-
 ambari-web/test/controllers/installer_test.js   |   4 +-
 .../test/controllers/main/service/item_test.js  |   2 +-
 ambari-web/test/controllers/wizard_test.js      |   4 +-
 ambari-web/test/mixins/common/persist_test.js   | 125 ++++++++++++++
 ambari-web/test/views/common/table_view_test.js |  14 +-
 .../test/views/main/dashboard/widgets_test.js   |   2 +-
 25 files changed, 328 insertions(+), 319 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 8859a29..ef8d0bc 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -186,6 +186,7 @@ var files = [
   'test/mixins/common/serverValidator_test',
   'test/mixins/common/table_server_view_mixin_test',
   'test/mixins/common/widget_mixin_test',
+  'test/mixins/common/persist_test',
   'test/mixins/main/host/details/host_components/decommissionable_test',
   'test/mixins/main/host/details/host_components/install_component_test',
   'test/mixins/main/service/configs/widget_popover_support_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/controllers/application.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/application.js b/ambari-web/app/controllers/application.js
index df0a8e8..580f337 100644
--- a/ambari-web/app/controllers/application.js
+++ b/ambari-web/app/controllers/application.js
@@ -19,7 +19,7 @@
 
 var App = require('app');
 
-App.ApplicationController = Em.Controller.extend(App.UserPref, {
+App.ApplicationController = Em.Controller.extend(App.Persist, {
 
   name: 'applicationController',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/controllers/experimental.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/experimental.js b/ambari-web/app/controllers/experimental.js
index bf5c529..f4e22ea 100644
--- a/ambari-web/app/controllers/experimental.js
+++ b/ambari-web/app/controllers/experimental.js
@@ -17,7 +17,7 @@
 
 var App = require('app');
 
-App.ExperimentalController = Em.Controller.extend(App.UserPref, {
+App.ExperimentalController = Em.Controller.extend(App.Persist, {
   name: 'experimentalController',
   supports: function () {
     return Em.keys(App.get('supports')).map(function (sup) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/controllers/global/errors_handler_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/errors_handler_controller.js b/ambari-web/app/controllers/global/errors_handler_controller.js
index c5b1067..966fcab 100644
--- a/ambari-web/app/controllers/global/errors_handler_controller.js
+++ b/ambari-web/app/controllers/global/errors_handler_controller.js
@@ -18,7 +18,7 @@
 
 var App = require('app');
 
-App.ErrorsHandlerController = Em.Controller.extend(App.UserPref, {
+App.ErrorsHandlerController = Em.Controller.extend(App.Persist, {
 
   name: 'errorsHandlerController',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/controllers/global/user_settings_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/user_settings_controller.js b/ambari-web/app/controllers/global/user_settings_controller.js
index e971cba..68d7e65 100644
--- a/ambari-web/app/controllers/global/user_settings_controller.js
+++ b/ambari-web/app/controllers/global/user_settings_controller.js
@@ -26,7 +26,7 @@ var timezoneUtils = require('utils/date/timezone');
  *
  * @class UserSettingsController
  */
-App.UserSettingsController = Em.Controller.extend(App.UserPref, {
+App.UserSettingsController = Em.Controller.extend(App.Persist, {
 
   name: 'userSettingsController',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/controllers/global/wizard_watcher_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/wizard_watcher_controller.js b/ambari-web/app/controllers/global/wizard_watcher_controller.js
index e2770fa..1562d7c 100644
--- a/ambari-web/app/controllers/global/wizard_watcher_controller.js
+++ b/ambari-web/app/controllers/global/wizard_watcher_controller.js
@@ -18,7 +18,7 @@
 
 var App = require('app');
 
-App.WizardWatcherController = Em.Controller.extend(App.UserPref, {
+App.WizardWatcherController = Em.Controller.extend(App.Persist, {
   name: 'wizardWatcherController',
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index 553ec43..0946ed8 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -21,7 +21,7 @@ var App = require('app');
 var stringUtils = require('utils/string_utils');
 var validator = require('utils/validator');
 
-App.InstallerController = App.WizardController.extend(App.UserPref, {
+App.InstallerController = App.WizardController.extend(App.Persist, {
 
   name: 'installerController',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index d9d05bc..49bdac6 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -18,7 +18,6 @@
 
 
 var App = require('app');
-var persistUtils = require('utils/persist');
 
 require('models/host');
 
@@ -915,7 +914,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
   loadServiceConfigProperties: function () {
     var dfd = $.Deferred();
     var self = this;
-    this.getPersistentProperty('serviceConfigProperties').always(function(data) {
+    this.getDecompressedData('serviceConfigProperties').always(function(data) {
       if (data && !data.error) {
         self.set('content.serviceConfigProperties', data);
       }
@@ -971,7 +970,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
     }, this);
     this.set('content.serviceConfigProperties', serviceConfigProperties);
     this.setDBProperty('fileNamesToUpdate', fileNamesToUpdate);
-    return this.setPersistentProperty('serviceConfigProperties', serviceConfigProperties);
+    return this.postCompressedData('serviceConfigProperties', serviceConfigProperties);
   },
 
   isExcludedConfig: function (configProperty) {
@@ -1436,7 +1435,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
 
   clearServiceConfigProperties: function() {
     this.get('content.serviceConfigProperties', null);
-    return this.removePersistentProperty('serviceConfigProperties');
+    return this.postCompressedData('serviceConfigProperties', '');
   },
 
   saveTasksStatuses: function (tasksStatuses) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/mixins.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins.js b/ambari-web/app/mixins.js
index 4fdfa54..06c69f7 100644
--- a/ambari-web/app/mixins.js
+++ b/ambari-web/app/mixins.js
@@ -23,8 +23,7 @@ require('mixins/common/blueprint');
 require('mixins/common/kdc_credentials_controller_mixin');
 require('mixins/common/localStorage');
 require('mixins/common/infinite_scroll_mixin');
-require('mixins/common/persist_mixin');
-require('mixins/common/userPref');
+require('mixins/common/persist');
 require('mixins/common/reload_popup');
 require('mixins/common/serverValidator');
 require('mixins/common/table_server_view_mixin');

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/mixins/common/persist.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/persist.js b/ambari-web/app/mixins/common/persist.js
new file mode 100644
index 0000000..4475112
--- /dev/null
+++ b/ambari-web/app/mixins/common/persist.js
@@ -0,0 +1,166 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+var LZString = require('utils/lz-string');
+
+/**
+ * Small mixin for processing user preferences
+ * Provide methods to save/load some values in <code>persist</code> storage
+ * Save available only for admin users!
+ * When using this mixin you should redeclare methods:
+ * <ul>
+ *   <li>getUserPrefSuccessCallback</li>
+ *   <li>getUserPrefErrorCallback</li>
+ *   <li>postUserPrefSuccessCallback</li>
+ *   <li>postUserPrefErrorCallback</li>
+ * </ul>
+ * @type {Em.Mixin}
+ */
+App.Persist = Em.Mixin.create({
+
+  /**
+   * Additional to request data
+   * @type {object}
+   */
+  additionalData: {},
+
+  /**
+   * Get persist value from server with persistKey
+   * @param {String} key
+   */
+  getUserPref: function(key) {
+    return App.ajax.send({
+      name: 'persist.get',
+      sender: this,
+      data: {
+        key: key,
+        data: this.get('additionalData')
+      },
+      success: 'getUserPrefSuccessCallback',
+      error: 'getUserPrefErrorCallback'
+    });
+  },
+
+  /**
+   *
+   * @param {string} key
+   * @returns {$.Deferred}
+   */
+  getDecompressedData: function(key) {
+    var dfd = $.Deferred();
+    App.ajax.send({
+      name: 'persist.get.text',
+      sender: this,
+      data: {
+        key: key
+      }
+    }).always(function(data, textStatus, error) {
+      if (data && typeof data === 'string') {
+        dfd.resolve(JSON.parse(LZString.decompressFromBase64(data)));
+      } else {
+        dfd.reject({error: error});
+      }
+    });
+    return dfd.promise();
+  },
+
+  /**
+   * Should be redefined in objects that use this mixin
+   * @param {*} response
+   * @param {Object} request
+   * @param {Object} data
+   * @returns {*}
+   */
+  getUserPrefSuccessCallback: function (response, request, data) {},
+
+  /**
+   * Should be redefined in objects that use this mixin
+   * @param {Object} request
+   * @param {Object} ajaxOptions
+   * @param {String} error
+   */
+  getUserPrefErrorCallback: function (request, ajaxOptions, error) {},
+
+  /**
+   * Post persist key/value to server, value is object
+   * Only for admin users!
+   * @param {String} key
+   * @param {Object} value
+   */
+  postUserPref: function (key, value) {
+    if (!App.isAuthorized('CLUSTER.MANAGE_USER_PERSISTED_DATA')) {
+      return $.Deferred().reject().promise();
+    }
+    var keyValuePair = {};
+    keyValuePair[key] = JSON.stringify(value);
+    return this.post(keyValuePair);
+  },
+
+  /**
+   *
+   * @param {string} key
+   * @param {Object} value
+   * @returns {$.ajax}
+   */
+  postCompressedData: function (key, value) {
+    var keyValuePair = {};
+    keyValuePair[key] = !Em.isEmpty(value) ? LZString.compressToBase64(JSON.stringify(value))
: '';
+    return this.post(keyValuePair);
+  },
+
+  post: function(keyValuePair) {
+    return App.ajax.send({
+      'name': 'persist.post',
+      'sender': this,
+      'beforeSend': 'postUserPrefBeforeSend',
+      'data': {
+        'keyValuePair': keyValuePair
+      },
+      'success': 'postUserPrefSuccessCallback',
+      'error': 'postUserPrefErrorCallback'
+    });
+  },
+
+  /**
+   * Should be redefined in objects that use this mixin
+   * @param {*} response
+   * @param {Object} request
+   * @param {Object} data
+   * @returns {*}
+   */
+  postUserPrefSuccessCallback: function (response, request, data) {},
+
+  /**
+   * Should be redefined in objects that use this mixin
+   * @param {Object} request
+   * @param {Object} ajaxOptions
+   * @param {String} error
+   */
+  postUserPrefErrorCallback: function(request, ajaxOptions, error) {},
+
+  /**
+   * Little log before post request
+   * @param {Object} request
+   * @param {Object} ajaxOptions
+   * @param {Object} data
+   */
+  postUserPrefBeforeSend: function(request, ajaxOptions, data){
+  }
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/mixins/common/persist_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/persist_mixin.js b/ambari-web/app/mixins/common/persist_mixin.js
deleted file mode 100644
index 0b81364..0000000
--- a/ambari-web/app/mixins/common/persist_mixin.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-var persistUtils = require('utils/persist');
-
-App.Persist = Em.Mixin.create({
-
-  persistNamespace: function() {
-    var name = this.get('name');
-    if (Em.isNone(name)) {
-      name = this.get('controller.name');
-    }
-    return name.capitalize().replace('Controller', '');
-  }.property('name'),
-
-  getPersistentProperty: function(key) {
-    return persistUtils.get(this.get('persistNamespace') + '__' + key);
-  },
-
-  setPersistentProperty: function(key, value) {
-    return persistUtils.put(this.get('persistNamespace') + '__' + key, value);
-  },
-
-  removePersistentProperty: function(key) {
-    return persistUtils.remove(this.get('persistNamespace') + '__' + key);
-  }
-
-
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/mixins/common/userPref.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/userPref.js b/ambari-web/app/mixins/common/userPref.js
deleted file mode 100644
index 54afe4a..0000000
--- a/ambari-web/app/mixins/common/userPref.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-
-/**
- * Small mixin for processing user preferences
- * Provide methods to save/load some values in <code>persist</code> storage
- * Save available only for admin users!
- * When using this mixin you should redeclare methods:
- * <ul>
- *   <li>getUserPrefSuccessCallback</li>
- *   <li>getUserPrefErrorCallback</li>
- *   <li>postUserPrefSuccessCallback</li>
- *   <li>postUserPrefErrorCallback</li>
- * </ul>
- * @type {Em.Mixin}
- */
-App.UserPref = Em.Mixin.create({
-
-  /**
-   * Additional to request data
-   * @type {object}
-   */
-  additionalData: {},
-
-  /**
-   * Get persist value from server with persistKey
-   * @param {String} key
-   */
-  getUserPref: function(key) {
-    return App.ajax.send({
-      name: 'settings.get.user_pref',
-      sender: this,
-      data: {
-        key: key,
-        data: this.get('additionalData')
-      },
-      success: 'getUserPrefSuccessCallback',
-      error: 'getUserPrefErrorCallback'
-    });
-  },
-
-  /**
-   * Should be redeclared in objects that use this mixin
-   * @param {*} response
-   * @param {Object} request
-   * @param {Object} data
-   * @returns {*}
-   */
-  getUserPrefSuccessCallback: function (response, request, data) {},
-
-  /**
-   * Should be redeclared in objects that use this mixin
-   * @param {Object} request
-   * @param {Object} ajaxOptions
-   * @param {String} error
-   */
-  getUserPrefErrorCallback: function (request, ajaxOptions, error) {},
-
-  /**
-   * Post persist key/value to server, value is object
-   * Only for admin users!
-   * @param {String} key
-   * @param {Object} value
-   */
-  postUserPref: function (key, value) {
-    if (!App.isAuthorized('CLUSTER.MANAGE_USER_PERSISTED_DATA')) {
-      return $.Deferred().reject().promise();
-    }
-    var keyValuePair = {};
-    keyValuePair[key] = JSON.stringify(value);
-    return App.ajax.send({
-      'name': 'settings.post.user_pref',
-      'sender': this,
-      'beforeSend': 'postUserPrefBeforeSend',
-      'data': {
-        'keyValuePair': keyValuePair
-      },
-      'success': 'postUserPrefSuccessCallback',
-      'error': 'postUserPrefErrorCallback'
-    });
-  },
-
-  /**
-   * Should be redeclared in objects that use this mixin
-   * @param {*} response
-   * @param {Object} request
-   * @param {Object} data
-   * @returns {*}
-   */
-  postUserPrefSuccessCallback: function (response, request, data) {},
-
-  /**
-   * Should be redeclared in objects that use this mixin
-   * @param {Object} request
-   * @param {Object} ajaxOptions
-   * @param {String} error
-   */
-  postUserPrefErrorCallback: function(request, ajaxOptions, error) {},
-
-  /**
-   * Little log before post request
-   * @param {Object} request
-   * @param {Object} ajaxOptions
-   * @param {Object} data
-   */
-  postUserPrefBeforeSend: function(request, ajaxOptions, data){
-  }
-
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/models/cluster_states.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/cluster_states.js b/ambari-web/app/models/cluster_states.js
index cbc134d..f111c3a 100644
--- a/ambari-web/app/models/cluster_states.js
+++ b/ambari-web/app/models/cluster_states.js
@@ -16,9 +16,8 @@
  * limitations under the License.
  */
 var App = require('app');
-require('mixins/common/userPref');
 var LZString = require('utils/lz-string');
-App.clusterStatus = Em.Object.create(App.UserPref, {
+App.clusterStatus = Em.Object.create(App.Persist, {
 
   /**
    * Cluster name

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index e8be31c..2d157fe 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1350,20 +1350,6 @@ var urls = {
       };
     }
   },
-  'settings.get.user_pref': {
-    'real': '/persist/{key}',
-    'mock': '/data/user_settings/{key}.json'
-  },
-  'settings.post.user_pref': {
-    'real': '/persist',
-    'mock': '',
-    'type': 'POST',
-    'format': function (data) {
-      return {
-        data: JSON.stringify(data.keyValuePair)
-      }
-    }
-  },
   'cluster.load_cluster_name': {
     'real': '/clusters?fields=Clusters/security_type',
     'mock': '/data/clusters/info.json'
@@ -2200,7 +2186,7 @@ var urls = {
     'mock': '/data/requests/host_check/1.json'
   },
 
-  'persist.get': {
+  'persist.get.text': {
     'real': '/persist/{key}',
     'mock': '',
     'type': 'GET',
@@ -2210,7 +2196,13 @@ var urls = {
       }
     }
   },
-  'persist.put': {
+
+  'persist.get': {
+    'real': '/persist/{key}',
+    'mock': '',
+    'type': 'GET'
+  },
+  'persist.post': {
     'real': '/persist',
     'mock': '',
     'type': 'POST',

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/utils/persist.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/persist.js b/ambari-web/app/utils/persist.js
deleted file mode 100644
index 3d3164f..0000000
--- a/ambari-web/app/utils/persist.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var LZString = require('utils/lz-string');
-/**
- * Persist storage managing utils. It helps to put and get values from persisted storage
- * by api (/api/v1/persist).
- * @type {Object}
- */
-module.exports = {
-  /**
-   * Get item from persist storage by key and optional path.
-   *
-   * @param  {String} key persist key to get e.g 'CLUSTER_STATUS', will fetch data from
-   * /api/v1/persist/CLUSTER_STATUS
-   * @param  {String} [path=null] Em.get compatible attributes path
-   * @return {$.Deferred}
-   */
-  get: function(key, path) {
-    var dfd = $.Deferred();
-    App.ajax.send({
-      name: 'persist.get',
-      sender: this,
-      data: {
-        deferred: dfd,
-        key: key || '',
-        path: path
-      },
-      success: 'getSuccessCallback',
-      error: 'getErrorCallback'
-    });
-    return dfd.promise();
-  },
-
-  getSuccessCallback: function(data, xhr, params) {
-    var extracted, response = data;
-    try {
-      response = JSON.parse(response);
-    } catch(e) { }
-    if (Em.isEmpty(data)) {
-      params.deferred.resolve(null);
-      return;
-    }
-    if (typeof response === 'string') {
-      extracted = JSON.parse(LZString.decompressFromBase64(response));
-      params.deferred.resolve(params.path ? Em.get(extracted, params.path) : extracted);
-    } else {
-      params.deferred.resolve(response);
-    }
-  },
-
-  getErrorCallback: function(request, ajaxOptions, error, opt, params) {
-    params.deferred.reject({
-      request: request,
-      error: error
-    });
-  },
-
-  /**
-   * Update key value.
-   *
-   * @param  {String} key
-   * @param  {Object} value value to save
-   * @return {$.Deferred}
-   */
-  put: function(key, value) {
-    var kv = {};
-    kv[key] = !Em.isEmpty(value) ? LZString.compressToBase64(JSON.stringify(value)) : '';
-    return App.ajax.send({
-      name: 'persist.put',
-      sender: this,
-      data: {
-        keyValuePair: kv
-      },
-      success: 'putSuccessCallback',
-      error: 'putErrorCallback'
-    });
-  },
-
-  putSuccessCallback: function() {},
-  putErrorCallback: function() {},
-
-  remove: function(key) {
-    return this.put(key, '');
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/views/common/configs/service_configs_by_category_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_configs_by_category_view.js b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
index 16c828c..4058020 100644
--- a/ambari-web/app/views/common/configs/service_configs_by_category_view.js
+++ b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
@@ -21,7 +21,7 @@ var App = require('app');
 var validator = require('utils/validator');
 require('utils/configs/modification_handlers/modification_handler');
 
-App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverridable, {
+App.ServiceConfigsByCategoryView = Em.View.extend(App.Persist, App.ConfigOverridable, {
 
   templateName: require('templates/common/configs/service_config_category'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/views/common/table_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/table_view.js b/ambari-web/app/views/common/table_view.js
index c394d47..e14d283 100644
--- a/ambari-web/app/views/common/table_view.js
+++ b/ambari-web/app/views/common/table_view.js
@@ -19,7 +19,7 @@
 var App = require('app');
 var filters = require('views/common/filter_view');
 
-App.TableView = Em.View.extend(App.UserPref, {
+App.TableView = Em.View.extend(App.Persist, {
 
   init: function() {
     this.set('filterConditions', []);

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/views/main/dashboard/widgets.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets.js b/ambari-web/app/views/main/dashboard/widgets.js
index 16840a5..2850200 100644
--- a/ambari-web/app/views/main/dashboard/widgets.js
+++ b/ambari-web/app/views/main/dashboard/widgets.js
@@ -28,7 +28,7 @@ const WidgetObject = Em.Object.extend({
   isVisible: true
 });
 
-App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, App.TimeRangeMixin,
{
+App.MainDashboardWidgetsView = Em.View.extend(App.Persist, App.LocalStorage, App.TimeRangeMixin,
{
   name: 'mainDashboardWidgetsView',
   templateName: require('templates/main/dashboard/widgets'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index 378a8b3..551a3fd 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -21,7 +21,7 @@ var misc = require('utils/misc');
 require('views/main/service/service');
 require('data/service_graph_config');
 
-App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, App.TimeRangeMixin, {
+App.MainServiceInfoSummaryView = Em.View.extend(App.Persist, App.TimeRangeMixin, {
   templateName: require('templates/main/service/info/summary'),
   /**
    * @property {Number} chunkSize - number of columns in Metrics section

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/test/controllers/installer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/installer_test.js b/ambari-web/test/controllers/installer_test.js
index 74556e8..d936ffc 100644
--- a/ambari-web/test/controllers/installer_test.js
+++ b/ambari-web/test/controllers/installer_test.js
@@ -787,12 +787,12 @@ describe('App.InstallerController', function () {
 
   describe('#loadServiceConfigProperties', function() {
     beforeEach(function () {
-      sinon.stub(installerController, 'getPersistentProperty').returns($.Deferred().resolve({
+      sinon.stub(installerController, 'getDecompressedData').returns($.Deferred().resolve({
         value: 2
       }).promise());
     });
     afterEach(function () {
-      installerController.getPersistentProperty.restore();
+      installerController.getDecompressedData.restore();
     });
     it ('Should load service config property', function() {
       installerController.loadServiceConfigProperties();

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index 69a02de..7f50620 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -20,7 +20,7 @@ App = require('app');
 require('ember');
 require('models/host_component');
 require('views/common/modal_popup');
-require('mixins/common/userPref');
+require('mixins/common/persist');
 require('controllers/application');
 require('controllers/global/background_operations_controller');
 require('controllers/global/cluster_controller');

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/test/controllers/wizard_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard_test.js b/ambari-web/test/controllers/wizard_test.js
index 922cc90..1a00f24 100644
--- a/ambari-web/test/controllers/wizard_test.js
+++ b/ambari-web/test/controllers/wizard_test.js
@@ -1055,7 +1055,7 @@ describe('App.WizardController', function () {
       sinon.stub(c, 'setDBProperty', Em.K);
       sinon.stub(c, 'setDBProperties', Em.K);
       sinon.stub(c, 'getDBProperty').withArgs('fileNamesToUpdate').returns([]);
-      sinon.stub(c, 'setPersistentProperty', Em.K);
+      sinon.stub(c, 'postCompressedData', Em.K);
       sinon.stub(App.config, 'shouldSupportFinal').returns(true);
     });
 
@@ -1063,7 +1063,7 @@ describe('App.WizardController', function () {
       c.setDBProperty.restore();
       c.setDBProperties.restore();
       c.getDBProperty.restore();
-      c.setPersistentProperty.restore();
+      c.postCompressedData.restore();
       App.config.shouldSupportFinal.restore();
     });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/test/mixins/common/persist_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/persist_test.js b/ambari-web/test/mixins/common/persist_test.js
new file mode 100644
index 0000000..592d9b7
--- /dev/null
+++ b/ambari-web/test/mixins/common/persist_test.js
@@ -0,0 +1,125 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+var testHelpers = require('test/helpers');
+var LZString = require('utils/lz-string');
+
+describe('App.Persist', function () {
+  var mixin;
+
+  beforeEach(function () {
+    mixin = Em.Object.create(App.Persist, {
+      additionalData: {}
+    });
+  });
+
+  describe('#getUserPref', function() {
+
+    it('App.ajax.send should be called', function() {
+      mixin.getUserPref('foo');
+      var args = testHelpers.findAjaxRequest('name', 'persist.get');
+      expect(args[0]).to.be.eql({
+        name: 'persist.get',
+        sender: mixin,
+        data: {
+          key: 'foo',
+          data: {}
+        },
+        success: 'getUserPrefSuccessCallback',
+        error: 'getUserPrefErrorCallback'
+      });
+    });
+  });
+
+  describe('#getDecompressedData', function() {
+
+    it('App.ajax.send should be called', function() {
+      mixin.getDecompressedData('foo');
+      var args = testHelpers.findAjaxRequest('name', 'persist.get.text');
+      expect(args[0]).to.be.eql({
+        name: 'persist.get.text',
+        sender: mixin,
+        data: {
+          key: 'foo'
+        }
+      });
+    });
+  });
+
+  describe('#post', function() {
+
+    it('App.ajax.send should be called', function() {
+      mixin.post({"foo": "bar"});
+      var args = testHelpers.findAjaxRequest('name', 'persist.post');
+      expect(args[0]).to.be.eql({
+        'name': 'persist.post',
+        'sender': mixin,
+        'beforeSend': 'postUserPrefBeforeSend',
+        'data': {
+          'keyValuePair': {"foo": "bar"}
+        },
+        'success': 'postUserPrefSuccessCallback',
+        'error': 'postUserPrefErrorCallback'
+      });
+    });
+  });
+
+  describe('#postUserPref', function() {
+    beforeEach(function() {
+      sinon.stub(mixin, 'post');
+      this.mockAuthorize = sinon.stub(App, 'isAuthorized');
+    });
+    afterEach(function() {
+      mixin.post.restore();
+      this.mockAuthorize.restore();
+    });
+
+    it('post should be called when authorized', function() {
+      this.mockAuthorize.withArgs('CLUSTER.MANAGE_USER_PERSISTED_DATA').returns(true);
+      mixin.postUserPref('foo', {"foo": "bar"});
+      expect(mixin.post.calledWith({'foo': '{"foo":"bar"}'})).to.be.true;
+    });
+
+    it('post should not be called when authorized', function() {
+      this.mockAuthorize.withArgs('CLUSTER.MANAGE_USER_PERSISTED_DATA').returns(false);
+      mixin.postUserPref('foo', {"foo": "bar"});
+      expect(mixin.post.called).to.be.false;
+    });
+  });
+
+  describe('#postCompressedData', function() {
+    beforeEach(function() {
+      sinon.stub(mixin, 'post');
+      sinon.stub(LZString, 'compressToBase64', function(args) {return args;})
+    });
+    afterEach(function() {
+      mixin.post.restore();
+      LZString.compressToBase64.restore();
+    });
+
+    it('post should be called with object value', function() {
+      mixin.postCompressedData('foo', {"foo": "bar"});
+      expect(mixin.post.calledWith({'foo': '{"foo":"bar"}'})).to.be.true;
+    });
+    it('post should be called with empty value', function() {
+      mixin.postCompressedData('foo', null);
+      expect(mixin.post.calledWith({'foo': ''})).to.be.true;
+    });
+  });
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/test/views/common/table_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/table_view_test.js b/ambari-web/test/views/common/table_view_test.js
index 3d11e30..439fac4 100644
--- a/ambari-web/test/views/common/table_view_test.js
+++ b/ambari-web/test/views/common/table_view_test.js
@@ -21,7 +21,7 @@ require('utils/db');
 require('views/common/filter_view');
 require('views/common/sort_view');
 require('mixins');
-require('mixins/common/userPref');
+require('mixins/common/persist');
 require('views/common/table_view');
 
 function getView() {
@@ -60,7 +60,7 @@ describe('App.TableView', function () {
   describe('#updatePaging', function() {
 
     beforeEach(function() {
-      view = App.TableView.create(App.UserPref, {
+      view = App.TableView.create(App.Persist, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -88,7 +88,7 @@ describe('App.TableView', function () {
   describe('#endIndex', function() {
 
     beforeEach(function() {
-      view = App.TableView.create(App.UserPref, {
+      view = App.TableView.create(App.Persist, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -130,7 +130,7 @@ describe('App.TableView', function () {
   describe('#pageContent', function() {
 
     beforeEach(function() {
-      view = App.TableView.create(App.UserPref, {
+      view = App.TableView.create(App.Persist, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -175,7 +175,7 @@ describe('App.TableView', function () {
   describe('#filtersUsedCalc', function() {
 
     beforeEach(function() {
-      view = App.TableView.create(App.UserPref, {
+      view = App.TableView.create(App.Persist, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -209,7 +209,7 @@ describe('App.TableView', function () {
   describe('#nextPage', function() {
 
     beforeEach(function() {
-      view = App.TableView.create(App.UserPref, {
+      view = App.TableView.create(App.Persist, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -249,7 +249,7 @@ describe('App.TableView', function () {
   describe('#previousPage', function() {
 
     beforeEach(function() {
-      view = App.TableView.create(App.UserPref, {
+      view = App.TableView.create(App.Persist, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 50,

http://git-wip-us.apache.org/repos/asf/ambari/blob/1352fa90/ambari-web/test/views/main/dashboard/widgets_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets_test.js b/ambari-web/test/views/main/dashboard/widgets_test.js
index 4700ac8..6e8a6eb 100644
--- a/ambari-web/test/views/main/dashboard/widgets_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets_test.js
@@ -19,7 +19,7 @@
 
 var App = require('app');
 require('messages');
-require('mixins/common/userPref');
+require('mixins/common/persist');
 require('mixins/common/localStorage');
 require('views/main/dashboard/widgets');
 


Mime
View raw message