Merge pull request #331 from mabashian/7509-host-filter-permissions

Smart Inv permissions bug fixes
This commit is contained in:
Michael Abashian 2017-08-23 18:20:08 -04:00 committed by GitHub
commit b4e78b6131
5 changed files with 7 additions and 8 deletions

View File

@ -98,8 +98,7 @@ export default ['i18n', function(i18n) {
ngClick: 'editInventory(inventory)',
awToolTip: i18n._('Edit inventory'),
dataPlacement: 'top',
ngShow: 'inventory.summary_fields.user_capabilities.edit',
ngHide: 'inventory.pending_deletion'
ngShow: '!inventory.pending_deletion && inventory.summary_fields.user_capabilities.edit'
},
view: {
label: i18n._('View'),
@ -113,8 +112,7 @@ export default ['i18n', function(i18n) {
ngClick: "deleteInventory(inventory.id, inventory.name)",
awToolTip: i18n._('Delete inventory'),
dataPlacement: 'top',
ngShow: 'inventory.summary_fields.user_capabilities.delete',
ngHide: 'inventory.pending_deletion'
ngShow: '!inventory.pending_deletion && inventory.summary_fields.user_capabilities.delete'
},
pending_deletion: {

View File

@ -8,7 +8,7 @@ export default ['$scope', 'QuerySet', 'InventoryHostsStrings',
function($scope, qs, InventoryHostsStrings) {
$scope.hostFilterTags = [];
$scope.filterTooltip = InventoryHostsStrings.get('smartinventories.TOOLTIP');
$scope.filterTooltip = $scope.fieldIsDisabled ? '' : InventoryHostsStrings.get('smartinventories.TOOLTIP');
$scope.$watch('hostFilter', function(){
$scope.hostFilterTags = [];

View File

@ -10,7 +10,8 @@ export default ['templateUrl', '$compile',
function(templateUrl, $compile) {
return {
scope: {
hostFilter: '='
hostFilter: '=',
fieldIsDisabled: '='
},
restrict: 'E',
templateUrl: templateUrl('inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter'),

View File

@ -1,6 +1,6 @@
<div class="input-group Form-mixedInputGroup">
<span class="input-group-btn Form-variableHeightButtonGroup">
<button type="button" class="Form-lookupButton Form-lookupButton--variableHeight btn btn-default" ng-click="openHostFilterModal()">
<button type="button" class="Form-lookupButton Form-lookupButton--variableHeight btn btn-default" ng-click="openHostFilterModal()" ng-disabled="fieldIsDisabled">
<i class="fa fa-search"></i>
</button>
</span>

View File

@ -64,7 +64,7 @@ export default ['i18n', 'InventoryCompletedJobsList', function(i18n, InventoryCo
smart_hosts: {
label: i18n._('Smart Host Filter'),
type: 'custom',
control: '<smart-inventory-host-filter host-filter="smart_hosts"></smart-inventory-host-filter>',
control: '<smart-inventory-host-filter host-filter="smart_hosts" field-is-disabled="!(inventory_obj.summary_fields.user_capabilities.edit || canAdd)"></smart-inventory-host-filter>',
awPopOver: "<p>" + i18n._("Populate the hosts for this inventory by using a search filter.") + "</p><p>" + i18n._("Example: ansible_facts.ansible_distribution:\"RedHat\"") + "</p><p>" + i18n._("Refer to the Ansible Tower documentation for further syntax and examples.") + "</p>",
dataTitle: i18n._('Smart Host Filter'),
dataPlacement: 'right',