From e59b1703d189dd9d77bb58826f83aae6c8725bf4 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Fri, 22 Nov 2024 17:21:25 -0800 Subject: [PATCH 1/5] ensure collection replay is fully reload (cache cleared) when: - editing collection metadata - adding / remove collection items --- .../collections/collection-items-dialog.ts | 6 ++++-- frontend/src/pages/org/collection-detail.ts | 20 ++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/frontend/src/features/collections/collection-items-dialog.ts b/frontend/src/features/collections/collection-items-dialog.ts index 81f109a098..34a65ed22a 100644 --- a/frontend/src/features/collections/collection-items-dialog.ts +++ b/frontend/src/features/collections/collection-items-dialog.ts @@ -554,7 +554,7 @@ export class CollectionItemsDialog extends BtrixElement { let selectionMessage = msg("No changes to save"); if (hasChange) { - const messages = []; + const messages: string[] = []; if (addCount) { messages.push( msg( @@ -564,7 +564,9 @@ export class CollectionItemsDialog extends BtrixElement { } if (removeCount) { messages.push( - str`Adding ${formatNumber(removeCount)} ${pluralOf("items", removeCount)}`, + msg( + str`Removing ${formatNumber(removeCount)} ${pluralOf("items", removeCount)}`, + ), ); } diff --git a/frontend/src/pages/org/collection-detail.ts b/frontend/src/pages/org/collection-detail.ts index 0781a7e0ea..d2f1f0843d 100644 --- a/frontend/src/pages/org/collection-detail.ts +++ b/frontend/src/pages/org/collection-detail.ts @@ -61,6 +61,9 @@ export class CollectionDetail extends BtrixElement { @query(".descriptionExpandBtn") private readonly descriptionExpandBtn?: HTMLElement | null; + @query("replay-web-page") + private readonly replayEmbed?: HTMLElement | null; + // Use to cancel requests private getArchivedItemsController: AbortController | null = null; @@ -204,6 +207,7 @@ export class CollectionDetail extends BtrixElement { ?open=${this.openDialogName === "editItems"} @sl-hide=${() => (this.openDialogName = undefined)} @btrix-collection-saved=${() => { + this.refreshReplay(); void this.fetchCollection(); void this.fetchArchivedItems(); }} @@ -216,7 +220,10 @@ export class CollectionDetail extends BtrixElement { .collection=${this.collection!} ?open=${this.openDialogName === "editMetadata"} @sl-hide=${() => (this.openDialogName = undefined)} - @btrix-collection-saved=${() => void this.fetchCollection()} + @btrix-collection-saved=${() => { + this.refreshReplay(); + void this.fetchCollection(); + }} > `, @@ -224,6 +231,17 @@ export class CollectionDetail extends BtrixElement { ${this.renderShareDialog()}`; } + private refreshReplay() { + if (this.replayEmbed) { + try { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this.replayEmbed as any).fullReload(); + } catch (e) { + console.warn("Full reload not available in RWP"); + } + } + } + private getPublicReplayURL() { return new URL( `/api/orgs/${this.orgId}/collections/${this.collectionId}/public/replay.json`, From 6cf62cec7f8cb6ad0463f478ebb6327bdc18ae36 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Fri, 22 Nov 2024 19:43:55 -0800 Subject: [PATCH 2/5] storage: don't use access url for presigning by default, make it a setting (defaulting to false) --- backend/btrixcloud/storages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/btrixcloud/storages.py b/backend/btrixcloud/storages.py index cee943dcbf..3b5acfbd97 100644 --- a/backend/btrixcloud/storages.py +++ b/backend/btrixcloud/storages.py @@ -143,7 +143,7 @@ def _create_s3_storage(self, storage: dict[str, str]) -> S3Storage: use_access_for_presign = False else: access_endpoint_url = storage.get("access_endpoint_url") or endpoint_url - use_access_for_presign = True + use_access_for_presign = storage.get("use_access_for_presign", False) return S3Storage( access_key=storage["access_key"], From 776b5b753e61d341614f385f7f3d7393f4a4236f Mon Sep 17 00:00:00 2001 From: ikreymer Date: Sat, 23 Nov 2024 03:47:38 +0000 Subject: [PATCH 3/5] Apply `localize:extract` changes --- frontend/xliff/es.xlf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/xliff/es.xlf b/frontend/xliff/es.xlf index 42e084cb60..d11806c40e 100644 --- a/frontend/xliff/es.xlf +++ b/frontend/xliff/es.xlf @@ -3780,6 +3780,9 @@ org settings for details. + + Removing + From 35e881eb82704f2b7b04d73012712807a88f2c8f Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Fri, 22 Nov 2024 19:54:17 -0800 Subject: [PATCH 4/5] use is_bool --- backend/btrixcloud/storages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/btrixcloud/storages.py b/backend/btrixcloud/storages.py index 3b5acfbd97..50b9557a92 100644 --- a/backend/btrixcloud/storages.py +++ b/backend/btrixcloud/storages.py @@ -143,7 +143,7 @@ def _create_s3_storage(self, storage: dict[str, str]) -> S3Storage: use_access_for_presign = False else: access_endpoint_url = storage.get("access_endpoint_url") or endpoint_url - use_access_for_presign = storage.get("use_access_for_presign", False) + use_access_for_presign = is_bool(storage.get("use_access_for_presign")) return S3Storage( access_key=storage["access_key"], From 61662b4fa9a10fe8cf9b2d6793e1678a6009744d Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Fri, 22 Nov 2024 22:50:17 -0800 Subject: [PATCH 5/5] chart: update rwp to 2.2.4 --- chart/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chart/values.yaml b/chart/values.yaml index 17d4d5fbc2..a0814866db 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -75,7 +75,7 @@ allow_dupe_invites: "0" invite_expire_seconds: 604800 # base url for replayweb.page -rwp_base_url: "https://cdn.jsdelivr.net/npm/replaywebpage@2.1.4/" +rwp_base_url: "https://cdn.jsdelivr.net/npm/replaywebpage@2.2.4/" superuser: # set this to enable a superuser admin