1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +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); stream.setFinalCounter(data.final_counter);
} }
function reloadState (params) {
params.isPanelExpanded = vm.isPanelExpanded;
return $state.transitionTo($state.current, params, { inherit: false, location: 'replace' });
}
function OutputIndexController ( function OutputIndexController (
_$compile_, _$compile_,
_$q_, _$q_,
@ -250,6 +256,7 @@ function OutputIndexController (
_stream_, _stream_,
$filter, $filter,
strings, strings,
$stateParams,
) { ) {
$compile = _$compile_; $compile = _$compile_;
$q = _$q_; $q = _$q_;
@ -269,7 +276,10 @@ function OutputIndexController (
vm.title = $filter('sanitize')(resource.model.get('name')); vm.title = $filter('sanitize')(resource.model.get('name'));
vm.strings = strings; vm.strings = strings;
vm.resource = resource; vm.resource = resource;
vm.isPanelExpanded = false;
const { isPanelExpanded } = $stateParams;
vm.reloadState = reloadState;
vm.isPanelExpanded = isPanelExpanded;
vm.togglePanelExpand = togglePanelExpand; vm.togglePanelExpand = togglePanelExpand;
// Stdout Navigation // Stdout Navigation
@ -325,6 +335,7 @@ OutputIndexController.$inject = [
'OutputStreamService', 'OutputStreamService',
'$filter', '$filter',
'OutputStrings', 'OutputStrings',
'$stateParams',
]; ];
module.exports = OutputIndexController; module.exports = OutputIndexController;

View File

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

View File

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

View File

@ -1,6 +1,5 @@
const templateUrl = require('~features/output/search.partial.html'); 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 searchKeyExamples = ['host_name:localhost', 'task:set', 'created:>=2000-01-01'];
const searchKeyFields = ['changed', 'created', 'failed', 'host_name', 'stdout', 'task', 'role', 'playbook', 'play']; 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'; 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.message = '';
vm.tags = getSearchTags(queryset); vm.tags = getSearchTags(queryset);
return $state.transitionTo($state.current, params, searchReloadOptions) return vm.reload(params)
.catch(() => { .catch(() => {
vm.tags = currentTags; vm.tags = currentTags;
vm.message = rejection; vm.message = rejection;
@ -139,4 +138,7 @@ export default {
templateUrl, templateUrl,
controller: JobSearchController, controller: JobSearchController,
controllerAs: 'vm', controllerAs: 'vm',
bindings: {
reload: '=',
},
}; };