mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
Add toolbar sort configuration to project list
This commit is contained in:
parent
1525c6d97e
commit
8100fc1cfb
@ -46,6 +46,11 @@ function ProjectsStrings (BaseString) {
|
|||||||
HEADER: this.error.HEADER,
|
HEADER: this.error.HEADER,
|
||||||
CALL: this.error.CALL,
|
CALL: this.error.CALL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ns.sort = {
|
||||||
|
NAME_ASCENDING: t.s('Name (Ascending)'),
|
||||||
|
NAME_DESCENDING: t.s('Name (Descending)')
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectsStrings.$inject = ['BaseStringService'];
|
ProjectsStrings.$inject = ['BaseStringService'];
|
||||||
|
@ -27,6 +27,8 @@ function projectsListController (
|
|||||||
};
|
};
|
||||||
vm.dataset = Dataset.data;
|
vm.dataset = Dataset.data;
|
||||||
vm.projects = Dataset.data.results;
|
vm.projects = Dataset.data.results;
|
||||||
|
vm.querySet = $state.params.project_search;
|
||||||
|
|
||||||
$scope.$watch('vm.dataset.count', () => {
|
$scope.$watch('vm.dataset.count', () => {
|
||||||
$scope.$emit('updateCount', vm.dataset.count, 'projects');
|
$scope.$emit('updateCount', vm.dataset.count, 'projects');
|
||||||
});
|
});
|
||||||
@ -48,6 +50,36 @@ function projectsListController (
|
|||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
const toolbarSortDefault = {
|
||||||
|
label: `${strings.get('sort.NAME_ASCENDING')}`,
|
||||||
|
value: 'name'
|
||||||
|
};
|
||||||
|
|
||||||
|
vm.toolbarSortOptions = [
|
||||||
|
toolbarSortDefault,
|
||||||
|
{
|
||||||
|
label: `${strings.get('sort.NAME_DESCENDING')}`,
|
||||||
|
value: '-name'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
vm.toolbarSortValue = toolbarSortDefault;
|
||||||
|
|
||||||
|
vm.onToolbarSort = (sort) => {
|
||||||
|
vm.toolbarSortValue = sort;
|
||||||
|
|
||||||
|
const queryParams = Object.assign(
|
||||||
|
vm.querySet,
|
||||||
|
{ order_by: sort.value }
|
||||||
|
);
|
||||||
|
|
||||||
|
qs.search(GetBasePath(vm.list.basePath), queryParams)
|
||||||
|
.then(({ data }) => {
|
||||||
|
vm.dataset = data;
|
||||||
|
vm.projects = vm.dataset.results;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.$on('ws-jobs', (e, data) => {
|
$scope.$on('ws-jobs', (e, data) => {
|
||||||
$log.debug(data);
|
$log.debug(data);
|
||||||
if (vm.projects) {
|
if (vm.projects) {
|
||||||
|
@ -21,10 +21,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<at-list-toolbar
|
<at-list-toolbar
|
||||||
ng-if="vm.projects.length > 0"
|
ng-if="vm.projects.length > 0"
|
||||||
sort-only="false"
|
|
||||||
on-collapse="vm.onCollapse"
|
|
||||||
on-expand="vm.onExpand"
|
on-expand="vm.onExpand"
|
||||||
is-collapsed="vm.isCollapsed">
|
on-collapse="vm.onCollapse"
|
||||||
|
is-collapsed="vm.isCollapsed"
|
||||||
|
sort-only="false"
|
||||||
|
sort-value="vm.toolbarSortValue"
|
||||||
|
sort-options="vm.toolbarSortOptions"
|
||||||
|
on-sort="vm.onToolbarSort">
|
||||||
</at-list-toolbar>
|
</at-list-toolbar>
|
||||||
<at-list results="vm.projects">
|
<at-list results="vm.projects">
|
||||||
<at-row ng-repeat="project in vm.projects"
|
<at-row ng-repeat="project in vm.projects"
|
||||||
@ -44,7 +47,7 @@
|
|||||||
<div aw-tool-tip="{{ project.scm_update_tooltip }}"
|
<div aw-tool-tip="{{ project.scm_update_tooltip }}"
|
||||||
data-tip-watch="project.scm_update_tooltip"
|
data-tip-watch="project.scm_update_tooltip"
|
||||||
data-placement="top">
|
data-placement="top">
|
||||||
<div class="at-RowAction"
|
<div class="at-RowAction"
|
||||||
ng-class="{'at-RowAction--disabled': project.scm_update_disabled }"
|
ng-class="{'at-RowAction--disabled': project.scm_update_disabled }"
|
||||||
ng-click="vm.SCMUpdate(project.id, $event)"
|
ng-click="vm.SCMUpdate(project.id, $event)"
|
||||||
ng-show="project.summary_fields.user_capabilities.start">
|
ng-show="project.summary_fields.user_capabilities.start">
|
||||||
@ -56,16 +59,16 @@
|
|||||||
</at-row-action>
|
</at-row-action>
|
||||||
<at-row-action icon="fa-trash" ng-click="vm.deleteProject(project.id, project.name)"
|
<at-row-action icon="fa-trash" ng-click="vm.deleteProject(project.id, project.name)"
|
||||||
ng-show="(project.status !== 'updating'
|
ng-show="(project.status !== 'updating'
|
||||||
&& project.status !== 'running'
|
&& project.status !== 'running'
|
||||||
&& project.status !== 'pending'
|
&& project.status !== 'pending'
|
||||||
&& project.status !== 'waiting')
|
&& project.status !== 'waiting')
|
||||||
&& project.summary_fields.user_capabilities.delete">
|
&& project.summary_fields.user_capabilities.delete">
|
||||||
</at-row-action>
|
</at-row-action>
|
||||||
<at-row-action icon="fa-minus-circle" ng-click="vm.cancelUpdate(project)"
|
<at-row-action icon="fa-minus-circle" ng-click="vm.cancelUpdate(project)"
|
||||||
ng-show="(project.status == 'updating'
|
ng-show="(project.status == 'updating'
|
||||||
|| project.status == 'running'
|
|| project.status == 'running'
|
||||||
|| project.status == 'pending'
|
|| project.status == 'pending'
|
||||||
|| project.status == 'waiting')
|
|| project.status == 'waiting')
|
||||||
&& project.summary_fields.user_capabilities.start">
|
&& project.summary_fields.user_capabilities.start">
|
||||||
</at-row-action>
|
</at-row-action>
|
||||||
</div>
|
</div>
|
||||||
@ -77,7 +80,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<at-truncate string="{{ project.scm_revision }}" maxLength="7"></at-truncate>
|
<at-truncate string="{{ project.scm_revision }}" maxLength="7"></at-truncate>
|
||||||
</div>
|
</div>
|
||||||
<at-row-item
|
<at-row-item
|
||||||
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_ORGANIZATION')}}"
|
label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_ORGANIZATION')}}"
|
||||||
value="{{ project.summary_fields.organization.name }}"
|
value="{{ project.summary_fields.organization.name }}"
|
||||||
value-link="/#/organizations/{{ project.organization }}">
|
value-link="/#/organizations/{{ project.organization }}">
|
||||||
@ -98,6 +101,7 @@
|
|||||||
collection="vm.projects"
|
collection="vm.projects"
|
||||||
dataset="vm.dataset"
|
dataset="vm.dataset"
|
||||||
iterator="project"
|
iterator="project"
|
||||||
base-path="projects">
|
base-path="projects"
|
||||||
|
query-set="vm.querySet">
|
||||||
</paginate>
|
</paginate>
|
||||||
</at-panel-body>
|
</at-panel-body>
|
Loading…
Reference in New Issue
Block a user