From 7f452ee8d10f209caebc648420ea1fffb08c8cfe Mon Sep 17 00:00:00 2001 From: mabashian Date: Thu, 25 Apr 2019 15:21:47 -0400 Subject: [PATCH] Add more sort options to new lists --- .../applications/applications.strings.js | 7 ------- .../list-applications-users.controller.js | 11 ++++++---- .../list-applications.controller.js | 4 +++- awx/ui/client/features/jobs/jobs.strings.js | 7 ------- .../features/jobs/jobsList.controller.js | 6 ++++-- .../features/projects/projects.strings.js | 5 ----- .../projects/projectsList.controller.js | 9 ++++---- .../features/templates/templates.strings.js | 5 ----- .../templates/templatesList.controller.js | 6 +++++- .../features/users/tokens/tokens.strings.js | 5 ----- .../tokens/users-tokens-list.controller.js | 11 ++++++---- .../lib/services/base-string.service.js | 21 +++++++++++++++++++ .../instance-groups.strings.js | 5 ----- .../instances/instance-modal.controller.js | 11 ++++++---- .../instances/instances.controller.js | 11 ++++++---- .../list/instance-groups-list.controller.js | 9 ++++---- 16 files changed, 71 insertions(+), 62 deletions(-) diff --git a/awx/ui/client/features/applications/applications.strings.js b/awx/ui/client/features/applications/applications.strings.js index 4c907acbfc..f6fb73f56a 100644 --- a/awx/ui/client/features/applications/applications.strings.js +++ b/awx/ui/client/features/applications/applications.strings.js @@ -38,13 +38,6 @@ function ApplicationsStrings (BaseString) { ns.inputs = { ORGANIZATION_PLACEHOLDER: t.s('SELECT AN ORGANIZATION') }; - - ns.sort = { - NAME_ASCENDING: t.s('Name (Ascending)'), - NAME_DESCENDING: t.s('Name (Descending)'), - USERNAME_ASCENDING: t.s('Username (Ascending)'), - USERNAME_DESCENDING: t.s('Username (Descending)') - }; } ApplicationsStrings.$inject = ['BaseStringService']; diff --git a/awx/ui/client/features/applications/list-applications-users.controller.js b/awx/ui/client/features/applications/list-applications-users.controller.js index 83b33b8251..bb7dc70edd 100644 --- a/awx/ui/client/features/applications/list-applications-users.controller.js +++ b/awx/ui/client/features/applications/list-applications-users.controller.js @@ -41,10 +41,13 @@ function ListApplicationsUsersController ( vm.toolbarSortOptions = [ toolbarSortDefault, - { - label: `${strings.get('sort.USERNAME_DESCENDING')}`, - value: '-user__username' - } + { label: `${strings.get('sort.USERNAME_DESCENDING')}`, value: '-user__username' }, + { label: `${strings.get('sort.CREATED_ASCENDING')}`, value: 'created' }, + { label: `${strings.get('sort.CREATED_DESCENDING')}`, value: '-created' }, + { label: `${strings.get('sort.MODIFIED_ASCENDING')}`, value: 'modified' }, + { label: `${strings.get('sort.MODIFIED_DESCENDING')}`, value: '-modified' }, + { label: `${strings.get('sort.EXPIRES_ASCENDING')}`, value: 'expires' }, + { label: `${strings.get('sort.EXPIRES_DESCENDING')}`, value: '-expires' } ]; function setToolbarSort () { diff --git a/awx/ui/client/features/applications/list-applications.controller.js b/awx/ui/client/features/applications/list-applications.controller.js index df824ac52f..254b31930b 100644 --- a/awx/ui/client/features/applications/list-applications.controller.js +++ b/awx/ui/client/features/applications/list-applications.controller.js @@ -54,7 +54,9 @@ function ListApplicationsController ( vm.toolbarSortOptions = [ toolbarSortDefault, - { label: `${strings.get('sort.NAME_DESCENDING')}`, value: '-name' } + { label: `${strings.get('sort.NAME_DESCENDING')}`, value: '-name' }, + { label: `${strings.get('sort.CREATED_ASCENDING')}`, value: 'created' }, + { label: `${strings.get('sort.CREATED_DESCENDING')}`, value: '-created' } ]; vm.toolbarSortValue = toolbarSortDefault; diff --git a/awx/ui/client/features/jobs/jobs.strings.js b/awx/ui/client/features/jobs/jobs.strings.js index 6bc6225760..a5b69df13f 100644 --- a/awx/ui/client/features/jobs/jobs.strings.js +++ b/awx/ui/client/features/jobs/jobs.strings.js @@ -4,13 +4,6 @@ function JobsStrings (BaseString) { const { t } = this; const ns = this.jobs; - ns.sort = { - NAME_ASCENDING: t.s('Name (Ascending)'), - NAME_DESCENDING: t.s('Name (Descending)'), - START_TIME: t.s('Start Time'), - FINISH_TIME: t.s('Finish Time') - }; - ns.list = { PANEL_TITLE: t.s('JOBS'), ROW_ITEM_LABEL_STARTED: t.s('Started'), diff --git a/awx/ui/client/features/jobs/jobsList.controller.js b/awx/ui/client/features/jobs/jobsList.controller.js index 48bedb049e..9b99bc397d 100644 --- a/awx/ui/client/features/jobs/jobsList.controller.js +++ b/awx/ui/client/features/jobs/jobsList.controller.js @@ -46,7 +46,7 @@ function ListJobsController ( }, true); const toolbarSortDefault = { - label: `${strings.get('sort.FINISH_TIME')}`, + label: `${strings.get('sort.FINISH_TIME_DESCENDING')}`, value: '-finished' }; @@ -63,7 +63,9 @@ function ListJobsController ( vm.toolbarSortOptions = [ { label: `${strings.get('sort.NAME_ASCENDING')}`, value: 'name' }, { label: `${strings.get('sort.NAME_DESCENDING')}`, value: '-name' }, - { label: `${strings.get('sort.START_TIME')}`, value: 'finished' }, + { label: `${strings.get('sort.FINISH_TIME_ASCENDING')}`, value: 'finished' }, + { label: `${strings.get('sort.START_TIME_ASCENDING')}`, value: 'started' }, + { label: `${strings.get('sort.START_TIME_DESCENDING')}`, value: '-started' }, toolbarSortDefault ]; diff --git a/awx/ui/client/features/projects/projects.strings.js b/awx/ui/client/features/projects/projects.strings.js index 7512f0f339..c09f3104d9 100644 --- a/awx/ui/client/features/projects/projects.strings.js +++ b/awx/ui/client/features/projects/projects.strings.js @@ -46,11 +46,6 @@ function ProjectsStrings (BaseString) { HEADER: this.error.HEADER, CALL: this.error.CALL, }; - - ns.sort = { - NAME_ASCENDING: t.s('Name (Ascending)'), - NAME_DESCENDING: t.s('Name (Descending)') - }; } ProjectsStrings.$inject = ['BaseStringService']; diff --git a/awx/ui/client/features/projects/projectsList.controller.js b/awx/ui/client/features/projects/projectsList.controller.js index b3557d7d00..3d2e1369fa 100644 --- a/awx/ui/client/features/projects/projectsList.controller.js +++ b/awx/ui/client/features/projects/projectsList.controller.js @@ -68,10 +68,11 @@ function projectsListController ( vm.toolbarSortOptions = [ toolbarSortDefault, - { - label: `${strings.get('sort.NAME_DESCENDING')}`, - value: '-name' - } + { label: `${strings.get('sort.NAME_DESCENDING')}`, value: '-name' }, + { label: `${strings.get('sort.MODIFIED_ASCENDING')}`, value: 'modified' }, + { label: `${strings.get('sort.MODIFIED_DESCENDING')}`, value: '-modified' }, + { label: `${strings.get('sort.LAST_JOB_RUN_ASCENDING')}`, value: 'last_job_run' }, + { label: `${strings.get('sort.LAST_JOB_RUN_DESCENDING')}`, value: '-last_job_run' } ]; vm.toolbarSortValue = toolbarSortDefault; diff --git a/awx/ui/client/features/templates/templates.strings.js b/awx/ui/client/features/templates/templates.strings.js index b536f665b3..d294988d01 100644 --- a/awx/ui/client/features/templates/templates.strings.js +++ b/awx/ui/client/features/templates/templates.strings.js @@ -143,11 +143,6 @@ function TemplatesStrings (BaseString) { CANCEL: t.s('CANCEL'), SAVE_AND_EXIT: t.s('SAVE & EXIT') }; - - ns.sort = { - NAME_ASCENDING: t.s('Name (Ascending)'), - NAME_DESCENDING: t.s('Name (Descending)') - }; } TemplatesStrings.$inject = ['BaseStringService']; diff --git a/awx/ui/client/features/templates/templatesList.controller.js b/awx/ui/client/features/templates/templatesList.controller.js index b072029752..84c2d512fb 100644 --- a/awx/ui/client/features/templates/templatesList.controller.js +++ b/awx/ui/client/features/templates/templatesList.controller.js @@ -71,7 +71,11 @@ function ListTemplatesController( vm.toolbarSortOptions = [ toolbarSortDefault, - { label: `${strings.get('sort.NAME_DESCENDING')}`, value: '-name' } + { label: `${strings.get('sort.NAME_DESCENDING')}`, value: '-name' }, + { label: `${strings.get('sort.MODIFIED_ASCENDING')}`, value: 'modified' }, + { label: `${strings.get('sort.MODIFIED_DESCENDING')}`, value: '-modified' }, + { label: `${strings.get('sort.LAST_JOB_RUN_ASCENDING')}`, value: 'last_job_run' }, + { label: `${strings.get('sort.LAST_JOB_RUN_DESCENDING')}`, value: '-last_job_run' } ]; vm.toolbarSortValue = toolbarSortDefault; diff --git a/awx/ui/client/features/users/tokens/tokens.strings.js b/awx/ui/client/features/users/tokens/tokens.strings.js index 13487e9ede..2f84642eae 100644 --- a/awx/ui/client/features/users/tokens/tokens.strings.js +++ b/awx/ui/client/features/users/tokens/tokens.strings.js @@ -41,11 +41,6 @@ function TokensStrings (BaseString) { PERSONAL_ACCESS_TOKEN: t.s('Personal Access Token'), HEADER: appName => t.s('{{ appName }} Token', { appName }), }; - - ns.sort = { - NAME_ASCENDING: t.s('Name (Ascending)'), - NAME_DESCENDING: t.s('Name (Descending)') - }; } TokensStrings.$inject = ['BaseStringService']; diff --git a/awx/ui/client/features/users/tokens/users-tokens-list.controller.js b/awx/ui/client/features/users/tokens/users-tokens-list.controller.js index aedac69bcb..008f30fda7 100644 --- a/awx/ui/client/features/users/tokens/users-tokens-list.controller.js +++ b/awx/ui/client/features/users/tokens/users-tokens-list.controller.js @@ -50,10 +50,13 @@ function ListTokensController ( vm.toolbarSortOptions = [ toolbarSortDefault, - { - label: `${strings.get('sort.NAME_DESCENDING')}`, - value: '-application__name' - } + { label: `${strings.get('sort.NAME_DESCENDING')}`, value: '-application__name' }, + { label: `${strings.get('sort.CREATED_ASCENDING')}`, value: 'created' }, + { label: `${strings.get('sort.CREATED_DESCENDING')}`, value: '-created' }, + { label: `${strings.get('sort.MODIFIED_ASCENDING')}`, value: 'modified' }, + { label: `${strings.get('sort.MODIFIED_DESCENDING')}`, value: '-modified' }, + { label: `${strings.get('sort.EXPIRES_ASCENDING')}`, value: 'expires' }, + { label: `${strings.get('sort.EXPIRES_DESCENDING')}`, value: '-expires' } ]; function setToolbarSort () { diff --git a/awx/ui/client/lib/services/base-string.service.js b/awx/ui/client/lib/services/base-string.service.js index 6db4249b49..df725d43a4 100644 --- a/awx/ui/client/lib/services/base-string.service.js +++ b/awx/ui/client/lib/services/base-string.service.js @@ -103,6 +103,27 @@ function BaseStringService (namespace) { CANCEL: resourceType => t.s('Cancel the {{resourceType}}', { resourceType }) }; + this.sort = { + NAME_ASCENDING: t.s('Name (Ascending)'), + NAME_DESCENDING: t.s('Name (Descending)'), + CREATED_ASCENDING: t.s('Created (Ascending)'), + CREATED_DESCENDING: t.s('Created (Descending)'), + MODIFIED_ASCENDING: t.s('Modified (Ascending)'), + MODIFIED_DESCENDING: t.s('Modified (Descending)'), + EXPIRES_ASCENDING: t.s('Expires (Ascending)'), + EXPIRES_DESCENDING: t.s('Expires (Descending)'), + LAST_JOB_RUN_ASCENDING: t.s('Last Run (Ascending)'), + LAST_JOB_RUN_DESCENDING: t.s('Last Run (Descending)'), + USERNAME_ASCENDING: t.s('Username (Ascending)'), + USERNAME_DESCENDING: t.s('Username (Descending)'), + START_TIME_ASCENDING: t.s('Start Time (Ascending)'), + START_TIME_DESCENDING: t.s('Start Time (Descending)'), + FINISH_TIME_ASCENDING: t.s('Finish Time (Ascending)'), + FINISH_TIME_DESCENDING: t.s('Finish Time (Descending)'), + UUID_ASCENDING: t.s('UUID (Ascending)'), + UUID_DESCENDING: t.s('UUID (Descending)') + }; + this.ALERT = ({ header, body }) => t.s('{{ header }} {{ body }}', { header, body }); /** diff --git a/awx/ui/client/src/instance-groups/instance-groups.strings.js b/awx/ui/client/src/instance-groups/instance-groups.strings.js index ca93c23140..0becb671f7 100644 --- a/awx/ui/client/src/instance-groups/instance-groups.strings.js +++ b/awx/ui/client/src/instance-groups/instance-groups.strings.js @@ -62,11 +62,6 @@ function InstanceGroupsStrings (BaseString) { ns.alert = { MISSING_PARAMETER: t.s('Instance Group parameter is missing.'), }; - - ns.sort = { - NAME_ASCENDING: t.s('Name (Ascending)'), - NAME_DESCENDING: t.s('Name (Descending)') - }; } InstanceGroupsStrings.$inject = ['BaseStringService']; diff --git a/awx/ui/client/src/instance-groups/instances/instance-modal.controller.js b/awx/ui/client/src/instance-groups/instances/instance-modal.controller.js index 474e3712bf..fdafc621bb 100644 --- a/awx/ui/client/src/instance-groups/instances/instance-modal.controller.js +++ b/awx/ui/client/src/instance-groups/instances/instance-modal.controller.js @@ -42,10 +42,13 @@ function InstanceModalController ($scope, $state, Dataset, models, strings, Proc vm.toolbarSortValue = toolbarSortDefault; vm.toolbarSortOptions = [ toolbarSortDefault, - { - label: `${strings.get('sort.NAME_DESCENDING')}`, - value: '-hostname' - } + { label: `${strings.get('sort.NAME_DESCENDING')}`, value: '-hostname' }, + { label: `${strings.get('sort.UUID_ASCENDING')}`, value: 'uuid' }, + { label: `${strings.get('sort.UUID_DESCENDING')}`, value: '-uuid' }, + { label: `${strings.get('sort.CREATED_ASCENDING')}`, value: 'created' }, + { label: `${strings.get('sort.CREATED_DESCENDING')}`, value: '-created' }, + { label: `${strings.get('sort.MODIFIED_ASCENDING')}`, value: 'modified' }, + { label: `${strings.get('sort.MODIFIED_DESCENDING')}`, value: '-modified' } ]; const removeStateParamsListener = $scope.$watchCollection('$state.params', () => { diff --git a/awx/ui/client/src/instance-groups/instances/instances.controller.js b/awx/ui/client/src/instance-groups/instances/instances.controller.js index 329ee1ad19..7b54b13af1 100644 --- a/awx/ui/client/src/instance-groups/instances/instances.controller.js +++ b/awx/ui/client/src/instance-groups/instances/instances.controller.js @@ -24,10 +24,13 @@ function InstancesController ($scope, $state, $http, $transitions, models, strin vm.toolbarSortValue = toolbarSortDefault; vm.toolbarSortOptions = [ toolbarSortDefault, - { - label: `${strings.get('sort.NAME_DESCENDING')}`, - value: '-hostname' - } + { label: `${strings.get('sort.NAME_DESCENDING')}`, value: '-hostname' }, + { label: `${strings.get('sort.UUID_ASCENDING')}`, value: 'uuid' }, + { label: `${strings.get('sort.UUID_DESCENDING')}`, value: '-uuid' }, + { label: `${strings.get('sort.CREATED_ASCENDING')}`, value: 'created' }, + { label: `${strings.get('sort.CREATED_DESCENDING')}`, value: '-created' }, + { label: `${strings.get('sort.MODIFIED_ASCENDING')}`, value: 'modified' }, + { label: `${strings.get('sort.MODIFIED_DESCENDING')}`, value: '-modified' } ]; const removeStateParamsListener = $scope.$watchCollection('$state.params', () => { diff --git a/awx/ui/client/src/instance-groups/list/instance-groups-list.controller.js b/awx/ui/client/src/instance-groups/list/instance-groups-list.controller.js index 766f968442..2037aef0d9 100644 --- a/awx/ui/client/src/instance-groups/list/instance-groups-list.controller.js +++ b/awx/ui/client/src/instance-groups/list/instance-groups-list.controller.js @@ -43,10 +43,11 @@ export default ['$scope', '$filter', '$state', 'Alert', 'resolvedModels', 'Datas vm.toolbarSortOptions = [ toolbarSortDefault, - { - label: `${strings.get('sort.NAME_DESCENDING')}`, - value: '-name' - } + { label: `${strings.get('sort.NAME_DESCENDING')}`, value: '-name' }, + { label: `${strings.get('sort.CREATED_ASCENDING')}`, value: 'created' }, + { label: `${strings.get('sort.CREATED_DESCENDING')}`, value: '-created' }, + { label: `${strings.get('sort.MODIFIED_ASCENDING')}`, value: 'modified' }, + { label: `${strings.get('sort.MODIFIED_DESCENDING')}`, value: '-modified' } ]; vm.toolbarSortValue = toolbarSortDefault;