dnazarenkoo 1eabacbaf4
feat: add the export panel to the traces explorer (#2983)
* feat: add the export panel to the traces explorer

* feat: onExport dashboard widget is updated

* chore: made common hook useDashboard

---------

Co-authored-by: Palash Gupta <palashgdev@gmail.com>
2023-06-28 18:25:20 +05:30

38 lines
737 B
TypeScript

import { PANEL_TYPES } from 'constants/queryBuilder';
import { Dashboard } from 'types/api/dashboard/getAll';
import { Query } from 'types/api/queryBuilder/queryBuilderData';
export const addEmptyWidgetInDashboardJSONWithQuery = (
dashboard: Dashboard,
query: Query,
): Dashboard => ({
...dashboard,
data: {
...dashboard.data,
layout: [
{
i: 'empty',
w: 6,
x: 0,
h: 2,
y: 0,
},
...(dashboard?.data?.layout || []),
],
widgets: [
...(dashboard?.data?.widgets || []),
{
id: 'empty',
query,
description: '',
isStacked: false,
nullZeroValues: '',
opacity: '',
title: '',
timePreferance: 'GLOBAL_TIME',
panelTypes: PANEL_TYPES.TIME_SERIES,
},
],
},
});