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
fix: added fix for panel setting scrollbar issue (#10587)
Abhi kumarc5ef455283b3
diff --git a/frontend/src/container/NewWidget/RightContainer/RightContainer.styles.scss b/frontend/src/container/NewWidget/RightContainer/RightContainer.styles.scssindex 996b9c8f3a..796fc27273 100644--- a/frontend/src/container/NewWidget/RightContainer/RightContainer.styles.scss+++ b/frontend/src/container/NewWidget/RightContainer/RightContainer.styles.scss@@ -1,6 +1,7 @@.right-container {display: flex;flex-direction: column;+ padding-bottom: 48px;.header {display: flex;diff --git a/frontend/src/container/NewWidget/index.tsx b/frontend/src/container/NewWidget/index.tsxindex ea77d7b08c..c9c0623665 100644--- a/frontend/src/container/NewWidget/index.tsx+++ b/frontend/src/container/NewWidget/index.tsx@@ -835,56 +835,54 @@ function NewWidget({</LeftContainerWrapper><RightContainerWrapper>- <OverlayScrollbar>- <RightContainer- setGraphHandler={setGraphHandler}- title={title}- setTitle={setTitle}- description={description}- setDescription={setDescription}- stackedBarChart={stackedBarChart}- setStackedBarChart={setStackedBarChart}- opacity={opacity}- yAxisUnit={yAxisUnit}- columnUnits={columnUnits}- setColumnUnits={setColumnUnits}- bucketCount={bucketCount}- bucketWidth={bucketWidth}- combineHistogram={combineHistogram}- setCombineHistogram={setCombineHistogram}- setBucketWidth={setBucketWidth}- setBucketCount={setBucketCount}- setOpacity={setOpacity}- selectedNullZeroValue={selectedNullZeroValue}- setSelectedNullZeroValue={setSelectedNullZeroValue}- selectedGraph={graphType}- setSelectedTime={setSelectedTime}- selectedTime={selectedTime}- setYAxisUnit={setYAxisUnit}- decimalPrecision={decimalPrecision}- setDecimalPrecision={setDecimalPrecision}- thresholds={thresholds}- setThresholds={setThresholds}- selectedWidget={selectedWidget}- isFillSpans={isFillSpans}- setIsFillSpans={setIsFillSpans}- isLogScale={isLogScale}- setIsLogScale={setIsLogScale}- legendPosition={legendPosition}- setLegendPosition={setLegendPosition}- customLegendColors={customLegendColors}- setCustomLegendColors={setCustomLegendColors}- queryResponse={queryResponse}- softMin={softMin}- setSoftMin={setSoftMin}- softMax={softMax}- setSoftMax={setSoftMax}- contextLinks={contextLinks}- setContextLinks={setContextLinks}- enableDrillDown={enableDrillDown}- isNewDashboard={isNewDashboard}- />- </OverlayScrollbar>+ <RightContainer+ setGraphHandler={setGraphHandler}+ title={title}+ setTitle={setTitle}+ description={description}+ setDescription={setDescription}+ stackedBarChart={stackedBarChart}+ setStackedBarChart={setStackedBarChart}+ opacity={opacity}+ yAxisUnit={yAxisUnit}+ columnUnits={columnUnits}+ setColumnUnits={setColumnUnits}+ bucketCount={bucketCount}+ bucketWidth={bucketWidth}+ combineHistogram={combineHistogram}+ setCombineHistogram={setCombineHistogram}+ setBucketWidth={setBucketWidth}+ setBucketCount={setBucketCount}+ setOpacity={setOpacity}+ selectedNullZeroValue={selectedNullZeroValue}+ setSelectedNullZeroValue={setSelectedNullZeroValue}+ selectedGraph={graphType}+ setSelectedTime={setSelectedTime}+ selectedTime={selectedTime}+ setYAxisUnit={setYAxisUnit}+ decimalPrecision={decimalPrecision}+ setDecimalPrecision={setDecimalPrecision}+ thresholds={thresholds}+ setThresholds={setThresholds}+ selectedWidget={selectedWidget}+ isFillSpans={isFillSpans}+ setIsFillSpans={setIsFillSpans}+ isLogScale={isLogScale}+ setIsLogScale={setIsLogScale}+ legendPosition={legendPosition}+ setLegendPosition={setLegendPosition}+ customLegendColors={customLegendColors}+ setCustomLegendColors={setCustomLegendColors}+ queryResponse={queryResponse}+ softMin={softMin}+ setSoftMin={setSoftMin}+ softMax={softMax}+ setSoftMax={setSoftMax}+ contextLinks={contextLinks}+ setContextLinks={setContextLinks}+ enableDrillDown={enableDrillDown}+ isNewDashboard={isNewDashboard}+ /></RightContainerWrapper></PanelContainer><Modaldiff --git a/frontend/src/container/NewWidget/styles.ts b/frontend/src/container/NewWidget/styles.tsindex 6b52d1fee1..d302846c85 100644--- a/frontend/src/container/NewWidget/styles.ts+++ b/frontend/src/container/NewWidget/styles.ts@@ -15,7 +15,14 @@ export const RightContainerWrapper = styled(Col)`overflow-y: auto;}&::-webkit-scrollbar {- width: 0rem;+ width: 0.3rem;+ }+ &::-webkit-scrollbar-thumb {+ background: rgb(136, 136, 136);+ border-radius: 0.625rem;+ }+ &::-webkit-scrollbar-track {+ background: transparent;}`;diff --git a/frontend/src/pages/DashboardWidget/__tests__/DashboardWidget.test.tsx b/frontend/src/pages/DashboardWidget/__tests__/DashboardWidget.test.tsxindex b0b46147cc..4cc8e9fbb1 100644--- a/frontend/src/pages/DashboardWidget/__tests__/DashboardWidget.test.tsx+++ b/frontend/src/pages/DashboardWidget/__tests__/DashboardWidget.test.tsx@@ -1,4 +1,5 @@import { Route } from 'react-router-dom';+import * as getDashboardModule from 'api/v1/dashboards/id/get';import { PANEL_TYPES } from 'constants/queryBuilder';import { rest, server } from 'mocks-server/server';import { render, screen, waitFor } from 'tests/test-utils';@@ -47,35 +48,33 @@ jest.mock('container/NewWidget', () => ({default: (): JSX.Element => <div data-testid="new-widget">NewWidget</div>,}));-// nuqs's useQueryState doesn't read from MemoryRouter, so we mock it to return-// controlled values via the `mockQueryState` map below.-const mockQueryState: Record<string, string | null> = {};--jest.mock('nuqs', () => ({- ...jest.requireActual('nuqs'),- useQueryState: (key: string): [string | null, jest.Mock] => [- mockQueryState[key] ?? null,- jest.fn(),- ],-}));--// Wrap component in a Route so useParams can resolve dashboardId+// Wrap component in a Route so useParams can resolve dashboardId.+// Query params are passed via the URL so useUrlQuery (react-router) can read them.function renderAtRoute(queryState: Record<string, string | null> = {},): ReturnType<typeof render> {- Object.assign(mockQueryState, queryState);+ const params = new URLSearchParams();+ Object.entries(queryState).forEach(([k, v]) => {+ if (v !== null) {+ params.set(k, v);+ }+ });+ const search = params.toString() ? `?${params.toString()}` : '';return render(<Route path="/dashboard/:dashboardId/new"><DashboardWidget /></Route>,undefined,- { initialRoute: `/dashboard/${DASHBOARD_ID}/new` },+ { initialRoute: `/dashboard/${DASHBOARD_ID}/new${search}` },);}beforeEach(() => {mockSafeNavigate.mockClear();- Object.keys(mockQueryState).forEach((k) => delete mockQueryState[k]);+});++afterEach(() => {+ jest.restoreAllMocks();});describe('DashboardWidget', () => {@@ -102,12 +101,10 @@ describe('DashboardWidget', () => {});it('shows spinner while dashboard is loading', () => {- server.use(- rest.get(- `http://localhost/api/v1/dashboards/${DASHBOARD_ID}`,- (_req, res, ctx) => res(ctx.delay('infinite')),- ),- );+ // Spy instead of MSW delay('infinite') to avoid leaving an open network handle.+ jest+ .spyOn(getDashboardModule, 'default')+ .mockReturnValue(new Promise(() => {}));renderAtRoute({ widgetId: WIDGET_ID, graphType: PANEL_TYPES.TIME_SERIES });diff --git a/frontend/src/pages/DashboardWidget/index.tsx b/frontend/src/pages/DashboardWidget/index.tsxindex 41da4a64cb..e1885caf0b 100644--- a/frontend/src/pages/DashboardWidget/index.tsx+++ b/frontend/src/pages/DashboardWidget/index.tsx@@ -1,10 +1,11 @@-import { useEffect, useState } from 'react';+import { useEffect, useMemo, useState } from 'react';import { useQuery } from 'react-query';import { generatePath, useParams } from 'react-router-dom';import { Card, Typography } from 'antd';import getDashboard from 'api/v1/dashboards/id/get';import Spinner from 'components/Spinner';import { SOMETHING_WENT_WRONG } from 'constants/api';+import { QueryParams } from 'constants/query';import { PANEL_TYPES } from 'constants/queryBuilder';import { DASHBOARD_CACHE_TIME } from 'constants/queryCacheTime';import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';@@ -13,7 +14,7 @@ import NewWidget from 'container/NewWidget';import { isDrilldownEnabled } from 'container/QueryTable/Drilldown/drilldownUtils';import { useTransformDashboardVariables } from 'hooks/dashboard/useTransformDashboardVariables';import { useSafeNavigate } from 'hooks/useSafeNavigate';-import { parseAsStringEnum, useQueryState } from 'nuqs';+import useUrlQuery from 'hooks/useUrlQuery';import { setDashboardVariablesStore } from 'providers/Dashboard/store/dashboardVariables/dashboardVariablesStore';import { Dashboard } from 'types/api/dashboard/getAll';@@ -21,11 +22,13 @@ function DashboardWidget(): JSX.Element | null {const { dashboardId } = useParams<{dashboardId: string;}>();- const [widgetId] = useQueryState('widgetId');- const [graphType] = useQueryState(- 'graphType',- parseAsStringEnum<PANEL_TYPES>(Object.values(PANEL_TYPES)),- );+ const query = useUrlQuery();+ const { graphType, widgetId } = useMemo(() => {+ return {+ graphType: query.get(QueryParams.graphType) as PANEL_TYPES,+ widgetId: query.get(QueryParams.widgetId),+ };+ }, [query]);const { safeNavigate } = useSafeNavigate();