Tweaks to inventory host strings

This commit is contained in:
mabashian
2017-08-08 13:25:43 -04:00
parent da8dff143c
commit 78a656bdd9
6 changed files with 47 additions and 59 deletions

View File

@@ -107,39 +107,39 @@
$scope.strings.deleteModal.host = $scope.toDelete.total_hosts === 1 ? InventoryHostsStrings.get('filter.HOST') : InventoryHostsStrings.get('filter.HOSTS'); $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) { if($scope.toDelete.total_groups > 1 && $scope.toDelete.total_hosts > 1) {
$scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEGROUPSHOSTS'); $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_GROUPS_HOSTS');
$scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEGROUPSHOSTS'); $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_GROUPS_HOSTS');
} }
else if($scope.toDelete.total_groups > 1 && $scope.toDelete.total_hosts === 1) { else if($scope.toDelete.total_groups > 1 && $scope.toDelete.total_hosts === 1) {
$scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEGROUPSHOST'); $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_GROUPS_HOST');
$scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEGROUPSHOST'); $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_GROUPS_HOST');
} }
else if($scope.toDelete.total_groups === 1 && $scope.toDelete.total_hosts > 1) { else if($scope.toDelete.total_groups === 1 && $scope.toDelete.total_hosts > 1) {
$scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEGROUPHOSTS'); $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_GROUP_HOSTS');
$scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEGROUPHOSTS'); $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_GROUP_HOSTS');
} }
else if($scope.toDelete.total_groups === 1 && $scope.toDelete.total_hosts === 1) { else if($scope.toDelete.total_groups === 1 && $scope.toDelete.total_hosts === 1) {
$scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEGROUPHOST'); $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_GROUP_HOST');
$scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEGROUPHOST'); $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_GROUP_HOST');
} }
else if($scope.toDelete.total_groups === 0) { else if($scope.toDelete.total_groups === 0) {
if($scope.toDelete.total_hosts > 1) { if($scope.toDelete.total_hosts > 1) {
$scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEHOSTS'); $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_HOSTS');
$scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEHOSTS'); $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_HOSTS');
} }
else { else {
$scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEHOST'); $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_HOST');
$scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEHOST'); $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_HOST');
} }
} }
else if($scope.toDelete.total_hosts === 0) { else if($scope.toDelete.total_hosts === 0) {
if($scope.toDelete.total_groups > 1) { if($scope.toDelete.total_groups > 1) {
$scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEGROUPS'); $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_GROUPS');
$scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEGROUPS'); $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_GROUPS');
} }
else { else {
$scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETEGROUP'); $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('filter.DELETE_GROUP');
$scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTEGROUP'); $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('filter.PROMOTE_GROUP');
} }
} }
} }

View File

@@ -21,20 +21,20 @@
<div ng-show="toDelete.total_groups > 0 || toDelete.total_hosts > 0"> <div ng-show="toDelete.total_groups > 0 || toDelete.total_hosts > 0">
<div> <div>
<p class="Prompt-bodyQuery">Deleting group <em>{{ toDelete.name }}</em>. <p class="Prompt-bodyQuery">Deleting group <em>{{ toDelete.name }}</em>.
<span ng-show="toDelete.total_groups > 0 && toDelete.total_hosts > 0"> <translate>This group contains</translate> {{ toDelete.total_groups }} {{strings.deleteModal.group}} <translate>and</translate> {{ toDelete.total_hosts }} {{strings.deleteModal.host}}. </span> <span ng-show="toDelete.total_groups > 0 && toDelete.total_hosts > 0"> <translate>This group contains</translate> {{ toDelete.total_groups }} {{:: strings.deleteModal.group }} <translate>and</translate> {{ toDelete.total_hosts }} {{:: strings.deleteModal.host }}. </span>
<span ng-show="toDelete.total_groups == 0 && toDelete.total_hosts > 0"> <translate>This group contains</translate> {{ toDelete.total_hosts }} {{strings.deleteModal.host}}. </span> <span ng-show="toDelete.total_groups == 0 && toDelete.total_hosts > 0"> <translate>This group contains</translate> {{ toDelete.total_hosts }} {{:: strings.deleteModal.host }}. </span>
<span ng-show="toDelete.total_groups > 0 && toDelete.total_hosts == 0"> <translate>This group contains</translate> {{ toDelete.total_groups }} {{strings.deleteModal.group}}. </span> <span ng-show="toDelete.total_groups > 0 && toDelete.total_hosts == 0"> <translate>This group contains</translate> {{ toDelete.total_groups }} {{:: strings.deleteModal.group }}. </span>
<translate>Delete or promote the group's children?</translate></p> <translate>Delete or promote the group's children?</translate></p>
<div style="margin: 15px auto;"> <div style="margin: 15px auto;">
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" ng-model="deleteOption" value="delete" > {{ strings.deleteModal.deleteGroupsHosts }} <input type="radio" ng-model="deleteOption" value="delete" > {{:: strings.deleteModal.deleteGroupsHosts }}
</label> </label>
</div> </div>
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" ng-model="deleteOption" value="promote"> {{ strings.deleteModal.promoteGroupsHosts }} <input type="radio" ng-model="deleteOption" value="promote"> {{:: strings.deleteModal.promoteGroupsHosts }}
</label> </label>
</div> </div>

View File

@@ -9,7 +9,6 @@ import smartInventoryEdit from './edit/main';
import smartInventoryForm from './smart-inventory.form'; import smartInventoryForm from './smart-inventory.form';
import smartInventoryHostFilter from './smart-inventory-host-filter/smart-inventory-host-filter.directive'; 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 hostFilterModal from './smart-inventory-host-filter/host-filter-modal/host-filter-modal.directive';
import SmartInventoryStrings from './smart-inventory.strings';
export default export default
angular.module('smartInventory', [ angular.module('smartInventory', [
@@ -18,5 +17,4 @@ angular.module('smartInventory', [
]) ])
.factory('smartInventoryForm', smartInventoryForm) .factory('smartInventoryForm', smartInventoryForm)
.directive('smartInventoryHostFilter', smartInventoryHostFilter) .directive('smartInventoryHostFilter', smartInventoryHostFilter)
.directive('hostFilterModal', hostFilterModal) .directive('hostFilterModal', hostFilterModal);
.service('SmartInventoryStrings', SmartInventoryStrings);

View File

@@ -4,11 +4,11 @@
* All Rights Reserved * All Rights Reserved
*************************************************/ *************************************************/
export default ['$scope', 'QuerySet', 'SmartInventoryStrings', export default ['$scope', 'QuerySet', 'InventoryHostsStrings',
function($scope, qs, SmartInventoryStrings) { function($scope, qs, InventoryHostsStrings) {
$scope.hostFilterTags = []; $scope.hostFilterTags = [];
$scope.filterTooltip = SmartInventoryStrings.get('filter.TOOLTIP'); $scope.filterTooltip = InventoryHostsStrings.get('smartinventories.TOOLTIP');
$scope.$watch('hostFilter', function(){ $scope.$watch('hostFilter', function(){
$scope.hostFilterTags = []; $scope.hostFilterTags = [];

View File

@@ -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;

View File

@@ -1,30 +1,34 @@
function InventoryHostsStrings (BaseString) { function InventoryHostsStrings (BaseString) {
BaseString.call(this, 'inventoryhosts'); BaseString.call(this, 'inventory-hosts');
let t = this.t; let t = this.t;
let ns = this.inventoryhosts; let ns = this['inventory-hosts'];
ns.filter = { ns.filter = {
GROUP: t('group'), GROUP: t('group'),
GROUPS: t('groups'), GROUPS: t('groups'),
HOST: t('host'), HOST: t('host'),
HOSTS: t('hosts'), HOSTS: t('hosts'),
PROMOTEGROUPSHOSTS: t('Promote groups and hosts'), PROMOTE_GROUPS_HOSTS: t('Promote groups and hosts'),
PROMOTEGROUPHOSTS: t('Promote group and hosts'), PROMOTE_GROUP_HOSTS: t('Promote group and hosts'),
PROMOTEGROUPSHOST: t('Promote groups and host'), PROMOTE_GROUPS_HOST: t('Promote groups and host'),
PROMOTEGROUPHOST: t('Promote group and host'), PROMOTE_GROUP_HOST: t('Promote group and host'),
DELETEGROUPSHOSTS: t('Delete groups and hosts'), DELETE_GROUPS_HOSTS: t('Delete groups and hosts'),
DELETEGROUPHOSTS: t('Delete group and hosts'), DELETE_GROUP_HOSTS: t('Delete group and hosts'),
DELETEGROUPSHOST: t('Delete groups and host'), DELETE_GROUPS_HOST: t('Delete groups and host'),
DELETEGROUPHOST: t('Delete group and host'), DELETE_GROUP_HOST: t('Delete group and host'),
PROMOTEGROUPS: t('Promote groups'), PROMOTE_GROUPS: t('Promote groups'),
PROMOTEGROUP: t('Promote group'), PROMOTE_GROUP: t('Promote group'),
DELETEGROUPS: t('Delete groups'), DELETE_GROUPS: t('Delete groups'),
DELETEGROUP: t('Delete group'), DELETE_GROUP: t('Delete group'),
PROMOTEHOSTS: t('Promote hosts'), PROMOTE_HOSTS: t('Promote hosts'),
PROMOTEHOST: t('Promote host'), PROMOTE_HOST: t('Promote host'),
DELETEHOSTS: t('Delete hosts'), DELETE_HOSTS: t('Delete hosts'),
DELETEHOST: t('Delete host') DELETE_HOST: t('Delete host')
};
ns.smartinventories = {
TOOLTIP: t('Please click the icon to edit the host filter.')
}; };
} }