mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-02 04:10:37 +08:00

* 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>
38 lines
737 B
TypeScript
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,
|
|
},
|
|
],
|
|
},
|
|
});
|