Commit a928530c authored by Vladimir Erokhov's avatar Vladimir Erokhov

bugfix(view-duplication): Removed unused file

parent dadc8d9a
Pipeline #4485 passed with stage
in 2 minutes and 13 seconds
import { omit } from 'lodash';
import {
generateViewTab,
generateViewRow,
generateWidgetByType,
} from '@/helpers/entities';
export default function copyViewTabs(tabs) {
const widgetsIdsMap = {};
const newTabs = tabs.map(tab => ({
...generateViewTab(),
title: tab.title,
rows: tab.rows.map(row => ({
...generateViewRow(),
title: row.title,
widgets: row.widgets.map((widget) => {
const newWidget = generateWidgetByType(widget.type);
widgetsIdsMap[widget._id] = newWidget._id; // Needed for userPreferences copy.
return {
...newWidget,
...omit(widget, ['_id']),
};
}),
})),
}));
return { tabs: newTabs, widgetsIdsMap };
}
export function copyTab(tab, title) {
const widgetsIdsMap = {};
const newTab = {
...generateViewTab(),
title,
rows: tab.rows.map(row => ({
...generateViewRow(),
title: row.title,
widgets: row.widgets.map((widget) => {
const newWidget = generateWidgetByType(widget.type);
widgetsIdsMap[widget._id] = newWidget._id; // Needed for userPreferences copy.
return {
...newWidget,
...omit(widget, ['_id']),
};
}),
})),
};
return { tab: newTab, widgetsIdsMap };
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment