Use ConfigService to get version for doc links

This commit is contained in:
gconsidine 2017-08-01 13:40:53 -04:00
parent 214b72bb8d
commit 384637fce8

View File

@ -1,17 +1,22 @@
export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', 'SmartSearchService', 'i18n', 'ConfigModel',
function($stateParams, $scope, $state, GetBasePath, qs, SmartSearchService, i18n, ConfigModel) {
export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', 'SmartSearchService', 'i18n', 'ConfigService',
function($stateParams, $scope, $state, GetBasePath, qs, SmartSearchService, i18n, configService) {
let path,
defaults,
queryset,
stateChangeSuccessListener,
configModel = new ConfigModel();
stateChangeSuccessListener;
configModel.request('get')
.then(() => init());
configService.getConfig()
.then(config => init(config));
function init() {
let version = configModel.getTruncatedVersion() || 'latest';
function init(config) {
let version;
try {
version = config.version.split('-')[0];
} catch (err) {
version = 'latest';
}
$scope.documentationLink = `http://docs.ansible.com/ansible-tower/${version}/html/userguide/search_sort.html`;