mirror of
https://github.com/ansible/awx.git
synced 2026-04-14 06:29:25 -02:30
Merge pull request #1647 from jakemcdermott/fix-1534-and-713
add persistent jobs->results filtering, prior version compatibility for job urls
This commit is contained in:
@@ -303,7 +303,7 @@
|
||||
grid-template-rows: minmax(500px, ~"calc(100vh - 140px)");
|
||||
|
||||
.at-Panel {
|
||||
overflow-y: scroll;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ function getProjectUpdateDetails (updateId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const link = `/#/jobz/project/${jobId}`;
|
||||
const link = `/#/jobs/project/${jobId}`;
|
||||
const tooltip = strings.get('resourceTooltips.PROJECT_UPDATE');
|
||||
|
||||
return { link, tooltip };
|
||||
@@ -510,8 +510,7 @@ function AtJobDetailsController (
|
||||
_strings_,
|
||||
_status_,
|
||||
_wait_,
|
||||
ParseTypeChange,
|
||||
ParseVariableString,
|
||||
_parse_,
|
||||
) {
|
||||
vm = this || {};
|
||||
|
||||
@@ -520,7 +519,7 @@ function AtJobDetailsController (
|
||||
$state = _$state_;
|
||||
|
||||
error = _error_;
|
||||
parse = ParseVariableString;
|
||||
parse = _parse_;
|
||||
prompt = _prompt_;
|
||||
strings = _strings_;
|
||||
status = _status_;
|
||||
@@ -589,7 +588,6 @@ AtJobDetailsController.$inject = [
|
||||
'JobStrings',
|
||||
'JobStatusService',
|
||||
'Wait',
|
||||
'ParseTypeChange',
|
||||
'ParseVariableString',
|
||||
];
|
||||
|
||||
|
||||
@@ -40,19 +40,19 @@
|
||||
|
||||
<div class="HostEvent-nav">
|
||||
<!-- view navigation buttons -->
|
||||
<button ui-sref="jobz.host-event.json" type="button"
|
||||
<button ui-sref="output.host-event.json" type="button"
|
||||
class="btn btn-sm btn-default HostEvent-tab"
|
||||
ng-class="{'HostEvent-tab--selected' : isActiveState('jobz.host-event.json')}">
|
||||
ng-class="{'HostEvent-tab--selected' : isActiveState('output.host-event.json')}">
|
||||
JSON
|
||||
</button>
|
||||
<button ng-if="stdout" ui-sref="jobz.host-event.stdout"
|
||||
<button ng-if="stdout" ui-sref="output.host-event.stdout"
|
||||
type="button" class="btn btn-sm btn-default HostEvent-tab"
|
||||
ng-class="{'HostEvent-tab--selected' : isActiveState('jobz.host-event.stdout')}">
|
||||
ng-class="{'HostEvent-tab--selected' : isActiveState('output.host-event.stdout')}">
|
||||
Standard Out
|
||||
</button>
|
||||
<button ng-if="stderr" ui-sref="jobz.host-event.stderr"
|
||||
<button ng-if="stderr" ui-sref="output.host-event.stderr"
|
||||
type="button" class="btn btn-sm btn-default HostEvent-tab"
|
||||
ng-class="{'HostEvent-tab--selected' : isActiveState('jobz.host-event.stderr')}">
|
||||
ng-class="{'HostEvent-tab--selected' : isActiveState('output.host-event.stderr')}">
|
||||
Standard Error
|
||||
</button>
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ function HostEventsController (
|
||||
$scope.stdout = event[0];// eslint-disable-line prefer-destructuring
|
||||
}
|
||||
// instantiate Codemirror
|
||||
if ($state.current.name === 'jobz.host-event.json') {
|
||||
if ($state.current.name === 'output.host-event.json') {
|
||||
try {
|
||||
if (_.has(hostEvent.event_data, 'res')) {
|
||||
initCodeMirror(
|
||||
@@ -73,14 +73,14 @@ function HostEventsController (
|
||||
// element with id HostEvent-codemirror is not the view
|
||||
// controlled by this instance of HostEventController
|
||||
}
|
||||
} else if ($state.current.name === 'jobz.host-event.stdout') {
|
||||
} else if ($state.current.name === 'output.host-event.stdout') {
|
||||
try {
|
||||
resize();
|
||||
} catch (err) {
|
||||
// element with id HostEvent-codemirror is not the view
|
||||
// controlled by this instance of HostEventController
|
||||
}
|
||||
} else if ($state.current.name === 'jobz.host-event.stderr') {
|
||||
} else if ($state.current.name === 'output.host-event.stderr') {
|
||||
try {
|
||||
resize();
|
||||
} catch (err) {
|
||||
@@ -98,11 +98,11 @@ function HostEventsController (
|
||||
});
|
||||
|
||||
function resize () {
|
||||
if ($state.current.name === 'jobz.host-event.json') {
|
||||
if ($state.current.name === 'output.host-event.json') {
|
||||
const editor = $('.CodeMirror')[0].CodeMirror;
|
||||
const height = $('.modal-dialog').height() - $('.HostEvent-header').height() - $('.HostEvent-details').height() - $('.HostEvent-nav').height() - $('.HostEvent-controls').height() - 120;
|
||||
editor.setSize('100%', height);
|
||||
} else if ($state.current.name === 'jobz.host-event.stdout' || $state.current.name === 'jobz.host-event.stderr') {
|
||||
} else if ($state.current.name === 'output.host-event.stdout' || $state.current.name === 'output.host-event.stderr') {
|
||||
const height = $('.modal-dialog').height() - $('.HostEvent-header').height() - $('.HostEvent-details').height() - $('.HostEvent-nav').height() - $('.HostEvent-controls').height() - 120;
|
||||
$('.HostEvent-stdout').width('100%');
|
||||
$('.HostEvent-stdout').height(height);
|
||||
@@ -154,7 +154,7 @@ function HostEventsController (
|
||||
// Unbind the listener so it doesn't fire when we close the modal via navigation
|
||||
$('#HostEvent').off('hidden.bs.modal');
|
||||
$('#HostEvent').modal('hide');
|
||||
$state.go('jobz');
|
||||
$state.go('output');
|
||||
}
|
||||
$scope.init = init;
|
||||
$scope.init();
|
||||
|
||||
@@ -25,7 +25,7 @@ HostEventResolve.$inject = [
|
||||
];
|
||||
|
||||
const hostEventModal = {
|
||||
name: 'jobz.host-event',
|
||||
name: 'output.host-event',
|
||||
url: '/host-event/:eventId',
|
||||
controller: 'HostEventsController',
|
||||
templateUrl: HostEventModalTemplate,
|
||||
@@ -40,7 +40,7 @@ const hostEventModal = {
|
||||
};
|
||||
|
||||
const hostEventJson = {
|
||||
name: 'jobz.host-event.json',
|
||||
name: 'output.host-event.json',
|
||||
url: '/json',
|
||||
controller: 'HostEventsController',
|
||||
templateUrl: HostEventCodeMirrorTemplate,
|
||||
@@ -50,7 +50,7 @@ const hostEventJson = {
|
||||
};
|
||||
|
||||
const hostEventStdout = {
|
||||
name: 'jobz.host-event.stdout',
|
||||
name: 'output.host-event.stdout',
|
||||
url: '/stdout',
|
||||
controller: 'HostEventsController',
|
||||
templateUrl: HostEventStdoutTemplate,
|
||||
@@ -60,7 +60,7 @@ const hostEventStdout = {
|
||||
};
|
||||
|
||||
const hostEventStderr = {
|
||||
name: 'jobz.host-event.stderr',
|
||||
name: 'output.host-event.stderr',
|
||||
url: '/stderr',
|
||||
controller: 'HostEventsController',
|
||||
templateUrl: HostEventStderrTemplate,
|
||||
|
||||
@@ -8,6 +8,7 @@ import RenderService from '~features/output/render.service';
|
||||
import ScrollService from '~features/output/scroll.service';
|
||||
import EngineService from '~features/output/engine.service';
|
||||
import StatusService from '~features/output/status.service';
|
||||
import LegacyRedirect from '~features/output/legacy.route';
|
||||
|
||||
import DetailsDirective from '~features/output/details.directive';
|
||||
import SearchDirective from '~features/output/search.directive';
|
||||
@@ -125,12 +126,6 @@ function resolveWebSocketConnection ($stateParams, SocketService) {
|
||||
return SocketService.addStateResolve(state, id);
|
||||
}
|
||||
|
||||
function resolveBreadcrumb (strings) {
|
||||
return {
|
||||
label: strings.get('state.TITLE')
|
||||
};
|
||||
}
|
||||
|
||||
function getWebSocketResource (type) {
|
||||
let name;
|
||||
let key;
|
||||
@@ -163,11 +158,15 @@ function getWebSocketResource (type) {
|
||||
return { name, key };
|
||||
}
|
||||
|
||||
function JobsRun ($stateRegistry) {
|
||||
function JobsRun ($stateRegistry, strings) {
|
||||
const parent = 'jobs';
|
||||
const ncyBreadcrumb = { parent, label: strings.get('state.BREADCRUMB_DEFAULT') };
|
||||
|
||||
const state = {
|
||||
name: 'jobz',
|
||||
url: '/jobz/:type/:id?job_event_search',
|
||||
route: '/jobz/:type/:id?job_event_search',
|
||||
url: '/:type/:id?job_event_search',
|
||||
name: 'output',
|
||||
parent,
|
||||
ncyBreadcrumb,
|
||||
data: {
|
||||
activityStream: false,
|
||||
},
|
||||
@@ -179,6 +178,11 @@ function JobsRun ($stateRegistry) {
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
webSocketConnection: [
|
||||
'$stateParams',
|
||||
'SocketService',
|
||||
resolveWebSocketConnection
|
||||
],
|
||||
resource: [
|
||||
'JobModel',
|
||||
'ProjectUpdateModel',
|
||||
@@ -191,14 +195,11 @@ function JobsRun ($stateRegistry) {
|
||||
'Wait',
|
||||
resolveResource
|
||||
],
|
||||
ncyBreadcrumb: [
|
||||
'JobStrings',
|
||||
resolveBreadcrumb
|
||||
],
|
||||
webSocketConnection: [
|
||||
'$stateParams',
|
||||
'SocketService',
|
||||
resolveWebSocketConnection
|
||||
breadcrumbLabel: [
|
||||
'resource',
|
||||
({ model }) => {
|
||||
ncyBreadcrumb.label = `${model.get('id')} - ${model.get('name')}`;
|
||||
}
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -206,7 +207,7 @@ function JobsRun ($stateRegistry) {
|
||||
$stateRegistry.register(state);
|
||||
}
|
||||
|
||||
JobsRun.$inject = ['$stateRegistry'];
|
||||
JobsRun.$inject = ['$stateRegistry', 'JobStrings'];
|
||||
|
||||
angular
|
||||
.module(MODULE_NAME, [
|
||||
@@ -223,6 +224,7 @@ angular
|
||||
.directive('atJobDetails', DetailsDirective)
|
||||
.directive('atJobSearch', SearchDirective)
|
||||
.directive('atJobStats', StatsDirective)
|
||||
.run(JobsRun);
|
||||
.run(JobsRun)
|
||||
.run(LegacyRedirect);
|
||||
|
||||
export default MODULE_NAME;
|
||||
|
||||
@@ -5,7 +5,7 @@ function JobsStrings (BaseString) {
|
||||
const ns = this.jobs;
|
||||
|
||||
ns.state = {
|
||||
TITLE: t.s('JOBZ')
|
||||
BREADCRUMB_DEFAULT: t.s('RESULTS'),
|
||||
};
|
||||
|
||||
ns.status = {
|
||||
|
||||
55
awx/ui/client/features/output/legacy.route.js
Normal file
55
awx/ui/client/features/output/legacy.route.js
Normal file
@@ -0,0 +1,55 @@
|
||||
function LegacyRedirect ($stateRegistry) {
|
||||
const destination = 'output';
|
||||
const routes = [
|
||||
{
|
||||
name: 'legacyJobResult',
|
||||
url: '/jobs/:id?job_event_search',
|
||||
redirectTo: (trans) => {
|
||||
const {
|
||||
id,
|
||||
job_event_search // eslint-disable-line camelcase
|
||||
} = trans.params();
|
||||
|
||||
return { state: destination, params: { type: 'playbook', id, job_event_search } };
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'legacyAdHocJobStdout',
|
||||
url: '/ad_hoc_commands/:id',
|
||||
redirectTo: (trans) => {
|
||||
const { id } = trans.params();
|
||||
return { state: destination, params: { type: 'command', id } };
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'legacyInventorySyncStdout',
|
||||
url: '/inventory_sync/:id',
|
||||
redirectTo: (trans) => {
|
||||
const { id } = trans.params();
|
||||
return { state: destination, params: { type: 'inventory', id } };
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'legacyManagementJobStdout',
|
||||
url: '/management_jobs/:id',
|
||||
redirectTo: (trans) => {
|
||||
const { id } = trans.params();
|
||||
return { state: destination, params: { type: 'system', id } };
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'legacyScmUpdateStdout',
|
||||
url: '/scm_update/:id',
|
||||
redirectTo: (trans) => {
|
||||
const { id } = trans.params();
|
||||
return { state: destination, params: { type: 'project', id } };
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
routes.forEach(state => $stateRegistry.register(state));
|
||||
}
|
||||
|
||||
LegacyRedirect.$inject = ['$stateRegistry'];
|
||||
|
||||
export default LegacyRedirect;
|
||||
@@ -183,7 +183,7 @@ function JobRenderService ($q, $sce, $window) {
|
||||
}
|
||||
|
||||
if (current.isHost) {
|
||||
tdEvent = `<td class="at-Stdout-event--host" ui-sref="jobz.host-event.json({eventId: ${current.id}, taskUuid: '${current.uuid}' })"><span ng-non-bindable>${content}</span></td>`;
|
||||
tdEvent = `<td class="at-Stdout-event--host" ui-sref="output.host-event.json({eventId: ${current.id}, taskUuid: '${current.uuid}' })"><span ng-non-bindable>${content}</span></td>`;
|
||||
}
|
||||
|
||||
if (current.time && current.line === ln) {
|
||||
|
||||
Reference in New Issue
Block a user