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
chore(storybook): add new-panel picker and config pane stories (#13058)
Abhi kumarea127308b6b4
diff --git a/frontend/scripts/story-shots.mjs b/frontend/scripts/story-shots.mjsindex 040e5f78cf..6504cfede2 100755--- a/frontend/scripts/story-shots.mjs+++ b/frontend/scripts/story-shots.mjs@@ -417,7 +417,7 @@ for (const theme of themes.length ? themes : [null]) {break;}- height = needed;+ height = Math.ceil(needed);await page.setViewportSize({ width: Number(opts.width), height });await page.waitForTimeout(Number(opts.settle));}diff --git a/frontend/src/pages/DashboardPage/PanelEditorPage/stories/PanelEditorPage.stories.tsx b/frontend/src/pages/DashboardPage/PanelEditorPage/stories/PanelEditorPage.stories.tsxindex d3ad6ed511..598409e77f 100644--- a/frontend/src/pages/DashboardPage/PanelEditorPage/stories/PanelEditorPage.stories.tsx+++ b/frontend/src/pages/DashboardPage/PanelEditorPage/stories/PanelEditorPage.stories.tsx@@ -2,6 +2,7 @@ import type { ComponentType } from 'react';import type { Meta, StoryObj } from '@storybook/react-vite';import { Route } from 'react-router-dom';import ROUTES from 'constants/routes';+import { userEvent, within } from 'storybook/test';import { storyMocks } from '@/storybook/controls/defineStoryMocks';import type { PageStoryArgs } from '@/storybook/runtime/resolveStory';@@ -22,6 +23,7 @@ const pageStory = storyMocks(panelEditorMocks, { layout: 'app' });*/const meta = {title: 'Pages/Dashboards/Panel Editor',+ tags: ['play'],// The page is wrapped in `withAuthZPage`, which types its props as an index// signature; the story's args are what the controls resolve to.component: PanelEditorPage as ComponentType<PanelEditorArgs>,@@ -38,6 +40,25 @@ export default meta;type Story = StoryObj<PanelEditorArgs>;+const expandConfigSections: Story['play'] = async ({ canvasElement }) => {+ const canvas = within(canvasElement);++ const headers = await canvas.findAllByTestId(+ /^config-section-/,+ {},+ { timeout: 10000 },+ );+ for (const header of headers) {+ if (header.getAttribute('aria-expanded') === 'false') {+ await userEvent.click(header);+ }+ }+ (document.activeElement as HTMLElement | null)?.blur();+ for (let el = headers[0].parentElement; el; el = el.parentElement) {+ el.scrollTop = 0;+ }+};+/*** Editing a saved time series panel: the live preview over the query builder on* the left, the panel's formatting, legend, axes and thresholds on the right.@@ -86,3 +107,57 @@ export const ReadOnly: Story = {export const Tooltips: Story = {args: { tooltipsOpen: true },};++/** A new time series panel's config pane, every section expanded. */+export const ConfigTimeSeries: Story = {+ args: { panel: 'new', newPanelKind: 'time-series' },+ play: expandConfigSections,+};++/** A new number panel's config pane, every section expanded. */+export const ConfigNumber: Story = {+ args: { panel: 'new', newPanelKind: 'number' },+ play: expandConfigSections,+};++/** A new table panel's config pane, every section expanded. */+export const ConfigTable: Story = {+ args: { panel: 'new', newPanelKind: 'table' },+ play: expandConfigSections,+};++/** A new bar chart panel's config pane, every section expanded. */+export const ConfigBarChart: Story = {+ args: { panel: 'new', newPanelKind: 'bar-chart' },+ play: expandConfigSections,+};++/** A new area chart panel's config pane, every section expanded. */+export const ConfigAreaChart: Story = {+ args: { panel: 'new', newPanelKind: 'area-chart' },+ play: expandConfigSections,+};++/** A new pie chart panel's config pane, every section expanded. */+export const ConfigPieChart: Story = {+ args: { panel: 'new', newPanelKind: 'pie-chart' },+ play: expandConfigSections,+};++/** A new histogram panel's config pane, every section expanded. */+export const ConfigHistogram: Story = {+ args: { panel: 'new', newPanelKind: 'histogram' },+ play: expandConfigSections,+};++/** A new list panel's config pane, every section expanded. */+export const ConfigList: Story = {+ args: { panel: 'new', newPanelKind: 'list' },+ play: expandConfigSections,+};++/** A new text panel's config pane, every section expanded. */+export const ConfigText: Story = {+ args: { panel: 'new', newPanelKind: 'text' },+ play: expandConfigSections,+};diff --git a/frontend/src/pages/DashboardPage/PanelEditorPage/stories/__story_mockdata__/panelEditor.ts b/frontend/src/pages/DashboardPage/PanelEditorPage/stories/__story_mockdata__/panelEditor.tsindex 8f6d7e79a3..f5d9af35bf 100644--- a/frontend/src/pages/DashboardPage/PanelEditorPage/stories/__story_mockdata__/panelEditor.ts+++ b/frontend/src/pages/DashboardPage/PanelEditorPage/stories/__story_mockdata__/panelEditor.ts@@ -21,12 +21,14 @@ import type { PanelKind } from '../../../DashboardContainer/Panels/types/panelKi*/export const NEW_PANEL_KINDS = ['time-series',- 'bar-chart','number',- 'pie-chart','table',+ 'bar-chart',+ 'area-chart',+ 'pie-chart','histogram','list',+ 'text',] as const;export type NewPanelKind = (typeof NEW_PANEL_KINDS)[number];@@ -34,11 +36,13 @@ export type NewPanelKind = (typeof NEW_PANEL_KINDS)[number];const KIND_BY_OPTION: Record<NewPanelKind, PanelKind> = {'time-series': 'signoz/TimeSeriesPanel','bar-chart': 'signoz/BarChartPanel',+ 'area-chart': 'signoz/AreaChartPanel',number: 'signoz/NumberPanel','pie-chart': 'signoz/PieChartPanel',table: 'signoz/TablePanel',histogram: 'signoz/HistogramPanel',list: 'signoz/ListPanel',+ text: 'signoz/TextPanel',};export const newPanelKindOf = (option: NewPanelKind): PanelKind =>diff --git a/frontend/src/pages/DashboardPage/stories/DashboardPage.stories.tsx b/frontend/src/pages/DashboardPage/stories/DashboardPage.stories.tsxindex aef57cf7c8..90056cd517 100644--- a/frontend/src/pages/DashboardPage/stories/DashboardPage.stories.tsx+++ b/frontend/src/pages/DashboardPage/stories/DashboardPage.stories.tsx@@ -285,6 +285,70 @@ export const SectionActionsMenu: Story = {},};+/**+ * The new-panel picker opened from the toolbar: the panel kinds as tiles, with+ * the target section to place the panel in.+ */+export const NewPanelPicker: Story = {+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);++ await userEvent.click(+ await canvas.findByTestId('add-panel-header', {}, { timeout: 10000 }),+ );+ await screen.findByTestId('panel-type-signoz/TimeSeriesPanel');+ },+};++/** The new-panel picker with a kind picked, waiting on the section to confirm. */+export const NewPanelPickerTypeSelected: Story = {+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);++ await userEvent.click(+ await canvas.findByTestId('add-panel-header', {}, { timeout: 10000 }),+ );+ await userEvent.click(+ await screen.findByTestId('panel-type-signoz/TimeSeriesPanel'),+ );+ },+};++/**+ * The new-panel picker on a dashboard without sections, where there is no+ * section to choose.+ */+export const NewPanelPickerNoSections: Story = {+ args: { sectioned: false },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);++ await userEvent.click(+ await canvas.findByTestId('add-panel-header', {}, { timeout: 10000 }),+ );+ await screen.findByTestId('panel-type-signoz/TimeSeriesPanel');+ },+};++/**+ * The new-panel picker opened from the second section's menu, targeting that+ * section.+ */+export const NewPanelPickerFromSection: Story = {+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);++ const [, secondSection] = await canvas.findAllByRole(+ 'button',+ { name: 'Section actions' },+ { timeout: 10000 },+ );+ await userEvent.click(secondSection);+ await userEvent.click(await screen.findByText('Add panel'));+ await screen.findByTestId('panel-type-signoz/TimeSeriesPanel');+ },+};+/*** A dashboard id nobody has, which is what a deleted or mistyped link opens on.*