Skip to content

Commit

Permalink
feat: keep column names if rebuilding started with type change
Browse files Browse the repository at this point in the history
  • Loading branch information
SmiteDeluxe committed May 9, 2024
1 parent efed9eb commit 7364077
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion packages/safe-ds-eda/src/components/tabs/TabContent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@
};
const newTypeSelected = function (selected: string) {
if (!$isInBuildingState && tab.type !== 'empty') setTabAsGenerating(tab);
let copyOverColumns = false;
if (!$isInBuildingState && tab.type !== 'empty') {
setTabAsGenerating(tab);
copyOverColumns = true;
}
if (selected === 'Histogram') {
buildATab.update((buildingTab) => {
buildingTab.type = 'histogram';
Expand Down Expand Up @@ -110,6 +115,21 @@
} else {
throw new Error('Invalid tab type');
}
if (copyOverColumns && tab.type !== 'empty') {
if (tab.columnNumber === 'one') {
buildATab.update((buildingTab) => {
buildingTab.xAxisColumnName = tab.content.columnName;
return buildingTab;
});
} else if (tab.columnNumber === 'two') {
buildATab.update((buildingTab) => {
buildingTab.xAxisColumnName = tab.content.xAxisColumnName;
buildingTab.yAxisColumnName = tab.content.yAxisColumnName;
return buildingTab;
});
}
}
};
const newXAxisSelected = function (selected: string) {
Expand Down

0 comments on commit 7364077

Please sign in to comment.