From 618fd0f19bc2c93180600111e2ef970992a0e3f6 Mon Sep 17 00:00:00 2001 From: Neeraj Sharma Date: Mon, 31 Mar 2025 13:05:05 +0530 Subject: [PATCH] Restore &manage=1 for search page --- package.json | 2 +- src/app-root.ts | 8 +++++++- src/collection-browser.ts | 13 ++++++++----- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index c897df1c7..ebca57844 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "The Internet Archive Collection Browser.", "license": "AGPL-3.0-only", "author": "Internet Archive", - "version": "2.7.13", + "version": "2.7.13-alpha4", "main": "dist/index.js", "module": "dist/index.js", "scripts": { diff --git a/src/app-root.ts b/src/app-root.ts index 99eb083c2..2eced1d49 100644 --- a/src/app-root.ts +++ b/src/app-root.ts @@ -131,10 +131,14 @@ export class AppRoot extends LitElement { private get getClass() { const searchParams = new URLSearchParams(window.location.search); - return searchParams.get('hide-dev-tools') ? 'hidden' : ''; } + private get urlBasedManageView() { + const searchParams = new URLSearchParams(window.location.search); + return searchParams.get('manage') ? true : false; + } + render() { return html`
@@ -484,6 +488,8 @@ export class AppRoot extends LitElement { .modalManager=${this.modalManager} .analyticsHandler=${this.analyticsHandler} .pageContext=${'search'} + .isManageView=${this.urlBasedManageView} + .urlBasedManageView=${this.urlBasedManageView} @visiblePageChanged=${this.visiblePageChanged} @baseQueryChanged=${this.baseQueryChanged} @searchTypeChanged=${this.searchTypeChanged} diff --git a/src/collection-browser.ts b/src/collection-browser.ts index 085089123..61d1625d5 100644 --- a/src/collection-browser.ts +++ b/src/collection-browser.ts @@ -241,6 +241,7 @@ export class CollectionBrowser * If item management UI active */ @property({ type: Boolean }) isManageView = false; + @property({ type: Boolean }) urlBasedManageView = false; @property({ type: String }) manageViewLabel = 'Select items to remove'; @@ -552,7 +553,7 @@ export class CollectionBrowser if (!hasQuery && !isCollection && !isProfile) { this.placeholderType = 'empty-query'; - } else if (noResults) { + } else if (noResults && !this.urlBasedManageView) { // Within a collection, no query + no results means the collection simply has no viewable items. // Otherwise, we must have a user query that produced 0 results. this.placeholderType = @@ -1457,7 +1458,9 @@ export class CollectionBrowser if (changed.has('isManageView')) { if (this.isManageView) { this.displayMode = 'grid'; - this.fetchManagableSearchResults(); + if (this.pageContext === 'search') { + this.fetchManagableSearchResults(); + } } else if (this.pageContext === 'search') this.infiniteScroller?.reload(); this.infiniteScroller?.refreshAllVisibleCells(); @@ -2110,10 +2113,10 @@ export class CollectionBrowser */ private fetchManagableSearchResults(): void { if ( - this.pageContext === 'search' && - this.dataSource.totalResults > 100 && - !this.searchResultsLoading + (this.dataSource.totalResults > 100 && !this.searchResultsLoading) || + this.urlBasedManageView ) { + console.log('here22'); this.dataSource.resetPages(); this.dataSource.fetchPage(1, this.maxPagesToManage); this.infiniteScroller?.reload();