From 384637fce8a56731a6c7d938e99832501c540a23 Mon Sep 17 00:00:00 2001 From: gconsidine Date: Tue, 1 Aug 2017 13:40:53 -0400 Subject: [PATCH] Use ConfigService to get version for doc links --- .../smart-search/smart-search.controller.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/awx/ui/client/src/shared/smart-search/smart-search.controller.js b/awx/ui/client/src/shared/smart-search/smart-search.controller.js index 7ddbfd42c7..c889a0b98b 100644 --- a/awx/ui/client/src/shared/smart-search/smart-search.controller.js +++ b/awx/ui/client/src/shared/smart-search/smart-search.controller.js @@ -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`;