From 67cd7ece4aafd930a65ece4313387bd9b795a278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Gr=C3=A4f?= Date: Mon, 5 Feb 2024 21:47:11 +0100 Subject: [PATCH] TAB-484 savepoint --- src/App.vue | 2 +- src/components/SidePanelFooter.vue | 21 +-- .../dialogues/helper/NewTabsetDialogBody.vue | 2 +- .../helper/SidePanelWindowMarkupTable.vue | 90 +++++----- .../helper/SidePanelWindowTable.vue | 14 +- src/models/Window.ts | 4 +- src/pages/SidePanelPage.vue | 8 +- src/pages/SidePanelSpacesPage.vue | 2 +- src/pages/SidePanelTabsetPage.vue | 2 +- src/pages/sidepanel/SidePanelTabInfo.vue_ | 2 +- .../sidepanel/helper/FirstToolbarHelper.vue | 4 +- src/services/AppService.ts | 82 ++++----- src/services/ChromeApi.ts | 4 +- src/services/ChromeListeners.ts | 122 +++++++------- src/services/IndexedDbPersistenceService.ts | 69 ++++---- src/services/NavigationService.ts | 1 - src/services/PersistenceService.ts | 2 + src/services/PouchDbPersistenceService.ts | 2 + src/services/TabsetService2.ts | 2 +- src/services/Utils.ts | 157 +++++++++-------- .../persistence/GitPersistentService.ts | 2 + .../storage/LocalStoragePersistenceService.ts | 2 + src/stores/notificationsStore.ts | 4 +- src/stores/spacesStore.ts | 2 +- src/stores/windowsStore.ts | 96 +++++++---- .../components/SidePanelFooter.test.ts | 159 ++++++++++++++++++ .../__tests__/stores/windowsStore.test.ts | 70 ++++---- 27 files changed, 551 insertions(+), 376 deletions(-) create mode 100644 test/vitest/__tests__/components/SidePanelFooter.test.ts diff --git a/src/App.vue b/src/App.vue index fac9d28a..56ac3432 100644 --- a/src/App.vue +++ b/src/App.vue @@ -81,7 +81,7 @@ if (isSignInWithEmailLink(auth, window.location.href)) { logtail.info("found email link redirection") }) .catch((error) => { - console.error("error", error) + console.error("error in email link redirection", error) logtail.error("error in email link redirection", error) useSuggestionsStore().addSuggestion(Suggestion.getStaticSuggestion(StaticSuggestionIdent.RESTART_SUGGESTED)) }); diff --git a/src/components/SidePanelFooter.vue b/src/components/SidePanelFooter.vue index 9bd75165..6ab593f9 100644 --- a/src/components/SidePanelFooter.vue +++ b/src/components/SidePanelFooter.vue @@ -82,6 +82,7 @@ (undefined) const randomKey = ref(uid()) watchEffect(() => { - const windowId = useWindowsStore().currentWindow?.id || 0 + const windowId = useWindowsStore().currentChromeWindow?.id || 0 if (useWindowsStore().windowForId(windowId)?.open) { //console.log("setting showWindowTable to ", useWindowsStore().windowForId(windowId)?.open) showWindowTable.value = useWindowsStore().windowForId(windowId)?.open || false @@ -218,13 +218,6 @@ watchEffect(() => { account.value = authStore.getAccount() }) -watchEffect(() => { - if (useWindowsStore().currentWindows.length === 1) { - console.log("setting showWindowTable to false (one window only)") - showWindowTable.value = false - } -}) - watchEffect(() => { const suggestions = useSuggestionsStore().getSuggestions( [SuggestionState.NEW, SuggestionState.DECISION_DELAYED, SuggestionState.NOTIFICATION]) @@ -255,7 +248,7 @@ watchEffect(() => { if (!inBexMode()) { return } - const windowId = useWindowsStore().currentWindow?.id || 0 + const windowId = useWindowsStore().currentChromeWindow?.id || 0 currentChromeTab.value = useTabsStore().getCurrentChromeTab(windowId) || useTabsStore().currentChromeTab }) @@ -360,7 +353,7 @@ const toggleShowWindowTable = () => { if (showWindowTable.value) { randomKey.value = uid() } - const windowId = useWindowsStore().currentWindow?.id || 0 + const windowId = useWindowsStore().currentChromeWindow?.id || 0 const currentWindow: Window | undefined = useWindowsStore().windowForId(windowId) if (currentWindow) { currentWindow.open = showWindowTable.value diff --git a/src/components/dialogues/helper/NewTabsetDialogBody.vue b/src/components/dialogues/helper/NewTabsetDialogBody.vue index 13ec9332..57be7aa3 100644 --- a/src/components/dialogues/helper/NewTabsetDialogBody.vue +++ b/src/components/dialogues/helper/NewTabsetDialogBody.vue @@ -140,7 +140,7 @@ const createNewTabset = () => { console.log("createNewTabset", addAllOpenTabs.value, tabsStore.tabs, windowModel.value) let tabsToUse = addAllOpenTabs.value ? tabsStore.tabs : [] if (props.windowId) { - const window:chrome.windows.Window | undefined = useWindowsStore().currentWindowForId(props.windowId) + const window:chrome.windows.Window | undefined = useWindowsStore().currentChromeWindow(props.windowId) if (window) { tabsToUse = window.tabs as chrome.tabs.Tab[] windowModel.value = newTabsetName.value diff --git a/src/components/helper/SidePanelWindowMarkupTable.vue b/src/components/helper/SidePanelWindowMarkupTable.vue index 6ed2d78c..b2e21535 100644 --- a/src/components/helper/SidePanelWindowMarkupTable.vue +++ b/src/components/helper/SidePanelWindowMarkupTable.vue @@ -1,5 +1,5 @@