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