mirror of
https://github.com/dbgate/dbgate
synced 2024-11-08 04:35:58 +00:00
removed debug code
This commit is contained in:
parent
ac07b7e1ba
commit
c8d031e2c4
@ -1,10 +1,13 @@
|
|||||||
|
import debug from 'debug';
|
||||||
import { Condition } from 'dbgate-sqltree';
|
import { Condition } from 'dbgate-sqltree';
|
||||||
import { RangeDefinition } from 'dbgate-types';
|
import { RangeDefinition } from 'dbgate-types';
|
||||||
import { format } from 'path';
|
import { format } from 'path';
|
||||||
import { PerspectiveBindingGroup, PerspectiveCache } from './PerspectiveCache';
|
import { PerspectiveBindingGroup, PerspectiveCache } from './PerspectiveCache';
|
||||||
import { PerspectiveDataLoader } from './PerspectiveDataLoader';
|
import { PerspectiveDataLoader } from './PerspectiveDataLoader';
|
||||||
|
|
||||||
export const PERSPECTIVE_PAGE_SIZE = 10;
|
export const PERSPECTIVE_PAGE_SIZE = 100;
|
||||||
|
|
||||||
|
const dbg = debug('dbgate:PerspectiveDataProvider');
|
||||||
|
|
||||||
export interface PerspectiveDatabaseConfig {
|
export interface PerspectiveDatabaseConfig {
|
||||||
conid: string;
|
conid: string;
|
||||||
@ -30,6 +33,7 @@ export interface PerspectiveDataLoadProps {
|
|||||||
export class PerspectiveDataProvider {
|
export class PerspectiveDataProvider {
|
||||||
constructor(public cache: PerspectiveCache, public loader: PerspectiveDataLoader) {}
|
constructor(public cache: PerspectiveCache, public loader: PerspectiveDataLoader) {}
|
||||||
async loadData(props: PerspectiveDataLoadProps): Promise<{ rows: any[]; incomplete: boolean }> {
|
async loadData(props: PerspectiveDataLoadProps): Promise<{ rows: any[]; incomplete: boolean }> {
|
||||||
|
dbg('load data', props);
|
||||||
// console.log('LOAD DATA', props);
|
// console.log('LOAD DATA', props);
|
||||||
if (props.bindingColumns) {
|
if (props.bindingColumns) {
|
||||||
return this.loadDataNested(props);
|
return this.loadDataNested(props);
|
||||||
@ -69,15 +73,17 @@ export class PerspectiveDataProvider {
|
|||||||
for (; groupIndex < props.bindingValues.length; groupIndex++) {
|
for (; groupIndex < props.bindingValues.length; groupIndex++) {
|
||||||
const groupValues = props.bindingValues[groupIndex];
|
const groupValues = props.bindingValues[groupIndex];
|
||||||
const group = tableCache.getBindingGroup(groupValues);
|
const group = tableCache.getBindingGroup(groupValues);
|
||||||
|
let loadCalled = false;
|
||||||
|
|
||||||
if (!group.loadedAll) {
|
if (!group.loadedAll) {
|
||||||
// wee need to load next data
|
// wee need to load next data
|
||||||
await this.loadNextGroup(props, groupIndex);
|
await this.loadNextGroup(props, groupIndex);
|
||||||
|
loadCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log('GRP', groupValues, group);
|
// console.log('GRP', groupValues, group);
|
||||||
rows.push(...group.loadedRows);
|
rows.push(...group.loadedRows);
|
||||||
if (rows.length >= props.topCount) {
|
if (rows.length >= props.topCount || loadCalled) {
|
||||||
return {
|
return {
|
||||||
rows: rows.slice(0, props.topCount),
|
rows: rows.slice(0, props.topCount),
|
||||||
incomplete: props.topCount < rows.length || !group.loadedAll || groupIndex < props.bindingValues.length - 1,
|
incomplete: props.topCount < rows.length || !group.loadedAll || groupIndex < props.bindingValues.length - 1,
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
cache.clear();
|
cache.clear();
|
||||||
}
|
}
|
||||||
config.update(value);
|
config.update(value);
|
||||||
|
// loadedCounts.set({});
|
||||||
}}
|
}}
|
||||||
{cache}
|
{cache}
|
||||||
{loadedCounts}
|
{loadedCounts}
|
||||||
|
Loading…
Reference in New Issue
Block a user