mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-24 23:26:00 +00:00
perspective fix
This commit is contained in:
@@ -7,6 +7,13 @@ import uuidv1 from 'uuid/v1';
|
|||||||
// uncheckedColumns: string[];
|
// uncheckedColumns: string[];
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
export type PerspectiveDatabaseEngineType = 'sqldb' | 'docdb';
|
||||||
|
|
||||||
|
export interface PerspectiveDatabaseConfig {
|
||||||
|
conid: string;
|
||||||
|
database: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface PerspectiveCustomJoinConfig {
|
export interface PerspectiveCustomJoinConfig {
|
||||||
refNodeDesignerId: string;
|
refNodeDesignerId: string;
|
||||||
referenceDesignerId: string;
|
referenceDesignerId: string;
|
||||||
|
|||||||
@@ -4,17 +4,12 @@ import { RangeDefinition } from 'dbgate-types';
|
|||||||
import { PerspectiveBindingGroup, PerspectiveCache } from './PerspectiveCache';
|
import { PerspectiveBindingGroup, PerspectiveCache } from './PerspectiveCache';
|
||||||
import { PerspectiveDataLoader } from './PerspectiveDataLoader';
|
import { PerspectiveDataLoader } from './PerspectiveDataLoader';
|
||||||
import { PerspectiveDataPatternDict } from './PerspectiveDataPattern';
|
import { PerspectiveDataPatternDict } from './PerspectiveDataPattern';
|
||||||
|
import { PerspectiveDatabaseConfig, PerspectiveDatabaseEngineType } from './PerspectiveConfig';
|
||||||
|
|
||||||
export const PERSPECTIVE_PAGE_SIZE = 100;
|
export const PERSPECTIVE_PAGE_SIZE = 100;
|
||||||
|
|
||||||
const dbg = debug('dbgate:PerspectiveDataProvider');
|
const dbg = debug('dbgate:PerspectiveDataProvider');
|
||||||
|
|
||||||
|
|
||||||
export interface PerspectiveDatabaseConfig {
|
|
||||||
conid: string;
|
|
||||||
database: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface PerspectiveDataLoadProps {
|
export interface PerspectiveDataLoadProps {
|
||||||
databaseConfig: PerspectiveDatabaseConfig;
|
databaseConfig: PerspectiveDatabaseConfig;
|
||||||
schemaName?: string;
|
schemaName?: string;
|
||||||
@@ -31,7 +26,7 @@ export interface PerspectiveDataLoadProps {
|
|||||||
topCount?: number;
|
topCount?: number;
|
||||||
sqlCondition?: Condition;
|
sqlCondition?: Condition;
|
||||||
mongoCondition?: any;
|
mongoCondition?: any;
|
||||||
engineType: 'sqldb' | 'docdb';
|
engineType: PerspectiveDatabaseEngineType;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PerspectiveDataProvider {
|
export class PerspectiveDataProvider {
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import {
|
|||||||
MultipleDatabaseInfo,
|
MultipleDatabaseInfo,
|
||||||
PerspectiveConfig,
|
PerspectiveConfig,
|
||||||
PerspectiveCustomJoinConfig,
|
PerspectiveCustomJoinConfig,
|
||||||
|
PerspectiveDatabaseConfig,
|
||||||
|
PerspectiveDatabaseEngineType,
|
||||||
PerspectiveFilterColumnInfo,
|
PerspectiveFilterColumnInfo,
|
||||||
PerspectiveNodeConfig,
|
PerspectiveNodeConfig,
|
||||||
PerspectiveReferenceConfig,
|
PerspectiveReferenceConfig,
|
||||||
@@ -28,11 +30,7 @@ import _uniqBy from 'lodash/uniqBy';
|
|||||||
import _sortBy from 'lodash/sortBy';
|
import _sortBy from 'lodash/sortBy';
|
||||||
import _cloneDeepWith from 'lodash/cloneDeepWith';
|
import _cloneDeepWith from 'lodash/cloneDeepWith';
|
||||||
import _findIndex from 'lodash/findIndex';
|
import _findIndex from 'lodash/findIndex';
|
||||||
import {
|
import { PerspectiveDataLoadProps, PerspectiveDataProvider } from './PerspectiveDataProvider';
|
||||||
PerspectiveDatabaseConfig,
|
|
||||||
PerspectiveDataLoadProps,
|
|
||||||
PerspectiveDataProvider,
|
|
||||||
} from './PerspectiveDataProvider';
|
|
||||||
import stableStringify from 'json-stable-stringify';
|
import stableStringify from 'json-stable-stringify';
|
||||||
import { getFilterType, parseFilter } from 'dbgate-filterparser';
|
import { getFilterType, parseFilter } from 'dbgate-filterparser';
|
||||||
import { FilterType } from 'dbgate-filterparser/lib/types';
|
import { FilterType } from 'dbgate-filterparser/lib/types';
|
||||||
@@ -119,6 +117,9 @@ export abstract class PerspectiveTreeNode {
|
|||||||
}
|
}
|
||||||
return this.parentNode.parentTableNode;
|
return this.parentNode.parentTableNode;
|
||||||
}
|
}
|
||||||
|
get engineType(): PerspectiveDatabaseEngineType {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
abstract getNodeLoadProps(parentRows: any[]): PerspectiveDataLoadProps;
|
abstract getNodeLoadProps(parentRows: any[]): PerspectiveDataLoadProps;
|
||||||
get isRoot() {
|
get isRoot() {
|
||||||
return this.parentNode == null;
|
return this.parentNode == null;
|
||||||
@@ -426,7 +427,9 @@ export abstract class PerspectiveTreeNode {
|
|||||||
return (
|
return (
|
||||||
(this.parentNode?.isRoot || this.parentNode?.supportsParentFilter) &&
|
(this.parentNode?.isRoot || this.parentNode?.supportsParentFilter) &&
|
||||||
this.parentNode?.databaseConfig?.conid == this.databaseConfig?.conid &&
|
this.parentNode?.databaseConfig?.conid == this.databaseConfig?.conid &&
|
||||||
this.parentNode?.databaseConfig?.database == this.databaseConfig?.database
|
this.parentNode?.databaseConfig?.database == this.databaseConfig?.database &&
|
||||||
|
this.engineType == 'sqldb' &&
|
||||||
|
this.parentNode?.engineType == 'sqldb'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,6 +535,10 @@ export class PerspectiveTableColumnNode extends PerspectiveTreeNode {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get engineType() {
|
||||||
|
return this.parentNode.engineType;
|
||||||
|
}
|
||||||
|
|
||||||
matchChildRow(parentRow: any, childRow: any): boolean {
|
matchChildRow(parentRow: any, childRow: any): boolean {
|
||||||
if (!this.foreignKey) return false;
|
if (!this.foreignKey) return false;
|
||||||
return parentRow[this.foreignKey.columns[0].columnName] == childRow[this.foreignKey.columns[0].refColumnName];
|
return parentRow[this.foreignKey.columns[0].columnName] == childRow[this.foreignKey.columns[0].refColumnName];
|
||||||
@@ -942,6 +949,10 @@ export class PerspectiveTableNode extends PerspectiveTreeNode {
|
|||||||
super(dbs, config, setConfig, parentNode, dataProvider, databaseConfig, designerId);
|
super(dbs, config, setConfig, parentNode, dataProvider, databaseConfig, designerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get engineType(): PerspectiveDatabaseEngineType {
|
||||||
|
return isCollectionInfo(this.table) ? 'docdb' : 'sqldb';
|
||||||
|
}
|
||||||
|
|
||||||
getNodeLoadProps(parentRows: any[]): PerspectiveDataLoadProps {
|
getNodeLoadProps(parentRows: any[]): PerspectiveDataLoadProps {
|
||||||
const isMongo = isCollectionInfo(this.table);
|
const isMongo = isCollectionInfo(this.table);
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user