mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 19:36:02 +00:00
parentFilter - declarative support
This commit is contained in:
@@ -27,6 +27,10 @@ export interface PerspectiveFilterColumnInfo {
|
||||
schemaName: string;
|
||||
foreignKey: ForeignKeyInfo;
|
||||
}
|
||||
|
||||
export interface PerspectiveParentFilterConfig {
|
||||
uniqueName: string;
|
||||
}
|
||||
export interface PerspectiveConfig extends PerspectiveConfigColumns {
|
||||
rootObject: { schemaName?: string; pureName: string };
|
||||
filters: { [uniqueName: string]: string };
|
||||
@@ -37,6 +41,7 @@ export interface PerspectiveConfig extends PerspectiveConfigColumns {
|
||||
}[];
|
||||
};
|
||||
customJoins: PerspectiveCustomJoinConfig[];
|
||||
parentFilters: PerspectiveParentFilterConfig[];
|
||||
}
|
||||
|
||||
export function createPerspectiveConfig(rootObject: { schemaName?: string; pureName: string }): PerspectiveConfig {
|
||||
@@ -48,6 +53,7 @@ export function createPerspectiveConfig(rootObject: { schemaName?: string; pureN
|
||||
filters: {},
|
||||
sort: {},
|
||||
rootObject,
|
||||
parentFilters: [],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,10 @@ export class PerspectiveDisplayColumn {
|
||||
return this.parentNodes[level]?.title;
|
||||
}
|
||||
|
||||
getParentNode(level) {
|
||||
return this.parentNodes[level];
|
||||
}
|
||||
|
||||
getParentTableUniqueName(level) {
|
||||
return this.parentNodes[level]?.headerTableAttributes ? this.parentNodes[level]?.uniqueName : '';
|
||||
}
|
||||
|
||||
@@ -247,6 +247,18 @@ export abstract class PerspectiveTreeNode {
|
||||
if (uniquePath[0] != this.codeName) return null;
|
||||
return this.findChildNodeByUniquePath(uniquePath.slice(1));
|
||||
}
|
||||
|
||||
get supportsParentFilter() {
|
||||
return (
|
||||
(this.parentNode?.isRoot || this.parentNode?.supportsParentFilter) &&
|
||||
this.parentNode?.databaseConfig?.conid == this.databaseConfig?.conid &&
|
||||
this.parentNode?.databaseConfig?.database == this.databaseConfig?.database
|
||||
);
|
||||
}
|
||||
|
||||
get isParentFilter() {
|
||||
return !!(this.config.parentFilters || []).find(x => x.uniqueName == this.uniqueName);
|
||||
}
|
||||
}
|
||||
|
||||
export class PerspectiveTableColumnNode extends PerspectiveTreeNode {
|
||||
|
||||
Reference in New Issue
Block a user