mirror of
https://github.com/ansible/awx.git
synced 2024-10-27 17:55:10 +03:00
local_config.js
Look for local_config.js. If not found, load config.js. Set debug_mode to true and make other config changes locally without affecting production builds.
This commit is contained in:
parent
f0cb84d973
commit
d872aa1985
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,7 @@ awx/job_output
|
|||||||
awx/public/media
|
awx/public/media
|
||||||
awx/public/static
|
awx/public/static
|
||||||
awx/ui/static/js/awx.min.js
|
awx/ui/static/js/awx.min.js
|
||||||
|
awx/ui/static/js/local_config.js
|
||||||
awx/ui/static/css/awx.min.css
|
awx/ui/static/css/awx.min.css
|
||||||
awx/main/fixtures
|
awx/main/fixtures
|
||||||
awx/tower_warnings.log
|
awx/tower_warnings.log
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
var urlPrefix = $basePath;
|
var urlPrefix = $basePath;
|
||||||
|
var $AnsibleConfig;
|
||||||
|
|
||||||
angular.module('Tower', [
|
angular.module('Tower', [
|
||||||
'ngRoute',
|
'ngRoute',
|
||||||
@ -99,7 +100,8 @@ angular.module('Tower', [
|
|||||||
'HostEventsViewerHelper',
|
'HostEventsViewerHelper',
|
||||||
'JobDetailHelper',
|
'JobDetailHelper',
|
||||||
'SocketIO',
|
'SocketIO',
|
||||||
'lrInfiniteScroll'
|
'lrInfiniteScroll',
|
||||||
|
'LoadConfigHelper'
|
||||||
])
|
])
|
||||||
|
|
||||||
.constant('AngularScheduler.partials', $basePath + 'lib/angular-scheduler/lib/')
|
.constant('AngularScheduler.partials', $basePath + 'lib/angular-scheduler/lib/')
|
||||||
@ -407,12 +409,13 @@ angular.module('Tower', [
|
|||||||
}])
|
}])
|
||||||
|
|
||||||
.run(['$compile', '$cookieStore', '$rootScope', '$log', 'CheckLicense', '$location', 'Authorization', 'LoadBasePaths', 'ViewLicense',
|
.run(['$compile', '$cookieStore', '$rootScope', '$log', 'CheckLicense', '$location', 'Authorization', 'LoadBasePaths', 'ViewLicense',
|
||||||
'Timer', 'ClearScope', 'HideStream', 'Socket',
|
'Timer', 'ClearScope', 'HideStream', 'Socket', 'LoadConfig',
|
||||||
function ($compile, $cookieStore, $rootScope, $log, CheckLicense, $location, Authorization, LoadBasePaths, ViewLicense,
|
function ($compile, $cookieStore, $rootScope, $log, CheckLicense, $location, Authorization, LoadBasePaths, ViewLicense,
|
||||||
Timer, ClearScope, HideStream, Socket) {
|
Timer, ClearScope, HideStream, Socket, LoadConfig) {
|
||||||
|
|
||||||
var e, html, sock, checkCount;
|
var e, html, sock, checkCount;
|
||||||
|
|
||||||
|
LoadConfig();
|
||||||
LoadBasePaths();
|
LoadBasePaths();
|
||||||
|
|
||||||
$rootScope.breadcrumbs = [];
|
$rootScope.breadcrumbs = [];
|
||||||
|
@ -6,11 +6,16 @@
|
|||||||
*
|
*
|
||||||
* Gobal configuration variables for controlling application behavior.
|
* Gobal configuration variables for controlling application behavior.
|
||||||
*
|
*
|
||||||
|
* Do NOT change this file, unless the changes should be included in
|
||||||
|
* production builds. For development, copy this file to local_config.js,
|
||||||
|
* and make changes. git will ignore local_config.js
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*jshint unused:false */
|
/*jshint unused:false */
|
||||||
|
|
||||||
var $AnsibleConfig = {
|
(function() {
|
||||||
|
return {
|
||||||
|
|
||||||
tooltip_delay: {show: 500, hide: 100}, // Default number of milliseconds to delay displaying/hiding tooltips
|
tooltip_delay: {show: 500, hide: 100}, // Default number of milliseconds to delay displaying/hiding tooltips
|
||||||
|
|
||||||
@ -51,3 +56,4 @@ var $AnsibleConfig = {
|
|||||||
websocket_port: 8080
|
websocket_port: 8080
|
||||||
|
|
||||||
};
|
};
|
||||||
|
})();
|
||||||
|
46
awx/ui/static/js/helpers/LoadConfig.js
Normal file
46
awx/ui/static/js/helpers/LoadConfig.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*********************************************
|
||||||
|
* Copyright (c) 2014 AnsibleWorks, Inc.
|
||||||
|
*
|
||||||
|
* LoadConfigHelper
|
||||||
|
*
|
||||||
|
* Attempts to load local_config.js. If not found, loads config.js. Then evaluates the loaded
|
||||||
|
* javascript, putting the result in $AnsibleConfig.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*jshint evil:true */
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('LoadConfigHelper', ['Utilities'])
|
||||||
|
|
||||||
|
.factory('LoadConfig', ['$rootScope', '$http', 'ProcessErrors', function($rootScope, $http, ProcessErrors) {
|
||||||
|
return function() {
|
||||||
|
|
||||||
|
if ($rootScope.removeLoadConfig) {
|
||||||
|
$rootScope.removeLoadConfig();
|
||||||
|
}
|
||||||
|
$rootScope.removeLoadConfig = $rootScope.$on('LoadConfig', function() {
|
||||||
|
// local_config.js not found, so we'll load config.js
|
||||||
|
$http({ method:'GET', url: $basePath + 'js/config.js' })
|
||||||
|
.success(function(data) {
|
||||||
|
$AnsibleConfig = eval(data);
|
||||||
|
})
|
||||||
|
.error(function(data, status) {
|
||||||
|
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Failed to load ' + $basePath + '/config.js. GET status: ' + status
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Load js/local_config.js
|
||||||
|
$http({ method:'GET', url: $basePath + 'js/local_config.js' })
|
||||||
|
.success(function(data) {
|
||||||
|
$AnsibleConfig = eval(data);
|
||||||
|
})
|
||||||
|
.error(function() {
|
||||||
|
//local_config.js not found
|
||||||
|
$rootScope.$emit('LoadConfig');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}]);
|
@ -25,7 +25,6 @@
|
|||||||
<script>
|
<script>
|
||||||
var $basePath = "{{ STATIC_URL }}";
|
var $basePath = "{{ STATIC_URL }}";
|
||||||
</script>
|
</script>
|
||||||
<script src="{{ STATIC_URL }}js/config.js"></script>
|
|
||||||
<script src="{{ STATIC_URL }}lib/jquery/dist/jquery.min.js"></script>
|
<script src="{{ STATIC_URL }}lib/jquery/dist/jquery.min.js"></script>
|
||||||
<script src="{{ STATIC_URL }}lib/angular/angular.min.js"></script>
|
<script src="{{ STATIC_URL }}lib/angular/angular.min.js"></script>
|
||||||
<script src="{{ STATIC_URL }}lib/angular-route/angular-route.min.js"></script>
|
<script src="{{ STATIC_URL }}lib/angular-route/angular-route.min.js"></script>
|
||||||
@ -126,6 +125,7 @@
|
|||||||
<script src="{{ STATIC_URL }}js/lists/Hosts.js"></script>
|
<script src="{{ STATIC_URL }}js/lists/Hosts.js"></script>
|
||||||
<script src="{{ STATIC_URL }}js/lists/Schedules.js"></script>
|
<script src="{{ STATIC_URL }}js/lists/Schedules.js"></script>
|
||||||
<script src="{{ STATIC_URL }}js/lists/ScheduledJobs.js"></script>
|
<script src="{{ STATIC_URL }}js/lists/ScheduledJobs.js"></script>
|
||||||
|
<script src="{{ STATIC_URL }}js/helpers/LoadConfig.js"></script>
|
||||||
<script src="{{ STATIC_URL }}js/helpers/refresh-related.js"></script>
|
<script src="{{ STATIC_URL }}js/helpers/refresh-related.js"></script>
|
||||||
<script src="{{ STATIC_URL }}js/helpers/related-search.js"></script>
|
<script src="{{ STATIC_URL }}js/helpers/related-search.js"></script>
|
||||||
<script src="{{ STATIC_URL }}js/helpers/refresh.js"></script>
|
<script src="{{ STATIC_URL }}js/helpers/refresh.js"></script>
|
||||||
|
Loading…
Reference in New Issue
Block a user