mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 15:06:01 +00:00
perspectives: added data provider layer
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
const loadChildNodes = [];
|
||||
const loadChildRows = [];
|
||||
const loadProps = node.getNodeLoadProps(parentRows);
|
||||
const rows = await node.loader(loadProps);
|
||||
const rows = await node.dataProvider.loadData(loadProps);
|
||||
// console.log('ROWS', rows, node.isRoot);
|
||||
|
||||
if (node.isRoot) {
|
||||
@@ -67,7 +67,7 @@
|
||||
await loadLevelData(node, rows);
|
||||
dataRows = rows;
|
||||
|
||||
// console.log('DISPLAY ROWS', rows);
|
||||
console.log('DISPLAY ROWS', rows);
|
||||
// const rows = await node.loadLevelData();
|
||||
// for (const child of node.childNodes) {
|
||||
// const loadProps = [];
|
||||
@@ -97,6 +97,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {});
|
||||
|
||||
$: loadData(root);
|
||||
$: display = root && dataRows ? new PerspectiveDisplay(root, dataRows) : null;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import {
|
||||
getTableChildPerspectiveNodes,
|
||||
PerspectiveDataLoadProps,
|
||||
PerspectiveDataProvider,
|
||||
PerspectiveTableColumnNode,
|
||||
PerspectiveTableNode,
|
||||
} from 'dbgate-datalib';
|
||||
@@ -18,7 +19,7 @@
|
||||
import PerspectiveTable from './PerspectiveTable.svelte';
|
||||
import { apiCall } from '../utility/api';
|
||||
import { Select } from 'dbgate-sqltree';
|
||||
import ManagerInnerContainer from '../elements/ManagerInnerContainer.svelte';
|
||||
import ManagerInnerContainer from '../elements/ManagerInnerContainer.svelte';
|
||||
|
||||
export let conid;
|
||||
export let database;
|
||||
@@ -28,6 +29,9 @@ import ManagerInnerContainer from '../elements/ManagerInnerContainer.svelte';
|
||||
export let config;
|
||||
export let setConfig;
|
||||
|
||||
export let cache;
|
||||
export let setCache;
|
||||
|
||||
let managerSize;
|
||||
|
||||
$: if (managerSize) setLocalStorage('perspectiveManagerWidth', managerSize);
|
||||
@@ -78,6 +82,22 @@ import ManagerInnerContainer from '../elements/ManagerInnerContainer.svelte';
|
||||
},
|
||||
})),
|
||||
selectAll: !dataColumns,
|
||||
orderBy: dataColumns
|
||||
? [
|
||||
{
|
||||
exprType: 'column',
|
||||
direction: 'ASC',
|
||||
columnName: dataColumns[0],
|
||||
source: {
|
||||
name: { schemaName, pureName },
|
||||
},
|
||||
},
|
||||
]
|
||||
: null,
|
||||
range: {
|
||||
offset: 0,
|
||||
limit: 100,
|
||||
},
|
||||
};
|
||||
if (bindingColumns?.length == 1) {
|
||||
select.where = {
|
||||
@@ -102,7 +122,8 @@ import ManagerInnerContainer from '../elements/ManagerInnerContainer.svelte';
|
||||
return response.rows;
|
||||
}
|
||||
|
||||
$: root = $tableInfo ? new PerspectiveTableNode($tableInfo, $dbInfo, config, setConfig, loader as any, null) : null;
|
||||
$: dataProvider = new PerspectiveDataProvider(cache, setCache, loader);
|
||||
$: root = $tableInfo ? new PerspectiveTableNode($tableInfo, $dbInfo, config, setConfig, dataProvider, null) : null;
|
||||
</script>
|
||||
|
||||
<HorizontalSplitter initialValue={getInitialManagerSize()} bind:size={managerSize}>
|
||||
|
||||
Reference in New Issue
Block a user