Ensure that columns should be merged if the newly added column is present in the parent table. Fixes #6780

This commit is contained in:
Pradip Parkale
2021-10-21 10:59:52 +05:30
committed by Akshay Joshi
parent d2a7f7fffe
commit c7cd57db91
4 changed files with 42 additions and 3 deletions

View File

@@ -537,7 +537,24 @@ export default class TableSchema extends BaseUISchema {
tabColsResponse.then((res)=>{
resolve((state)=>{
let finalCols = res.map((col)=>obj.columnsSchema.getNewData(col));
finalCols = [...state.columns, ...finalCols];
let currentSelectedCols = [];
if (!_.isEmpty(state.columns)){
currentSelectedCols = state.columns;
}
let colNameList = [];
state.columns.forEach((col=>{
colNameList.push(col.name);
}));
for (let col of Object.values(finalCols)) {
if(!colNameList.includes(col.name)){
currentSelectedCols.push(col);
}
}
if (!_.isEmpty(currentSelectedCols)){
finalCols = currentSelectedCols;
}
obj.changeColumnOptions(finalCols);
return {
adding_inherit_cols: false,