mirror of
https://github.com/ansible/awx.git
synced 2026-02-16 02:30:01 -03:30
Merge pull request #2817 from jakemcdermott/job-results/_debug-mode
add event replay mode to ui for finished jobs
This commit is contained in:
@@ -38,6 +38,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-menuIcon--md {
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: @at-blue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&-menuIcon--lg {
|
&-menuIcon--lg {
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
line-height: 12px;
|
line-height: 12px;
|
||||||
|
|||||||
@@ -416,6 +416,22 @@ function reloadState (params) {
|
|||||||
return $state.transitionTo($state.current, params, { inherit: false, location: 'replace' });
|
return $state.transitionTo($state.current, params, { inherit: false, location: 'replace' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clear () {
|
||||||
|
stopListening();
|
||||||
|
render.clear();
|
||||||
|
|
||||||
|
followOnce = true;
|
||||||
|
lockFollow = false;
|
||||||
|
lockFrames = false;
|
||||||
|
|
||||||
|
bufferInit();
|
||||||
|
status.init(resource);
|
||||||
|
slide.init(render, resource.events, scroll);
|
||||||
|
status.subscribe(data => { vm.status = data.status; });
|
||||||
|
|
||||||
|
startListening();
|
||||||
|
}
|
||||||
|
|
||||||
function OutputIndexController (
|
function OutputIndexController (
|
||||||
_$compile_,
|
_$compile_,
|
||||||
_$q_,
|
_$q_,
|
||||||
@@ -432,7 +448,8 @@ function OutputIndexController (
|
|||||||
strings,
|
strings,
|
||||||
$stateParams,
|
$stateParams,
|
||||||
) {
|
) {
|
||||||
const { isPanelExpanded } = $stateParams;
|
const { isPanelExpanded, _debug } = $stateParams;
|
||||||
|
const isProcessingFinished = !_debug && _resource_.model.get('event_processing_finished');
|
||||||
|
|
||||||
$compile = _$compile_;
|
$compile = _$compile_;
|
||||||
$q = _$q_;
|
$q = _$q_;
|
||||||
@@ -444,7 +461,7 @@ function OutputIndexController (
|
|||||||
render = _render_;
|
render = _render_;
|
||||||
status = _status_;
|
status = _status_;
|
||||||
stream = _stream_;
|
stream = _stream_;
|
||||||
slide = resource.model.get('event_processing_finished') ? _page_ : _slide_;
|
slide = isProcessingFinished ? _page_ : _slide_;
|
||||||
|
|
||||||
vm = this || {};
|
vm = this || {};
|
||||||
|
|
||||||
@@ -458,7 +475,7 @@ function OutputIndexController (
|
|||||||
vm.togglePanelExpand = togglePanelExpand;
|
vm.togglePanelExpand = togglePanelExpand;
|
||||||
|
|
||||||
// Stdout Navigation
|
// Stdout Navigation
|
||||||
vm.menu = { last: menuLast, first, down, up };
|
vm.menu = { last: menuLast, first, down, up, clear };
|
||||||
vm.isMenuExpanded = true;
|
vm.isMenuExpanded = true;
|
||||||
vm.isFollowing = false;
|
vm.isFollowing = false;
|
||||||
vm.toggleMenuExpand = toggleMenuExpand;
|
vm.toggleMenuExpand = toggleMenuExpand;
|
||||||
@@ -466,6 +483,7 @@ function OutputIndexController (
|
|||||||
vm.showHostDetails = showHostDetails;
|
vm.showHostDetails = showHostDetails;
|
||||||
vm.toggleLineEnabled = resource.model.get('type') === 'job';
|
vm.toggleLineEnabled = resource.model.get('type') === 'job';
|
||||||
vm.followTooltip = vm.strings.get('tooltips.MENU_LAST');
|
vm.followTooltip = vm.strings.get('tooltips.MENU_LAST');
|
||||||
|
vm.debug = _debug;
|
||||||
|
|
||||||
render.requestAnimationFrame(() => {
|
render.requestAnimationFrame(() => {
|
||||||
bufferInit();
|
bufferInit();
|
||||||
@@ -523,7 +541,7 @@ function OutputIndexController (
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (resource.model.get('event_processing_finished')) {
|
if (isProcessingFinished) {
|
||||||
followOnce = false;
|
followOnce = false;
|
||||||
lockFollow = true;
|
lockFollow = true;
|
||||||
lockFrames = true;
|
lockFrames = true;
|
||||||
@@ -537,6 +555,10 @@ function OutputIndexController (
|
|||||||
startListening();
|
startListening();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_debug) {
|
||||||
|
return render.clear();
|
||||||
|
}
|
||||||
|
|
||||||
return last();
|
return last();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ function resolveResource (
|
|||||||
order_by: OUTPUT_ORDER_BY,
|
order_by: OUTPUT_ORDER_BY,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (job_event_search) { // eslint-disable-line camelcase
|
if (job_event_search) {
|
||||||
const query = qs.encodeQuerysetObject(qs.decodeArr(job_event_search));
|
const query = qs.encodeQuerysetObject(qs.decodeArr(job_event_search));
|
||||||
Object.assign(params, query);
|
Object.assign(params, query);
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ function JobsRun ($stateRegistry, $filter, strings) {
|
|||||||
const sanitize = $filter('sanitize');
|
const sanitize = $filter('sanitize');
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
url: '/:type/:id?job_event_search',
|
url: '/:type/:id?job_event_search?_debug',
|
||||||
name: 'output',
|
name: 'output',
|
||||||
parent,
|
parent,
|
||||||
ncyBreadcrumb,
|
ncyBreadcrumb,
|
||||||
|
|||||||
@@ -47,6 +47,9 @@
|
|||||||
<i class="at-Stdout-menuIcon--lg fa fa-angle-up"
|
<i class="at-Stdout-menuIcon--lg fa fa-angle-up"
|
||||||
data-placement="top" aw-tool-tip="{{:: vm.strings.get('tooltips.MENU_UP') }}"></i>
|
data-placement="top" aw-tool-tip="{{:: vm.strings.get('tooltips.MENU_UP') }}"></i>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="pull-right" ng-if="vm.debug" ng-click="vm.menu.clear()">
|
||||||
|
<i class="at-Stdout-menuIcon--md fa fa-undo"></i>
|
||||||
|
</div>
|
||||||
<div class="at-u-clear"></div>
|
<div class="at-u-clear"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="at-Stdout-container">
|
<div class="at-Stdout-container">
|
||||||
|
|||||||
@@ -95,6 +95,9 @@ playbook_on_play_start-install
|
|||||||
runner_on_ok_hostA (install_tower)
|
runner_on_ok_hostA (install_tower)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
A management command for event replay exists for replaying jobs at varying speeds and other parameters. Run `awx-manage replay_job_events --help` for additional usage information. To prepare the UI for event replay, load the page for a finished job and then append `_debug` as a parameter to the url.
|
||||||
|
|
||||||
## Code References
|
## Code References
|
||||||
* More comprehensive list of Job Events and the hierarchy they form https://github.com/ansible/awx/blob/devel/awx/main/models/jobs.py#L870
|
* More comprehensive list of Job Events and the hierarchy they form https://github.com/ansible/awx/blob/devel/awx/main/models/jobs.py#L870
|
||||||
* Exhaustive list of Job Events in Tower https://github.com/ansible/awx/blob/devel/awx/main/models/jobs.py#L900
|
* Exhaustive list of Job Events in Tower https://github.com/ansible/awx/blob/devel/awx/main/models/jobs.py#L900
|
||||||
|
|||||||
Reference in New Issue
Block a user