mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 01:16:01 +00:00
table data grid
This commit is contained in:
@@ -1,8 +1,27 @@
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
interface TabDefinition {
|
||||
title: string;
|
||||
closedTime?: number;
|
||||
icon: string;
|
||||
props: any;
|
||||
selected: boolean;
|
||||
busy: boolean;
|
||||
tabid: string;
|
||||
}
|
||||
|
||||
export function writableWithStorage<T>(defaultValue: T, storageName) {
|
||||
const init = localStorage.getItem(storageName);
|
||||
const res = writable<T>(init ? JSON.parse(init) : defaultValue);
|
||||
res.subscribe(value => {
|
||||
localStorage.setItem(storageName, JSON.stringify(value));
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
export const selectedWidget = writable('database');
|
||||
export const openedConnections = writable([]);
|
||||
export const currentDatabase = writable(null);
|
||||
export const openedTabs = writable([]);
|
||||
export const openedTabs = writableWithStorage<TabDefinition[]>([], 'openedTabs');
|
||||
|
||||
// export const leftPanelWidth = writable(300);
|
||||
|
||||
Reference in New Issue
Block a user