mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-03 20:50:43 +08:00
27 lines
752 B
TypeScript
27 lines
752 B
TypeScript
import { QueryParams } from 'constants/query';
|
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
|
import ROUTES from 'constants/routes';
|
|
import { generatePath } from 'react-router-dom';
|
|
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
|
|
|
type GenerateExportToDashboardLinkParams = {
|
|
dashboardId: string;
|
|
panelType: PANEL_TYPES;
|
|
query: Query;
|
|
widgetId: string;
|
|
};
|
|
|
|
export const generateExportToDashboardLink = ({
|
|
query,
|
|
dashboardId,
|
|
panelType,
|
|
widgetId,
|
|
}: GenerateExportToDashboardLinkParams): string =>
|
|
`${generatePath(ROUTES.DASHBOARD, {
|
|
dashboardId,
|
|
})}/new?${QueryParams.graphType}=${panelType}&${
|
|
QueryParams.widgetId
|
|
}=${widgetId}&${QueryParams.compositeQuery}=${encodeURIComponent(
|
|
JSON.stringify(query),
|
|
)}`;
|