Add Config model

* Add ability to configurably cache API responses per model
* Fix general error display on credentials
* Add current version from API to the documentation link
This commit is contained in:
gconsidine
2017-07-31 17:07:25 -04:00
parent 59157565bd
commit bdb2bbbd41
9 changed files with 171 additions and 24 deletions

View File

@@ -1,14 +1,19 @@
export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', 'SmartSearchService', 'i18n',
function($stateParams, $scope, $state, GetBasePath, qs, SmartSearchService, i18n) {
export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', 'SmartSearchService', 'i18n', 'ConfigModel',
function($stateParams, $scope, $state, GetBasePath, qs, SmartSearchService, i18n, ConfigModel) {
let path,
defaults,
queryset,
stateChangeSuccessListener;
stateChangeSuccessListener,
configModel = new ConfigModel();
init();
configModel.request('get')
.then(() => init());
function init() {
let version = configModel.getTruncatedVersion() || 'latest';
$scope.documentationLink = `http://docs.ansible.com/ansible-tower/${version}/html/userguide/search_sort.html`;
if($scope.defaultParams) {
defaults = $scope.defaultParams;