1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

Merge pull request #2205 from Haokun-Chen/2181

keep expanded output window state after search
This commit is contained in:
Haokun Chen 2018-06-18 12:42:41 -04:00 committed by GitHub
commit af97338190
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 5 deletions

View File

@ -237,6 +237,12 @@ function handleSummaryEvent (data) {
stream.setFinalCounter(data.final_counter);
}
function reloadState (params) {
params.isPanelExpanded = vm.isPanelExpanded;
return $state.transitionTo($state.current, params, { inherit: false, location: 'replace' });
}
function OutputIndexController (
_$compile_,
_$q_,
@ -250,6 +256,7 @@ function OutputIndexController (
_stream_,
$filter,
strings,
$stateParams,
) {
$compile = _$compile_;
$q = _$q_;
@ -269,7 +276,10 @@ function OutputIndexController (
vm.title = $filter('sanitize')(resource.model.get('name'));
vm.strings = strings;
vm.resource = resource;
vm.isPanelExpanded = false;
const { isPanelExpanded } = $stateParams;
vm.reloadState = reloadState;
vm.isPanelExpanded = isPanelExpanded;
vm.togglePanelExpand = togglePanelExpand;
// Stdout Navigation
@ -325,6 +335,7 @@ OutputIndexController.$inject = [
'OutputStreamService',
'$filter',
'OutputStrings',
'$stateParams',
];
module.exports = OutputIndexController;

View File

@ -191,6 +191,7 @@ function JobsRun ($stateRegistry, $filter, strings) {
ncyBreadcrumb,
params: {
handleErrors: true,
isPanelExpanded: false,
},
data: {
activityStream: false,

View File

@ -14,7 +14,7 @@
resource="vm.resource"
expanded="vm.isPanelExpanded">
</at-job-stats>
<at-job-search></at-job-search>
<at-job-search reload="vm.reloadState"></at-job-search>
<div class="at-Stdout-menuTop">
<div class="pull-left" ng-click="vm.toggleMenuExpand()">

View File

@ -1,6 +1,5 @@
const templateUrl = require('~features/output/search.partial.html');
const searchReloadOptions = { inherit: false, location: 'replace' };
const searchKeyExamples = ['host_name:localhost', 'task:set', 'created:>=2000-01-01'];
const searchKeyFields = ['changed', 'created', 'failed', 'host_name', 'stdout', 'task', 'role', 'playbook', 'play'];
const searchKeyDocLink = 'https://docs.ansible.com/ansible-tower/3.3.0/html/userguide/search_sort.html';
@ -40,7 +39,7 @@ function reloadQueryset (queryset, rejection = strings.get('search.REJECT_DEFAUL
vm.message = '';
vm.tags = getSearchTags(queryset);
return $state.transitionTo($state.current, params, searchReloadOptions)
return vm.reload(params)
.catch(() => {
vm.tags = currentTags;
vm.message = rejection;
@ -139,4 +138,7 @@ export default {
templateUrl,
controller: JobSearchController,
controllerAs: 'vm',
bindings: {
reload: '=',
},
};