diff --git a/awx/ui/client/legacy-styles/lists.less b/awx/ui/client/legacy-styles/lists.less index b4d65d1862..484ea4440c 100644 --- a/awx/ui/client/legacy-styles/lists.less +++ b/awx/ui/client/legacy-styles/lists.less @@ -80,6 +80,28 @@ table, tbody { padding-left: 10px; } +.List-tableRow--disabled { + .List-tableCell, .List-tableCell * { + color: @b7grey; + cursor: not-allowed; + } +} + +.List-tableRow--disabled { + .List-actionButton:hover { + color: @list-action-icon; + background-color: @list-actn-bg !important; + } +} + +.List-tableRow--disabled { + .List-actionButtonCell * { + color: @default-err; + font-size: 11px; + text-transform: uppercase; + } +} + .List-tableCell { padding: 7px 15px; border-top:0px!important; diff --git a/awx/ui/client/src/inventories-hosts/inventories/inventories.route.js b/awx/ui/client/src/inventories-hosts/inventories/inventories.route.js index 3d78c78323..fc2888a2eb 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/inventories.route.js +++ b/awx/ui/client/src/inventories-hosts/inventories/inventories.route.js @@ -9,7 +9,12 @@ export default { }, data: { activityStream: true, - activityStreamTarget: 'inventory' + activityStreamTarget: 'inventory', + socket: { + "groups": { + "inventories": ["status_changed"] + } + } }, views: { '@': { diff --git a/awx/ui/client/src/inventories-hosts/inventories/inventory.list.js b/awx/ui/client/src/inventories-hosts/inventories/inventory.list.js index 22319179a5..f1175316f4 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/inventory.list.js +++ b/awx/ui/client/src/inventories-hosts/inventories/inventory.list.js @@ -18,6 +18,7 @@ export default ['i18n', function(i18n) { hover: true, basePath: 'inventory', title: false, + disableRow: "{{ inventory.pending_deletion }}", fields: { status: { @@ -27,7 +28,7 @@ export default ['i18n', function(i18n) { ngClick: "null", iconOnly: true, excludeModal: true, - template: ``, + template: ``, icons: [{ icon: "{{ 'icon-cloud-' + inventory.syncStatus }}", awToolTip: "{{ inventory.syncTip }}", @@ -97,7 +98,8 @@ export default ['i18n', function(i18n) { ngClick: 'editInventory(inventory)', awToolTip: i18n._('Edit inventory'), dataPlacement: 'top', - ngShow: 'inventory.summary_fields.user_capabilities.edit' + ngShow: 'inventory.summary_fields.user_capabilities.edit', + ngHide: 'inventory.pending_deletion' }, view: { label: i18n._('View'), @@ -111,7 +113,12 @@ export default ['i18n', function(i18n) { ngClick: "deleteInventory(inventory.id, inventory.name)", awToolTip: i18n._('Delete inventory'), dataPlacement: 'top', - ngShow: 'inventory.summary_fields.user_capabilities.delete' + ngShow: 'inventory.summary_fields.user_capabilities.delete', + ngHide: 'inventory.pending_deletion' + + }, + pending_deletion: { + label: i18n._('Pending Delete'), } } };}]; diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/inventory-list.controller.js b/awx/ui/client/src/inventories-hosts/inventories/list/inventory-list.controller.js index 3f81647145..0af4c78392 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/list/inventory-list.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/list/inventory-list.controller.js @@ -102,11 +102,19 @@ function InventoriesList($scope, Prompt({ hdr: 'Delete', - body: '
Are you sure you want to delete the inventory below?
' + $filter('sanitize')(name) + '
', + body: '
Are you sure you want to delete the inventory below?
' + $filter('sanitize')(name) + '
' + + '
Note: The inventory will be in a pending status until the final delete is processed.
', action: action, actionText: 'DELETE' }); }; + + $scope.$on(`ws-inventories`, function(e, data){ + let inventory = $scope.inventories.find((inventory) => inventory.id === data.inventory_id); + if (data.status === 'pending_deletion') { + inventory.pending_deletion = true; + } + }); } export default ['$scope', diff --git a/awx/ui/client/src/shared/directives.js b/awx/ui/client/src/shared/directives.js index fbf4301f06..b06d6bfa3d 100644 --- a/awx/ui/client/src/shared/directives.js +++ b/awx/ui/client/src/shared/directives.js @@ -272,6 +272,21 @@ function(ConfigurationUtils, i18n, $rootScope) { }; }) +// the disableRow directive disables table row click events +.directive('disableRow', function() { + return { + restrict: 'A', + link: function(scope, element, attrs) { + element.bind('click', function(event) { + if (attrs.disableRow) { + event.preventDefault(); + } + return; + }); + } + }; +}) + .directive('awSurveyQuestion', function() { return { diff --git a/awx/ui/client/src/shared/list-generator/list-generator.factory.js b/awx/ui/client/src/shared/list-generator/list-generator.factory.js index c55f4f1c0d..9502a99b0c 100644 --- a/awx/ui/client/src/shared/list-generator/list-generator.factory.js +++ b/awx/ui/client/src/shared/list-generator/list-generator.factory.js @@ -292,6 +292,7 @@ export default ['$compile', 'Attr', 'Icon', innerTable += options.mode === 'lookup' ? `` : `"\n"`; innerTable += "Pending Delete`; + } + else { fAction = list.fieldActions[field_action]; innerTable += "