Fixing little UI bugs.

This commit is contained in:
mike12345567 2021-07-03 10:26:37 +01:00
parent 2a1243e81e
commit 71f96f9601
2 changed files with 14 additions and 4 deletions

View File

@ -177,9 +177,11 @@
Update display columns Update display columns
</Button> </Button>
{/if} {/if}
<Button primary on:click={updateDatasourceSchema} <div>
>Fetch Tables From Database</Button <Button primary on:click={updateDatasourceSchema}>
> Fetch Tables From Database
</Button>
</div>
</div> </div>
</div> </div>
<Body> <Body>
@ -319,4 +321,8 @@
grid-gap: var(--spacing-l); grid-gap: var(--spacing-l);
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
} }
.table-buttons div {
grid-column-end: -1;
}
</style> </style>

View File

@ -134,6 +134,7 @@ module PostgresModule {
/** /**
* Fetches the tables from the postgres table and assigns them to the datasource. * Fetches the tables from the postgres table and assigns them to the datasource.
* @param {*} datasourceId - datasourceId to fetch * @param {*} datasourceId - datasourceId to fetch
* @param entities - the tables that are to be built
*/ */
async buildSchema(datasourceId: string, entities: Record<string, Table>) { async buildSchema(datasourceId: string, entities: Record<string, Table>) {
let tableKeys: { [key: string]: string[] } = {} let tableKeys: { [key: string]: string[] } = {}
@ -169,9 +170,12 @@ module PostgresModule {
} }
// add the existing relationships from the entities if they exist, to prevent them from being overridden // add the existing relationships from the entities if they exist, to prevent them from being overridden
if (entities) { if (entities && entities[tableName]) {
const existingTableSchema = entities[tableName].schema const existingTableSchema = entities[tableName].schema
for (let key in existingTableSchema) { for (let key in existingTableSchema) {
if (!existingTableSchema.hasOwnProperty(key)) {
continue
}
if (existingTableSchema[key].type === "link") { if (existingTableSchema[key].type === "link") {
tables[tableName].schema[key] = existingTableSchema[key] tables[tableName].schema[key] = existingTableSchema[key]
} }