mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
open favorites on startup
This commit is contained in:
parent
acdba0c52c
commit
484e7c27a2
@ -5,19 +5,11 @@ SERVER_mysql=localhost
|
||||
USER_mysql=root
|
||||
PASSWORD_mysql=test
|
||||
PORT_mysql=3307
|
||||
ENGINE_mysql=mysql
|
||||
ENGINE_mysql=mysql@dbgate-plugin-mysql
|
||||
|
||||
LABEL_postgres=Postgres localhost
|
||||
SERVER_postgres=localhost
|
||||
USER_postgres=postgres
|
||||
PASSWORD_postgres=test
|
||||
PORT_postgres=5433
|
||||
ENGINE_postgres=postgres
|
||||
|
||||
TOOLBAR=home
|
||||
ICON_home=mdi mdi-home
|
||||
TITLE_home=Home
|
||||
PAGE_home=home.html
|
||||
STARTUP_PAGES=home
|
||||
|
||||
PAGES_DIRECTORY=/home/jena/jenasoft/dbgate-web/pages
|
||||
ENGINE_postgres=postgres@dbgate-plugin-postgres
|
||||
|
@ -4,9 +4,11 @@
|
||||
import PluginsProvider from './plugins/PluginsProvider.svelte';
|
||||
import Screen from './Screen.svelte';
|
||||
import ErrorHandler from './utility/ErrorHandler.svelte';
|
||||
import OpenTabsOnStartup from './utility/OpenTabsOnStartup.svelte';
|
||||
</script>
|
||||
|
||||
<ErrorHandler />
|
||||
<PluginsProvider />
|
||||
<CommandListener />
|
||||
<OpenTabsOnStartup />
|
||||
<Screen />
|
||||
|
29
packages/web/src/utility/OpenTabsOnStartup.svelte
Normal file
29
packages/web/src/utility/OpenTabsOnStartup.svelte
Normal file
@ -0,0 +1,29 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { openFavorite } from '../appobj/FavoriteFileAppObject.svelte';
|
||||
import { openedTabs } from '../stores';
|
||||
|
||||
import { useFavorites } from './metadataLoaders';
|
||||
|
||||
$: favorites = useFavorites();
|
||||
let opened = false;
|
||||
|
||||
onMount(() => {
|
||||
openOnStartup($favorites);
|
||||
});
|
||||
|
||||
$: openOnStartup($favorites);
|
||||
|
||||
function openOnStartup(list) {
|
||||
if (!list) return;
|
||||
if (opened) return;
|
||||
|
||||
opened = true;
|
||||
|
||||
if ($openedTabs.find(x => !x.closedTime)) return;
|
||||
|
||||
for (const favorite of list.filter(x => x.openOnStartup)) {
|
||||
openFavorite(favorite);
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user