mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 05:26:00 +00:00
perspective cache - basic design
This commit is contained in:
@@ -24,7 +24,10 @@
|
||||
const loadChildNodes = [];
|
||||
const loadChildRows = [];
|
||||
const loadProps = node.getNodeLoadProps(parentRows);
|
||||
const { rows, incomplete } = await node.dataProvider.loadData(loadProps);
|
||||
const { rows, incomplete } = await node.dataProvider.loadData({
|
||||
...loadProps,
|
||||
topCount: 100,
|
||||
});
|
||||
// console.log('ROWS', rows, node.isRoot);
|
||||
|
||||
if (node.isRoot) {
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
import { Select } from 'dbgate-sqltree';
|
||||
import ManagerInnerContainer from '../elements/ManagerInnerContainer.svelte';
|
||||
import { PerspectiveDataLoader } from 'dbgate-datalib/lib/PerspectiveDataLoader';
|
||||
import stableStringify from 'json-stable-stringify';
|
||||
import createRef from '../utility/createRef';
|
||||
import { tick } from 'svelte';
|
||||
|
||||
const dbg = debug('dbgate:PerspectiveView');
|
||||
|
||||
@@ -34,9 +37,9 @@
|
||||
export let setConfig;
|
||||
|
||||
export let cache;
|
||||
export let setCache;
|
||||
|
||||
let managerSize;
|
||||
let nextCacheRef = createRef(null);
|
||||
|
||||
$: if (managerSize) setLocalStorage('perspectiveManagerWidth', managerSize);
|
||||
|
||||
@@ -52,8 +55,8 @@
|
||||
const tableInfo = useTableInfo({ conid, database, schemaName, pureName });
|
||||
const viewInfo = useViewInfo({ conid, database, schemaName, pureName });
|
||||
|
||||
$: loader = new PerspectiveDataLoader(apiCall, dbg);
|
||||
$: dataProvider = new PerspectiveDataProvider(cache, setCache, loader);
|
||||
$: dataProvider = new PerspectiveDataProvider(cache, loader);
|
||||
$: loader = new PerspectiveDataLoader(apiCall);
|
||||
$: root = $tableInfo
|
||||
? new PerspectiveTableNode($tableInfo, $dbInfo, config, setConfig, dataProvider, { conid, database }, null)
|
||||
: null;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { PerspectiveCache } from 'dbgate-datalib';
|
||||
|
||||
import PerspectiveView from '../perspectives/PerspectiveView.svelte';
|
||||
import usePerspectiveConfig, { usePerspectiveCache } from '../utility/usePerspectiveConfig';
|
||||
import usePerspectiveConfig from '../utility/usePerspectiveConfig';
|
||||
import stableStringify from 'json-stable-stringify';
|
||||
|
||||
export let tabid;
|
||||
export let conid;
|
||||
@@ -9,16 +12,7 @@
|
||||
export let pureName;
|
||||
|
||||
const config = usePerspectiveConfig(tabid);
|
||||
const cache = usePerspectiveCache();
|
||||
const cache = new PerspectiveCache(stableStringify);
|
||||
</script>
|
||||
|
||||
<PerspectiveView
|
||||
{conid}
|
||||
{database}
|
||||
{schemaName}
|
||||
{pureName}
|
||||
config={$config}
|
||||
setConfig={config.update}
|
||||
{cache}
|
||||
setCache={cache.update}
|
||||
/>
|
||||
<PerspectiveView {conid} {database} {schemaName} {pureName} config={$config} setConfig={config.update} {cache} />
|
||||
|
||||
@@ -26,7 +26,9 @@ export default function usePerspectiveConfig(tabid) {
|
||||
return config;
|
||||
}
|
||||
|
||||
export function usePerspectiveCache() {
|
||||
const cache = writable({});
|
||||
return cache;
|
||||
}
|
||||
// export function usePerspectiveCache() {
|
||||
// const cache = writable({
|
||||
// tables: {},
|
||||
// });
|
||||
// return cache;
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user