2270e9139b
Move the angular app module from the framework to openstack_dashboard at the top level as "horizon.app". This edit also removes the old hzUtils.log function: it exists in the framework, but is configured in the application, thus causing dependency issues. It is only used in one place (hz.tables.js), and for debugging. I contend that if debugging is needed then $log can be asked for as needed. The hzConfig.debug flag was only used by that one function, so it is also removed in this edit. Change-Id: Ie538940cd8d1b0eabe677790bad979cc146bfbd1 Closes-Bug: #1458697 Closes-Bug: #1465885
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
/*global angularModuleExtension*/
|
|
(function () {
|
|
'use strict';
|
|
|
|
angular.module('horizon.app', [
|
|
'horizon.auth',
|
|
'horizon.openstack-service-api',
|
|
'horizon.framework',
|
|
'hz.dashboard',
|
|
'ngCookies'].concat(angularModuleExtension))
|
|
|
|
.constant('horizon.app.conf', {
|
|
// Placeholders; updated by Django.
|
|
static_url: null,
|
|
ajax: {
|
|
queue_limit: null
|
|
}
|
|
})
|
|
|
|
.run([
|
|
'horizon.framework.conf.spinner_options',
|
|
'horizon.app.conf',
|
|
'horizon.framework.util.tech-debt.helper-functions',
|
|
'$cookieStore',
|
|
'$http',
|
|
'$cookies',
|
|
function (spinnerOptions, hzConfig, hzUtils, $cookieStore, $http, $cookies) {
|
|
$http.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken;
|
|
//expose the configuration for horizon legacy variable
|
|
horizon.conf = angular.extend({spinner_options: spinnerOptions}, hzConfig);
|
|
horizon.utils = hzUtils;
|
|
angular.extend(horizon.cookies = {}, $cookieStore);
|
|
horizon.cookies.put = function (key, value) {
|
|
//cookies are updated at the end of current $eval, so for the horizon
|
|
//namespace we need to wrap it in a $apply function.
|
|
angular.element('body').scope().$apply(function () {
|
|
$cookieStore.put(key, value);
|
|
});
|
|
};
|
|
horizon.cookies.getRaw = function (key) {
|
|
return $cookies[key];
|
|
};
|
|
}]);
|
|
}());
|