mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 11:56:00 +00:00
custom join dialog
This commit is contained in:
@@ -4,6 +4,19 @@ export interface PerspectiveConfigColumns {
|
||||
uncheckedColumns: string[];
|
||||
}
|
||||
|
||||
export interface PerspectiveCustomJoinConfig {
|
||||
joinid: string;
|
||||
joinName: string;
|
||||
baseUniqueName: string;
|
||||
conid?: string;
|
||||
database?: string;
|
||||
refSchemaName?: string;
|
||||
refTableName: string;
|
||||
columns: {
|
||||
baseColumnName: string;
|
||||
refColumnName: string;
|
||||
}[];
|
||||
}
|
||||
export interface PerspectiveConfig extends PerspectiveConfigColumns {
|
||||
filters: { [uniqueName: string]: string };
|
||||
sort: {
|
||||
@@ -12,6 +25,7 @@ export interface PerspectiveConfig extends PerspectiveConfigColumns {
|
||||
order: 'ASC' | 'DESC';
|
||||
}[];
|
||||
};
|
||||
customJoins: PerspectiveCustomJoinConfig[];
|
||||
}
|
||||
|
||||
export function createPerspectiveConfig(): PerspectiveConfig {
|
||||
@@ -19,6 +33,7 @@ export function createPerspectiveConfig(): PerspectiveConfig {
|
||||
expandedColumns: [],
|
||||
checkedColumns: [],
|
||||
uncheckedColumns: [],
|
||||
customJoins: [],
|
||||
filters: {},
|
||||
sort: {},
|
||||
};
|
||||
|
||||
@@ -203,6 +203,20 @@ export abstract class PerspectiveTreeNode {
|
||||
{ columnName: table?.columns[0].columnName, order: 'ASC' },
|
||||
];
|
||||
}
|
||||
|
||||
getBaseTables() {
|
||||
const res = [];
|
||||
const table = this.getBaseTableFromThis();
|
||||
if (table) res.push({ table, node: this });
|
||||
for (const child of this.childNodes) {
|
||||
if (!child.isChecked) continue;
|
||||
res.push(...child.getBaseTables());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
getBaseTableFromThis() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export class PerspectiveTableColumnNode extends PerspectiveTreeNode {
|
||||
@@ -311,6 +325,10 @@ export class PerspectiveTableColumnNode extends PerspectiveTreeNode {
|
||||
);
|
||||
}
|
||||
|
||||
getBaseTableFromThis() {
|
||||
return this.refTable;
|
||||
}
|
||||
|
||||
parseFilterCondition() {
|
||||
const filter = this.getFilter();
|
||||
if (!filter) return null;
|
||||
@@ -380,6 +398,10 @@ export class PerspectiveTableNode extends PerspectiveTreeNode {
|
||||
get icon() {
|
||||
return 'img table';
|
||||
}
|
||||
|
||||
getBaseTableFromThis() {
|
||||
return this.table;
|
||||
}
|
||||
}
|
||||
|
||||
export class PerspectiveViewNode extends PerspectiveTreeNode {
|
||||
@@ -433,6 +455,10 @@ export class PerspectiveViewNode extends PerspectiveTreeNode {
|
||||
get icon() {
|
||||
return 'img table';
|
||||
}
|
||||
|
||||
getBaseTableFromThis() {
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
|
||||
export class PerspectiveTableReferenceNode extends PerspectiveTableNode {
|
||||
|
||||
Reference in New Issue
Block a user