mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 12:46:00 +00:00
perspective subloading works
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import {
|
||||
ChangePerspectiveConfigFunc,
|
||||
createPerspectiveNodeConfig,
|
||||
getPerspectiveParentColumnName,
|
||||
PerspectiveDataPatternColumn,
|
||||
PerspectiveNodeConfig,
|
||||
perspectiveNodesHaveStructure,
|
||||
@@ -331,12 +332,8 @@
|
||||
isColumnExpanded: column => column.isExpanded,
|
||||
columnExpandLevel: column => column.expandLevel,
|
||||
toggleExpandedColumn: (column, value) => column.toggleExpanded(value),
|
||||
getColumnDisplayName: column => column.shortName,
|
||||
getParentColumnName: columnName => {
|
||||
const path = columnName.split('::');
|
||||
if (path.length >= 2) return path.slice(0, -1).join('::');
|
||||
return null;
|
||||
},
|
||||
getColumnDisplayName: column => column.shortName || column.columnName,
|
||||
getParentColumnName: getPerspectiveParentColumnName,
|
||||
}}
|
||||
referenceComponent={QueryDesignerReference}
|
||||
value={createDesignerModel(config, dbInfos, dataPatterns)}
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
const disableLoadNextRef = createRef(false);
|
||||
|
||||
async function loadLevelData(node: PerspectiveTreeNode, parentRows: any[], counts) {
|
||||
/// console.log('loadLevelData', node, parentRows, counts);
|
||||
dbg('load level data', counts);
|
||||
// const loadProps: PerspectiveDataLoadPropsWithNode[] = [];
|
||||
const loadChildNodes = [];
|
||||
@@ -100,7 +101,7 @@
|
||||
incompleteRowsIndicator: [node.designerId],
|
||||
});
|
||||
}
|
||||
} else {
|
||||
} else if (!node.preloadedLevelData) {
|
||||
let lastRowWithChildren = null;
|
||||
for (const parentRow of parentRows) {
|
||||
const childRows = rows.filter(row => node.matchChildRow(parentRow, row));
|
||||
@@ -116,9 +117,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
// console.log('TESTING NODE', node);
|
||||
// console.log('ROWS', rows);
|
||||
for (const child of node.childNodes) {
|
||||
if (child.isExpandable && child.isCheckedNode) {
|
||||
await loadLevelData(child, rows, counts);
|
||||
// console.log('TEST CHILD FOR LOAD', child);
|
||||
// console.log(child.isExpandable, child.isCheckedNode, child.preloadedLevelData);
|
||||
if (child.isExpandable && (child.isCheckedNode || child.preloadedLevelData)) {
|
||||
// console.log('TESTED OK');
|
||||
// if (child.preloadedLevelData) console.log('LOADING CHILD DATA', rows);
|
||||
// console.log(child.preloadedLevelData, child);
|
||||
// console.log('LOADING FOR CHILD', child.codeName, child.columnName, child);
|
||||
// console.log('ROWS', child.preloadedLevelData ? parentRows : rows);
|
||||
await loadLevelData(
|
||||
child,
|
||||
child.preloadedLevelData
|
||||
? _.compact(_.flatten(parentRows.map(x => x[child.columnName])))
|
||||
: node.preloadedLevelData
|
||||
? parentRows
|
||||
: rows,
|
||||
counts
|
||||
);
|
||||
// loadProps.push(child.getNodeLoadProps());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user