mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-25 00:36:00 +00:00
perspective data pattern
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
import {
|
||||
ChangePerspectiveConfigFunc,
|
||||
extractPerspectiveDatabases,
|
||||
PerspectiveCollectionNode,
|
||||
PerspectiveConfig,
|
||||
PerspectiveDataProvider,
|
||||
PerspectiveTableNode,
|
||||
@@ -65,6 +66,7 @@
|
||||
import { sleep } from '../utility/common';
|
||||
import FontIcon from '../icons/FontIcon.svelte';
|
||||
import InlineButton from '../buttons/InlineButton.svelte';
|
||||
import { usePerspectiveDataPatterns } from '../utility/usePerspectiveDataPatterns';
|
||||
|
||||
const dbg = debug('dbgate:PerspectiveView');
|
||||
|
||||
@@ -128,13 +130,17 @@
|
||||
}
|
||||
|
||||
$: dbInfos = useMultipleDatabaseInfo(perspectiveDatabases);
|
||||
$: loader = new PerspectiveDataLoader(apiCall);
|
||||
$: dataPatterns = usePerspectiveDataPatterns({ conid, database }, config, cache, $dbInfos, loader);
|
||||
$: rootObject = config?.nodes?.find(x => x.designerId == config?.rootDesignerId);
|
||||
$: rootDb = rootObject ? $dbInfos?.[rootObject.conid || conid]?.[rootObject.database || database] : null;
|
||||
$: tableInfo = rootDb?.tables.find(x => x.pureName == rootObject?.pureName && x.schemaName == rootObject?.schemaName);
|
||||
$: viewInfo = rootDb?.views.find(x => x.pureName == rootObject?.pureName && x.schemaName == rootObject?.schemaName);
|
||||
$: collectionInfo = rootDb?.collections.find(
|
||||
x => x.pureName == rootObject?.pureName && x.schemaName == rootObject?.schemaName
|
||||
);
|
||||
|
||||
$: loader = new PerspectiveDataLoader(apiCall);
|
||||
$: dataProvider = new PerspectiveDataProvider(cache, loader);
|
||||
$: dataProvider = new PerspectiveDataProvider(cache, loader, $dataPatterns);
|
||||
$: root =
|
||||
tableInfo || viewInfo
|
||||
? new PerspectiveTableNode(
|
||||
@@ -147,6 +153,17 @@
|
||||
null,
|
||||
config.rootDesignerId
|
||||
)
|
||||
: collectionInfo
|
||||
? new PerspectiveCollectionNode(
|
||||
collectionInfo,
|
||||
$dbInfos,
|
||||
config,
|
||||
setConfig,
|
||||
dataProvider,
|
||||
{ conid, database },
|
||||
null,
|
||||
config.rootDesignerId
|
||||
)
|
||||
: null;
|
||||
$: tempRoot = root?.findNodeByDesignerId(tempRootDesignerId);
|
||||
|
||||
@@ -158,6 +175,7 @@
|
||||
|
||||
// $: console.log('PERSPECTIVE', config);
|
||||
// $: console.log('VIEW ROOT', root);
|
||||
// $: console.log('dataPatterns', $dataPatterns);
|
||||
</script>
|
||||
|
||||
<HorizontalSplitter initialValue={getInitialManagerSize()} bind:size={managerSize} allowCollapseChild1>
|
||||
@@ -205,6 +223,7 @@
|
||||
{database}
|
||||
{setConfig}
|
||||
dbInfos={$dbInfos}
|
||||
dataPatterns={$dataPatterns}
|
||||
{root}
|
||||
onClickTableHeader={designerId => {
|
||||
sleep(100).then(() => {
|
||||
|
||||
Reference in New Issue
Block a user