Updated Branches: refs/heads/trunk dac8ff8b1 -> 6001f062c
AMBARI-3576 Common "get" and "set" methods. (atkach) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/6001f062 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/6001f062 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/6001f062 Branch: refs/heads/trunk Commit: 6001f062c821c6bff28c5abe3f140d16512ece51 Parents: dac8ff8 Author: atkach <[email protected]> Authored: Tue Oct 22 18:41:27 2013 +0300 Committer: atkach <[email protected]> Committed: Tue Oct 22 18:41:27 2013 +0300 ---------------------------------------------------------------------- ambari-web/app/controllers/wizard.js | 20 ++++++++++++++++++++ ambari-web/app/utils/db.js | 12 ++++++++++++ 2 files changed, 32 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6001f062/ambari-web/app/controllers/wizard.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js index 583793e..c1be65b 100644 --- a/ambari-web/app/controllers/wizard.js +++ b/ambari-web/app/controllers/wizard.js @@ -38,6 +38,26 @@ App.WizardController = Em.Controller.extend({ } }, + dbNamespace: function(){ + return this.get('name').capitalize().replace('Controller', ""); + }.property('name'), + /** + * get property from local storage + * @param key + * @return {*} + */ + getDBProperty: function(key){ + return App.db.get(this.get('dbNamespace'), key); + }, + /** + * set property to local storage + * @param key + * @param value + */ + setDBProperty: function(key, value){ + App.db.set(this.get('dbNamespace'), key, value); + }, + setStepsEnable: function () { for (var i = 1; i <= this.totalSteps; i++) { var step = this.get('isStepDisabled').findProperty('step', i); http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6001f062/ambari-web/app/utils/db.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js index ddec85a..3102e09 100644 --- a/ambari-web/app/utils/db.js +++ b/ambari-web/app/utils/db.js @@ -88,6 +88,18 @@ if (localStorage.getObject('ambari') == null) { App.db.cleanUp(); } +App.db.get = function (namespace, key) { + console.log('TRACE: Entering db:get' + key); + App.db.data = localStorage.getObject('ambari'); + return App.db.data[namespace][key]; +}; + +App.db.set = function (namespace, key, value) { + console.log('TRACE: Entering db:set' + key + ';value: ' + value); + App.db.data = localStorage.getObject('ambari'); + App.db.data[namespace][key] = value; + localStorage.setObject('ambari', App.db.data); +}; /* * setter methods */
