mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
AC-977 fixed jobs in AS so that user can search by Job Name and the job name is diplayed in description. Links to jobs page work as well, filtering completed jobs by job id.
This commit is contained in:
parent
ece772332f
commit
34c992f48c
@ -49,7 +49,7 @@ 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',
|
||||
});
|
||||
running_scope = $scope.$new(true);
|
||||
LoadJobsScope({
|
||||
|
||||
@ -113,7 +113,6 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
||||
|
||||
function promptPassword() {
|
||||
var e, fld, field;
|
||||
console.log(passwords);
|
||||
password = passwords.pop();
|
||||
|
||||
// Prompt for password
|
||||
|
||||
@ -342,14 +342,15 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job
|
||||
* Called from JobsList controller to load each section or list on the page
|
||||
*
|
||||
*/
|
||||
.factory('LoadJobsScope', ['SearchInit', 'PaginateInit', 'GenerateList', 'JobsControllerInit', 'JobsListUpdate',
|
||||
function(SearchInit, PaginateInit, GenerateList, JobsControllerInit, JobsListUpdate) {
|
||||
.factory('LoadJobsScope', ['$routeParams', '$location', 'SearchInit', 'PaginateInit', 'GenerateList', 'JobsControllerInit', 'JobsListUpdate',
|
||||
function($routeParams, $location, SearchInit, PaginateInit, GenerateList, JobsControllerInit, JobsListUpdate) {
|
||||
return function(params) {
|
||||
var parent_scope = params.parent_scope,
|
||||
scope = params.scope,
|
||||
list = params.list,
|
||||
id = params.id,
|
||||
url = params.url;
|
||||
url = params.url,
|
||||
base = $location.path().replace(/^\//, '').split('/')[0];
|
||||
|
||||
GenerateList.inject(list, {
|
||||
mode: 'edit',
|
||||
@ -384,6 +385,14 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job
|
||||
JobsListUpdate({ scope: scope, parent_scope: parent_scope, list: list });
|
||||
parent_scope.$emit('listLoaded');
|
||||
});
|
||||
|
||||
if (base === 'jobs' && list.name === 'completed_jobs') {
|
||||
if ($routeParams.id__int) {
|
||||
scope[list.iterator + 'SearchField'] = 'id';
|
||||
scope[list.iterator + 'SearchValue'] = $routeParams.id__int;
|
||||
scope[list.iterator + 'SearchFieldLabel'] = 'Job ID';
|
||||
}
|
||||
}
|
||||
scope.search(list.iterator);
|
||||
};
|
||||
}])
|
||||
|
||||
@ -282,7 +282,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
if (calcOnly) {
|
||||
scope.$emit('searchParamsReady', url);
|
||||
}
|
||||
else if (defaultUrl) {
|
||||
else if (defaultUrl && !/undefined/.test(url)) {
|
||||
Refresh({
|
||||
scope: scope,
|
||||
set: set,
|
||||
|
||||
@ -27,7 +27,8 @@ angular.module('StreamListDefinition', [])
|
||||
key: true,
|
||||
desc: true,
|
||||
noLink: true,
|
||||
searchable: false
|
||||
searchable: false,
|
||||
filter: "date:'MM/dd/yy HH:mm:ss'"
|
||||
},
|
||||
user: {
|
||||
label: 'Initiated by',
|
||||
@ -109,7 +110,7 @@ angular.module('StreamListDefinition', [])
|
||||
searchOnly: true,
|
||||
searchObject: 'job',
|
||||
searchPlaceholder: 'Job name',
|
||||
searchOnID: true,
|
||||
//searchOnID: true,
|
||||
searchWidget: 2,
|
||||
searchField: 'object1'
|
||||
},
|
||||
@ -193,7 +194,7 @@ angular.module('StreamListDefinition', [])
|
||||
searchOnly: true,
|
||||
searchObject: 'job',
|
||||
searchPlaceholder: 'Related job name',
|
||||
searchOnID: true,
|
||||
//searchOnID: true,
|
||||
searchWidget: 3,
|
||||
searchField: 'object2'
|
||||
},
|
||||
|
||||
@ -155,7 +155,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
||||
url += 'home/' + obj.base + 's/?id=' + obj.id;
|
||||
break;
|
||||
case 'job':
|
||||
url += 'jobs/?id=' + obj.id;
|
||||
url += 'jobs/?id__int=' + obj.id;
|
||||
break;
|
||||
case 'inventory':
|
||||
url += 'inventories/' + obj.id + '/';
|
||||
@ -202,7 +202,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
||||
|
||||
if (obj2_obj && obj2_obj.name && !/^_delete/.test(obj2_obj.name)) {
|
||||
obj2_obj.base = obj2;
|
||||
descr += obj2 + ' <a href=\"' + BuildUrl(obj2_obj) + '\">' + obj2_obj.name + '</a>' + ((activity.operation === 'disassociate') ? ' from ' : ' to ');
|
||||
descr += obj2 + " <a href=\"" + BuildUrl(obj2_obj) + "\">" + obj2_obj.name + '</a>' + ((activity.operation === 'disassociate') ? ' from ' : ' to ');
|
||||
descr_nolink += obj2 + ' ' + obj2_obj.name + ((activity.operation === 'disassociate') ? ' from ' : ' to ');
|
||||
} else if (obj2) {
|
||||
name = '';
|
||||
@ -214,7 +214,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
||||
}
|
||||
if (obj1_obj && obj1_obj.name && !/^\_delete/.test(obj1_obj.name)) {
|
||||
obj1_obj.base = obj1;
|
||||
descr += obj1 + ' <a href=\"' + BuildUrl(obj1_obj) + '\">' + obj1_obj.name + '</a>';
|
||||
descr += obj1 + " <a href=\"" + BuildUrl(obj1_obj) + "\" >" + obj1_obj.name + '</a>';
|
||||
descr_nolink += obj1 + ' ' + obj1_obj.name;
|
||||
} else if (obj1) {
|
||||
name = '';
|
||||
@ -229,7 +229,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
||||
name = ' ' + activity.changes.name[0];
|
||||
name_nolink = name;
|
||||
}
|
||||
} else if (obj1 === 'job' && obj1_obj && activity.changes && activity.changes.job_template) {
|
||||
/*} else if (obj1 === 'job' && obj1_obj && activity.changes && activity.changes.job_template) {
|
||||
// Hack for job activity where the template name is known
|
||||
if (activity.operation !== 'delete') {
|
||||
obj1_obj.base = obj1;
|
||||
@ -248,7 +248,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
||||
} else {
|
||||
name = ' ' + obj1_obj.id;
|
||||
name_nolink = name;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
} else if (obj1_obj && obj1_obj.name) {
|
||||
name = ' ' + stripDeleted(obj1_obj.name);
|
||||
@ -263,9 +263,9 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
||||
}
|
||||
])
|
||||
|
||||
.factory('ShowDetail', ['$rootScope', 'Rest', 'Alert', 'GenerateForm', 'ProcessErrors', 'GetBasePath', 'FormatDate',
|
||||
.factory('ShowDetail', ['$filter', '$rootScope', 'Rest', 'Alert', 'GenerateForm', 'ProcessErrors', 'GetBasePath', 'FormatDate',
|
||||
'ActivityDetailForm', 'Empty', 'Find',
|
||||
function ($rootScope, Rest, Alert, GenerateForm, ProcessErrors, GetBasePath, FormatDate, ActivityDetailForm, Empty, Find) {
|
||||
function ($filter, $rootScope, Rest, Alert, GenerateForm, ProcessErrors, GetBasePath, FormatDate, ActivityDetailForm, Empty, Find) {
|
||||
return function (params) {
|
||||
|
||||
var activity_id = params.activity_id,
|
||||
@ -287,7 +287,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
||||
scope = generator.inject(form, { mode: 'edit', modal: true, related: false });
|
||||
scope.changes = activity.changes_stringified;
|
||||
scope.user = ((activity.summary_fields.actor) ? activity.summary_fields.actor.username : 'system') +
|
||||
' on ' + FormatDate(new Date(activity.timestamps));
|
||||
' on ' + $filter('date')(activity.timestamp, "MM/dd/yy HH:mm:ss");
|
||||
scope.operation = activity.description_nolink;
|
||||
|
||||
scope.formModalAction = function () {
|
||||
@ -399,6 +399,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
||||
if (inUrl) {
|
||||
$location.path(inUrl);
|
||||
}
|
||||
scope.$destroy();
|
||||
};
|
||||
|
||||
scope.refreshStream = function () {
|
||||
@ -416,14 +417,14 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
||||
scope.removeStreamPostRefresh();
|
||||
}
|
||||
scope.removeStreamPostRefresh = scope.$on('PostRefresh', function () {
|
||||
var i, cDate, href, deleted, obj1, obj2;
|
||||
var i, href, deleted, obj1, obj2;
|
||||
for (i = 0; i < scope.activities.length; i++) {
|
||||
// Convert event_time date to local time zone
|
||||
cDate = new Date(scope.activities[i].timestamp);
|
||||
scope.activities[i].timestamp = FormatDate(cDate);
|
||||
//cDate = new Date(scope.activities[i].timestamp);
|
||||
//scope.activities[i].timestamp = FormatDate(cDate);
|
||||
|
||||
if (scope.activities[i].summary_fields.actor) {
|
||||
scope.activities[i].user = "<a href=\"/#/users/" + scope.activities[i].summary_fields.actor.id + "\">" +
|
||||
scope.activities[i].user = "<a href=\"\" ng-click=\"closeStream('/#/users/" + scope.activities[i].summary_fields.actor.id + "')\">" +
|
||||
scope.activities[i].summary_fields.actor.username + "</a>";
|
||||
} else {
|
||||
scope.activities[i].user = 'system';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user