From 78a656bdd957c97e445cbb97952e86fe81b28db2 Mon Sep 17 00:00:00 2001 From: mabashian Date: Tue, 8 Aug 2017 13:25:43 -0400 Subject: [PATCH] Tweaks to inventory host strings --- .../groups/list/groups-list.controller.js | 32 +++++++-------- .../groups/list/groups-list.partial.html | 10 ++--- .../inventories/smart-inventory/main.js | 4 +- .../smart-inventory-host-filter.controller.js | 6 +-- .../smart-inventory.strings.js | 14 ------- .../inventory-hosts.strings.js | 40 ++++++++++--------- 6 files changed, 47 insertions(+), 59 deletions(-) delete mode 100644 awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.strings.js diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.controller.js index 017fc65081..14fd0caf8f 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.controller.js @@ -107,39 +107,39 @@ $scope.strings.deleteModal.host = $scope.toDelete.total_hosts === 1 ? InventoryHostsStrings.get('filter.HOST') : InventoryHostsStrings.get('filter.HOSTS'); if($scope.toDelete.total_groups > 1 && $scope.toDelete.total_hosts > 1) { - $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEGROUPSHOSTS'); - $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEGROUPSHOSTS'); + $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_GROUPS_HOSTS'); + $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_GROUPS_HOSTS'); } else if($scope.toDelete.total_groups > 1 && $scope.toDelete.total_hosts === 1) { - $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEGROUPSHOST'); - $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEGROUPSHOST'); + $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_GROUPS_HOST'); + $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_GROUPS_HOST'); } else if($scope.toDelete.total_groups === 1 && $scope.toDelete.total_hosts > 1) { - $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEGROUPHOSTS'); - $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEGROUPHOSTS'); + $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_GROUP_HOSTS'); + $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_GROUP_HOSTS'); } else if($scope.toDelete.total_groups === 1 && $scope.toDelete.total_hosts === 1) { - $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEGROUPHOST'); - $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEGROUPHOST'); + $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_GROUP_HOST'); + $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_GROUP_HOST'); } else if($scope.toDelete.total_groups === 0) { if($scope.toDelete.total_hosts > 1) { - $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEHOSTS'); - $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEHOSTS'); + $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_HOSTS'); + $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_HOSTS'); } else { - $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEHOST'); - $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEHOST'); + $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_HOST'); + $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_HOST'); } } else if($scope.toDelete.total_hosts === 0) { if($scope.toDelete.total_groups > 1) { - $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEGROUPS'); - $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEGROUPS'); + $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_GROUPS'); + $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_GROUPS'); } else { - $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEGROUP'); - $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEGROUP'); + $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_GROUP'); + $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_GROUP'); } } } diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.partial.html b/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.partial.html index 68056e0ed7..ec594610a6 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.partial.html +++ b/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.partial.html @@ -21,20 +21,20 @@

Deleting group {{ toDelete.name }}. - This group contains {{ toDelete.total_groups }} {{strings.deleteModal.group}} and {{ toDelete.total_hosts }} {{strings.deleteModal.host}}. - This group contains {{ toDelete.total_hosts }} {{strings.deleteModal.host}}. - This group contains {{ toDelete.total_groups }} {{strings.deleteModal.group}}. + This group contains {{ toDelete.total_groups }} {{:: strings.deleteModal.group }} and {{ toDelete.total_hosts }} {{:: strings.deleteModal.host }}. + This group contains {{ toDelete.total_hosts }} {{:: strings.deleteModal.host }}. + This group contains {{ toDelete.total_groups }} {{:: strings.deleteModal.group }}. Delete or promote the group's children?

diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/main.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/main.js index 9265ca2501..0f8a57560f 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/main.js +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/main.js @@ -9,7 +9,6 @@ import smartInventoryEdit from './edit/main'; import smartInventoryForm from './smart-inventory.form'; import smartInventoryHostFilter from './smart-inventory-host-filter/smart-inventory-host-filter.directive'; import hostFilterModal from './smart-inventory-host-filter/host-filter-modal/host-filter-modal.directive'; -import SmartInventoryStrings from './smart-inventory.strings'; export default angular.module('smartInventory', [ @@ -18,5 +17,4 @@ angular.module('smartInventory', [ ]) .factory('smartInventoryForm', smartInventoryForm) .directive('smartInventoryHostFilter', smartInventoryHostFilter) - .directive('hostFilterModal', hostFilterModal) - .service('SmartInventoryStrings', SmartInventoryStrings); + .directive('hostFilterModal', hostFilterModal); diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.controller.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.controller.js index 198e398b66..dd9008632b 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.controller.js @@ -4,11 +4,11 @@ * All Rights Reserved *************************************************/ -export default ['$scope', 'QuerySet', 'SmartInventoryStrings', - function($scope, qs, SmartInventoryStrings) { +export default ['$scope', 'QuerySet', 'InventoryHostsStrings', + function($scope, qs, InventoryHostsStrings) { $scope.hostFilterTags = []; - $scope.filterTooltip = SmartInventoryStrings.get('filter.TOOLTIP'); + $scope.filterTooltip = InventoryHostsStrings.get('smartinventories.TOOLTIP'); $scope.$watch('hostFilter', function(){ $scope.hostFilterTags = []; diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.strings.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.strings.js deleted file mode 100644 index e84d4d38f0..0000000000 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.strings.js +++ /dev/null @@ -1,14 +0,0 @@ -function SmartInventoryStrings (BaseString) { - BaseString.call(this, 'smartinventories'); - - let t = this.t; - let ns = this.smartinventories; - - ns.filter = { - TOOLTIP: t('Please click the icon to edit the host filter.') - }; -} - -SmartInventoryStrings.$inject = ['BaseStringService']; - -export default SmartInventoryStrings; diff --git a/awx/ui/client/src/inventories-hosts/inventory-hosts.strings.js b/awx/ui/client/src/inventories-hosts/inventory-hosts.strings.js index 5d62c5de95..ff6b50b3f6 100644 --- a/awx/ui/client/src/inventories-hosts/inventory-hosts.strings.js +++ b/awx/ui/client/src/inventories-hosts/inventory-hosts.strings.js @@ -1,30 +1,34 @@ function InventoryHostsStrings (BaseString) { - BaseString.call(this, 'inventoryhosts'); + BaseString.call(this, 'inventory-hosts'); let t = this.t; - let ns = this.inventoryhosts; + let ns = this['inventory-hosts']; ns.filter = { GROUP: t('group'), GROUPS: t('groups'), HOST: t('host'), HOSTS: t('hosts'), - PROMOTEGROUPSHOSTS: t('Promote groups and hosts'), - PROMOTEGROUPHOSTS: t('Promote group and hosts'), - PROMOTEGROUPSHOST: t('Promote groups and host'), - PROMOTEGROUPHOST: t('Promote group and host'), - DELETEGROUPSHOSTS: t('Delete groups and hosts'), - DELETEGROUPHOSTS: t('Delete group and hosts'), - DELETEGROUPSHOST: t('Delete groups and host'), - DELETEGROUPHOST: t('Delete group and host'), - PROMOTEGROUPS: t('Promote groups'), - PROMOTEGROUP: t('Promote group'), - DELETEGROUPS: t('Delete groups'), - DELETEGROUP: t('Delete group'), - PROMOTEHOSTS: t('Promote hosts'), - PROMOTEHOST: t('Promote host'), - DELETEHOSTS: t('Delete hosts'), - DELETEHOST: t('Delete host') + PROMOTE_GROUPS_HOSTS: t('Promote groups and hosts'), + PROMOTE_GROUP_HOSTS: t('Promote group and hosts'), + PROMOTE_GROUPS_HOST: t('Promote groups and host'), + PROMOTE_GROUP_HOST: t('Promote group and host'), + DELETE_GROUPS_HOSTS: t('Delete groups and hosts'), + DELETE_GROUP_HOSTS: t('Delete group and hosts'), + DELETE_GROUPS_HOST: t('Delete groups and host'), + DELETE_GROUP_HOST: t('Delete group and host'), + PROMOTE_GROUPS: t('Promote groups'), + PROMOTE_GROUP: t('Promote group'), + DELETE_GROUPS: t('Delete groups'), + DELETE_GROUP: t('Delete group'), + PROMOTE_HOSTS: t('Promote hosts'), + PROMOTE_HOST: t('Promote host'), + DELETE_HOSTS: t('Delete hosts'), + DELETE_HOST: t('Delete host') + }; + + ns.smartinventories = { + TOOLTIP: t('Please click the icon to edit the host filter.') }; }