Skip to content

Commit

Permalink
fix: fix widget clone (#5426)
Browse files Browse the repository at this point in the history
* fix: fix widget clone

Signed-off-by: yuda <[email protected]>

* chore: fix type error

Signed-off-by: yuda <[email protected]>

---------

Signed-off-by: yuda <[email protected]>
  • Loading branch information
yuda110 authored Jan 3, 2025
1 parent 70550cb commit 54b903e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,6 @@ const getRefinedDataTables = (dataTableList: DataTableModel[]) => {
data_type: dt.data_type,
source_type: dt.source_type,
operator: dt.operator,
labels_info: dt.labels_info,
data_info: dt.data_info,
options: dt.options,
};
if (dt.data_type === DATA_TABLE_TYPE.TRANSFORMED) {
Expand All @@ -237,7 +235,7 @@ const getRefinedDataTables = (dataTableList: DataTableModel[]) => {
data_tables: _dataTableIndices,
},
};
} else if (dt.operator === 'EVAL' || dt.operator === 'QUERY') {
} else if (dt.operator === 'EVAL' || dt.operator === 'QUERY' || dt.operator === 'PIVOT' || dt.operator === 'VALUE_MAPPING' || dt.operator === 'ADD_LABELS') {
const _dataTableId = dt.options[dt.operator]?.data_table_id;
const _dataTableIdx = dataTableList.findIndex((d) => d.data_table_id === _dataTableId);
_sharedDataTable.options = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,20 @@ const _getSharedDataTableInfoList = (widgetDataTablesMap: Record<string, DataTab
data_type: dt.data_type,
source_type: dt.source_type,
operator: dt.operator,
labels_info: dt.labels_info,
data_info: dt.data_info,
options: dt.options,
};
if (dt.data_type === DATA_TABLE_TYPE.TRANSFORMED) {
if (dt.operator === 'JOIN' || dt.operator === 'CONCAT') {
const _dataTableIds = dt.options[dt.operator].data_tables;
const _dataTableIndices = _dataTableIds.map((dtId) => _dataTables.findIndex((d) => d.data_table_id === dtId));
const _dataTableIds = dt.options[dt.operator]?.data_tables;
const _dataTableIndices = _dataTableIds?.map((dtId) => _dataTables.findIndex((d) => d.data_table_id === dtId));
_sharedDataTable.options = {
[dt.operator]: {
...dt.options[dt.operator],
data_tables: _dataTableIndices,
},
};
} else if (dt.operator === 'EVAL' || dt.operator === 'QUERY' || dt.operator === 'PIVOT' || dt.operator === 'VALUE_MAPPING' || dt.operator === 'ADD_LABELS') {
const _dataTableId = dt.options[dt.operator].data_table_id;
const _dataTableId = dt.options[dt.operator]?.data_table_id;
const _dataTableIdx = _dataTables.findIndex((d) => d.data_table_id === _dataTableId);
_sharedDataTable.options = {
[dt.operator]: {
Expand Down

0 comments on commit 54b903e

Please sign in to comment.