diff --git a/client/src/components/History/CurrentHistory/HistoryOperations/SelectionOperations.vue b/client/src/components/History/CurrentHistory/HistoryOperations/SelectionOperations.vue index 27e478cea34b..0930569fb50f 100644 --- a/client/src/components/History/CurrentHistory/HistoryOperations/SelectionOperations.vue +++ b/client/src/components/History/CurrentHistory/HistoryOperations/SelectionOperations.vue @@ -13,10 +13,13 @@ With {{ numSelected }} selected... - + Unhide - + Hide Undelete Delete @@ -195,20 +198,37 @@ export default { }, computed: { /** @returns {Boolean} */ - showHidden() { - return !HistoryFilters.checkFilter(this.filterText, "visible", true); + canUnhideSelection() { + return ( + this.areAllSelectedHidden || + (HistoryFilters.checkFilter(this.filterText, "visible", "any") && !this.areAllSelectedVisible) + ); + }, + /** @returns {Boolean} */ + canHideSelection() { + return ( + this.areAllSelectedVisible || + (HistoryFilters.checkFilter(this.filterText, "visible", "any") && !this.areAllSelectedHidden) + ); }, /** @returns {Boolean} */ showDeleted() { return !HistoryFilters.checkFilter(this.filterText, "deleted", false); }, /** @returns {Boolean} */ - showStrictDeleted() { - return HistoryFilters.checkFilter(this.filterText, "deleted", true); + canDeleteSelection() { + return ( + this.areAllSelectedActive || + (HistoryFilters.checkFilter(this.filterText, "deleted", "any") && !this.areAllSelectedDeleted) + ); + }, + /** @returns {Boolean} */ + canUndeleteSelection() { + return this.showDeleted && (this.isQuerySelection || !this.areAllSelectedPurged); }, /** @returns {Boolean} */ showBuildOptions() { - return !this.isQuerySelection && !this.showHidden && !this.showDeleted; + return !this.isQuerySelection && this.areAllSelectedActive && !this.showDeleted; }, /** @returns {Boolean} */ showBuildOptionForAll() { @@ -229,9 +249,6 @@ export default { noTagsSelected() { return this.selectedTags.length === 0; }, - canUndeleteSelection() { - return this.showDeleted && (this.isQuerySelection || !this.areAllSelectedPurged); - }, areAllSelectedPurged() { for (const item of this.contentSelection.values()) { if (Object.prototype.hasOwnProperty.call(item, "purged") && !item["purged"]) { @@ -240,6 +257,38 @@ export default { } return true; }, + areAllSelectedVisible() { + for (const item of this.contentSelection.values()) { + if (Object.prototype.hasOwnProperty.call(item, "visible") && !item["visible"]) { + return false; + } + } + return true; + }, + areAllSelectedHidden() { + for (const item of this.contentSelection.values()) { + if (Object.prototype.hasOwnProperty.call(item, "visible") && item["visible"]) { + return false; + } + } + return true; + }, + areAllSelectedActive() { + for (const item of this.contentSelection.values()) { + if (Object.prototype.hasOwnProperty.call(item, "deleted") && item["deleted"]) { + return false; + } + } + return true; + }, + areAllSelectedDeleted() { + for (const item of this.contentSelection.values()) { + if (Object.prototype.hasOwnProperty.call(item, "deleted") && !item["deleted"]) { + return false; + } + } + return true; + }, }, watch: { hasSelection(newVal) {