SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
feat: added the share link for view widget mode (#4052)
Palash Gupta780a86394381
diff --git a/frontend/src/constants/query.ts b/frontend/src/constants/query.tsindex a35f0223a7..af7b76b2c4 100644--- a/frontend/src/constants/query.ts+++ b/frontend/src/constants/query.ts@@ -26,4 +26,5 @@ export enum QueryParams {linesPerRow = 'linesPerRow',viewName = 'viewName',viewKey = 'viewKey',+ expandedWidgetId = 'expandedWidgetId',}diff --git a/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx b/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsxindex b10b49d8cf..ee216280e2 100644--- a/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx+++ b/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx@@ -1,9 +1,11 @@import { Skeleton, Typography } from 'antd';import { ToggleGraphProps } from 'components/Graph/types';import { SOMETHING_WENT_WRONG } from 'constants/api';+import { QueryParams } from 'constants/query';import GridPanelSwitch from 'container/GridPanelSwitch';import { useUpdateDashboard } from 'hooks/dashboard/useUpdateDashboard';import { useNotifications } from 'hooks/useNotifications';+import useUrlQuery from 'hooks/useUrlQuery';import createQueryParams from 'lib/createQueryParams';import history from 'lib/history';import { useDashboard } from 'providers/Dashboard/Dashboard';@@ -43,11 +45,14 @@ function WidgetGraphComponent({onDragSelect,}: WidgetGraphComponentProps): JSX.Element {const [deleteModal, setDeleteModal] = useState(false);- const [modal, setModal] = useState<boolean>(false);const [hovered, setHovered] = useState(false);const { notifications } = useNotifications();const { pathname } = useLocation();+ const params = useUrlQuery();++ const isFullViewOpen = params.get(QueryParams.expandedWidgetId) === widget.id;+const lineChartRef = useRef<ToggleGraphProps>();const graphRef = useRef<HTMLDivElement>(null);@@ -175,7 +180,14 @@ function WidgetGraphComponent({};const handleOnView = (): void => {- onToggleModal(setModal);+ const queryParams = {+ [QueryParams.expandedWidgetId]: widget.id,+ };++ history.push({+ pathname,+ search: createQueryParams(queryParams),+ });};const handleOnDelete = (): void => {@@ -187,7 +199,10 @@ function WidgetGraphComponent({};const onToggleModelHandler = (): void => {- onToggleModal(setModal);+ history.push({+ pathname,+ search: createQueryParams({}),+ });};if (queryResponse.isLoading || queryResponse.status === 'idle') {@@ -236,7 +251,7 @@ function WidgetGraphComponent({title={widget?.title || 'View'}footer={[]}centered- open={modal}+ open={isFullViewOpen}onCancel={onToggleModelHandler}width="85%"destroyOnClosediff --git a/frontend/src/container/ListOfDashboard/index.tsx b/frontend/src/container/ListOfDashboard/index.tsxindex 9ab2ff94ee..b9d48aef3c 100644--- a/frontend/src/container/ListOfDashboard/index.tsx+++ b/frontend/src/container/ListOfDashboard/index.tsx@@ -29,9 +29,9 @@ import { ButtonContainer, NewDashboardButton, TableContainer } from './styles';import DeleteButton from './TableComponents/DeleteButton';import Name from './TableComponents/Name';-function ListOfAllDashboard(): JSX.Element {- const { Search } = Input;+const { Search } = Input;+function ListOfAllDashboard(): JSX.Element {const {data: dashboardListResponse = [],isLoading: isDashboardListLoading,@@ -321,7 +321,6 @@ function ListOfAllDashboard(): JSX.Element {</Row>),[- Search,isDashboardListLoading,handleSearch,isFilteringDashboards,diff --git a/frontend/src/lib/createQueryParams.ts b/frontend/src/lib/createQueryParams.tsindex 7ab387934d..0ef053e75e 100644--- a/frontend/src/lib/createQueryParams.ts+++ b/frontend/src/lib/createQueryParams.ts@@ -1,4 +1,6 @@-const createQueryParams = (params: { [x: string]: string | number }): string =>+const createQueryParams = (params: {+ [x: string]: string | number | undefined;+}): string =>Object.keys(params).map((k) => `${encodeURIComponent(k)}=${encodeURIComponent(String(params[k]))}`,