From 8bd2117e771c2cc225070bcece9b4504d281a7e6 Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Tue, 13 May 2014 14:05:39 -0400 Subject: [PATCH] AC-1236 fixed broken failed jobs link on dashboard. Fixed broken job links on inventory tab page. --- awx/ui/static/js/controllers/Inventories.js | 6 +++--- awx/ui/static/js/controllers/Jobs.js | 22 ++++++++++++++++++--- awx/ui/static/js/helpers/Jobs.js | 9 ++++++++- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index 2c7fb19cda..864907dd7b 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -188,9 +188,9 @@ function InventoriesList($scope, $rootScope, $location, $log, $routeParams, $com html += "\n"; - html += "" + ((row.finished) ? ( ($filter('date')(row.finished,'MM/dd HH:mm:ss')).replace(/ /,'
') ) : '') + ""; - html += "Events
" + - "Hosts"; + html += "" + ($filter('date')(row.finished,'MM/dd HH:mm:ss')).replace(/ /,'
') + ""; + html += "Events
" + + "Hosts"; html += "" + ellipsis(row.name) + ""; html += "\n"; }); diff --git a/awx/ui/static/js/controllers/Jobs.js b/awx/ui/static/js/controllers/Jobs.js index 54db17b414..ee63614b08 100644 --- a/awx/ui/static/js/controllers/Jobs.js +++ b/awx/ui/static/js/controllers/Jobs.js @@ -10,7 +10,7 @@ 'use strict'; -function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBreadCrumbs, LoadSchedulesScope, LoadJobsScope, RunningJobsList, CompletedJobsList, QueuedJobsList, +function JobsListController ($scope, $compile, $routeParams, ClearScope, Breadcrumbs, LoadBreadCrumbs, LoadSchedulesScope, LoadJobsScope, RunningJobsList, CompletedJobsList, QueuedJobsList, ScheduledJobsList, GetChoices, GetBasePath, Wait, Socket) { ClearScope(); @@ -135,6 +135,8 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea $scope.removeBuildJobsList(); } $scope.removeBuildJobsList = $scope.$on('buildJobsList', function() { + var opt, search_params; + if (CompletedJobsList.fields.type) { CompletedJobsList.fields.type.searchOptions = $scope.type_choices; } @@ -144,6 +146,19 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea if (QueuedJobsList.fields.type) { QueuedJobsList.fields.type.searchOptions = $scope.type_choices; } + if ($routeParams.status) { + search_params[CompletedJobsList.iterator + 'SearchField'] = 'status'; + search_params[CompletedJobsList.iterator + 'SelectShow'] = true; + search_params[CompletedJobsList.iterator + 'SearchSelectOpts'] = CompletedJobsList.fields.status.searchOptions; + search_params[CompletedJobsList.iterator + 'SearchFieldLabel'] = CompletedJobsList.fields.status.label.replace(//g,' '); + search_params[CompletedJobsList.iterator + 'SearchType'] = ''; + for (opt in CompletedJobsList.fields.status.searchOptions) { + if (CompletedJobsList.fields.status.searchOptions[opt].value === $routeParams.status) { + search_params[CompletedJobsList.iterator + 'SearchSelectValue'] = CompletedJobsList.fields.status.searchOptions[opt]; + break; + } + } + } completed_scope = $scope.$new(true); completed_scope.showJobType = true; LoadJobsScope({ @@ -151,7 +166,8 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea scope: completed_scope, list: CompletedJobsList, id: 'completed-jobs', - url: GetBasePath('unified_jobs') + '?or__status=successful&or__status=failed&or__status=error&or__status=canceled' + url: GetBasePath('unified_jobs') + '?or__status=successful&or__status=failed&or__status=error&or__status=canceled', + searchParams: search_params }); running_scope = $scope.$new(true); LoadJobsScope({ @@ -254,7 +270,7 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea } } -JobsListController.$inject = [ '$scope', '$compile', 'ClearScope', 'Breadcrumbs', 'LoadBreadCrumbs', 'LoadSchedulesScope', 'LoadJobsScope', 'RunningJobsList', 'CompletedJobsList', +JobsListController.$inject = [ '$scope', '$compile', '$routeParams', 'ClearScope', 'Breadcrumbs', 'LoadBreadCrumbs', 'LoadSchedulesScope', 'LoadJobsScope', 'RunningJobsList', 'CompletedJobsList', 'QueuedJobsList', 'ScheduledJobsList', 'GetChoices', 'GetBasePath', 'Wait', 'Socket' ]; function JobsEdit($scope, $rootScope, $compile, $location, $log, $routeParams, JobForm, JobTemplateForm, GenerateForm, Rest, diff --git a/awx/ui/static/js/helpers/Jobs.js b/awx/ui/static/js/helpers/Jobs.js index 64e4d82dc5..594b4f0732 100644 --- a/awx/ui/static/js/helpers/Jobs.js +++ b/awx/ui/static/js/helpers/Jobs.js @@ -357,7 +357,8 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job url = params.url, pageSize = params.pageSize || 5, base = $location.path().replace(/^\//, '').split('/')[0], - e, html; + search_params = params.searchParams, + e, html, key; // Add the search widget. We want it arranged differently, so we're injecting and compiling it separately html = SearchWidget({ @@ -408,6 +409,12 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job scope[list.iterator + 'SearchFieldLabel'] = 'Job ID'; } } + + if (search_params) { + for (key in search_params) { + scope[key] = search_params[key]; + } + } scope.search(list.iterator); }; }])