mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-25 20:06:00 +00:00
fixed possible render error
This commit is contained in:
@@ -103,11 +103,11 @@ export class TableGridDisplay extends GridDisplay {
|
|||||||
isChecked: this.isColumnChecked(col),
|
isChecked: this.isColumnChecked(col),
|
||||||
hintColumnNames:
|
hintColumnNames:
|
||||||
this.getFkDictionaryDescription(col.isForeignKeyUnique ? col.foreignKey : null)?.columns?.map(columnName =>
|
this.getFkDictionaryDescription(col.isForeignKeyUnique ? col.foreignKey : null)?.columns?.map(columnName =>
|
||||||
shortenIdentifier(`hint_${col.uniqueName}_${columnName}`, this.driver.dialect.maxIdentifierLength)
|
shortenIdentifier(`hint_${col.uniqueName}_${columnName}`, this.driver?.dialect?.maxIdentifierLength)
|
||||||
) || null,
|
) || null,
|
||||||
hintColumnDelimiter: this.getFkDictionaryDescription(col.isForeignKeyUnique ? col.foreignKey : null)
|
hintColumnDelimiter: this.getFkDictionaryDescription(col.isForeignKeyUnique ? col.foreignKey : null)
|
||||||
?.delimiter,
|
?.delimiter,
|
||||||
uniqueNameShorten: shortenIdentifier(col.uniqueName, this.driver.dialect.maxIdentifierLength),
|
uniqueNameShorten: shortenIdentifier(col.uniqueName, this.driver?.dialect?.maxIdentifierLength),
|
||||||
isExpandable: !!col.foreignKey,
|
isExpandable: !!col.foreignKey,
|
||||||
})) || []
|
})) || []
|
||||||
);
|
);
|
||||||
@@ -118,7 +118,7 @@ export class TableGridDisplay extends GridDisplay {
|
|||||||
if (this.isExpandedColumn(column.uniqueName)) {
|
if (this.isExpandedColumn(column.uniqueName)) {
|
||||||
const table = this.getFkTarget(column);
|
const table = this.getFkTarget(column);
|
||||||
if (table) {
|
if (table) {
|
||||||
const childAlias = shortenIdentifier(`${column.uniqueName}_ref`, this.driver.dialect.maxIdentifierLength);
|
const childAlias = shortenIdentifier(`${column.uniqueName}_ref`, this.driver?.dialect?.maxIdentifierLength);
|
||||||
const subcolumns = this.getDisplayColumns(table, column.uniquePath);
|
const subcolumns = this.getDisplayColumns(table, column.uniquePath);
|
||||||
|
|
||||||
this.addReferenceToSelect(select, parentAlias, column);
|
this.addReferenceToSelect(select, parentAlias, column);
|
||||||
@@ -131,8 +131,8 @@ export class TableGridDisplay extends GridDisplay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addReferenceToSelect(select: Select, parentAlias: string, column: DisplayColumn) {
|
addReferenceToSelect(select: Select, parentAlias: string, column: DisplayColumn) {
|
||||||
const childAlias = shortenIdentifier(`${column.uniqueName}_ref`, this.driver.dialect.maxIdentifierLength);
|
|
||||||
if ((select.from.relations || []).find(x => x.alias == childAlias)) return;
|
if ((select.from.relations || []).find(x => x.alias == childAlias)) return;
|
||||||
|
const childAlias = shortenIdentifier(`${column.uniqueName}_ref`, this.driver?.dialect?.maxIdentifierLength);
|
||||||
const table = this.getFkTarget(column);
|
const table = this.getFkTarget(column);
|
||||||
if (table && table.primaryKey) {
|
if (table && table.primaryKey) {
|
||||||
select.from.relations = [
|
select.from.relations = [
|
||||||
@@ -196,11 +196,11 @@ export class TableGridDisplay extends GridDisplay {
|
|||||||
this.addReferenceToSelect(
|
this.addReferenceToSelect(
|
||||||
select,
|
select,
|
||||||
parentUniqueName
|
parentUniqueName
|
||||||
? shortenIdentifier(`${parentUniqueName}_ref`, this.driver.dialect.maxIdentifierLength)
|
? shortenIdentifier(`${parentUniqueName}_ref`, this.driver?.dialect?.maxIdentifierLength)
|
||||||
: 'basetbl',
|
: 'basetbl',
|
||||||
column
|
column
|
||||||
);
|
);
|
||||||
const childAlias = shortenIdentifier(`${column.uniqueName}_ref`, this.driver.dialect.maxIdentifierLength);
|
const childAlias = shortenIdentifier(`${column.uniqueName}_ref`, this.driver?.dialect?.maxIdentifierLength);
|
||||||
select.columns.push(
|
select.columns.push(
|
||||||
...hintDescription.columns.map(
|
...hintDescription.columns.map(
|
||||||
columnName =>
|
columnName =>
|
||||||
@@ -209,7 +209,7 @@ export class TableGridDisplay extends GridDisplay {
|
|||||||
columnName,
|
columnName,
|
||||||
alias: shortenIdentifier(
|
alias: shortenIdentifier(
|
||||||
`hint_${column.uniqueName}_${columnName}`,
|
`hint_${column.uniqueName}_${columnName}`,
|
||||||
this.driver.dialect.maxIdentifierLength
|
this.driver?.dialect?.maxIdentifierLength
|
||||||
),
|
),
|
||||||
source: { alias: childAlias },
|
source: { alias: childAlias },
|
||||||
} as ColumnRefExpression)
|
} as ColumnRefExpression)
|
||||||
|
|||||||
Reference in New Issue
Block a user