From f6eb39ee99e7af1ac98241dd48b4093f5b36c8a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Viguier?= Date: Wed, 20 Nov 2024 10:39:03 +0100 Subject: [PATCH] Fix duplicate upload + add scroll remembering (#2693) --- .../diagnostics/ConfigurationsDiagnostics.vue | 2 +- .../diagnostics/ErrorsDiagnostics.vue | 2 +- .../diagnostics/InfoDiagnostics.vue | 2 +- .../diagnostics/SpaceDiagnostics.vue | 2 +- resources/js/components/drawers/AlbumEdit.vue | 8 +- .../js/components/drawers/AlbumStatistics.vue | 4 +- resources/js/components/drawers/PhotoEdit.vue | 14 ++-- .../forms/album/AlbumCreateDialog.vue | 18 ++++- .../forms/album/AlbumCreateTagDialog.vue | 29 ++++--- .../js/components/forms/album/AlbumMove.vue | 4 +- .../forms/album/AlbumProperties.vue | 22 +++--- .../js/components/forms/album/AlbumShare.vue | 2 +- .../components/forms/album/AlbumTransfer.vue | 2 +- .../forms/album/SearchTargetAlbum.vue | 6 +- .../forms/album/SearchTargetUser.vue | 6 +- .../gallery-dialogs/AlbumMergeDialog.vue | 4 +- .../forms/gallery-dialogs/MoveDialog.vue | 4 +- .../forms/gallery-dialogs/RenameDialog.vue | 2 +- .../forms/photo/PhotoCopyDialog.vue | 4 +- .../components/forms/photo/PhotoTagDialog.vue | 2 +- .../js/components/forms/profile/ApiToken.vue | 2 +- .../js/components/forms/profile/SetLogin.vue | 12 +-- .../js/components/forms/profile/SetOauth.vue | 2 +- .../forms/profile/SetSecondFactor.vue | 2 +- .../components/forms/settings/BoolField.vue | 2 +- .../components/forms/settings/NumberField.vue | 2 +- .../js/components/forms/settings/OldField.vue | 2 +- .../components/forms/settings/SelectLang.vue | 2 +- .../components/forms/settings/SliderField.vue | 2 +- .../components/forms/settings/StringField.vue | 2 +- .../forms/settings/ZipSliderField.vue | 2 +- .../forms/sharing/CreateSharing.vue | 2 +- .../components/forms/upload/UploadingLine.vue | 2 +- .../components/forms/users/CreateEditUser.vue | 8 +- .../components/gallery/thumbs/AlbumThumb.vue | 6 +- .../js/components/headers/AlbumHeader.vue | 39 ++-------- .../js/components/headers/AlbumsHeader.vue | 36 ++++----- .../js/components/headers/OpenLeftMenu.vue | 6 +- .../js/components/headers/PhotoHeader.vue | 13 ++-- .../maintenance/MaintenanceCleaning.vue | 2 +- .../maintenance/MaintenanceFilesize.vue | 2 +- .../maintenance/MaintenanceFixJobs.vue | 2 +- .../maintenance/MaintenanceFixTree.vue | 2 +- .../MaintenanceGenSizevariants.vue | 2 +- .../maintenance/MaintenanceOptimize.vue | 2 +- .../maintenance/MaintenanceUpdate.vue | 2 +- .../js/components/modals/AboutLychee.vue | 2 +- resources/js/components/modals/LoginModal.vue | 2 +- .../js/components/modals/RegisterLychee.vue | 2 +- .../js/components/modals/UploadPanel.vue | 8 +- .../js/components/modals/WebauthnModal.vue | 2 +- .../js/components/settings/AllSettings.vue | 6 +- .../js/components/settings/EasySettings.vue | 2 +- .../js/components/statistics/AlbumsTable.vue | 2 +- .../statistics/SizeVariantMeter.vue | 4 +- .../js/composables/album/albumRefresher.ts | 30 +++---- .../js/composables/album/albumsRefresher.ts | 16 ++-- resources/js/composables/album/scrollable.ts | 28 +++++++ .../js/composables/album/searchRefresher.ts | 8 +- .../contextMenus/contextMenuAlbumsAdd.ts | 7 +- .../modalsTriggers/galleryModals.ts | 17 ++-- resources/js/composables/photo/basePhoto.ts | 6 +- resources/js/composables/photo/slideshow.ts | 2 +- .../js/composables/selections/selections.ts | 8 +- resources/js/menus/LeftMenu.vue | 9 ++- resources/js/services/sidebar-map.ts | 4 +- resources/js/stores/LycheeState.ts | 39 ---------- resources/js/stores/ModalsState.ts | 78 +++++++++++++++++++ resources/js/views/Diagnostics.vue | 9 +-- resources/js/views/Error.vue | 4 +- resources/js/views/Jobs.vue | 2 +- resources/js/views/Landing.vue | 2 +- resources/js/views/Permissions.vue | 4 +- resources/js/views/Sharing.vue | 2 +- resources/js/views/Statistics.vue | 5 +- resources/js/views/Users.vue | 2 +- resources/js/views/gallery-panels/Album.vue | 24 ++++-- resources/js/views/gallery-panels/Albums.vue | 26 +++++-- resources/js/views/gallery-panels/Map.vue | 14 ++-- resources/js/views/gallery-panels/Photo.vue | 24 +++--- resources/js/views/gallery-panels/Search.vue | 13 ++-- 81 files changed, 396 insertions(+), 314 deletions(-) create mode 100644 resources/js/composables/album/scrollable.ts create mode 100644 resources/js/stores/ModalsState.ts diff --git a/resources/js/components/diagnostics/ConfigurationsDiagnostics.vue b/resources/js/components/diagnostics/ConfigurationsDiagnostics.vue index ff4db3a6a18..0a3d7ca1e09 100644 --- a/resources/js/components/diagnostics/ConfigurationsDiagnostics.vue +++ b/resources/js/components/diagnostics/ConfigurationsDiagnostics.vue @@ -9,7 +9,7 @@ import { ref } from "vue"; import Panel from "primevue/panel"; import DiagnosticsService from "@/services/diagnostics-service"; -const configs = ref(undefined as string[] | undefined); +const configs = ref(undefined); function load() { DiagnosticsService.config().then((response) => { diff --git a/resources/js/components/diagnostics/ErrorsDiagnostics.vue b/resources/js/components/diagnostics/ErrorsDiagnostics.vue index e64581967c6..9e233012fc3 100644 --- a/resources/js/components/diagnostics/ErrorsDiagnostics.vue +++ b/resources/js/components/diagnostics/ErrorsDiagnostics.vue @@ -12,7 +12,7 @@ import { ref } from "vue"; import Panel from "primevue/panel"; import DiagnosticsService from "@/services/diagnostics-service"; -const errors = ref(undefined as App.Http.Resources.Diagnostics.ErrorLine[] | undefined); +const errors = ref(undefined); function load() { DiagnosticsService.errors().then((response) => { diff --git a/resources/js/components/diagnostics/InfoDiagnostics.vue b/resources/js/components/diagnostics/InfoDiagnostics.vue index 913f5f0aa64..4e1e3a39914 100644 --- a/resources/js/components/diagnostics/InfoDiagnostics.vue +++ b/resources/js/components/diagnostics/InfoDiagnostics.vue @@ -9,7 +9,7 @@ import { ref } from "vue"; import Panel from "primevue/panel"; import DiagnosticsService from "@/services/diagnostics-service"; -const infos = ref(undefined as string[] | undefined); +const infos = ref(undefined); function load() { DiagnosticsService.info().then((response) => { diff --git a/resources/js/components/diagnostics/SpaceDiagnostics.vue b/resources/js/components/diagnostics/SpaceDiagnostics.vue index 643b68999a7..8d9e69f46a2 100644 --- a/resources/js/components/diagnostics/SpaceDiagnostics.vue +++ b/resources/js/components/diagnostics/SpaceDiagnostics.vue @@ -13,7 +13,7 @@ import Panel from "primevue/panel"; import DiagnosticsService from "@/services/diagnostics-service"; const requested = ref(false); -const space = ref(undefined as string[] | undefined); +const space = ref(undefined); function load() { requested.value = true; diff --git a/resources/js/components/drawers/AlbumEdit.vue b/resources/js/components/drawers/AlbumEdit.vue index 481fba697d8..37d1acb9fca 100644 --- a/resources/js/components/drawers/AlbumEdit.vue +++ b/resources/js/components/drawers/AlbumEdit.vue @@ -78,18 +78,16 @@ import AlbumDelete from "@/components/forms/album/AlbumDelete.vue"; import AlbumMove from "../forms/album/AlbumMove.vue"; import AlbumTransfer from "../forms/album/AlbumTransfer.vue"; import AlbumShare from "../forms/album/AlbumShare.vue"; -import { useLycheeStateStore } from "@/stores/LycheeState"; import { storeToRefs } from "pinia"; +import { useTogglablesStateStore } from "@/stores/ModalsState"; const props = defineProps<{ album: App.Http.Resources.Models.AlbumResource | App.Http.Resources.Models.SmartAlbumResource | App.Http.Resources.Models.TagAlbumResource; config: App.Http.Resources.GalleryConfigs.AlbumConfig; }>(); -const lycheeStore = useLycheeStateStore(); -lycheeStore.init(); - -const { are_details_open } = storeToRefs(lycheeStore); +const togglableStore = useTogglablesStateStore(); +const { are_details_open } = storeToRefs(togglableStore); const activeTab = ref(0); const numUsers = ref(0); diff --git a/resources/js/components/drawers/AlbumStatistics.vue b/resources/js/components/drawers/AlbumStatistics.vue index fbf5cd3c27b..f6dd2c81885 100644 --- a/resources/js/components/drawers/AlbumStatistics.vue +++ b/resources/js/components/drawers/AlbumStatistics.vue @@ -88,9 +88,9 @@ const props = defineProps<{ const { getStatistics } = useAlbumsStatistics(); const photosData = ref(getStatistics(props.photos)); -const totalAlbumSpace = ref(undefined as undefined | App.Http.Resources.Statistics.Album); +const totalAlbumSpace = ref(undefined); -const total = ref(undefined as undefined | TotalAlbum); +const total = ref(undefined); if (props.config.is_model_album) { StatisticsService.getTotalAlbumSpace(props.album.id).then((response) => { diff --git a/resources/js/components/drawers/PhotoEdit.vue b/resources/js/components/drawers/PhotoEdit.vue index 6d9ea2e9817..8911dbe9685 100644 --- a/resources/js/components/drawers/PhotoEdit.vue +++ b/resources/js/components/drawers/PhotoEdit.vue @@ -82,13 +82,13 @@ const props = defineProps<{ const toast = useToast(); const isEditOpen = defineModel("isEditOpen", { default: false }) as Ref; -const photo_id = ref(undefined as string | undefined); -const title = ref(undefined as string | undefined); -const description = ref(undefined as string | undefined); -const uploadDate = ref(undefined as Date | undefined); -const tags = ref([] as string[]); -const license = ref(undefined as SelectOption | undefined); -const uploadTz = ref(undefined as string | undefined); +const photo_id = ref(undefined); +const title = ref(undefined); +const description = ref(undefined); +const uploadDate = ref(undefined); +const tags = ref([]); +const license = ref | undefined>(undefined); +const uploadTz = ref(undefined); // TODO: updating exif data later diff --git a/resources/js/components/forms/album/AlbumCreateDialog.vue b/resources/js/components/forms/album/AlbumCreateDialog.vue index 21af97ddfd5..a724e5b9683 100644 --- a/resources/js/components/forms/album/AlbumCreateDialog.vue +++ b/resources/js/components/forms/album/AlbumCreateDialog.vue @@ -1,5 +1,11 @@