custom join dialog

This commit is contained in:
Jan Prochazka
2022-07-31 20:09:48 +02:00
parent 2b4120435b
commit 091e91556d
8 changed files with 422 additions and 1 deletions

View File

@@ -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: {},
};

View File

@@ -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 {