mirror of
https://github.com/ansible/awx.git
synced 2026-03-26 13:25:02 -02: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:
@@ -49,7 +49,7 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea
|
|||||||
scope: completed_scope,
|
scope: completed_scope,
|
||||||
list: CompletedJobsList,
|
list: CompletedJobsList,
|
||||||
id: 'completed-jobs',
|
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);
|
running_scope = $scope.$new(true);
|
||||||
LoadJobsScope({
|
LoadJobsScope({
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
|||||||
|
|
||||||
function promptPassword() {
|
function promptPassword() {
|
||||||
var e, fld, field;
|
var e, fld, field;
|
||||||
console.log(passwords);
|
|
||||||
password = passwords.pop();
|
password = passwords.pop();
|
||||||
|
|
||||||
// Prompt for password
|
// 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
|
* Called from JobsList controller to load each section or list on the page
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
.factory('LoadJobsScope', ['SearchInit', 'PaginateInit', 'GenerateList', 'JobsControllerInit', 'JobsListUpdate',
|
.factory('LoadJobsScope', ['$routeParams', '$location', 'SearchInit', 'PaginateInit', 'GenerateList', 'JobsControllerInit', 'JobsListUpdate',
|
||||||
function(SearchInit, PaginateInit, GenerateList, JobsControllerInit, JobsListUpdate) {
|
function($routeParams, $location, SearchInit, PaginateInit, GenerateList, JobsControllerInit, JobsListUpdate) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
var parent_scope = params.parent_scope,
|
var parent_scope = params.parent_scope,
|
||||||
scope = params.scope,
|
scope = params.scope,
|
||||||
list = params.list,
|
list = params.list,
|
||||||
id = params.id,
|
id = params.id,
|
||||||
url = params.url;
|
url = params.url,
|
||||||
|
base = $location.path().replace(/^\//, '').split('/')[0];
|
||||||
|
|
||||||
GenerateList.inject(list, {
|
GenerateList.inject(list, {
|
||||||
mode: 'edit',
|
mode: 'edit',
|
||||||
@@ -384,6 +385,14 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job
|
|||||||
JobsListUpdate({ scope: scope, parent_scope: parent_scope, list: list });
|
JobsListUpdate({ scope: scope, parent_scope: parent_scope, list: list });
|
||||||
parent_scope.$emit('listLoaded');
|
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);
|
scope.search(list.iterator);
|
||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
|||||||
if (calcOnly) {
|
if (calcOnly) {
|
||||||
scope.$emit('searchParamsReady', url);
|
scope.$emit('searchParamsReady', url);
|
||||||
}
|
}
|
||||||
else if (defaultUrl) {
|
else if (defaultUrl && !/undefined/.test(url)) {
|
||||||
Refresh({
|
Refresh({
|
||||||
scope: scope,
|
scope: scope,
|
||||||
set: set,
|
set: set,
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ angular.module('StreamListDefinition', [])
|
|||||||
key: true,
|
key: true,
|
||||||
desc: true,
|
desc: true,
|
||||||
noLink: true,
|
noLink: true,
|
||||||
searchable: false
|
searchable: false,
|
||||||
|
filter: "date:'MM/dd/yy HH:mm:ss'"
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
label: 'Initiated by',
|
label: 'Initiated by',
|
||||||
@@ -109,7 +110,7 @@ angular.module('StreamListDefinition', [])
|
|||||||
searchOnly: true,
|
searchOnly: true,
|
||||||
searchObject: 'job',
|
searchObject: 'job',
|
||||||
searchPlaceholder: 'Job name',
|
searchPlaceholder: 'Job name',
|
||||||
searchOnID: true,
|
//searchOnID: true,
|
||||||
searchWidget: 2,
|
searchWidget: 2,
|
||||||
searchField: 'object1'
|
searchField: 'object1'
|
||||||
},
|
},
|
||||||
@@ -193,7 +194,7 @@ angular.module('StreamListDefinition', [])
|
|||||||
searchOnly: true,
|
searchOnly: true,
|
||||||
searchObject: 'job',
|
searchObject: 'job',
|
||||||
searchPlaceholder: 'Related job name',
|
searchPlaceholder: 'Related job name',
|
||||||
searchOnID: true,
|
//searchOnID: true,
|
||||||
searchWidget: 3,
|
searchWidget: 3,
|
||||||
searchField: 'object2'
|
searchField: 'object2'
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
url += 'home/' + obj.base + 's/?id=' + obj.id;
|
url += 'home/' + obj.base + 's/?id=' + obj.id;
|
||||||
break;
|
break;
|
||||||
case 'job':
|
case 'job':
|
||||||
url += 'jobs/?id=' + obj.id;
|
url += 'jobs/?id__int=' + obj.id;
|
||||||
break;
|
break;
|
||||||
case 'inventory':
|
case 'inventory':
|
||||||
url += 'inventories/' + obj.id + '/';
|
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)) {
|
if (obj2_obj && obj2_obj.name && !/^_delete/.test(obj2_obj.name)) {
|
||||||
obj2_obj.base = obj2;
|
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 ');
|
descr_nolink += obj2 + ' ' + obj2_obj.name + ((activity.operation === 'disassociate') ? ' from ' : ' to ');
|
||||||
} else if (obj2) {
|
} else if (obj2) {
|
||||||
name = '';
|
name = '';
|
||||||
@@ -214,7 +214,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
}
|
}
|
||||||
if (obj1_obj && obj1_obj.name && !/^\_delete/.test(obj1_obj.name)) {
|
if (obj1_obj && obj1_obj.name && !/^\_delete/.test(obj1_obj.name)) {
|
||||||
obj1_obj.base = obj1;
|
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;
|
descr_nolink += obj1 + ' ' + obj1_obj.name;
|
||||||
} else if (obj1) {
|
} else if (obj1) {
|
||||||
name = '';
|
name = '';
|
||||||
@@ -229,7 +229,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
name = ' ' + activity.changes.name[0];
|
name = ' ' + activity.changes.name[0];
|
||||||
name_nolink = name;
|
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
|
// Hack for job activity where the template name is known
|
||||||
if (activity.operation !== 'delete') {
|
if (activity.operation !== 'delete') {
|
||||||
obj1_obj.base = obj1;
|
obj1_obj.base = obj1;
|
||||||
@@ -248,7 +248,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
} else {
|
} else {
|
||||||
name = ' ' + obj1_obj.id;
|
name = ' ' + obj1_obj.id;
|
||||||
name_nolink = name;
|
name_nolink = name;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
} else if (obj1_obj && obj1_obj.name) {
|
} else if (obj1_obj && obj1_obj.name) {
|
||||||
name = ' ' + stripDeleted(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',
|
'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) {
|
return function (params) {
|
||||||
|
|
||||||
var activity_id = params.activity_id,
|
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 = generator.inject(form, { mode: 'edit', modal: true, related: false });
|
||||||
scope.changes = activity.changes_stringified;
|
scope.changes = activity.changes_stringified;
|
||||||
scope.user = ((activity.summary_fields.actor) ? activity.summary_fields.actor.username : 'system') +
|
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.operation = activity.description_nolink;
|
||||||
|
|
||||||
scope.formModalAction = function () {
|
scope.formModalAction = function () {
|
||||||
@@ -399,6 +399,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
if (inUrl) {
|
if (inUrl) {
|
||||||
$location.path(inUrl);
|
$location.path(inUrl);
|
||||||
}
|
}
|
||||||
|
scope.$destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
scope.refreshStream = function () {
|
scope.refreshStream = function () {
|
||||||
@@ -416,14 +417,14 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
scope.removeStreamPostRefresh();
|
scope.removeStreamPostRefresh();
|
||||||
}
|
}
|
||||||
scope.removeStreamPostRefresh = scope.$on('PostRefresh', function () {
|
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++) {
|
for (i = 0; i < scope.activities.length; i++) {
|
||||||
// Convert event_time date to local time zone
|
// Convert event_time date to local time zone
|
||||||
cDate = new Date(scope.activities[i].timestamp);
|
//cDate = new Date(scope.activities[i].timestamp);
|
||||||
scope.activities[i].timestamp = FormatDate(cDate);
|
//scope.activities[i].timestamp = FormatDate(cDate);
|
||||||
|
|
||||||
if (scope.activities[i].summary_fields.actor) {
|
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>";
|
scope.activities[i].summary_fields.actor.username + "</a>";
|
||||||
} else {
|
} else {
|
||||||
scope.activities[i].user = 'system';
|
scope.activities[i].user = 'system';
|
||||||
|
|||||||
Reference in New Issue
Block a user