mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
fixes
This commit is contained in:
parent
646a83b288
commit
380ab2e69e
@ -51,7 +51,7 @@ function addObjectToColumns(columns: PerspectiveDataPatternColumn[], row) {
|
|||||||
if (!column.types.includes(type)) {
|
if (!column.types.includes(type)) {
|
||||||
column.types.push(type);
|
column.types.push(type);
|
||||||
}
|
}
|
||||||
if (_isPlainObject(value)) {
|
if (_isPlainObject(value) && type != 'oid') {
|
||||||
addObjectToColumns(column.columns, value);
|
addObjectToColumns(column.columns, value);
|
||||||
}
|
}
|
||||||
if (_isArray(value)) {
|
if (_isArray(value)) {
|
||||||
|
@ -54,7 +54,7 @@ export class PerspectiveDataProvider {
|
|||||||
...props,
|
...props,
|
||||||
bindingValues: uncached,
|
bindingValues: uncached,
|
||||||
});
|
});
|
||||||
// console.log('COUNTS', counts);
|
// console.log('loadDataNested COUNTS', counts);
|
||||||
for (const resetItem of uncached) {
|
for (const resetItem of uncached) {
|
||||||
tableCache.storeGroupSize(props, resetItem, 0);
|
tableCache.storeGroupSize(props, resetItem, 0);
|
||||||
}
|
}
|
||||||
|
@ -1248,7 +1248,7 @@ export class PerspectiveCustomJoinTreeNode extends PerspectiveTableNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
matchChildRow(parentRow: any, childRow: any): boolean {
|
matchChildRow(parentRow: any, childRow: any): boolean {
|
||||||
// console.log('MATCH ROW', parentRow, childRow);
|
console.log('MATCH ROW', parentRow, childRow);
|
||||||
for (const column of this.customJoin.columns) {
|
for (const column of this.customJoin.columns) {
|
||||||
if (parentRow[getPerspectiveMostNestedChildColumnName(column.baseColumnName)] != childRow[column.refColumnName]) {
|
if (parentRow[getPerspectiveMostNestedChildColumnName(column.baseColumnName)] != childRow[column.refColumnName]) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -79,8 +79,12 @@
|
|||||||
const lastVisibleRowIndexRef = createRef(0);
|
const lastVisibleRowIndexRef = createRef(0);
|
||||||
const disableLoadNextRef = createRef(false);
|
const disableLoadNextRef = createRef(false);
|
||||||
|
|
||||||
|
// Essential function !!
|
||||||
|
// Fills nested data into parentRows (assigns into array parentRows[i][node.fieldName])
|
||||||
|
// eg. when node is CustomJoinTreeNode, loads data from data provider
|
||||||
async function loadLevelData(node: PerspectiveTreeNode, parentRows: any[], counts) {
|
async function loadLevelData(node: PerspectiveTreeNode, parentRows: any[], counts) {
|
||||||
/// console.log('loadLevelData', node, parentRows, counts);
|
// console.log('loadLevelData', node.codeName, node.fieldName, parentRows);
|
||||||
|
// console.log('COUNTS', node.codeName, counts);
|
||||||
dbg('load level data', counts);
|
dbg('load level data', counts);
|
||||||
// const loadProps: PerspectiveDataLoadPropsWithNode[] = [];
|
// const loadProps: PerspectiveDataLoadPropsWithNode[] = [];
|
||||||
const loadChildNodes = [];
|
const loadChildNodes = [];
|
||||||
@ -115,6 +119,9 @@
|
|||||||
incompleteRowsIndicator: [node.designerId],
|
incompleteRowsIndicator: [node.designerId],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// this is needed for nested call
|
||||||
|
rows = _.compact(_.flatten(parentRows.map(x => x[node.fieldName])));
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log('TESTING NODE', node);
|
// console.log('TESTING NODE', node);
|
||||||
@ -127,14 +134,21 @@
|
|||||||
// if (child.preloadedLevelData) console.log('LOADING CHILD DATA', rows);
|
// if (child.preloadedLevelData) console.log('LOADING CHILD DATA', rows);
|
||||||
// console.log(child.preloadedLevelData, child);
|
// console.log(child.preloadedLevelData, child);
|
||||||
// console.log('LOADING FOR CHILD', child.codeName, child.columnName, child);
|
// console.log('LOADING FOR CHILD', child.codeName, child.columnName, child);
|
||||||
// console.log('ROWS', child.preloadedLevelData ? parentRows : rows);
|
// console.log('CALL CHILD', child.codeName, rows, parentRows);
|
||||||
await loadLevelData(
|
await loadLevelData(
|
||||||
child,
|
child,
|
||||||
child.preloadedLevelData
|
rows,
|
||||||
? _.compact(_.flatten(parentRows.map(x => x[child.columnName])))
|
// node.preloadedLevelData
|
||||||
: node.preloadedLevelData
|
// ? _.compact(_.flatten(parentRows.map(x => x[child.columnName])))
|
||||||
? parentRows
|
// : child.preloadedLevelData
|
||||||
: rows,
|
// ? parentRows
|
||||||
|
// : rows,
|
||||||
|
// child.preloadedLevelData
|
||||||
|
// ? _.compact(_.flatten(parentRows.map(x => x[child.columnName])))
|
||||||
|
// : node.preloadedLevelData
|
||||||
|
// ? parentRows
|
||||||
|
// : rows,
|
||||||
|
|
||||||
counts
|
counts
|
||||||
);
|
);
|
||||||
// loadProps.push(child.getNodeLoadProps());
|
// loadProps.push(child.getNodeLoadProps());
|
||||||
|
@ -258,7 +258,7 @@ const driver = {
|
|||||||
const count = await collection.countDocuments(convertObjectId(options.condition) || {});
|
const count = await collection.countDocuments(convertObjectId(options.condition) || {});
|
||||||
return { count };
|
return { count };
|
||||||
} else if (options.aggregate) {
|
} else if (options.aggregate) {
|
||||||
let cursor = await collection.aggregate(options.aggregate);
|
let cursor = await collection.aggregate(convertObjectId(options.aggregate));
|
||||||
const rows = await cursor.toArray();
|
const rows = await cursor.toArray();
|
||||||
return { rows: rows.map(transformMongoData) };
|
return { rows: rows.map(transformMongoData) };
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user