Fix issue where we were saving the entire datasource definition into every datasource setting

This commit is contained in:
Andrew Kingston 2024-08-21 09:55:30 +01:00
parent 256f177fd5
commit 4be3f0a320
No known key found for this signature in database
2 changed files with 11 additions and 9 deletions

View File

@ -29,7 +29,7 @@
on:click={() => onSelect(data)}
>
<span class="spectrum-Menu-itemLabel">
{data.datasource?.name ? `${data.datasource.name} - ` : ""}{data.label}
{data.datasourceName ? `${data.datasourceName} - ` : ""}{data.label}
</span>
<svg
class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"

View File

@ -1,12 +1,14 @@
export const datasourceSelect = {
table: (table, datasources) => ({
label: table.name,
tableId: table._id,
type: "table",
datasource: datasources.find(
datasource => datasource._id === table.sourceId || table.datasourceId
),
}),
table: (table, datasources) => {
const sourceId = table.sourceId || table.datasourceId
const datasource = datasources.find(ds => ds._id === sourceId)
return {
label: table.name,
tableId: table._id,
type: "table",
datasourceName: datasource?.name,
}
},
viewV2: view => ({
...view,
label: view.name,