From e6cbd2e8442b41eed6d90c9182228d0242a99436 Mon Sep 17 00:00:00 2001 From: Vincent Fournier Date: Thu, 30 Jul 2015 16:02:21 -0400 Subject: [PATCH] Rename config.json => defaultLayoutConfig.json Change-Id: I6365ab3e0da0c98a0be6a8f12420973e9896297f --- .../authentication/authentication.js | 2 +- app/components/config/config.js | 38 +++++++++---------- .../{config.json => defaultLayoutConfig.json} | 0 app/components/surveil/surveil.js | 2 +- app/routing_view/routing_view.js | 2 +- app/templates/config/config.js | 4 +- 6 files changed, 24 insertions(+), 24 deletions(-) rename app/components/config/{config.json => defaultLayoutConfig.json} (100%) diff --git a/app/components/authentication/authentication.js b/app/components/authentication/authentication.js index 4472a90..67c8662 100644 --- a/app/components/authentication/authentication.js +++ b/app/components/authentication/authentication.js @@ -67,7 +67,7 @@ angular.module('bansho.authentication', []) session.create(data.access.token.id, data.access.token.expires); $http.defaults.headers.common['X-Auth-Token'] = session.sessionId; - configManager.fetchConfig(configManager.getDevelopmentConfig().useStoredConfig).then(function () { + configManager.fetchLayoutConfig(configManager.getDevelopmentConfig().useStoredConfig).then(function () { themeManager.setTheme(configManager.getTheme()); $location.path('/view'); }, function (message) { diff --git a/app/components/config/config.js b/app/components/config/config.js index c9d480d..8384c82 100644 --- a/app/components/config/config.js +++ b/app/components/config/config.js @@ -89,7 +89,7 @@ angular.module('bansho.config', []) .service('configManager', ['$http', '$q', 'componentsConfig', 'surveilConfig', function ($http, $q, componentsConfig, surveilConfig) { - var config = {}, + var layoutConfig = {}, developmentConfig = {}; this.loadDevelopmentConfig = function() { @@ -114,37 +114,37 @@ angular.module('bansho.config', []) }; this.getConfigData = function (templateName) { - return config.data[templateName]; + return layoutConfig.data[templateName]; }; - this.readConfig = function () { - return config.data; + this.readLayoutConfig = function () { + return layoutConfig.data; }; - this.saveConfig = function(configuration) { - config.data = configuration; - saveConfig(); + this.saveLayoutConfig = function(configuration) { + layoutConfig.data = configuration; + saveLayoutConfig(); }; this.setThemeAndSave = function (theme) { - config.data.banshoConfig.theme = theme; - saveConfig(); + layoutConfig.data.banshoConfig.theme = theme; + saveLayoutConfig(); }; this.getTheme = function () { var theme; - if (config.data) { - theme = config.data.banshoConfig.theme; + if (layoutConfig.data) { + theme = layoutConfig.data.banshoConfig.theme; } return theme; }; - var saveConfig = function () { + var saveLayoutConfig = function () { var responsePromise = $q.defer(); - $http.post(surveilConfig.endpoint('config'), JSON.stringify(config.data)) + $http.post(surveilConfig.endpoint('appConfig'), JSON.stringify(layoutConfig.data)) .success(function () { responsePromise.resolve(); }) @@ -155,19 +155,19 @@ angular.module('bansho.config', []) return responsePromise.promise; }; - this.fetchConfig = function (useStoredConfig) { + this.fetchLayoutConfig = function (useStoredConfig) { var responsePromise = $q.defer(); componentsConfig.load(); - $http.get(surveilConfig.endpoint('config')) + $http.get(surveilConfig.endpoint('appConfig')) .success(function (conf) { if (!useStoredConfig || jQuery.isEmptyObject(conf)) { - $http.get('components/config/config.json') + $http.get('components/config/defaultLayoutConfig.json') .success(function (conf) { - config.data = conf; + layoutConfig.data = conf; - $http.post(surveilConfig.endpoint('config'), JSON.stringify(conf)) + $http.post(surveilConfig.endpoint('appConfig'), JSON.stringify(conf)) .success(function () { responsePromise.resolve(); }) @@ -179,7 +179,7 @@ angular.module('bansho.config', []) responsePromise.reject('Failed to fetch default config'); }); } else { - config.data = conf; + layoutConfig.data = conf; responsePromise.resolve(); } }) diff --git a/app/components/config/config.json b/app/components/config/defaultLayoutConfig.json similarity index 100% rename from app/components/config/config.json rename to app/components/config/defaultLayoutConfig.json diff --git a/app/components/surveil/surveil.js b/app/components/surveil/surveil.js index b8cd106..0050d95 100644 --- a/app/components/surveil/surveil.js +++ b/app/components/surveil/surveil.js @@ -10,7 +10,7 @@ angular.module('bansho.surveil', []) surveilEndpoints = { status: apiUrl + '/status', actions: apiUrl + '/actions', - config: apiUrl + '/bansho/config' + appConfig: apiUrl + '/bansho/config' }; }, setAuthUrl: function (url) { diff --git a/app/routing_view/routing_view.js b/app/routing_view/routing_view.js index 1afb8fb..fcf730c 100644 --- a/app/routing_view/routing_view.js +++ b/app/routing_view/routing_view.js @@ -43,7 +43,7 @@ angular.module('bansho.view', ['ngRoute', .service('loadConfig', ['configManager', 'viewsTemplate', function (configManager, viewsTemplate) { return function () { - var viewsConfig = configManager.readConfig(); + var viewsConfig = configManager.readLayoutConfig(); angular.forEach(viewsConfig, function (config, view) { viewsTemplate[view] = config.template; diff --git a/app/templates/config/config.js b/app/templates/config/config.js index b492622..fdc8b1b 100644 --- a/app/templates/config/config.js +++ b/app/templates/config/config.js @@ -5,10 +5,10 @@ angular.module('bansho.view.config', []) .controller('ConfigCtrl', ['$scope', '$window', 'configManager', function ($scope, $window, configManager) { - $scope.configuration = JSON.stringify(configManager.readConfig(),null,4); + $scope.configuration = JSON.stringify(configManager.readLayoutConfig(), null, 4); $scope.saveConfiguration = function () { - configManager.saveConfig(JSON.parse($scope.configuration)); + configManager.saveLayoutConfig(JSON.parse($scope.configuration)); $window.location.reload(); }; }]);