From 2e039a7c3371e9d097071c8f01b76e2d05096415 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Tue, 20 May 2025 10:33:05 +0100 Subject: [PATCH 01/23] One asset container at a time. --- .../js/components/assets/AssetManager.vue | 2 +- .../js/components/assets/Browser/Browser.vue | 44 +++++-------------- 2 files changed, 13 insertions(+), 33 deletions(-) diff --git a/resources/js/components/assets/AssetManager.vue b/resources/js/components/assets/AssetManager.vue index 24d2ecba9e2..d5773675b88 100644 --- a/resources/js/components/assets/AssetManager.vue +++ b/resources/js/components/assets/AssetManager.vue @@ -3,7 +3,7 @@ ref="browser" :can-create-containers="canCreateContainers" :create-container-url="createContainerUrl" - :initial-container="container" + :container="container" :initial-per-page="$config.get('paginationSize')" :initial-editing-asset-id="initialEditingAssetId" :selected-path="path" diff --git a/resources/js/components/assets/Browser/Browser.vue b/resources/js/components/assets/Browser/Browser.vue index bf374e44350..336f8ac6fee 100644 --- a/resources/js/components/assets/Browser/Browser.vue +++ b/resources/js/components/assets/Browser/Browser.vue @@ -165,7 +165,7 @@ export default { autoselectUploads: Boolean, canCreateContainers: Boolean, createContainerUrl: String, - initialContainer: Object, + container: Object, initialEditingAssetId: String, maxFiles: Number, queryScopes: Array, @@ -188,7 +188,6 @@ export default { }, ], containers: [], - container: {}, initializing: true, loading: true, assets: [], @@ -202,8 +201,8 @@ export default { page: 1, preferencesPrefix: null, meta: {}, - sortColumn: this.initialContainer.sort_field, - sortDirection: this.initialContainer.sort_direction, + sortColumn: this.container.sort_field, + sortDirection: this.container.sort_direction, mode: 'table', actionUrl: null, folderActionUrl: null, @@ -215,7 +214,7 @@ export default { computed: { actionContext() { - return { container: this.selectedContainer }; + return { container: this.container.id }; }, canCreateFolders() { @@ -276,10 +275,6 @@ export default { return this.selectedAssets.length >= this.maxFiles; }, - selectedContainer() { - return typeof this.initialContainer === 'object' ? this.initialContainer.id : this.initialContainer; - }, - showAssetEditor() { return Boolean(this.editedAssetId); }, @@ -309,29 +304,25 @@ export default { }, }, - mounted() { - this.loadContainers(); - }, - created() { this.$events.$on('editor-action-started', this.actionStarted); this.$events.$on('editor-action-completed', this.actionCompleted); }, + mounted() { + this.initializing = true; + this.preferencesPrefix = `assets.${this.container.id}`; + this.mode = this.getPreference('mode') || 'table'; + this.setInitialPerPage(); + this.loadAssets(); + }, + unmounted() { this.$events.$off('editor-action-started', this.actionStarted); this.$events.$off('editor-action-completed', this.actionCompleted); }, watch: { - container(container) { - this.initializing = true; - this.preferencesPrefix = `assets.${container.id}`; - this.mode = this.getPreference('mode') || 'table'; - this.setInitialPerPage(); - this.loadAssets(); - }, - mode(mode) { this.setPreference('mode', mode == 'table' ? null : mode); }, @@ -344,10 +335,6 @@ export default { this.$emit('navigated', this.container, path); }, - initialContainer() { - this.container = this.initialContainer; - }, - initializing(isInitializing, wasInitializing) { if (wasInitializing && this.autofocusSearch) { this.$nextTick(() => this.$refs.search.focus()); @@ -491,13 +478,6 @@ export default { }); }, - loadContainers() { - this.$axios.get(cp_url('asset-containers')).then((response) => { - this.containers = keyBy(response.data, 'id'); - this.container = this.containers[this.selectedContainer]; - }); - }, - openFileBrowser() { this.$refs.uploader.browse(); }, From 01337e5f0181ae5e311959dfe30f5e662b3e7c68 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Tue, 20 May 2025 10:47:18 +0100 Subject: [PATCH 02/23] Use new dropdown components --- .../js/components/assets/Browser/Browser.vue | 44 +++++++++++++------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/resources/js/components/assets/Browser/Browser.vue b/resources/js/components/assets/Browser/Browser.vue index 336f8ac6fee..2ec4a1165b4 100644 --- a/resources/js/components/assets/Browser/Browser.vue +++ b/resources/js/components/assets/Browser/Browser.vue @@ -1,19 +1,35 @@