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(dashboards): views-first V2 dashboards list with filters, saved views, and tabbed new-dashboard modal (#11682)
Ashwin Bhatkal4dda1e0ab50a
diff --git a/frontend/src/constants/localStorage.ts b/frontend/src/constants/localStorage.tsindex bc7cd7502c..32a7fd60c7 100644--- a/frontend/src/constants/localStorage.ts+++ b/frontend/src/constants/localStorage.ts@@ -43,4 +43,5 @@ export enum LOCALSTORAGE {DASHBOARD_PREFERENCES = 'DASHBOARD_PREFERENCES',ACTIVE_SIGNOZ_INSTANCE_URL = 'ACTIVE_SIGNOZ_INSTANCE_URL',DASHBOARDS_LIST_VISIBLE_COLUMNS = 'DASHBOARDS_LIST_VISIBLE_COLUMNS',+ DASHBOARDS_LIST_VIEWS = 'DASHBOARDS_LIST_VIEWS',}diff --git a/frontend/src/pages/DashboardsListPageV2/DashboardsListPageV2.module.scss b/frontend/src/pages/DashboardsListPageV2/DashboardsListPageV2.module.scssindex 8857586d18..8dfe4bc63e 100644--- a/frontend/src/pages/DashboardsListPageV2/DashboardsListPageV2.module.scss+++ b/frontend/src/pages/DashboardsListPageV2/DashboardsListPageV2.module.scss@@ -1,17 +1,20 @@.page {display: flex;flex-direction: column;- gap: 16px;width: 100%;+ flex: 1;+ min-height: 0;}.header {display: flex;align-items: center;justify-content: space-between;- padding: 0 8px;+ padding: 0 16px;gap: 8px;height: 48px;+ flex: none;+ border-bottom: 1px solid var(--l2-border);}.headerLeft {diff --git a/frontend/src/pages/DashboardsListPageV2/DashboardsListPageV2.tsx b/frontend/src/pages/DashboardsListPageV2/DashboardsListPageV2.tsxindex 9e2ff3c9d6..bc64e62eb4 100644--- a/frontend/src/pages/DashboardsListPageV2/DashboardsListPageV2.tsx+++ b/frontend/src/pages/DashboardsListPageV2/DashboardsListPageV2.tsx@@ -1,12 +1,12 @@import { useState } from 'react';import { AnnouncementBanner } from '@signozhq/ui/announcement-banner';-import { Typography } from '@signozhq/ui/typography';import { LayoutGrid } from '@signozhq/icons';import HeaderRightSection from 'components/HeaderRightSection/HeaderRightSection';-import DashboardsList from './components/DashboardsList';+import DashboardsList from './components/DashboardsList/DashboardsList';import styles from './DashboardsListPageV2.module.scss';+import { BreadcrumbLink } from '@signozhq/ui/breadcrumb';function DashboardsListPageV2(): JSX.Element {const [showBanner, setShowBanner] = useState(true);@@ -24,8 +24,7 @@ function DashboardsListPageV2(): JSX.Element {)}<div className={styles.header}><div className={styles.headerLeft}>- <LayoutGrid size={14} className={styles.icon} />- <Typography.Text className={styles.text}>Dashboards</Typography.Text>+ <BreadcrumbLink icon={<LayoutGrid size={14} />}>Dashboard</BreadcrumbLink></div><HeaderRightSectionenableAnnouncements={false}diff --git a/frontend/src/pages/DashboardsListPageV2/components/ActionsPopover/ActionsPopover.tsx b/frontend/src/pages/DashboardsListPageV2/components/ActionsPopover/ActionsPopover.tsxindex c8bc3b2f15..31763abdb1 100644--- a/frontend/src/pages/DashboardsListPageV2/components/ActionsPopover/ActionsPopover.tsx+++ b/frontend/src/pages/DashboardsListPageV2/components/ActionsPopover/ActionsPopover.tsx@@ -1,12 +1,21 @@+import { useMutation } from 'react-query';+import { generatePath } from 'react-router-dom';import { Popover } from 'antd';import { Button } from '@signozhq/ui/button';+import { toast } from '@signozhq/ui/sonner';import {+ Copy,Expand,EllipsisVertical,Link2,SquareArrowOutUpRight,} from '@signozhq/icons';import { useCopyToClipboard } from 'react-use';+import { cloneDashboardV2 } from 'api/generated/services/dashboard';+import ROUTES from 'constants/routes';+import { useSafeNavigate } from 'hooks/useSafeNavigate';+import { useErrorModal } from 'providers/ErrorModalProvider';+import APIError from 'types/api/error';import { getAbsoluteUrl } from 'utils/basePath';import { openInNewTab } from 'utils/navigation';@@ -31,6 +40,23 @@ function ActionsPopover({onView,}: Props): JSX.Element {const [, setCopy] = useCopyToClipboard();+ const { safeNavigate } = useSafeNavigate();+ const { showErrorModal } = useErrorModal();++ // Clone keeps the source's name/panels/tags as a new unlocked dashboard owned+ // by the caller; open the copy so it can be tweaked right away.+ const { mutate: runClone, isLoading: isCloning } = useMutation({+ mutationFn: () => cloneDashboardV2({ id: dashboardId }),+ onSuccess: (response) => {+ toast.success(`Duplicated "${dashboardName}"`);+ safeNavigate(+ generatePath(ROUTES.DASHBOARD, { dashboardId: response.data.id }),+ );+ },+ onError: (error: APIError) => {+ showErrorModal(error);+ },+ });return (<Popover@@ -71,6 +97,20 @@ function ActionsPopover({>Copy Link</Button>+ <Button+ color="secondary"+ className={styles.menuItem}+ prefix={<Copy size={14} />}+ loading={isCloning}+ onClick={(e): void => {+ e.stopPropagation();+ e.preventDefault();+ runClone();+ }}+ testId="dashboard-action-duplicate"+ >+ Duplicate+ </Button><DeleteActionItemdashboardId={dashboardId}dashboardName={dashboardName}diff --git a/frontend/src/pages/DashboardsListPageV2/components/ConfigureMetadataModal/ConfigureMetadataModal.module.scss b/frontend/src/pages/DashboardsListPageV2/components/ConfigureMetadataModal/ConfigureMetadataModal.module.scssdeleted file mode 100644index 4678ac0ca9..0000000000--- a/frontend/src/pages/DashboardsListPageV2/components/ConfigureMetadataModal/ConfigureMetadataModal.module.scss+++ /dev/null@@ -1,164 +0,0 @@-.content {- display: flex;- flex-direction: column;- gap: 14px;-}--.preview {- display: flex;- padding: 12px 14.634px;- flex-direction: column;- align-items: flex-start;- gap: 7.317px;- border-radius: 4px;- border: 0.915px solid var(--l1-border);- background: var(--l2-background);-}--.previewHeader {- display: flex;- gap: 10px;- align-items: center;-}--.previewIcon {- height: 14px;- width: 14px;-}--.previewTitle {- color: var(--l1-foreground);- font-family: Inter;- font-size: 12.805px;- font-style: normal;- font-weight: var(--font-weight-medium);- line-height: 18.293px;- letter-spacing: -0.064px;-}--.previewDetails {- display: flex;- flex-direction: column;- gap: 8px;- width: 100%;-}--.previewRow {- display: flex;- justify-content: space-between;- align-items: center;-}--.formattedTime {- display: inline-flex;- gap: 8px;- align-items: center;- color: var(--l2-foreground);-}--.formattedTimeText {- font-family: Inter;- font-size: 12.805px;- font-style: normal;- font-weight: var(--font-weight-normal);- line-height: 16.463px;- letter-spacing: -0.064px;- color: var(--l2-foreground);-}--.user {- display: flex;- align-items: center;- gap: 8px;-}--.userTag {- width: 12px;- height: 12px;- display: flex;- justify-content: center;- align-items: center;- color: var(--l2-foreground);- font-size: 8px;- font-style: normal;- font-weight: var(--font-weight-normal);- line-height: normal;- letter-spacing: -0.05px;- border-radius: 12.805px;- background-color: var(--l1-background);-}--.userLabel {- color: var(--l2-foreground);- font-family: Inter;- font-size: 12.805px;- font-weight: var(--font-weight-normal);- line-height: 16.463px;- letter-spacing: -0.064px;-}--.action {- display: flex;- justify-content: space-between;- align-items: center;- padding: 0px 0px 0px 14.634px;-}--.actionLeft {- display: flex;- gap: 10px;- align-items: center;-}--.connectionLine {- border-top: 1px dashed var(--l1-border);- min-width: 20px;- flex-grow: 1;- margin: 0px 8px;-}--.actionRight {- display: flex;- align-items: center;-}--.saveChanges {- display: flex;- width: 100%;- height: 32px;- padding: 8px 16px;- justify-content: center;- align-items: center;- flex-shrink: 0;- border-radius: 2px;- border: 1px solid var(--l1-border);- background: var(--l1-border);-}--:global(.configureMetadataModalRoot) {- :global(.ant-modal-content) {- width: 500px;- flex-shrink: 0;- border-radius: 4px;- border: 1px solid var(--l1-border);- background: var(--card);- box-shadow: 0px -4px 16px 2px rgba(0, 0, 0, 0.2);- padding: 0px;- }-- :global(.ant-modal-header) {- background: var(--card);- padding: 16px;- border-bottom: 1px solid var(--l1-border);- margin-bottom: 0px;- }-- :global(.ant-modal-body) {- padding: 14px 16px;- }-- :global(.ant-modal-footer) {- margin-top: 0px;- padding: 4px 16px 16px 16px;- }-}diff --git a/frontend/src/pages/DashboardsListPageV2/components/ConfigureMetadataModal/ConfigureMetadataModal.tsx b/frontend/src/pages/DashboardsListPageV2/components/ConfigureMetadataModal/ConfigureMetadataModal.tsxdeleted file mode 100644index 0d6052e6e0..0000000000--- a/frontend/src/pages/DashboardsListPageV2/components/ConfigureMetadataModal/ConfigureMetadataModal.tsx+++ /dev/null@@ -1,218 +0,0 @@-import { useEffect, useState } from 'react';-import { Button, Modal } from 'antd';-import { Typography } from '@signozhq/ui/typography';-import { Switch } from '@signozhq/ui/switch';-import { CalendarClock, Check, Clock4 } from '@signozhq/icons';-import { get } from 'lodash-es';-import { Base64Icons } from 'container/DashboardContainer/DashboardSettings/General/utils';-import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';-import { useTimezone } from 'providers/Timezone';--import { lastUpdatedLabel, type DashboardListItem } from '../../utils';-import {- DynamicColumns,- useDashboardsListVisibleColumnsStore,- type DashboardDynamicColumns,-} from './useDynamicColumns';--import styles from './ConfigureMetadataModal.module.scss';--interface Props {- open: boolean;- previewDashboard: DashboardListItem | undefined;- onClose: () => void;-}--function ConfigureMetadataModal({- open,- previewDashboard,- onClose,-}: Props): JSX.Element {- const { formatTimezoneAdjustedTimestamp } = useTimezone();-- const storedColumns = useDashboardsListVisibleColumnsStore(- (s) => s.visibleColumns,- );- const setStoredColumns = useDashboardsListVisibleColumnsStore(- (s) => s.setVisibleColumns,- );- const [draftColumns, setDraftColumns] =- useState<DashboardDynamicColumns>(storedColumns);-- useEffect(() => {- if (open) {- setDraftColumns(storedColumns);- }- }, [open, storedColumns]);-- const handleSave = (): void => {- setStoredColumns(draftColumns);- onClose();- };-- const previewImage = previewDashboard?.image || Base64Icons[0];- const previewName = previewDashboard?.spec?.display?.name;- const previewCreatedBy = previewDashboard?.createdBy;- const previewUpdatedBy = previewDashboard?.updatedBy;- const previewUpdatedAt = previewDashboard?.updatedAt;-- const formattedCreatedAt = previewDashboard- ? formatTimezoneAdjustedTimestamp(- get(previewDashboard, 'createdAt', '') as string,- DATE_TIME_FORMATS.DASH_DATETIME_UTC,- )- : '';-- return (- <Modal- open={open}- onCancel={onClose}- title="Configure Metadata"- footer={- <Button- type="text"- icon={<Check size={14} />}- className={styles.saveChanges}- onClick={handleSave}- >- Save Changes- </Button>- }- rootClassName="configureMetadataModalRoot"- >- <div className={styles.content}>- <div className={styles.preview}>- <section className={styles.previewHeader}>- <img- src={previewImage}- alt="dashboard-image"- className={styles.previewIcon}- />- <Typography.Text className={styles.previewTitle}>- {previewName}- </Typography.Text>- </section>- <section className={styles.previewDetails}>- <section className={styles.previewRow}>- {draftColumns.createdAt && (- <span className={styles.formattedTime}>- <CalendarClock size={14} />- <Typography.Text className={styles.formattedTimeText}>- {formattedCreatedAt}- </Typography.Text>- </span>- )}- {draftColumns.createdBy && (- <div className={styles.user}>- <Typography.Text className={styles.userTag}>- {previewCreatedBy?.substring(0, 1).toUpperCase()}- </Typography.Text>- <Typography.Text className={styles.userLabel}>- {previewCreatedBy}- </Typography.Text>- </div>- )}- </section>- <section className={styles.previewRow}>- {draftColumns.updatedAt && (- <span className={styles.formattedTime}>- <CalendarClock size={14} />- <Typography.Text className={styles.formattedTimeText}>- {lastUpdatedLabel(previewUpdatedAt)}- </Typography.Text>- </span>- )}- {draftColumns.updatedBy && (- <div className={styles.user}>- <Typography.Text className={styles.userTag}>- {previewUpdatedBy?.substring(0, 1).toUpperCase()}- </Typography.Text>- <Typography.Text className={styles.userLabel}>- {previewUpdatedBy}- </Typography.Text>- </div>- )}- </section>- </section>- </div>-- <div className={styles.action}>- <div className={styles.actionLeft}>- <CalendarClock size={14} />- <Typography.Text>Created at</Typography.Text>- </div>- <div className={styles.connectionLine} />- <div className={styles.actionRight}>- <Switch- value- disabled- onChange={(check): void =>- setDraftColumns((prev) => ({- ...prev,- [DynamicColumns.CREATED_AT]: check,- }))- }- />- </div>- </div>- <div className={styles.action}>- <div className={styles.actionLeft}>- <CalendarClock size={14} />- <Typography.Text>Created by</Typography.Text>- </div>- <div className={styles.connectionLine} />- <div className={styles.actionRight}>- <Switch- value- disabled- onChange={(check): void =>- setDraftColumns((prev) => ({- ...prev,- [DynamicColumns.CREATED_BY]: check,- }))- }- />- </div>- </div>- <div className={styles.action}>- <div className={styles.actionLeft}>- <Clock4 size={14} />- <Typography.Text>Updated at</Typography.Text>- </div>- <div className={styles.connectionLine} />- <div className={styles.actionRight}>- <Switch- value={draftColumns.updatedAt}- onChange={(check): void =>- setDraftColumns((prev) => ({- ...prev,- [DynamicColumns.UPDATED_AT]: check,- }))- }- />- </div>- </div>- <div className={styles.action}>- <div className={styles.actionLeft}>- <Clock4 size={14} />- <Typography.Text>Updated by</Typography.Text>- </div>- <div className={styles.connectionLine} />- <div className={styles.actionRight}>- <Switch- value={draftColumns.updatedBy}- onChange={(check): void =>- setDraftColumns((prev) => ({- ...prev,- [DynamicColumns.UPDATED_BY]: check,- }))- }- />- </div>- </div>- </div>- </Modal>- );-}--export default ConfigureMetadataModal;diff --git a/frontend/src/pages/DashboardsListPageV2/components/CreateDashboardDropdown/CreateDashboardDropdown.module.scss b/frontend/src/pages/DashboardsListPageV2/components/CreateDashboardDropdown/CreateDashboardDropdown.module.scssdeleted file mode 100644index cce5b11fbe..0000000000--- a/frontend/src/pages/DashboardsListPageV2/components/CreateDashboardDropdown/CreateDashboardDropdown.module.scss+++ /dev/null@@ -1,34 +0,0 @@-.menuItem {- display: flex;- align-items: center;- gap: 8px;-}--.templatesItem {- display: flex;- justify-content: space-between;- align-items: center;- gap: 8px;- width: 100%;-}--.primaryButton {- padding: 6px 12px;-}--.textButton {- display: flex;- width: 153px;- align-items: center;- height: 32px;- padding: 6px 12px;- justify-content: center;- gap: 6px;- border-radius: 2px;- background: var(--primary-background);- color: var(--l1-foreground);-}--:global(.createDashboardMenuOverlay) {- width: 200px;-}diff --git a/frontend/src/pages/DashboardsListPageV2/components/CreateDashboardDropdown/CreateDashboardDropdown.tsx b/frontend/src/pages/DashboardsListPageV2/components/CreateDashboardDropdown/CreateDashboardDropdown.tsxdeleted file mode 100644index d1debd18c5..0000000000--- a/frontend/src/pages/DashboardsListPageV2/components/CreateDashboardDropdown/CreateDashboardDropdown.tsx+++ /dev/null@@ -1,119 +0,0 @@-import { useMemo } from 'react';-// eslint-disable-next-line signoz/no-antd-components -- TODO: migrate Dropdown to @signozhq/ui/dropdown-menu-import { Button, Dropdown, MenuProps } from 'antd';-import cx from 'classnames';-import logEvent from 'api/common/logEvent';-import {- ExternalLink,- Github,- LayoutGrid,- Plus,- Radius,-} from '@signozhq/icons';--import styles from './CreateDashboardDropdown.module.scss';--interface Props {- canCreate: boolean;- onCreate: () => void;- onImportJSON: () => void;- variant?: 'primary' | 'text';-}--const TEMPLATES_HREF =- 'https://signoz.io/docs/dashboards/dashboard-templates/overview/';--function CreateDashboardDropdown({- canCreate,- onCreate,- onImportJSON,- variant = 'primary',-}: Props): JSX.Element {- const items: MenuProps['items'] = useMemo(() => {- const menuItems: MenuProps['items'] = [- {- key: 'import-json',- label: (- <div- className={styles.menuItem}- data-testid="import-json-menu-cta"- onClick={onImportJSON}- >- <Radius size={14} /> Import JSON- </div>- ),- },- {- key: 'view-templates',- label: (- <a- href={TEMPLATES_HREF}- target="_blank"- rel="noopener noreferrer"- data-testid="view-templates-menu-cta"- >- <div className={styles.templatesItem}>- <div className={styles.menuItem}>- <Github size={14} /> View templates- </div>- <ExternalLink size={14} />- </div>- </a>- ),- },- ];-- if (canCreate) {- menuItems.unshift({- key: 'create-dashboard',- label: (- <div- className={styles.menuItem}- data-testid="create-dashboard-menu-cta"- onClick={onCreate}- >- <LayoutGrid size={14} /> Create dashboard- </div>- ),- });- }-- return menuItems;- }, [canCreate, onCreate, onImportJSON]);-- return (- <Dropdown- overlayClassName="createDashboardMenuOverlay"- menu={{ items }}- placement="bottomRight"- trigger={['click']}- >- {variant === 'primary' ? (- <Button- type="primary"- className={cx('periscope-btn primary', styles.primaryButton)}- icon={<Plus size={14} />}- data-testid="new-dashboard-cta"- onClick={(): void => {- logEvent('Dashboard List: New dashboard clicked', {});- }}- >- New dashboard- </Button>- ) : (- <Button- type="text"- className={styles.textButton}- icon={<Plus size={14} />}- onClick={(): void => {- logEvent('Dashboard List: New dashboard clicked', {});- }}- >- New Dashboard- </Button>- )}- </Dropdown>- );-}--export default CreateDashboardDropdown;diff --git a/frontend/src/pages/DashboardsListPageV2/components/DashboardRow/DashboardRow.module.scss b/frontend/src/pages/DashboardsListPageV2/components/DashboardRow/DashboardRow.module.scssindex 2835c79195..4cd5a592b5 100644--- a/frontend/src/pages/DashboardsListPageV2/components/DashboardRow/DashboardRow.module.scss+++ b/frontend/src/pages/DashboardsListPageV2/components/DashboardRow/DashboardRow.module.scss@@ -1,9 +1,14 @@.row {padding: 12px 16px 16px 16px;- border: 1px solid var(--l1-border);+ border: 1px solid var(--l2-border);border-top: none;- background: var(--l2-background);+ background: var(--l1-background);cursor: pointer;+ transition: background 0.12s;+}++.row:hover {+ background: var(--l2-background);}.titleWithAction {@@ -57,6 +62,40 @@justify-content: flex-end;}+.favBtn {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 24px;+ height: 24px;+ flex: none;+ border: none;+ border-radius: 5px;+ background: transparent;+ color: transparent;+ cursor: pointer;+ transition:+ background 0.12s,+ color 0.12s;+}++.row:hover .favBtn {+ color: var(--l3-foreground);+}++.favBtn:hover {+ background: var(--l1-background);+ color: var(--bg-amber-500);+}++.favBtnOn {+ color: var(--bg-amber-500);++ svg {+ fill: currentColor;+ }+}+.tags {display: flex;flex-wrap: wrap;diff --git a/frontend/src/pages/DashboardsListPageV2/components/DashboardRow/DashboardRow.tsx b/frontend/src/pages/DashboardsListPageV2/components/DashboardRow/DashboardRow.tsxindex fd422d8e99..e576fc612d 100644--- a/frontend/src/pages/DashboardsListPageV2/components/DashboardRow/DashboardRow.tsx+++ b/frontend/src/pages/DashboardsListPageV2/components/DashboardRow/DashboardRow.tsx@@ -1,7 +1,8 @@import { Tooltip } from 'antd';import { Typography } from '@signozhq/ui/typography';import { Badge } from '@signozhq/ui/badge';-import { CalendarClock } from '@signozhq/icons';+import { CalendarClock, Star } from '@signozhq/icons';+import cx from 'classnames';import logEvent from 'api/common/logEvent';import { generatePath } from 'react-router-dom';import { Base64Icons } from 'container/DashboardContainer/DashboardSettings/General/utils';@@ -11,6 +12,7 @@ import { useSafeNavigate } from 'hooks/useSafeNavigate';import { useTimezone } from 'providers/Timezone';import { isModifierKeyPressed } from 'utils/app';+import { useDashboardViewsStore } from '../../store/useDashboardViewsStore';import type { DashboardListItem } from '../../utils';import { lastUpdatedLabel, tagsToStrings } from '../../utils';import ActionsPopover from '../ActionsPopover/ActionsPopover';@@ -35,6 +37,12 @@ function DashboardRow({const { safeNavigate } = useSafeNavigate();const { formatTimezoneAdjustedTimestamp } = useTimezone();+ const isFavorite = useDashboardViewsStore((s) =>+ s.favorites.includes(dashboard.id),+ );+ const toggleFavorite = useDashboardViewsStore((s) => s.toggleFavorite);+ const markViewed = useDashboardViewsStore((s) => s.markViewed);+const id = dashboard.id;const name = dashboard.spec?.display?.name ?? '';const image = dashboard.image || Base64Icons[0];@@ -53,6 +61,7 @@ function DashboardRow({const onClickHandler = (event: React.MouseEvent<HTMLElement>): void => {event.stopPropagation();+ markViewed(id);safeNavigate(link, { newTab: isModifierKeyPressed(event) });logEvent('Dashboard List: Clicked on dashboard', {dashboardId: id,@@ -60,6 +69,11 @@ function DashboardRow({});};+ const onToggleFavorite = (event: React.MouseEvent<HTMLElement>): void => {+ event.stopPropagation();+ toggleFavorite(id);+ };+return (<div className={styles.row} onClick={onClickHandler}><div className={styles.titleWithAction}>@@ -98,6 +112,17 @@ function DashboardRow({)}</div>+ <button+ type="button"+ className={cx(styles.favBtn, { [styles.favBtnOn]: isFavorite })}+ aria-label={isFavorite ? 'Remove from favorites' : 'Add to favorites'}+ title={isFavorite ? 'Remove from favorites' : 'Add to favorites'}+ data-testid={`dashboard-favorite-${index}`}+ onClick={onToggleFavorite}+ >+ <Star size={14} />+ </button>+{canAct && (<ActionsPopoverlink={link}diff --git a/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/CommandHeader.tsx b/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/CommandHeader.tsxnew file mode 100644index 0000000000..a8284bdf99--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/CommandHeader.tsx@@ -0,0 +1,32 @@+import { Typography } from '@signozhq/ui/typography';++import NewDashboardButton from './NewDashboardButton';++import styles from './DashboardsList.module.scss';++interface Props {+ label: string;+ count: number;+ canCreate: boolean;+ onCreate: () => void;+}++function CommandHeader({+ label,+ count,+ canCreate,+ onCreate,+}: Props): JSX.Element {+ return (+ <div className={styles.commandHeader}>+ <div className={styles.headingBlock}>+ <Typography.Title className={styles.title}>{label}</Typography.Title>+ <span className={styles.countPill}>{count}</span>+ </div>+ <div className={styles.grow} />+ {canCreate && <NewDashboardButton onClick={onCreate} />}+ </div>+ );+}++export default CommandHeader;diff --git a/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/DashboardsList.module.scss b/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/DashboardsList.module.scssindex afdcb98361..51258ed53a 100644--- a/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/DashboardsList.module.scss+++ b/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/DashboardsList.module.scss@@ -1,14 +1,43 @@-.container {- margin-top: 30px;- margin-bottom: 30px;+.layout {display: flex;- justify-content: center;+ align-items: stretch;width: 100%;+ flex: 1;+ min-height: 0;+}++.main {+ flex: 1;+ min-width: 0;+ display: flex;+ flex-direction: column;+ min-height: 0;+ // Deepest layer — the results canvas, so the lighter header zone and the+ // row cards read with clear contrast (matches the design's list surface).+ background: var(--l1-background);+}++.mainScroll {+ flex: 1;+ min-height: 0;+ overflow-y: auto;+}++.headerZone {+ display: flex;+ flex-direction: column;+ gap: 14px;+ padding: 20px 24px;+ background: var(--l2-background);+ border-bottom: 1px solid var(--l2-border);+}++.emptyWrap {+ padding: 24px;}.viewContent {- width: calc(100% - 30px);- max-width: 836px;+ width: 100%;:global(.ant-table-wrapper) :global(.ant-table-cell) {padding: 0 !important;@@ -16,14 +45,6 @@background: var(--l1-background) !important;}- :global(.ant-table-wrapper)- :global(.ant-table-tbody)- :global(.ant-table-row)- :global(.ant-table-cell)- > div {- // Row content is the only child of the td; it carries the borders.- }-:global(.ant-table-wrapper):global(.ant-table-tbody):global(.ant-table-row:last-child)@@ -55,19 +76,43 @@}}-.titleContainer {+.commandHeader {display: flex;- flex-direction: column;- gap: 4px;+ align-items: center;+ gap: 12px;+}++.headingBlock {+ display: flex;+ align-items: center;+ gap: 10px;+ min-width: 0;+}++.grow {+ flex: 1;+}++.countPill {+ padding: 2px 9px;+ border-radius: 999px;+ background: var(--l2-background);+ border: 1px solid var(--l2-border);+ color: var(--l2-foreground);+ font-size: var(--font-size-xs);+ font-variant-numeric: tabular-nums;}.title {color: var(--l1-foreground);font-size: var(--font-size-lg);font-style: normal;- font-weight: var(--font-weight-normal);+ font-weight: var(--font-weight-medium);line-height: 28px;letter-spacing: -0.09px;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;}.subtitle {@@ -80,17 +125,16 @@}.integrationsContainer {- margin: 16px 0;+ width: 100%;}.integrationsContent {max-width: 100%;width: 100%;-}-.toolbar {- display: flex;- align-items: center;- gap: 8px;- margin: 16px 0;+ // The shared request banner ships a 12px margin; drop it so the banner's+ // left edge lines up with the heading and filters above/below it.+ :global(.request-entity-container) {+ margin: 0;+ }}diff --git a/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/DashboardsList.tsx b/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/DashboardsList.tsxindex 98cc70b938..328baa36d4 100644--- a/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/DashboardsList.tsx+++ b/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/DashboardsList.tsx@@ -1,55 +1,45 @@import { useCallback, useEffect, useMemo, useRef, useState } from 'react';-import { generatePath } from 'react-router-dom';-import { useTranslation } from 'react-i18next';-import { Typography } from '@signozhq/ui/typography';-import { AxiosError } from 'axios';import logEvent from 'api/common/logEvent';-import {- createDashboardV2,- useListDashboardsV2,-} from 'api/generated/services/dashboard';+import { useListDashboardsV2 } from 'api/generated/services/dashboard';import {DashboardtypesListOrderDTO,DashboardtypesListSortDTO,} from 'api/generated/services/sigNoz.schemas';-import ROUTES from 'constants/routes';-import { RequestDashboardBtn } from 'container/ListOfDashboard/RequestDashboardBtn';import useComponentPermission from 'hooks/useComponentPermission';-import { toast } from '@signozhq/ui/sonner';import { useGetTenantLicense } from 'hooks/useGetTenantLicense';-import { useSafeNavigate } from 'hooks/useSafeNavigate';import { useAppContext } from 'providers/App/App';-import { useErrorModal } from 'providers/ErrorModalProvider';-import APIError from 'types/api/error';import { toAPIError } from 'utils/errorUtils';+import { combineQueries } from '../../filterQuery';+import { useActiveView } from '../../hooks/useActiveView';+import { useDashboardFilters } from '../../hooks/useDashboardFilters';import {usePage,- useSearch,useSortColumn,useSortOrder,} from '../../hooks/useDashboardsListQueryParams';+import { useDashboardViewsStore } from '../../store/useDashboardViewsStore';+import { useDashboardsListVisibleColumnsStore } from '../../store/useVisibleColumnsStore';+import type { UpdatedWindow } from '../../types';import type { DashboardListItem } from '../../utils';-import ConfigureMetadataModal from '../ConfigureMetadataModal/ConfigureMetadataModal';-import { useDashboardsListVisibleColumnsStore } from '../ConfigureMetadataModal/useDynamicColumns';-import CreateDashboardDropdown from '../CreateDashboardDropdown/CreateDashboardDropdown';-import ImportJSONModal from '../ImportJSONModal/ImportJSONModal';-import ListHeader from '../ListHeader/ListHeader';-import EmptyState from '../states/EmptyState/EmptyState';-import ErrorState from '../states/ErrorState/ErrorState';-import LoadingState from '../states/LoadingState/LoadingState';-import NoResultsState from '../states/NoResultsState/NoResultsState';-import SearchBar from '../SearchBar/SearchBar';-import DashboardsListContent from './DashboardsListContent';+import { applyClientView } from '../../views';+import type { CreatorOption } from '../FilterZone/FilterChips';+import FilterZone from '../FilterZone/FilterZone';+import NewDashboardModal from '../NewDashboardModal/NewDashboardModal';+import StatusBar from '../StatusBar/StatusBar';+import ViewsRail from '../ViewsRail/ViewsRail';+import CommandHeader from './CommandHeader';+import DashboardsResults from './DashboardsResults';+import WorkspaceEmptyState from './WorkspaceEmptyState';import styles from './DashboardsList.module.scss';const PAGE_SIZE = 20;+// Favorites / recently-viewed are filtered client-side (no server id filter), so+// we pull a single large page and constrain it in-memory.+const CLIENT_VIEW_LIMIT = 200;function DashboardsList(): JSX.Element {- const { safeNavigate } = useSafeNavigate();- const { t } = useTranslation('dashboard');- const { showErrorModal } = useErrorModal();const { isCloudUser } = useGetTenantLicense();const { user } = useAppContext();@@ -58,38 +48,100 @@ function DashboardsList(): JSX.Element {user.role,);- const [searchString, setSearchString] = useSearch();+ const {+ filters,+ query,+ isEmpty: filtersEmpty,+ setSearch,+ setCreatedBy,+ setUpdated,+ applyFilters,+ clearAll,+ } = useDashboardFilters();const [sortColumn, setSortColumn] = useSortColumn();const [sortOrder, setSortOrder] = useSortOrder();const [page, setPage] = usePage();- const [searchInput, setSearchInput] = useState(searchString);+ const {+ activeViewId,+ builtinViews,+ customViews,+ isCustomActive,+ isModified,+ viewQuery,+ clientView,+ selectView,+ saveView,+ saveActiveView,+ resetView,+ removeView,+ } = useActiveView({ filters, applyFilters, userEmail: user.email });- // Keep the local input in sync with external searchString changes- // (browser back/forward, deep link). User typing only mutates- // searchInput, so this won't fight with in-flight edits.- useEffect(() => {- setSearchInput(searchString);- }, [searchString]);+ const railCollapsed = useDashboardViewsStore((s) => s.railCollapsed);+ const setRailCollapsed = useDashboardViewsStore((s) => s.setRailCollapsed);+ const favorites = useDashboardViewsStore((s) => s.favorites);+ const recent = useDashboardViewsStore((s) => s.recent);- const handleSubmitSearch = useCallback((): void => {- const next = searchInput.trim();- if (next === searchString) {- return;- }- void setSearchString(next);+ // Any filter change resets to the first page so the user isn't stranded on a+ // now-out-of-range offset.+ const handleSearchChange = useCallback(+ (value: string): void => {+ setSearch(value);+ void setPage(1);+ },+ [setSearch, setPage],+ );+ const handleCreatedByChange = useCallback(+ (emails: string[]): void => {+ setCreatedBy(emails);+ void setPage(1);+ },+ [setCreatedBy, setPage],+ );+ const handleUpdatedChange = useCallback(+ (window: UpdatedWindow): void => {+ setUpdated(window);+ void setPage(1);+ },+ [setUpdated, setPage],+ );+ const handleClearAll = useCallback((): void => {+ clearAll();+ void setPage(1);+ }, [clearAll, setPage]);++ // View actions that change the result set reset pagination too.+ const handleSelectView = useCallback(+ (id: string): void => {+ selectView(id);+ void setPage(1);+ },+ [selectView, setPage],+ );+ const handleResetView = useCallback((): void => {+ resetView();void setPage(1);- }, [searchInput, searchString, setSearchString, setPage]);+ }, [resetView, setPage]);+ const handleRemoveView = useCallback(+ (id: string): void => {+ removeView(id);+ void setPage(1);+ },+ [removeView, setPage],+ );+ const toggleRail = useCallback((): void => {+ setRailCollapsed(!railCollapsed);+ }, [setRailCollapsed, railCollapsed]);const listParams = useMemo(() => ({- query: searchString.trim() || undefined,+ query: combineQueries(viewQuery, query) || undefined,sort: sortColumn,order: sortOrder,- limit: PAGE_SIZE,- offset: (page - 1) * PAGE_SIZE,+ limit: clientView ? CLIENT_VIEW_LIMIT : PAGE_SIZE,+ offset: clientView ? 0 : (page - 1) * PAGE_SIZE,}),- [searchString, sortColumn, sortOrder, page],+ [viewQuery, query, sortColumn, sortOrder, page, clientView],);const {@@ -107,52 +159,49 @@ function DashboardsList(): JSX.Element {const errorHttpStatus = apiError?.getHttpStatusCode();const errorMessage = apiError?.getErrorMessage();- const dashboards = useMemo<DashboardListItem[]>(+ const rawDashboards = useMemo<DashboardListItem[]>(() => response?.data?.dashboards ?? [],[response],);- const total = response?.data?.total ?? 0;- const [isImportOpen, setIsImportOpen] = useState(false);- const [isConfigureOpen, setIsConfigureOpen] = useState(false);- const visibleColumns = useDashboardsListVisibleColumnsStore(- (s) => s.visibleColumns,+ // Favorites / recently-viewed constrain the fetched rows by a client-side id+ // set; all other views are already constrained server-side.+ const dashboards = useMemo<DashboardListItem[]>(+ () =>+ clientView+ ? applyClientView(rawDashboards, activeViewId, favorites, recent)+ : rawDashboards,+ [clientView, rawDashboards, activeViewId, favorites, recent],);+ const total = clientView ? dashboards.length : (response?.data?.total ?? 0);- const [creating, setCreating] = useState(false);-- const handleCreateNew = useCallback(async (): Promise<void> => {- try {- logEvent('Dashboard List: Create dashboard clicked', {});- setCreating(true);- const created = await createDashboardV2({- schemaVersion: 'v6',- // Backend requires `name` (immutable, server-side identifier);- // asking it to generate one keeps the UI's "new dashboard" flow.- generateName: true,- tags: null,- spec: {- display: { name: t('new_dashboard_title', { ns: 'dashboard' }) },- layouts: [],- panels: {},- variables: [],- // TODO(@AshwinBhatkal): duration and refresh interval need to be integrated- },- });- safeNavigate(- generatePath(ROUTES.DASHBOARD, { dashboardId: created.data.id }),- );- } catch (e) {- showErrorModal(e as APIError);- toast.error((e as AxiosError).toString() || 'Failed to create dashboard');- } finally {- setCreating(false);+ // Creator filter options: distinct authors on the loaded page plus the+ // current user (so "me" is always selectable). Page-scoped until a members+ // source backs this.+ const creatorOptions = useMemo<CreatorOption[]>(() => {+ const emails = new Set<string>();+ if (user.email) {+ emails.add(user.email);}- }, [safeNavigate, showErrorModal, t]);+ rawDashboards.forEach((d) => {+ if (d.createdBy) {+ emails.add(d.createdBy);+ }+ });+ return [...emails].sort().map((email) => ({+ email,+ label: email === user.email ? `${email} (me)` : email,+ }));+ }, [rawDashboards, user.email]);- const handleImportToggle = useCallback((): void => {- logEvent('Dashboard List V2: Import JSON clicked', {});- setIsImportOpen((s) => !s);+ const [isCreateOpen, setIsCreateOpen] = useState(false);+ const visibleColumns = useDashboardsListVisibleColumnsStore(+ (s) => s.visibleColumns,+ );++ const openCreate = useCallback((): void => {+ logEvent('Dashboard List: New dashboard clicked', {});+ setIsCreateOpen(true);}, []);const onSortChange = useCallback(@@ -180,102 +229,109 @@ function DashboardsList(): JSX.Element {// eslint-disable-next-line react-hooks/exhaustive-deps}, [isLoading]);- return (- <div className={styles.container}>- <div className={styles.viewContent}>- <div className={styles.titleContainer}>- <Typography.Title className={styles.title}>Dashboards</Typography.Title>- <Typography.Text className={styles.subtitle}>- Create and manage dashboards for your workspace.- </Typography.Text>- {isCloudUser && (- <div className={styles.integrationsContainer}>- <div className={styles.integrationsContent}>- <RequestDashboardBtn />- </div>- </div>- )}- </div>+ const activeLabel =+ customViews.find((v) => v.id === activeViewId)?.name ??+ builtinViews.find((v) => v.id === activeViewId)?.label ??+ 'Dashboards';- {isLoading ? (- <LoadingState />- ) : !error && dashboards.length === 0 && !searchString && page === 1 ? (- <EmptyState- createDropdown={- canCreateNewDashboard ? (- <CreateDashboardDropdown- canCreate={!!canCreateNewDashboard}- onCreate={handleCreateNew}- onImportJSON={handleImportToggle}- variant="text"+ // The workspace-empty CTA ("create your first dashboard") belongs only to the+ // unfiltered All view; every other view's zero result is a no-results state.+ const showWorkspaceEmpty =+ !error &&+ dashboards.length === 0 &&+ activeViewId === 'all' &&+ filtersEmpty &&+ page === 1;++ const isWorkspaceEmpty = showWorkspaceEmpty && !isLoading;++ return (+ <div className={styles.layout}>+ <ViewsRail+ activeViewId={activeViewId}+ builtinViews={builtinViews}+ customViews={customViews}+ isCustomActive={isCustomActive}+ isModified={isModified}+ collapsed={railCollapsed}+ onSelect={handleSelectView}+ onSave={saveView}+ onSaveChanges={saveActiveView}+ onReset={handleResetView}+ onClearFilters={handleClearAll}+ onDelete={handleRemoveView}+ />+ <div className={styles.main}>+ <div className={styles.mainScroll}>+ {isWorkspaceEmpty ? (+ <WorkspaceEmptyState+ canCreate={canCreateNewDashboard}+ onCreate={openCreate}+ />+ ) : (+ <>+ <div className={styles.headerZone}>+ <CommandHeader+ label={activeLabel}+ count={total}+ canCreate={canCreateNewDashboard}+ onCreate={openCreate}/>- ) : null- }- />- ) : (- <>- <div className={styles.toolbar}>- <SearchBar- value={searchInput}- onChange={setSearchInput}- onSubmit={handleSubmitSearch}- />- {canCreateNewDashboard && (- <CreateDashboardDropdown- canCreate={!!canCreateNewDashboard}- onCreate={handleCreateNew}- onImportJSON={handleImportToggle}+ <FilterZone+ search={filters.search}+ createdBy={filters.createdBy}+ updated={filters.updated}+ creatorOptions={creatorOptions}+ isEmpty={filtersEmpty}+ onSearchChange={handleSearchChange}+ onCreatedByChange={handleCreatedByChange}+ onUpdatedChange={handleUpdatedChange}+ onClearAll={handleClearAll}/>- )}- </div>-- {error ? (- <ErrorState- isCloudUser={!!isCloudUser}- onRetry={(): void => {- refetch();- }}- httpStatus={errorHttpStatus}- errorMessage={errorMessage}- />- ) : dashboards.length === 0 ? (- <NoResultsState searchString={searchInput} />- ) : (- <>- <ListHeader+ </div>+ <div className={styles.viewContent}>+ <DashboardsResults+ isLoading={isLoading}+ hasError={!!error}+ isCloudUser={!!isCloudUser}+ onRetry={(): void => {+ refetch();+ }}+ errorHttpStatus={errorHttpStatus}+ errorMessage={errorMessage}+ dashboards={dashboards}+ activeViewId={activeViewId}+ searchValue={filters.search}+ hasFilters={!filtersEmpty}sortColumn={sortColumn}onSortChange={onSortChange}sortOrder={sortOrder}onOrderChange={onOrderChange}- onConfigureMetadata={(): void => setIsConfigureOpen(true)}- />- <DashboardsListContent- dashboards={dashboards}page={page}- pageSize={PAGE_SIZE}+ pageSize={clientView ? CLIENT_VIEW_LIMIT : PAGE_SIZE}total={total}onPageChange={setPage}canAct={!!action}showUpdatedAt={visibleColumns.updatedAt}showUpdatedBy={visibleColumns.updatedBy}- loading={creating || isFetching}+ loading={isFetching}/>- </>- )}- </>- )}-- <ImportJSONModal- open={isImportOpen}- onClose={(): void => setIsImportOpen(false)}- />-- <ConfigureMetadataModal- open={isConfigureOpen}- previewDashboard={dashboards[0]}- onClose={(): void => setIsConfigureOpen(false)}+ </div>+ </>+ )}+ </div>+ <StatusBar+ collapsed={railCollapsed}+ onToggleCollapse={toggleRail}+ count={dashboards.length}+ total={total}/></div>++ <NewDashboardModal+ open={isCreateOpen}+ onClose={(): void => setIsCreateOpen(false)}+ /></div>);}diff --git a/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/DashboardsResults.tsx b/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/DashboardsResults.tsxnew file mode 100644index 0000000000..9ea2be40c6--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/DashboardsResults.tsx@@ -0,0 +1,103 @@+import {+ DashboardtypesListOrderDTO,+ DashboardtypesListSortDTO,+} from 'api/generated/services/sigNoz.schemas';++import type { DashboardListItem } from '../../utils';+import { noResultsCopy } from '../../views';+import ListHeader from '../ListHeader/ListHeader';+import ErrorState from '../states/ErrorState/ErrorState';+import LoadingState from '../states/LoadingState/LoadingState';+import NoResultsState from '../states/NoResultsState/NoResultsState';+import DashboardsListContent from './DashboardsListContent';++interface Props {+ isLoading: boolean;+ hasError: boolean;+ isCloudUser: boolean;+ onRetry: () => void;+ errorHttpStatus?: number;+ errorMessage?: string;+ dashboards: DashboardListItem[];+ activeViewId: string;+ searchValue: string;+ hasFilters: boolean;+ sortColumn: DashboardtypesListSortDTO;+ onSortChange: (column: DashboardtypesListSortDTO) => void;+ sortOrder: DashboardtypesListOrderDTO;+ onOrderChange: (order: DashboardtypesListOrderDTO) => void;+ page: number;+ pageSize: number;+ total: number;+ onPageChange: (page: number) => void;+ canAct: boolean;+ showUpdatedAt: boolean;+ showUpdatedBy: boolean;+ loading: boolean;+}++function DashboardsResults({+ isLoading,+ hasError,+ isCloudUser,+ onRetry,+ errorHttpStatus,+ errorMessage,+ dashboards,+ activeViewId,+ searchValue,+ hasFilters,+ sortColumn,+ onSortChange,+ sortOrder,+ onOrderChange,+ page,+ pageSize,+ total,+ onPageChange,+ canAct,+ showUpdatedAt,+ showUpdatedBy,+ loading,+}: Props): JSX.Element {+ if (isLoading) {+ return <LoadingState />;+ }+ if (hasError) {+ return (+ <ErrorState+ isCloudUser={isCloudUser}+ onRetry={onRetry}+ httpStatus={errorHttpStatus}+ errorMessage={errorMessage}+ />+ );+ }+ if (dashboards.length === 0) {+ const copy = noResultsCopy(activeViewId, searchValue, hasFilters);+ return <NoResultsState title={copy.title} description={copy.description} />;+ }+ return (+ <>+ <ListHeader+ sortColumn={sortColumn}+ onSortChange={onSortChange}+ sortOrder={sortOrder}+ onOrderChange={onOrderChange}+ />+ <DashboardsListContent+ dashboards={dashboards}+ page={page}+ pageSize={pageSize}+ total={total}+ onPageChange={onPageChange}+ canAct={canAct}+ showUpdatedAt={showUpdatedAt}+ showUpdatedBy={showUpdatedBy}+ loading={loading}+ />+ </>+ );+}++export default DashboardsResults;diff --git a/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/NewDashboardButton.tsx b/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/NewDashboardButton.tsxnew file mode 100644index 0000000000..f2e45d6b8b--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/NewDashboardButton.tsx@@ -0,0 +1,22 @@+import { Button } from '@signozhq/ui/button';+import { Plus } from '@signozhq/icons';++interface Props {+ onClick: () => void;+}++function NewDashboardButton({ onClick }: Props): JSX.Element {+ return (+ <Button+ variant="solid"+ color="primary"+ prefix={<Plus size={14} />}+ onClick={onClick}+ testId="new-dashboard-cta"+ >+ New dashboard+ </Button>+ );+}++export default NewDashboardButton;diff --git a/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/WorkspaceEmptyState.tsx b/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/WorkspaceEmptyState.tsxnew file mode 100644index 0000000000..30c4845784--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/WorkspaceEmptyState.tsx@@ -0,0 +1,23 @@+import EmptyState from '../states/EmptyState/EmptyState';+import NewDashboardButton from './NewDashboardButton';++import styles from './DashboardsList.module.scss';++interface Props {+ canCreate: boolean;+ onCreate: () => void;+}++function WorkspaceEmptyState({ canCreate, onCreate }: Props): JSX.Element {+ return (+ <div className={styles.emptyWrap}>+ <EmptyState+ createDropdown={+ canCreate ? <NewDashboardButton onClick={onCreate} /> : null+ }+ />+ </div>+ );+}++export default WorkspaceEmptyState;diff --git a/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/index.tsx b/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/index.tsxdeleted file mode 100644index 03cc6ba563..0000000000--- a/frontend/src/pages/DashboardsListPageV2/components/DashboardsList/index.tsx+++ /dev/null@@ -1,3 +0,0 @@-import DashboardsList from './DashboardsList';--export default DashboardsList;diff --git a/frontend/src/pages/DashboardsListPageV2/components/FilterZone/FilterChips.tsx b/frontend/src/pages/DashboardsListPageV2/components/FilterZone/FilterChips.tsxnew file mode 100644index 0000000000..916a8ef57a--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/FilterZone/FilterChips.tsx@@ -0,0 +1,129 @@+import { useMemo } from 'react';+import { Button } from '@signozhq/ui/button';+import { DropdownMenuSimple, type MenuItem } from '@signozhq/ui/dropdown-menu';+import { CalendarClock, ChevronDown, User } from '@signozhq/icons';+import cx from 'classnames';++import type { UpdatedWindow } from '../../types';++import styles from './FilterZone.module.scss';++export interface CreatorOption {+ email: string;+ label: string;+}++const UPDATED_LABELS: Record<UpdatedWindow, string> = {+ any: 'Any time',+ today: 'Today',+ '7d': 'Last 7 days',+ '30d': 'Last 30 days',+};++const UPDATED_WINDOWS: UpdatedWindow[] = ['any', 'today', '7d', '30d'];++interface Props {+ createdBy: string[];+ updated: UpdatedWindow;+ creatorOptions: CreatorOption[];+ onCreatedByChange: (emails: string[]) => void;+ onUpdatedChange: (window: UpdatedWindow) => void;+}++function FilterChips({+ createdBy,+ updated,+ creatorOptions,+ onCreatedByChange,+ onUpdatedChange,+}: Props): JSX.Element {+ const createdByLabel = useMemo((): string => {+ if (createdBy.length === 0) {+ return 'Anyone';+ }+ if (createdBy.length === 1) {+ const match = creatorOptions.find((o) => o.email === createdBy[0]);+ return match?.label ?? createdBy[0];+ }+ return `${createdBy.length} people`;+ }, [createdBy, creatorOptions]);++ const createdByItems = useMemo<MenuItem[]>(() => {+ const items: MenuItem[] = creatorOptions.map((option) => ({+ type: 'checkbox',+ key: option.email,+ label: option.label,+ checked: createdBy.includes(option.email),+ onCheckedChange: (checked: boolean): void =>+ onCreatedByChange(+ checked+ ? [...createdBy, option.email]+ : createdBy.filter((e) => e !== option.email),+ ),+ }));+ if (createdBy.length > 0) {+ items.push({ type: 'divider', key: 'sep' });+ items.push({+ key: 'clear',+ label: 'Clear selection',+ onClick: (): void => onCreatedByChange([]),+ });+ }+ return items;+ }, [creatorOptions, createdBy, onCreatedByChange]);++ const updatedItems = useMemo<MenuItem[]>(+ () => [+ {+ type: 'radio-group',+ value: updated,+ onChange: (value: string): void => onUpdatedChange(value as UpdatedWindow),+ children: UPDATED_WINDOWS.map((window) => ({+ type: 'radio',+ key: window,+ value: window,+ label: UPDATED_LABELS[window],+ })),+ },+ ],+ [updated, onUpdatedChange],+ );++ return (+ <div className={styles.chips}>+ <DropdownMenuSimple menu={{ items: createdByItems }} align="start">+ <Button+ variant="outlined"+ color="secondary"+ size="sm"+ prefix={<User size={12} />}+ suffix={<ChevronDown size={12} />}+ className={cx(styles.chip, {+ [styles.chipActive]: createdBy.length > 0,+ })}+ testId="dashboards-filter-created-by"+ >+ Created by: {createdByLabel}+ </Button>+ </DropdownMenuSimple>++ <DropdownMenuSimple menu={{ items: updatedItems }} align="start">+ <Button+ variant="outlined"+ color="secondary"+ size="sm"+ prefix={<CalendarClock size={12} />}+ suffix={<ChevronDown size={12} />}+ className={cx(styles.chip, {+ [styles.chipActive]: updated !== 'any',+ })}+ testId="dashboards-filter-updated"+ >+ Updated: {UPDATED_LABELS[updated]}+ </Button>+ </DropdownMenuSimple>+ </div>+ );+}++export default FilterChips;diff --git a/frontend/src/pages/DashboardsListPageV2/components/FilterZone/FilterZone.module.scss b/frontend/src/pages/DashboardsListPageV2/components/FilterZone/FilterZone.module.scssnew file mode 100644index 0000000000..61817977e7--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/FilterZone/FilterZone.module.scss@@ -0,0 +1,50 @@+.filterZone {+ display: flex;+ flex-direction: column;+ gap: 12px;+ width: 100%;+}++.searchRow {+ display: flex;+ align-items: center;+ gap: 8px;+ width: 100%;+}++.searchInput {+ flex: 1;+ min-width: 0;+}++.filtersRow {+ display: flex;+ align-items: center;+ gap: 8px;+ flex-wrap: wrap;+}++.filtersLabel {+ font-size: var(--font-size-xs);+ font-weight: var(--font-weight-medium);+ letter-spacing: 0.06em;+ text-transform: uppercase;+ color: var(--l2-foreground);+ margin-right: 2px;+}++.chips {+ display: flex;+ align-items: center;+ gap: 8px;+ flex-wrap: wrap;+}++.chip {+ font-size: var(--font-size-sm);+}++.chipActive {+ border-color: var(--primary-background) !important;+ color: var(--l1-foreground) !important;+}diff --git a/frontend/src/pages/DashboardsListPageV2/components/FilterZone/FilterZone.tsx b/frontend/src/pages/DashboardsListPageV2/components/FilterZone/FilterZone.tsxnew file mode 100644index 0000000000..c0d34eb646--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/FilterZone/FilterZone.tsx@@ -0,0 +1,94 @@+import { type ReactNode, useCallback, useEffect, useState } from 'react';+import { Button } from '@signozhq/ui/button';+import { X } from '@signozhq/icons';++import type { UpdatedWindow } from '../../types';+import SearchBar from '../SearchBar/SearchBar';+import FilterChips, { type CreatorOption } from './FilterChips';++import styles from './FilterZone.module.scss';++interface Props {+ search: string;+ createdBy: string[];+ updated: UpdatedWindow;+ creatorOptions: CreatorOption[];+ isEmpty: boolean;+ onSearchChange: (value: string) => void;+ onCreatedByChange: (emails: string[]) => void;+ onUpdatedChange: (window: UpdatedWindow) => void;+ onClearAll: () => void;+ // Rendered at the end of the search row (e.g. the New Dashboard action).+ rightSlot?: ReactNode;+}++// The filter command zone: name search + structured chips (created-by, updated)+// + clear-all. Search is committed on submit/blur (matching the prior bar);+// chips apply immediately.+function FilterZone({+ search,+ createdBy,+ updated,+ creatorOptions,+ isEmpty,+ onSearchChange,+ onCreatedByChange,+ onUpdatedChange,+ onClearAll,+ rightSlot,+}: Props): JSX.Element {+ const [searchInput, setSearchInput] = useState(search);++ // Keep the local input in sync with external search changes (applying a view,+ // clear-all, back/forward). User typing only mutates the local copy.+ useEffect(() => {+ setSearchInput(search);+ }, [search]);++ const handleSubmit = useCallback((): void => {+ const next = searchInput.trim();+ if (next !== search) {+ onSearchChange(next);+ }+ }, [searchInput, search, onSearchChange]);++ return (+ <div className={styles.filterZone}>+ <div className={styles.searchRow}>+ <div className={styles.searchInput}>+ <SearchBar+ value={searchInput}+ placeholder="Search dashboards by name"+ onChange={setSearchInput}+ onSubmit={handleSubmit}+ />+ </div>+ {rightSlot}+ </div>+ <div className={styles.filtersRow}>+ <span className={styles.filtersLabel}>Filters</span>+ <FilterChips+ createdBy={createdBy}+ updated={updated}+ creatorOptions={creatorOptions}+ onCreatedByChange={onCreatedByChange}+ onUpdatedChange={onUpdatedChange}+ />+ {!isEmpty && (+ <Button+ variant="ghost"+ color="secondary"+ size="sm"+ prefix={<X size={12} />}+ onClick={onClearAll}+ testId="dashboards-filter-clear"+ >+ Clear+ </Button>+ )}+ </div>+ </div>+ );+}++export default FilterZone;diff --git a/frontend/src/pages/DashboardsListPageV2/components/ImportJSONModal/ImportJSONModal.module.scss b/frontend/src/pages/DashboardsListPageV2/components/ImportJSONModal/ImportJSONModal.module.scssdeleted file mode 100644index 3e7238b107..0000000000--- a/frontend/src/pages/DashboardsListPageV2/components/ImportJSONModal/ImportJSONModal.module.scss+++ /dev/null@@ -1,73 +0,0 @@-.contentContainer {- display: flex;- flex-direction: column;-}--.contentHeader {- padding: 16px;- display: flex;- align-items: center;- justify-content: space-between;- border-bottom: 1px solid var(--l1-border);-}--.footer {- display: flex;- flex-direction: column;- gap: 8px;-}--.jsonError {- display: flex;- align-items: center;- gap: 8px;-}--.errorText {- color: var(--warning-background);-}--.actions {- display: flex;- justify-content: space-between;- align-items: center;-}--:global(.importJsonModalWrapper) {- :global(.ant-modal-content) {- border-radius: 4px;- border: 1px solid var(--l1-border);- background: linear-gradient(- 139deg,- color-mix(in srgb, var(--card) 80%, transparent) 0%,- color-mix(in srgb, var(--card) 90%, transparent) 98.68%- );- box-shadow: 4px 10px 16px 2px rgba(0, 0, 0, 0.2);- backdrop-filter: blur(20px);- padding: 0;- }-- :global(.margin) {- background: linear-gradient(- 139deg,- color-mix(in srgb, var(--card) 80%, transparent) 0%,- color-mix(in srgb, var(--card) 90%, transparent) 98.68%- );- backdrop-filter: blur(20px);- }-- :global(.view-lines) {- background: linear-gradient(- 139deg,- color-mix(in srgb, var(--card) 80%, transparent) 0%,- color-mix(in srgb, var(--card) 90%, transparent) 98.68%- );- backdrop-filter: blur(20px);- }-- :global(.ant-modal-footer) {- margin-top: 0;- padding: 16px;- border-top: 1px solid var(--l1-border);- }-}diff --git a/frontend/src/pages/DashboardsListPageV2/components/ImportJSONModal/ImportJSONModal.tsx b/frontend/src/pages/DashboardsListPageV2/components/ImportJSONModal/ImportJSONModal.tsxdeleted file mode 100644index 3a9d320024..0000000000--- a/frontend/src/pages/DashboardsListPageV2/components/ImportJSONModal/ImportJSONModal.tsx+++ /dev/null@@ -1,223 +0,0 @@-import { useState } from 'react';-import { useTranslation } from 'react-i18next';-import { generatePath } from 'react-router-dom';-import { red } from '@ant-design/colors';-import MEditor, { Monaco } from '@monaco-editor/react';-import { Color } from '@signozhq/design-tokens';-import { Button, Flex, Modal, Upload, UploadProps } from 'antd';-import { toast } from '@signozhq/ui/sonner';-import { Typography } from '@signozhq/ui/typography';-import {- CircleAlert,- ExternalLink,- Github,- MonitorDot,- MoveRight,- Sparkles,-} from '@signozhq/icons';-import logEvent from 'api/common/logEvent';-import { createDashboardV2 } from 'api/generated/services/dashboard';-import ROUTES from 'constants/routes';-import { useIsDarkMode } from 'hooks/useDarkMode';-import { useSafeNavigate } from 'hooks/useSafeNavigate';-import { useErrorModal } from 'providers/ErrorModalProvider';-import APIError from 'types/api/error';--import sampleDashboard from './sampleDashboard.json';--import styles from './ImportJSONModal.module.scss';-import { normalizeToPostable } from './ImportJSONModalUtils';--interface Props {- open: boolean;- onClose: () => void;-}--function ImportJSONModal({ open, onClose }: Props): JSX.Element {- const { safeNavigate } = useSafeNavigate();- const { t } = useTranslation(['dashboard', 'common']);- const [isUploadError, setIsUploadError] = useState(false);- const [isCreateError, setIsCreateError] = useState(false);- const [isCreating, setIsCreating] = useState(false);- const [editorValue, setEditorValue] = useState('');-- const { showErrorModal } = useErrorModal();- const isDarkMode = useIsDarkMode();-- const handleUpload: UploadProps['onChange'] = (info) => {- const lastFile = info.fileList[info.fileList.length - 1];- if (!lastFile?.originFileObj) {- return;- }- const reader = new FileReader();- reader.onload = (event): void => {- try {- const target = event.target?.result;- if (!target) {- return;- }- const parsed = JSON.parse(target.toString());- setEditorValue(JSON.stringify(parsed, null, 2));- setIsUploadError(false);- } catch {- setIsUploadError(true);- }- };- reader.readAsText(lastFile.originFileObj);- };-- const handleImport = async (): Promise<void> => {- try {- setIsCreating(true);- logEvent('Dashboard List V2: Import and next clicked', {});- const parsed = JSON.parse(editorValue) as Record<string, unknown>;- const payload = normalizeToPostable(parsed);- const response = await createDashboardV2(payload);- safeNavigate(- generatePath(ROUTES.DASHBOARD, { dashboardId: response.data.id }),- );- logEvent('Dashboard List V2: New dashboard imported successfully', {- dashboardId: response.data?.id,- });- } catch (error) {- showErrorModal(error as APIError);- setIsCreateError(true);- toast.error(- error instanceof Error ? error.message : t('error_loading_json'),- );- } finally {- setIsCreating(false);- }- };-- const handleClose = (): void => {- setIsUploadError(false);- setIsCreateError(false);- onClose();- };-- const setEditorTheme = (monaco: Monaco): void => {- monaco.editor.defineTheme('my-theme', {- base: 'vs-dark',- inherit: true,- rules: [- { token: 'string.key.json', foreground: Color.BG_VANILLA_400 },- { token: 'string.value.json', foreground: Color.BG_ROBIN_400 },- ],- colors: { 'editor.background': Color.BG_INK_300 },- });- };-- const renderError = (msg: string): JSX.Element => (- <div className={styles.jsonError}>- <CircleAlert size="md" color={red[7]} />- <Typography className={styles.errorText}>{msg}</Typography>- </div>- );-- return (- <Modal- wrapClassName="importJsonModalWrapper"- open={open}- centered- closable- keyboard- maskClosable- onCancel={handleClose}- destroyOnClose- width="60vw"- footer={- <div className={styles.footer}>- {isCreateError && renderError(t('error_loading_json'))}- {isUploadError && renderError(t('error_upload_json'))}-- <div className={styles.actions}>- <Flex gap="small">- <Upload- accept=".json"- showUploadList={false}- multiple={false}- onChange={handleUpload}- beforeUpload={(): boolean => false}- action="none"- >- <Button- type="default"- className="periscope-btn"- icon={<MonitorDot size={14} />}- onClick={(): void => {- logEvent('Dashboard List V2: Upload JSON file clicked', {});- }}- >- {t('upload_json_file')}- </Button>- </Upload>- <Button- type="default"- className="periscope-btn"- icon={<Sparkles size={14} />}- onClick={(): void => {- setEditorValue(JSON.stringify(sampleDashboard, null, 2));- setIsUploadError(false);- logEvent('Dashboard List V2: Load sample clicked', {});- }}- >- Load sample- </Button>- <a- href="https://signoz.io/docs/dashboards/dashboard-templates/overview/"- target="_blank"- rel="noopener noreferrer"- >- <Button- type="default"- className="periscope-btn"- icon={<Github size={14} />}- >- {t('view_template')} - <ExternalLink size={14} />- </Button>- </a>- </Flex>-- <Button- onClick={handleImport}- loading={isCreating}- className="periscope-btn primary"- type="primary"- >- {t('import_and_next')} <MoveRight size={14} />- </Button>- </div>- </div>- }- >- <div className={styles.contentContainer}>- <div className={styles.contentHeader}>- <Typography.Text>{t('import_json')}</Typography.Text>- </div>- <MEditor- language="json"- height="40vh"- onChange={(newValue): void => setEditorValue(newValue || '')}- value={editorValue}- options={{- scrollbar: { alwaysConsumeMouseWheel: false },- minimap: { enabled: false },- fontSize: 14,- fontFamily: 'Space Mono',- }}- theme={isDarkMode ? 'my-theme' : 'light'}- onMount={(_, monaco): void => {- document.fonts.ready.then(() => {- monaco.editor.remeasureFonts();- });- }}- beforeMount={setEditorTheme}- />- </div>- </Modal>- );-}--export default ImportJSONModal;diff --git a/frontend/src/pages/DashboardsListPageV2/components/ImportJSONModal/sampleDashboard.json b/frontend/src/pages/DashboardsListPageV2/components/ImportJSONModal/sampleDashboard.jsondeleted file mode 100644index 1f10322e19..0000000000--- a/frontend/src/pages/DashboardsListPageV2/components/ImportJSONModal/sampleDashboard.json+++ /dev/null@@ -1,154 +0,0 @@-{- "display": {- "name": "NV dashboard with sections",- "description": ""- },- "datasources": {- "SigNozDatasource": {- "default": true,- "plugin": {- "kind": "signoz/Datasource",- "spec": {}- }- }- },- "panels": {- "b424e23b": {- "kind": "Panel",- "spec": {- "display": {- "name": ""- },- "plugin": {- "kind": "signoz/NumberPanel",- "spec": {- "formatting": {- "unit": "s",- "decimalPrecision": "2"- }- }- },- "queries": [- {- "kind": "TimeSeriesQuery",- "spec": {- "plugin": {- "kind": "signoz/BuilderQuery",- "spec": {- "name": "A",- "signal": "metrics",- "aggregations": [- {- "metricName": "container.cpu.time",- "reduceTo": "sum",- "spaceAggregation": "sum",- "timeAggregation": "rate"- }- ],- "filter": {- "expression": ""- }- }- }- }- }- ]- }- },- "251df4d5": {- "kind": "Panel",- "spec": {- "display": {- "name": ""- },- "plugin": {- "kind": "signoz/TimeSeriesPanel",- "spec": {- "visualization": {- "fillSpans": false- },- "formatting": {- "unit": "recommendations",- "decimalPrecision": "2"- },- "chartAppearance": {- "lineInterpolation": "spline",- "showPoints": false,- "lineStyle": "solid",- "fillMode": "none",- "spanGaps": {"fillOnlyBelow": true}- },- "legend": {- "position": "bottom"- }- }- },- "queries": [- {- "kind": "TimeSeriesQuery",- "spec": {- "plugin": {- "kind": "signoz/BuilderQuery",- "spec": {- "name": "A",- "signal": "metrics",- "aggregations": [- {- "metricName": "app_recommendations_counter",- "reduceTo": "sum",- "spaceAggregation": "sum",- "timeAggregation": "rate"- }- ],- "filter": {- "expression": ""- }- }- }- }- }- ]- }- }- },- "layouts": [- {- "kind": "Grid",- "spec": {- "display": {- "title": "Bravo"- },- "items": [- {- "x": 0,- "y": 0,- "width": 6,- "height": 6,- "content": {- "$ref": "#/spec/panels/b424e23b"- }- }- ]- }- },- {- "kind": "Grid",- "spec": {- "display": {- "title": "Alpha"- },- "items": [- {- "x": 0,- "y": 0,- "width": 6,- "height": 6,- "content": {- "$ref": "#/spec/panels/251df4d5"- }- }- ]- }- }- ]-}\ No newline at end of filediff --git a/frontend/src/pages/DashboardsListPageV2/components/ListHeader/ListHeader.module.scss b/frontend/src/pages/DashboardsListPageV2/components/ListHeader/ListHeader.module.scssindex afce1988a2..ef4df9e9db 100644--- a/frontend/src/pages/DashboardsListPageV2/components/ListHeader/ListHeader.module.scss+++ b/frontend/src/pages/DashboardsListPageV2/components/ListHeader/ListHeader.module.scss@@ -6,9 +6,8 @@height: 44px;flex-shrink: 0;border-radius: 6px 6px 0px 0px;- border: 1px solid var(--l1-border);- background: var(--l2-background);- box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.1);+ border: 1px solid var(--l2-border);+ background: var(--l1-background);}.label {@@ -23,10 +22,36 @@.rightActions {display: flex;+ align-items: center;gap: 4px;color: white;}+.sortPrefix {+ color: var(--l3-foreground);+}++// Inline metadata-visibility toggles (replaces the configure modal).+.metaPanel {+ display: flex;+ flex-direction: column;+ min-width: 220px;+ padding: 4px;+}++.metaRow {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 16px;+ padding: 8px 10px;+}++.metaLabel {+ color: var(--l2-foreground);+ font-size: var(--font-size-sm);+}+// Shared trigger button for the sort + configure-group icons in the right// actions cluster. Provides a square hover/active background so users know// which icon they're targeting.diff --git a/frontend/src/pages/DashboardsListPageV2/components/ListHeader/ListHeader.tsx b/frontend/src/pages/DashboardsListPageV2/components/ListHeader/ListHeader.tsxindex be2f3b406c..48295ee0d1 100644--- a/frontend/src/pages/DashboardsListPageV2/components/ListHeader/ListHeader.tsx+++ b/frontend/src/pages/DashboardsListPageV2/components/ListHeader/ListHeader.tsx@@ -1,17 +1,20 @@-import { Button, Popover, Tooltip } from 'antd';+// eslint-disable-next-line signoz/no-antd-components -- Popover/Tooltip not yet migrated for this menu+import { Popover, Tooltip } from 'antd';+import { Button } from '@signozhq/ui/button';+import { Switch } from '@signozhq/ui/switch';import { Typography } from '@signozhq/ui/typography';-import {- ArrowDownWideNarrow,- Check,- Ellipsis,- HdmiPort,-} from '@signozhq/icons';+import { ArrowDown, ArrowUp, Check, HdmiPort } from '@signozhq/icons';import {DashboardtypesListOrderDTO,DashboardtypesListSortDTO,} from 'api/generated/services/sigNoz.schemas';+import {+ type DashboardDynamicColumns,+ useDashboardsListVisibleColumnsStore,+} from '../../store/useVisibleColumnsStore';+import styles from './ListHeader.module.scss';interface Props {@@ -19,131 +22,178 @@ interface Props {onSortChange: (column: DashboardtypesListSortDTO) => void;sortOrder: DashboardtypesListOrderDTO;onOrderChange: (order: DashboardtypesListOrderDTO) => void;- onConfigureMetadata: () => void;}+const SORT_LABELS: Record<DashboardtypesListSortDTO, string> = {+ [DashboardtypesListSortDTO.updated_at]: 'Last updated',+ [DashboardtypesListSortDTO.created_at]: 'Last created',+ [DashboardtypesListSortDTO.name]: 'Name',+};++// Created-at / created-by are always shown; only the "updated" columns toggle.+const METADATA_COLUMNS: {+ key: keyof DashboardDynamicColumns;+ label: string;+}[] = [+ { key: 'updatedAt', label: 'Updated at' },+ { key: 'updatedBy', label: 'Updated by' },+];+function ListHeader({sortColumn,onSortChange,sortOrder,onOrderChange,- onConfigureMetadata,}: Props): JSX.Element {+ const visibleColumns = useDashboardsListVisibleColumnsStore(+ (s) => s.visibleColumns,+ );+ const setVisibleColumns = useDashboardsListVisibleColumnsStore(+ (s) => s.setVisibleColumns,+ );++ const metadataContent = (+ <div className={styles.metaPanel}>+ <Typography.Text className={styles.sortHeading}>Metadata</Typography.Text>+ {METADATA_COLUMNS.map((col) => (+ <div key={col.key} className={styles.metaRow}>+ <Typography.Text className={styles.metaLabel}>{col.label}</Typography.Text>+ <Switch+ value={visibleColumns[col.key]}+ testId={`metadata-toggle-${col.key}`}+ onChange={(checked): void =>+ setVisibleColumns({ ...visibleColumns, [col.key]: checked })+ }+ />+ </div>+ ))}+ </div>+ );+return (<div className={styles.wrapper}>- <Typography.Text className={styles.label}>All Dashboards</Typography.Text>+ <Typography.Text className={styles.label}>Results</Typography.Text><section className={styles.rightActions}>- <Tooltip title="Sort">- <Popover- trigger="click"- content={- <div className={styles.sortContent}>- <Typography.Text className={styles.sortHeading}>- Sort By- </Typography.Text>- <Button- type="text"- className={styles.sortButton}- onClick={(): void => onSortChange(DashboardtypesListSortDTO.name)}- data-testid="sort-by-name"- >- Name- {sortColumn === DashboardtypesListSortDTO.name && <Check size={14} />}- </Button>- <Button- type="text"- className={styles.sortButton}- onClick={(): void =>- onSortChange(DashboardtypesListSortDTO.created_at)- }- data-testid="sort-by-last-created"- >- Last created- {sortColumn === DashboardtypesListSortDTO.created_at && (- <Check size={14} />- )}- </Button>- <Button- type="text"- className={styles.sortButton}- onClick={(): void =>- onSortChange(DashboardtypesListSortDTO.updated_at)- }- data-testid="sort-by-last-updated"- >- Last updated- {sortColumn === DashboardtypesListSortDTO.updated_at && (- <Check size={14} />- )}- </Button>- <div className={styles.sortDivider} />- <Typography.Text className={styles.sortHeading}>Order</Typography.Text>- <Button- type="text"- className={styles.sortButton}- onClick={(): void => onOrderChange(DashboardtypesListOrderDTO.asc)}- data-testid="sort-order-asc"- >- Ascending- {sortOrder === DashboardtypesListOrderDTO.asc && <Check size={14} />}- </Button>- <Button- type="text"- className={styles.sortButton}- onClick={(): void => onOrderChange(DashboardtypesListOrderDTO.desc)}- data-testid="sort-order-desc"- >- Descending- {sortOrder === DashboardtypesListOrderDTO.desc && <Check size={14} />}- </Button>- </div>- }- rootClassName="sortDashboardsPopover"- placement="bottomRight"- arrow={false}- >- <button- type="button"- className={styles.iconTrigger}- data-testid="sort-by"- aria-label="Sort"- >- <ArrowDownWideNarrow size={14} />- </button>- </Popover>- </Tooltip><Popovertrigger="click"content={- <div className={styles.configureContent}>- <button- type="button"- className={styles.configureItem}- onClick={(e): void => {- e.preventDefault();- e.stopPropagation();- onConfigureMetadata();- }}- data-testid="configure-metadata-trigger"+ <div className={styles.sortContent}>+ <Typography.Text className={styles.sortHeading}>Sort By</Typography.Text>+ <Button+ variant="ghost"+ color="secondary"+ className={styles.sortButton}+ onClick={(): void => onSortChange(DashboardtypesListSortDTO.name)}+ testId="sort-by-name"+ suffix={+ sortColumn === DashboardtypesListSortDTO.name ? (+ <Check size={14} />+ ) : undefined+ }>- <span className={styles.configureIcon}>- <HdmiPort size={14} />- </span>- <span>Configure metadata</span>- </button>+ Name+ </Button>+ <Button+ variant="ghost"+ color="secondary"+ className={styles.sortButton}+ onClick={(): void => onSortChange(DashboardtypesListSortDTO.created_at)}+ testId="sort-by-last-created"+ suffix={+ sortColumn === DashboardtypesListSortDTO.created_at ? (+ <Check size={14} />+ ) : undefined+ }+ >+ Last created+ </Button>+ <Button+ variant="ghost"+ color="secondary"+ className={styles.sortButton}+ onClick={(): void => onSortChange(DashboardtypesListSortDTO.updated_at)}+ testId="sort-by-last-updated"+ suffix={+ sortColumn === DashboardtypesListSortDTO.updated_at ? (+ <Check size={14} />+ ) : undefined+ }+ >+ Last updated+ </Button>+ <div className={styles.sortDivider} />+ <Typography.Text className={styles.sortHeading}>Order</Typography.Text>+ <Button+ variant="ghost"+ color="secondary"+ className={styles.sortButton}+ onClick={(): void => onOrderChange(DashboardtypesListOrderDTO.asc)}+ testId="sort-order-asc"+ suffix={+ sortOrder === DashboardtypesListOrderDTO.asc ? (+ <Check size={14} />+ ) : undefined+ }+ >+ Ascending+ </Button>+ <Button+ variant="ghost"+ color="secondary"+ className={styles.sortButton}+ onClick={(): void => onOrderChange(DashboardtypesListOrderDTO.desc)}+ testId="sort-order-desc"+ suffix={+ sortOrder === DashboardtypesListOrderDTO.desc ? (+ <Check size={14} />+ ) : undefined+ }+ >+ Descending+ </Button></div>}- rootClassName="configureGroupPopover"+ rootClassName="sortDashboardsPopover"placement="bottomRight"arrow={false}>- <button- type="button"- className={styles.iconTrigger}- aria-label="More options"+ <Button+ variant="outlined"+ color="secondary"+ size="sm"+ testId="sort-by"+ aria-label="Sort"+ suffix={+ sortOrder === DashboardtypesListOrderDTO.asc ? (+ <ArrowUp size={12} />+ ) : (+ <ArrowDown size={12} />+ )+ }>- <Ellipsis size={14} />- </button>+ <span className={styles.sortPrefix}>Sort:</span>{' '}+ {SORT_LABELS[sortColumn]}{' '}+ </Button>+ </Popover>++ <Popover+ trigger="click"+ content={metadataContent}+ rootClassName="configureGroupPopover"+ placement="bottomRight"+ arrow={false}+ >+ <Tooltip title="Metadata">+ <Button+ variant="ghost"+ color="secondary"+ size="icon"+ aria-label="Metadata"+ testId="configure-metadata-trigger"+ >+ <HdmiPort size={14} />+ </Button>+ </Tooltip></Popover></section></div>diff --git a/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/BlankDashboardPanel.tsx b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/BlankDashboardPanel.tsxnew file mode 100644index 0000000000..3a2411342e--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/BlankDashboardPanel.tsx@@ -0,0 +1,148 @@+import { type ChangeEvent, useState } from 'react';+// eslint-disable-next-line signoz/no-antd-components -- no @signozhq/ui multiline TextArea yet+import { Input as AntInput } from 'antd';+import { Button } from '@signozhq/ui/button';+import { Input } from '@signozhq/ui/input';+import { Typography } from '@signozhq/ui/typography';+import { toast } from '@signozhq/ui/sonner';+import { AxiosError } from 'axios';+import { generatePath } from 'react-router-dom';+import logEvent from 'api/common/logEvent';+import { createDashboardV2 } from 'api/generated/services/dashboard';+import ROUTES from 'constants/routes';+import { useSafeNavigate } from 'hooks/useSafeNavigate';+import { useErrorModal } from 'providers/ErrorModalProvider';+import APIError from 'types/api/error';++import { toPostableTags } from '../../utils';++import styles from './NewDashboardModal.module.scss';++const DEFAULT_NAME = 'Sample Dashboard';++interface Props {+ onClose: () => void;+}++function BlankDashboardPanel({ onClose }: Props): JSX.Element {+ const { safeNavigate } = useSafeNavigate();+ const { showErrorModal } = useErrorModal();++ const [name, setName] = useState(DEFAULT_NAME);+ const [description, setDescription] = useState('');+ const [tags, setTags] = useState('');+ const [submitting, setSubmitting] = useState(false);++ const canSubmit = name.trim().length > 0 && !submitting;++ const handleCreate = async (): Promise<void> => {+ if (!canSubmit) {+ return;+ }+ try {+ setSubmitting(true);+ logEvent('Dashboard List: Create dashboard clicked', {});+ const postableTags = toPostableTags(tags);+ const created = await createDashboardV2({+ schemaVersion: 'v6',+ generateName: true,+ tags: postableTags.length ? postableTags : null,+ spec: {+ display: {+ name: name.trim(),+ description: description.trim() || undefined,+ },+ layouts: [],+ panels: {},+ variables: [],+ },+ });+ safeNavigate(+ generatePath(ROUTES.DASHBOARD, { dashboardId: created.data.id }),+ );+ } catch (e) {+ showErrorModal(e as APIError);+ toast.error((e as AxiosError).toString() || 'Failed to create dashboard');+ setSubmitting(false);+ }+ };++ return (+ <div className={styles.panel}>+ <div className={styles.form}>+ <div className={styles.field}>+ <Typography.Text className={styles.label}>+ Title <span className={styles.required}>*</span>+ </Typography.Text>+ <Input+ value={name}+ autoFocus+ placeholder="e.g. Sample Dashboard"+ testId="create-dashboard-name"+ onChange={(e: ChangeEvent<HTMLInputElement>): void =>+ setName(e.target.value)+ }+ onKeyDown={(e): void => {+ if (e.key === 'Enter') {+ void handleCreate();+ }+ }}+ />+ </div>++ <div className={styles.field}>+ <Typography.Text className={styles.label}>Description</Typography.Text>+ {/* eslint-disable-next-line signoz/no-antd-components -- no @signozhq TextArea yet */}+ <AntInput.TextArea+ value={description}+ rows={3}+ placeholder="What is this dashboard for?"+ data-testid="create-dashboard-description"+ onChange={(e): void => setDescription(e.target.value)}+ />+ </div>++ <div className={styles.field}>+ <Typography.Text className={styles.label}>Tags</Typography.Text>+ <Input+ value={tags}+ placeholder="team:jarvis, prod"+ testId="create-dashboard-tags"+ onChange={(e: ChangeEvent<HTMLInputElement>): void =>+ setTags(e.target.value)+ }+ />+ <Typography.Text className={styles.hint}>+ Comma-separated. Use key:value (e.g. team:jarvis) or a single label.+ </Typography.Text>+ </div>+ </div>++ <div className={styles.footer}>+ <Button+ variant="ghost"+ color="secondary"+ size="md"+ onClick={onClose}+ testId="create-dashboard-cancel"+ >+ Cancel+ </Button>+ <Button+ variant="solid"+ color="primary"+ size="md"+ disabled={!canSubmit}+ testId="create-dashboard-submit"+ onClick={(): void => {+ void handleCreate();+ }}+ >+ Create dashboard+ </Button>+ </div>+ </div>+ );+}++export default BlankDashboardPanel;diff --git a/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/ImportJsonPanel.tsx b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/ImportJsonPanel.tsxnew file mode 100644index 0000000000..8e02007325--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/ImportJsonPanel.tsx@@ -0,0 +1,132 @@+import { useState } from 'react';+import { useTranslation } from 'react-i18next';+import { generatePath } from 'react-router-dom';+import { red } from '@ant-design/colors';+// eslint-disable-next-line signoz/no-antd-components -- Upload has no @signozhq/ui equivalent yet+import { Upload, UploadProps } from 'antd';+import { Button } from '@signozhq/ui/button';+import { toast } from '@signozhq/ui/sonner';+import { Typography } from '@signozhq/ui/typography';+import { CircleAlert, MonitorDot, MoveRight } from '@signozhq/icons';+import logEvent from 'api/common/logEvent';+import { createDashboardV2 } from 'api/generated/services/dashboard';+import ROUTES from 'constants/routes';+import { useSafeNavigate } from 'hooks/useSafeNavigate';+import { useErrorModal } from 'providers/ErrorModalProvider';+import APIError from 'types/api/error';++import { normalizeToPostable } from './importUtils';+import JsonEditor from './JsonEditor';++import styles from './NewDashboardModal.module.scss';++function ImportJsonPanel(): JSX.Element {+ const { safeNavigate } = useSafeNavigate();+ const { t } = useTranslation(['dashboard', 'common']);+ const { showErrorModal } = useErrorModal();++ const [editorValue, setEditorValue] = useState('');+ const [isUploadError, setIsUploadError] = useState(false);+ const [isCreateError, setIsCreateError] = useState(false);+ const [isCreating, setIsCreating] = useState(false);++ const handleUpload: UploadProps['onChange'] = (info) => {+ const lastFile = info.fileList[info.fileList.length - 1];+ if (!lastFile?.originFileObj) {+ return;+ }+ const reader = new FileReader();+ reader.onload = (event): void => {+ try {+ const target = event.target?.result;+ if (!target) {+ return;+ }+ const parsed = JSON.parse(target.toString());+ setEditorValue(JSON.stringify(parsed, null, 2));+ setIsUploadError(false);+ } catch {+ setIsUploadError(true);+ }+ };+ reader.readAsText(lastFile.originFileObj);+ };++ const handleImport = async (): Promise<void> => {+ try {+ setIsCreating(true);+ logEvent('Dashboard List V2: Import and next clicked', {});+ const parsed = JSON.parse(editorValue) as Record<string, unknown>;+ const payload = normalizeToPostable(parsed);+ const response = await createDashboardV2(payload);+ safeNavigate(+ generatePath(ROUTES.DASHBOARD, { dashboardId: response.data.id }),+ );+ } catch (error) {+ showErrorModal(error as APIError);+ setIsCreateError(true);+ toast.error(+ error instanceof Error ? error.message : t('error_loading_json'),+ );+ } finally {+ setIsCreating(false);+ }+ };++ return (+ <div className={styles.panel}>+ <Typography.Text className={styles.importHeader}>+ {t('import_json')}+ </Typography.Text>++ <JsonEditor value={editorValue} onChange={setEditorValue} height="280px" />++ {(isCreateError || isUploadError) && (+ <div className={styles.jsonError}>+ <CircleAlert size="md" color={red[7]} />+ <Typography className={styles.errorText}>+ {isUploadError ? t('error_upload_json') : t('error_loading_json')}+ </Typography>+ </div>+ )}++ <div className={styles.importFooter}>+ <Upload+ accept=".json"+ showUploadList={false}+ multiple={false}+ onChange={handleUpload}+ beforeUpload={(): boolean => false}+ action="none"+ >+ <Button+ variant="outlined"+ color="secondary"+ size="md"+ prefix={<MonitorDot size={14} />}+ testId="upload-json-file"+ onClick={(): void => {+ logEvent('Dashboard List V2: Upload JSON file clicked', {});+ }}+ >+ {t('upload_json_file')}+ </Button>+ </Upload>++ <Button+ variant="solid"+ color="primary"+ size="md"+ loading={isCreating}+ suffix={<MoveRight size={14} />}+ testId="import-json-submit"+ onClick={handleImport}+ >+ {t('import_and_next')}+ </Button>+ </div>+ </div>+ );+}++export default ImportJsonPanel;diff --git a/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/JsonEditor.tsx b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/JsonEditor.tsxnew file mode 100644index 0000000000..6dd72923a1--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/JsonEditor.tsx@@ -0,0 +1,90 @@+import { useState } from 'react';+import MEditor, { Monaco } from '@monaco-editor/react';+import { Color } from '@signozhq/design-tokens';+import { Button } from '@signozhq/ui/button';+import { DialogWrapper } from '@signozhq/ui/dialog';+import { Maximize2 } from '@signozhq/icons';+import { useIsDarkMode } from 'hooks/useDarkMode';++import styles from './NewDashboardModal.module.scss';++interface Props {+ value: string;+ onChange?: (value: string) => void;+ readOnly?: boolean;+ height?: string;+}++const defineTheme = (monaco: Monaco): void => {+ monaco.editor.defineTheme('my-theme', {+ base: 'vs-dark',+ inherit: true,+ rules: [+ { token: 'string.key.json', foreground: Color.BG_VANILLA_400 },+ { token: 'string.value.json', foreground: Color.BG_ROBIN_400 },+ ],+ colors: { 'editor.background': Color.BG_INK_300 },+ });+};++// JSON editor with a one-click "expand" into an extra-wide modal for easier+// editing/review. The expanded editor shares the same value, so edits persist.+function JsonEditor({+ value,+ onChange,+ readOnly = false,+ height = '38vh',+}: Props): JSX.Element {+ const isDarkMode = useIsDarkMode();+ const [expanded, setExpanded] = useState(false);++ const renderEditor = (editorHeight: string): JSX.Element => (+ <MEditor+ language="json"+ height={editorHeight}+ value={value}+ onChange={(next): void => onChange?.(next || '')}+ options={{+ readOnly,+ scrollbar: { alwaysConsumeMouseWheel: false },+ minimap: { enabled: false },+ fontSize: 14,+ fontFamily: 'Space Mono',+ }}+ theme={isDarkMode ? 'my-theme' : 'light'}+ beforeMount={defineTheme}+ />+ );++ return (+ <div className={styles.editorWrap}>+ <Button+ variant="ghost"+ color="secondary"+ size="icon"+ className={styles.expandBtn}+ aria-label="Expand editor"+ testId="json-editor-expand"+ onClick={(): void => setExpanded(true)}+ >+ <Maximize2 size={14} />+ </Button>+ <div className={styles.editor}>{renderEditor(height)}</div>++ <DialogWrapper+ title={readOnly ? 'Preview JSON' : 'Edit JSON'}+ open={expanded}+ width="extra-wide"+ onOpenChange={(next): void => {+ if (!next) {+ setExpanded(false);+ }+ }}+ >+ <div className={styles.editorExpanded}>{renderEditor('70vh')}</div>+ </DialogWrapper>+ </div>+ );+}++export default JsonEditor;diff --git a/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/NewDashboardModal.module.scss b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/NewDashboardModal.module.scssnew file mode 100644index 0000000000..bd757b7dbf--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/NewDashboardModal.module.scss@@ -0,0 +1,195 @@+// Fixed height so the modal doesn't resize when switching tabs.+.panel {+ display: flex;+ flex-direction: column;+ gap: 16px;+ padding-top: 12px;+ height: 460px;+}++.footer {+ display: flex;+ justify-content: flex-end;+ gap: 8px;+ margin-top: auto;+}++.form {+ display: flex;+ flex-direction: column;+ gap: 16px;+}++.field {+ display: flex;+ flex-direction: column;+ gap: 6px;+}++.label {+ font-size: var(--font-size-sm);+ color: var(--l2-foreground);+}++.required {+ color: var(--danger-background);+}++.hint {+ font-size: var(--font-size-xs);+ color: var(--l3-foreground);+}++.loading {+ flex: 1;+ display: flex;+ align-items: center;+ justify-content: center;+ gap: 8px;+ color: var(--l3-foreground);+ font-size: var(--font-size-sm);+}++.spinner {+ animation: spin 1s linear infinite;+}++@keyframes spin {+ to {+ transform: rotate(360deg);+ }+}++.cardName {+ color: var(--l1-foreground);+ font-size: var(--font-size-sm);+ font-weight: var(--font-weight-medium);+}++.cardDesc {+ color: var(--l2-foreground);+ font-size: var(--font-size-xs);+ line-height: 1.45;+}++.requestRow {+ border-top: 1px solid var(--l2-border);+ padding-top: 12px;++ :global(.request-entity-container) {+ gap: 10px 16px;+ padding: 14px 16px;+ }+}++.importHeader {+ font-size: var(--font-size-sm);+ color: var(--l2-foreground);+}++.editorWrap {+ position: relative;+}++.expandBtn {+ position: absolute;+ top: 6px;+ right: 6px;+ z-index: 2;+}++.editor {+ border: 1px solid var(--l2-border);+ border-radius: 6px;+ overflow: hidden;+}++.editorExpanded {+ margin-top: 8px;+}++.templatesLayout {+ display: flex;+ gap: 12px;+ flex: 1;+ min-height: 0;+}++.templatesList {+ flex: none;+ width: 200px;+ display: flex;+ flex-direction: column;+ gap: 4px;+ overflow-y: auto;+ padding-right: 4px;+}++.templateItem {+ display: flex;+ flex-direction: column;+ gap: 2px;+ padding: 8px 10px;+ border: 1px solid transparent;+ border-radius: 6px;+ background: transparent;+ text-align: left;+ cursor: pointer;+ transition:+ background 0.12s,+ border-color 0.12s;+}++.templateItem:hover {+ background: var(--l2-background);+}++.templateItemActive {+ background: var(--l2-background);+ border-color: var(--primary-background);+}++.templateName {+ color: var(--l1-foreground);+ font-size: var(--font-size-sm);+ font-weight: var(--font-weight-medium);+}++.templateCat {+ color: var(--l3-foreground);+ font-size: var(--font-size-xs);+}++.templatesPreview {+ flex: 1;+ min-width: 0;+ display: flex;+ flex-direction: column;+ gap: 10px;+}++.previewHead {+ display: flex;+ align-items: flex-start;+ justify-content: space-between;+ gap: 12px;+}++.jsonError {+ display: flex;+ align-items: center;+ gap: 8px;+}++.errorText {+ color: var(--danger-background);+ font-size: var(--font-size-sm);+}++.importFooter {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 12px;+ margin-top: auto;+}diff --git a/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/NewDashboardModal.tsx b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/NewDashboardModal.tsxnew file mode 100644index 0000000000..1cb2ede0e4--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/NewDashboardModal.tsx@@ -0,0 +1,59 @@+import { useEffect, useState } from 'react';+import { DialogWrapper } from '@signozhq/ui/dialog';+import { Tabs } from '@signozhq/ui/tabs';++import BlankDashboardPanel from './BlankDashboardPanel';+import ImportJsonPanel from './ImportJsonPanel';+import TemplatesPanel from './TemplatesPanel';++interface Props {+ open: boolean;+ onClose: () => void;+}++function NewDashboardModal({ open, onClose }: Props): JSX.Element {+ const [tab, setTab] = useState('blank');++ useEffect(() => {+ if (open) {+ setTab('blank');+ }+ }, [open]);++ return (+ <DialogWrapper+ title="New dashboard"+ open={open}+ width="wide"+ onOpenChange={(next): void => {+ if (!next) {+ onClose();+ }+ }}+ >+ <Tabs+ value={tab}+ onChange={(key): void => setTab(key)}+ items={[+ {+ key: 'blank',+ label: 'Blank',+ children: <BlankDashboardPanel onClose={onClose} />,+ },+ {+ key: 'template',+ label: 'From a template',+ children: <TemplatesPanel />,+ },+ {+ key: 'import',+ label: 'Import JSON',+ children: <ImportJsonPanel />,+ },+ ]}+ />+ </DialogWrapper>+ );+}++export default NewDashboardModal;diff --git a/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/TemplatesPanel.tsx b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/TemplatesPanel.tsxnew file mode 100644index 0000000000..1a5564035d--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/TemplatesPanel.tsx@@ -0,0 +1,139 @@+import { useState } from 'react';+import { generatePath } from 'react-router-dom';+import { Button } from '@signozhq/ui/button';+import { Typography } from '@signozhq/ui/typography';+import { toast } from '@signozhq/ui/sonner';+import { ExternalLink, LoaderCircle } from '@signozhq/icons';+import { AxiosError } from 'axios';+import cx from 'classnames';+import logEvent from 'api/common/logEvent';+import { createDashboardV2 } from 'api/generated/services/dashboard';+import ROUTES from 'constants/routes';+import { RequestDashboardBtn } from 'container/ListOfDashboard/RequestDashboardBtn';+import { useSafeNavigate } from 'hooks/useSafeNavigate';+import { useErrorModal } from 'providers/ErrorModalProvider';+import APIError from 'types/api/error';+import { openInNewTab } from 'utils/navigation';++import { normalizeToPostable } from './importUtils';+import JsonEditor from './JsonEditor';+import { useDashboardTemplates } from './templatesData';++import styles from './NewDashboardModal.module.scss';++// Browse the template gallery (mock data until the API lands): pick one on the+// left to preview its JSON on the right, then use it or open the docs.+function TemplatesPanel(): JSX.Element {+ const { safeNavigate } = useSafeNavigate();+ const { showErrorModal } = useErrorModal();+ const { data, isLoading } = useDashboardTemplates(true);+ const templates = data ?? [];++ const [selectedId, setSelectedId] = useState<string | null>(null);+ const [creating, setCreating] = useState(false);++ const selected = templates.find((t) => t.id === selectedId) ?? templates[0];++ const handleUse = async (): Promise<void> => {+ if (!selected) {+ return;+ }+ try {+ setCreating(true);+ logEvent('Dashboard List: Use template clicked', { template: selected.id });+ const parsed = JSON.parse(selected.json) as Record<string, unknown>;+ const created = await createDashboardV2(normalizeToPostable(parsed));+ safeNavigate(+ generatePath(ROUTES.DASHBOARD, { dashboardId: created.data.id }),+ );+ } catch (e) {+ showErrorModal(e as APIError);+ toast.error(+ (e as AxiosError).toString() || 'Failed to create from template',+ );+ setCreating(false);+ }+ };++ if (isLoading) {+ return (+ <div className={styles.panel}>+ <div className={styles.loading}>+ <LoaderCircle size={18} className={styles.spinner} />+ <span>Loading templates…</span>+ </div>+ </div>+ );+ }++ return (+ <div className={styles.panel}>+ <div className={styles.templatesLayout}>+ <div className={styles.templatesList}>+ {templates.map((template) => (+ <button+ key={template.id}+ type="button"+ className={cx(styles.templateItem, {+ [styles.templateItemActive]: selected?.id === template.id,+ })}+ data-testid={`template-${template.id}`}+ onClick={(): void => setSelectedId(template.id)}+ >+ <span className={styles.templateName}>{template.name}</span>+ <span className={styles.templateCat}>{template.category}</span>+ </button>+ ))}+ </div>++ {selected && (+ <div className={styles.templatesPreview}>+ <div className={styles.previewHead}>+ <div>+ <Typography.Text className={styles.cardName}>+ {selected.name}+ </Typography.Text>+ <Typography.Text className={styles.cardDesc}>+ {selected.description}+ </Typography.Text>+ </div>+ <Button+ variant="ghost"+ color="secondary"+ size="sm"+ suffix={<ExternalLink size={13} />}+ onClick={(): void => openInNewTab(selected.href)}+ testId="template-docs"+ >+ Docs+ </Button>+ </div>++ <JsonEditor value={selected.json} readOnly height="240px" />++ <div className={styles.footer}>+ <Button+ variant="solid"+ color="primary"+ size="md"+ loading={creating}+ testId="use-template"+ onClick={(): void => {+ void handleUse();+ }}+ >+ Use template+ </Button>+ </div>+ </div>+ )}+ </div>++ <div className={styles.requestRow}>+ <RequestDashboardBtn />+ </div>+ </div>+ );+}++export default TemplatesPanel;diff --git a/frontend/src/pages/DashboardsListPageV2/components/ImportJSONModal/ImportJSONModalUtils.ts b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/importUtils.tssimilarity index 100%rename from frontend/src/pages/DashboardsListPageV2/components/ImportJSONModal/ImportJSONModalUtils.tsrename to frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/importUtils.tsdiff --git a/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/templatesData.ts b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/templatesData.tsnew file mode 100644index 0000000000..36849be7cf--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/NewDashboardModal/templatesData.ts@@ -0,0 +1,106 @@+import { useQuery, type UseQueryResult } from 'react-query';++export interface DashboardTemplate {+ id: string;+ name: string;+ description: string;+ category: string;+ href: string;+ // Importable dashboard definition previewed in the gallery (mock for now).+ json: string;+}++// A representative dashboard definition for a template — mock until the API+// returns real ones.+const buildTemplateJson = (+ name: string,+ description: string,+ category: string,+): string =>+ JSON.stringify(+ {+ schemaVersion: 'v6',+ generateName: true,+ tags: [{ key: 'category', value: category.toLowerCase() }],+ spec: {+ display: { name, description },+ layouts: [],+ panels: {},+ variables: [],+ },+ },+ null,+ 2,+ );++// Mock catalogue until the templates API lands. Mirrors the public gallery at+// https://signoz.io/docs/dashboards/dashboard-templates/overview/+const BASE_TEMPLATES: Omit<DashboardTemplate, 'json'>[] = [+ {+ id: 'apm',+ name: 'APM Metrics',+ description: 'Latency, error rate, and throughput across your services.',+ category: 'APM',+ href: 'https://signoz.io/docs/dashboards/dashboard-templates/apm/',+ },+ {+ id: 'hostmetrics',+ name: 'Host Metrics',+ description: 'CPU, memory, disk, and network for your hosts.',+ category: 'Infra',+ href: 'https://signoz.io/docs/dashboards/dashboard-templates/hostmetrics/',+ },+ {+ id: 'kubernetes',+ name: 'Kubernetes Pod Metrics',+ description: 'Pod, node, and container health for your clusters.',+ category: 'Infra',+ href:+ 'https://signoz.io/docs/dashboards/dashboard-templates/kubernetes-pod-metrics-detailed/',+ },+ {+ id: 'postgres',+ name: 'PostgreSQL',+ description: 'Connections, throughput, and query performance.',+ category: 'Databases',+ href: 'https://signoz.io/docs/dashboards/dashboard-templates/postgresql/',+ },+ {+ id: 'redis',+ name: 'Redis',+ description: 'Memory, commands, and hit-rate for Redis instances.',+ category: 'Databases',+ href: 'https://signoz.io/docs/dashboards/dashboard-templates/redis/',+ },+ {+ id: 'nginx',+ name: 'NGINX',+ description: 'Request rate, connections, and error responses.',+ category: 'Web servers',+ href: 'https://signoz.io/docs/dashboards/dashboard-templates/nginx/',+ },+];++const MOCK_TEMPLATES: DashboardTemplate[] = BASE_TEMPLATES.map((t) => ({+ ...t,+ json: buildTemplateJson(t.name, t.description, t.category),+}));++// TODO(@AshwinBhatkal): replace with the real templates API when available.+// The small delay simulates the network round-trip so the loading state is+// exercised (a real API call won't resolve instantly).+const fetchDashboardTemplates = (): Promise<DashboardTemplate[]> =>+ new Promise((resolve) => {+ setTimeout(() => resolve(MOCK_TEMPLATES), 600);+ });++export function useDashboardTemplates(+ enabled: boolean,+): UseQueryResult<DashboardTemplate[]> {+ return useQuery({+ queryKey: ['dashboard-templates'],+ queryFn: fetchDashboardTemplates,+ enabled,+ staleTime: Infinity,+ });+}diff --git a/frontend/src/pages/DashboardsListPageV2/components/SearchBar/SearchBar.tsx b/frontend/src/pages/DashboardsListPageV2/components/SearchBar/SearchBar.tsxindex ce75f32ce5..1ffa6078d3 100644--- a/frontend/src/pages/DashboardsListPageV2/components/SearchBar/SearchBar.tsx+++ b/frontend/src/pages/DashboardsListPageV2/components/SearchBar/SearchBar.tsx@@ -9,12 +9,18 @@ interface Props {value: string;onChange: (value: string) => void;onSubmit: () => void;+ placeholder?: string;}-function SearchBar({ value, onChange, onSubmit }: Props): JSX.Element {+function SearchBar({+ value,+ onChange,+ onSubmit,+ placeholder = "Search with DSL (e.g. name CONTAINS 'foo')",+}: Props): JSX.Element {return (<Input- placeholder="Search with DSL (e.g. name CONTAINS 'foo')"+ placeholder={placeholder}prefix={<Search size={12} color={Color.BG_VANILLA_400} />}suffix={<buttondiff --git a/frontend/src/pages/DashboardsListPageV2/components/StatusBar/StatusBar.module.scss b/frontend/src/pages/DashboardsListPageV2/components/StatusBar/StatusBar.module.scssnew file mode 100644index 0000000000..1fe7b3f14e--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/StatusBar/StatusBar.module.scss@@ -0,0 +1,15 @@+.statusBar {+ display: flex;+ align-items: center;+ gap: 14px;+ height: 36px;+ flex: none;+ padding: 0 16px;+ border-top: 1px solid var(--l2-border);+ background: var(--l1-background);+}++.count {+ font-size: var(--font-size-xs);+ color: var(--l3-foreground);+}diff --git a/frontend/src/pages/DashboardsListPageV2/components/StatusBar/StatusBar.tsx b/frontend/src/pages/DashboardsListPageV2/components/StatusBar/StatusBar.tsxnew file mode 100644index 0000000000..7c95f98278--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/StatusBar/StatusBar.tsx@@ -0,0 +1,41 @@+import { Button } from '@signozhq/ui/button';+import { Typography } from '@signozhq/ui/typography';+import { PanelLeftClose, PanelLeftOpen } from '@signozhq/icons';++import styles from './StatusBar.module.scss';++interface Props {+ collapsed: boolean;+ onToggleCollapse: () => void;+ count: number;+ total: number;+}++function StatusBar({+ collapsed,+ onToggleCollapse,+ count,+ total,+}: Props): JSX.Element {+ return (+ <div className={styles.statusBar}>+ <Button+ variant="ghost"+ color="secondary"+ size="sm"+ prefix={+ collapsed ? <PanelLeftOpen size={14} /> : <PanelLeftClose size={14} />+ }+ onClick={onToggleCollapse}+ testId="dashboards-rail-toggle"+ >+ {collapsed ? 'Expand' : 'Collapse'}+ </Button>+ <Typography.Text className={styles.count}>+ {count} of {total} dashboards+ </Typography.Text>+ </div>+ );+}++export default StatusBar;diff --git a/frontend/src/pages/DashboardsListPageV2/components/ViewsRail/SaveViewPopover.tsx b/frontend/src/pages/DashboardsListPageV2/components/ViewsRail/SaveViewPopover.tsxnew file mode 100644index 0000000000..6874a91cc7--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/ViewsRail/SaveViewPopover.tsx@@ -0,0 +1,110 @@+import { type ChangeEvent, type ReactNode, useEffect, useState } from 'react';+import { Button } from '@signozhq/ui/button';+import { Input } from '@signozhq/ui/input';+import { PopoverSimple } from '@signozhq/ui/popover';+import cx from 'classnames';++import { VIEW_ICON_OPTIONS } from '../../views';++import styles from './ViewsRail.module.scss';++interface Props {+ open: boolean;+ onOpenChange: (open: boolean) => void;+ onSave: (name: string, icon: string) => void;+ trigger: ReactNode;+}++const DEFAULT_ICON = VIEW_ICON_OPTIONS[0].name;++function SaveViewPopover({+ open,+ onOpenChange,+ onSave,+ trigger,+}: Props): JSX.Element {+ const [name, setName] = useState('');+ const [icon, setIcon] = useState(DEFAULT_ICON);++ useEffect(() => {+ if (open) {+ setName('');+ setIcon(DEFAULT_ICON);+ }+ }, [open]);++ const canSave = name.trim().length > 0;++ const handleSave = (): void => {+ if (canSave) {+ onSave(name, icon);+ onOpenChange(false);+ }+ };++ return (+ <PopoverSimple+ open={open}+ onOpenChange={onOpenChange}+ align="start"+ trigger={trigger}+ >+ <div className={styles.savePopover}>+ <div className={styles.saveTitle}>Save as view</div>+ <span className={styles.saveLabel}>Name</span>+ <Input+ value={name}+ autoFocus+ placeholder="e.g. Prod alerts"+ testId="save-view-name"+ onChange={(e: ChangeEvent<HTMLInputElement>): void =>+ setName(e.target.value)+ }+ onKeyDown={(e): void => {+ if (e.key === 'Enter') {+ handleSave();+ }+ }}+ />+ <span className={styles.saveLabel}>Icon</span>+ <div className={styles.iconGrid}>+ {VIEW_ICON_OPTIONS.map(({ name: iconName, Icon }) => (+ <button+ key={iconName}+ type="button"+ aria-label={iconName}+ className={cx(styles.iconCell, {+ [styles.iconCellOn]: icon === iconName,+ })}+ onClick={(): void => setIcon(iconName)}+ >+ <Icon size={14} />+ </button>+ ))}+ </div>+ <div className={styles.saveActions}>+ <Button+ variant="ghost"+ color="secondary"+ size="sm"+ onClick={(): void => onOpenChange(false)}+ >+ Cancel+ </Button>+ <Button+ variant="solid"+ color="primary"+ size="sm"+ disabled={!canSave}+ testId="save-view-confirm"+ onClick={handleSave}+ >+ Save view+ </Button>+ </div>+ </div>+ </PopoverSimple>+ );+}++export default SaveViewPopover;diff --git a/frontend/src/pages/DashboardsListPageV2/components/ViewsRail/ViewsRail.module.scss b/frontend/src/pages/DashboardsListPageV2/components/ViewsRail/ViewsRail.module.scssnew file mode 100644index 0000000000..d773f7c5a0--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/ViewsRail/ViewsRail.module.scss@@ -0,0 +1,256 @@+.rail {+ display: flex;+ flex-direction: column;+ width: 300px;+ flex: none;+ border-right: 1px solid var(--l2-border);+ background: var(--l1-background);+ overflow: hidden;+ transition: width 0.18s cubic-bezier(0.2, 0.7, 0.3, 1);+}++.collapsed {+ width: 0;+ border-right-color: transparent;+}++.header {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 8px;+ padding: 14px 12px 10px 16px;+}++.headerTitle {+ margin: 0;+ font-size: var(--font-size-base);+ font-weight: var(--font-weight-semibold);+ letter-spacing: -0.01em;+ color: var(--l1-foreground);+}++.search {+ padding: 0 12px 10px;+}++.searchEmpty {+ padding: 12px;+ color: var(--l3-foreground);+ font-size: var(--font-size-xs);+ text-align: center;+}++.scroll {+ flex: 1;+ min-height: 0;+ overflow-y: auto;+ padding: 0 8px 8px;+}++.groupLabel {+ display: flex;+ align-items: center;+ gap: 6px;+ padding: 16px 8px 8px;+ font-size: var(--font-size-xs);+ font-weight: var(--font-weight-semibold);+ letter-spacing: 0.08em;+ text-transform: uppercase;+ color: var(--l3-foreground);+}++.groupLabelSpaced {+ margin-top: 10px;+ border-top: 1px solid var(--l2-border);+ padding-top: 18px;+}++.groupCount {+ font-size: var(--font-size-xs);+ font-weight: var(--font-weight-normal);+ letter-spacing: 0;+ color: var(--l3-foreground);+ background: var(--l2-background);+ border-radius: 10px;+ padding: 1px 6px;+}++.row {+ display: flex;+ align-items: center;+ margin: 3px 0;+ border-radius: 6px;+ transition: background 0.12s;+}++.row:hover {+ background: var(--l2-background);+}++.rowActive {+ background: var(--l2-background);+}++.item {+ // Neutralise the signoz Button defaults so it reads as a full-width,+ // left-aligned list row; the row coordinates hover/active colours below.+ --button-display: flex;+ --button-justify-content: flex-start;+ --button-height: auto;+ --button-padding: 9px 10px;+ --button-gap: 10px;+ --button-variant-ghost-background-color: transparent;+ --button-variant-ghost-hover-background-color: transparent;+ --button-variant-ghost-color: var(--l2-foreground);+ --button-variant-ghost-hover-color: var(--l1-foreground);+ flex: 1;+ min-width: 0;+ width: 100%;+ font-size: var(--font-size-sm);+}++.row:hover .item,+.rowActive .item {+ --button-variant-ghost-color: var(--l1-foreground);+}++.itemIcon {+ display: inline-flex;+ color: var(--l3-foreground);+}++.rowActive .itemIcon {+ color: var(--primary-background);+}++.itemLabel {+ flex: 1;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}++.dirtyDot {+ width: 7px;+ height: 7px;+ border-radius: 50%;+ background: var(--warning-background);+ flex: none;+}++.itemAction {+ // Square icon button that surfaces on row hover and turns red on its own+ // hover; colours flow through the signoz Button tokens.+ --button-height: auto;+ --button-padding: 0;+ --button-border-radius: 4px;+ --button-variant-ghost-background-color: transparent;+ --button-variant-ghost-color: var(--l3-foreground);+ --button-variant-ghost-hover-background-color: var(--danger-background);+ --button-variant-ghost-hover-color: var(--danger-color, #fff);+ width: 20px;+ height: 20px;+ margin-right: 8px;+ opacity: 0;+ transition: opacity 0.1s;+}++.row:hover .itemAction {+ opacity: 1;+}++.empty {+ margin: 4px 8px;+ padding: 12px;+ border: 1px dashed var(--l2-border);+ border-radius: 8px;+ color: var(--l3-foreground);+ font-size: var(--font-size-xs);+ line-height: 1.5;+ text-align: center;+}++.dirtyPanel {+ flex: none;+ padding: 12px 14px;+ border-top: 1px solid var(--l2-border);+ background: var(--l2-background);+}++.dirtyPanelDefault {+ background: var(--l1-background);+}++.dirtyTitle {+ font-size: var(--font-size-xs);+ font-weight: var(--font-weight-semibold);+ letter-spacing: 0.04em;+ text-transform: uppercase;+ color: var(--l2-foreground);+ margin-bottom: 8px;+}++.dirtyActions {+ display: flex;+ flex-wrap: wrap;+ gap: 6px;+}++.savePopover {+ display: flex;+ flex-direction: column;+ gap: 8px;+ width: 280px;+ padding: 4px;+}++.saveTitle {+ font-size: var(--font-size-sm);+ font-weight: var(--font-weight-semibold);+ color: var(--l1-foreground);+}++.saveLabel {+ font-size: var(--font-size-xs);+ color: var(--l3-foreground);+ margin-top: 2px;+}++.iconGrid {+ display: grid;+ grid-template-columns: repeat(5, 1fr);+ gap: 6px;+}++.iconCell {+ display: flex;+ align-items: center;+ justify-content: center;+ height: 34px;+ border: 1px solid var(--l2-border);+ border-radius: 6px;+ background: var(--l2-background);+ color: var(--l2-foreground);+ cursor: pointer;+ transition:+ border-color 0.12s,+ color 0.12s;+}++.iconCell:hover {+ color: var(--l1-foreground);+ border-color: var(--l3-foreground);+}++.iconCellOn {+ border-color: var(--primary-background);+ color: var(--primary-background);+}++.saveActions {+ display: flex;+ justify-content: flex-end;+ gap: 8px;+ margin-top: 4px;+}diff --git a/frontend/src/pages/DashboardsListPageV2/components/ViewsRail/ViewsRail.tsx b/frontend/src/pages/DashboardsListPageV2/components/ViewsRail/ViewsRail.tsxnew file mode 100644index 0000000000..8ceb1e9ab9--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/components/ViewsRail/ViewsRail.tsx@@ -0,0 +1,283 @@+import { type ChangeEvent, useCallback, useState } from 'react';+import { Modal } from 'antd';+import { Button } from '@signozhq/ui/button';+import { Input } from '@signozhq/ui/input';+import { Typography } from '@signozhq/ui/typography';+import { CircleAlert, Plus, Search, Trash2 } from '@signozhq/icons';+import cx from 'classnames';++import type { SavedView } from '../../types';+import { type BuiltinView, iconByName } from '../../views';+import SaveViewPopover from './SaveViewPopover';++import styles from './ViewsRail.module.scss';++interface Props {+ activeViewId: string;+ builtinViews: BuiltinView[];+ customViews: SavedView[];+ isCustomActive: boolean;+ isModified: boolean;+ collapsed?: boolean;+ onSelect: (id: string) => void;+ onSave: (name: string, icon: string) => void;+ onSaveChanges: () => void;+ onReset: () => void;+ onClearFilters: () => void;+ onDelete: (id: string) => void;+}++interface ViewRow {+ id: string;+ label: string;+ icon: BuiltinView['icon'];+ deletable?: boolean;+}++// Purely presentational — active view, dirty state, and handlers come from+// `useActiveView`.+function ViewsRail({+ activeViewId,+ builtinViews,+ customViews,+ isCustomActive,+ isModified,+ collapsed = false,+ onSelect,+ onSave,+ onSaveChanges,+ onReset,+ onClearFilters,+ onDelete,+}: Props): JSX.Element {+ const [saveOpen, setSaveOpen] = useState(false);+ const [query, setQuery] = useState('');+ const [modal, contextHolder] = Modal.useModal();++ const q = query.trim().toLowerCase();+ const matchesQuery = (label: string): boolean =>+ !q || label.toLowerCase().includes(q);++ const personal = builtinViews.filter(+ (v) => v.section === 'personal' && matchesQuery(v.label),+ );+ const system = builtinViews.filter(+ (v) => v.section === 'system' && matchesQuery(v.label),+ );+ const custom = customViews.filter((v) => matchesQuery(v.name));+ const noMatches =+ !!q && personal.length === 0 && system.length === 0 && custom.length === 0;++ const confirmDelete = useCallback(+ (id: string, label: string): void => {+ const { destroy } = modal.confirm({+ title: (+ <Typography.Title level={5}>+ Delete the+ <span style={{ color: 'var(--danger-background)', fontWeight: 500 }}>+ {' '}+ {label}{' '}+ </span>+ view?+ </Typography.Title>+ ),+ content: 'This removes the saved view. Your dashboards are not affected.',+ icon: (+ <CircleAlert+ style={{ color: 'var(--danger-background)', marginInlineEnd: '12px' }}+ size="3xl"+ />+ ),+ okText: 'Delete',+ okButtonProps: {+ danger: true,+ onClick: (e): void => {+ e.preventDefault();+ e.stopPropagation();+ onDelete(id);+ destroy();+ },+ },+ centered: true,+ });+ },+ [modal, onDelete],+ );++ const renderItem = (row: ViewRow): JSX.Element => {+ const Icon = row.icon;+ const active = row.id === activeViewId;+ return (+ <div key={row.id} className={cx(styles.row, { [styles.rowActive]: active })}>+ <Button+ variant="ghost"+ color="secondary"+ className={styles.item}+ onClick={(): void => onSelect(row.id)}+ testId={`dashboards-view-${row.id}`}+ >+ <span className={styles.itemIcon}>+ <Icon size={14} />+ </span>+ <span className={styles.itemLabel}>{row.label}</span>+ {active && isModified && (+ <span className={styles.dirtyDot} title="Unsaved changes" />+ )}+ </Button>+ {row.deletable && (+ <Button+ variant="ghost"+ color="secondary"+ size="icon"+ className={styles.itemAction}+ aria-label="Delete view"+ title="Delete view"+ onClick={(): void => confirmDelete(row.id, row.label)}+ >+ <Trash2 size={12} />+ </Button>+ )}+ </div>+ );+ };++ return (+ <aside className={cx(styles.rail, { [styles.collapsed]: collapsed })}>+ <div className={styles.header}>+ <h4 className={styles.headerTitle}>Views</h4>+ <SaveViewPopover+ open={saveOpen}+ onOpenChange={setSaveOpen}+ onSave={onSave}+ trigger={+ <Button+ variant="ghost"+ color="secondary"+ size="icon"+ title="Save current filters as a view"+ testId="dashboards-view-save-trigger"+ >+ <Plus size={14} />+ </Button>+ }+ />+ </div>++ <div className={styles.search}>+ <Input+ value={query}+ placeholder="Search views"+ prefix={<Search size={12} />}+ testId="dashboards-view-search"+ onChange={(e: ChangeEvent<HTMLInputElement>): void =>+ setQuery(e.target.value)+ }+ />+ </div>++ <div className={styles.scroll}>+ {personal.length > 0 && (+ <>+ <div className={styles.groupLabel}>Personal</div>+ {personal.map((v) => renderItem(v))}+ </>+ )}++ {system.length > 0 && (+ <>+ <div className={cx(styles.groupLabel, styles.groupLabelSpaced)}>+ System+ </div>+ {system.map((v) => renderItem(v))}+ </>+ )}++ {(!q || custom.length > 0) && (+ <>+ <div className={cx(styles.groupLabel, styles.groupLabelSpaced)}>+ My views+ <span className={styles.groupCount}>{customViews.length}</span>+ </div>+ {customViews.length === 0 ? (+ <div className={styles.empty}>+ No saved views yet. Filter the list, then save it as a view.+ </div>+ ) : (+ custom.map((v) =>+ renderItem({+ id: v.id,+ label: v.name,+ icon: iconByName(v.icon),+ deletable: true,+ }),+ )+ )}+ </>+ )}++ {noMatches && (+ <div className={styles.searchEmpty}>+ No views match “{query}”+ </div>+ )}+ </div>++ {isCustomActive && isModified && (+ <div className={styles.dirtyPanel}>+ <div className={styles.dirtyTitle}>Unsaved changes</div>+ <div className={styles.dirtyActions}>+ <Button+ variant="solid"+ color="primary"+ size="sm"+ onClick={onSaveChanges}+ testId="dashboards-view-save-changes"+ >+ Save+ </Button>+ <Button+ variant="outlined"+ color="secondary"+ size="sm"+ onClick={(): void => setSaveOpen(true)}+ >+ Save as…+ </Button>+ <Button variant="ghost" color="secondary" size="sm" onClick={onReset}>+ Reset+ </Button>+ </div>+ </div>+ )}++ {!isCustomActive && isModified && (+ <div className={cx(styles.dirtyPanel, styles.dirtyPanelDefault)}>+ <div className={styles.dirtyTitle}>Filters active</div>+ <div className={styles.dirtyActions}>+ <Button+ variant="solid"+ color="primary"+ size="sm"+ prefix={<Plus size={12} />}+ onClick={(): void => setSaveOpen(true)}+ testId="dashboards-view-save-as-new"+ >+ Save as new view+ </Button>+ <Button+ variant="ghost"+ color="secondary"+ size="sm"+ onClick={onClearFilters}+ >+ Clear+ </Button>+ </div>+ </div>+ )}+ {contextHolder}+ </aside>+ );+}++export default ViewsRail;diff --git a/frontend/src/pages/DashboardsListPageV2/components/states/LoadingState/LoadingState.module.scss b/frontend/src/pages/DashboardsListPageV2/components/states/LoadingState/LoadingState.module.scssindex 82345e3658..3917858924 100644--- a/frontend/src/pages/DashboardsListPageV2/components/states/LoadingState/LoadingState.module.scss+++ b/frontend/src/pages/DashboardsListPageV2/components/states/LoadingState/LoadingState.module.scss@@ -1,11 +1,18 @@.wrapper {display: flex;flex-direction: column;- gap: 16px;+ gap: 12px;margin-top: 16px;+ width: 100%;}.skeleton {- height: 125px;width: 100%;+ height: 76px;++ // antd sizes the inner input element; stretch it to fill the row.+ :global(.ant-skeleton-input) {+ width: 100% !important;+ height: 76px !important;+ }}diff --git a/frontend/src/pages/DashboardsListPageV2/components/states/LoadingState/LoadingState.tsx b/frontend/src/pages/DashboardsListPageV2/components/states/LoadingState/LoadingState.tsxindex dcc098f44c..b0e4ae2ad9 100644--- a/frontend/src/pages/DashboardsListPageV2/components/states/LoadingState/LoadingState.tsx+++ b/frontend/src/pages/DashboardsListPageV2/components/states/LoadingState/LoadingState.tsx@@ -2,13 +2,14 @@ import { Skeleton } from 'antd';import styles from './LoadingState.module.scss';+const ROWS = [0, 1, 2, 3, 4];+function LoadingState(): JSX.Element {return (<div className={styles.wrapper}>- <Skeleton.Input active size="large" className={styles.skeleton} />- <Skeleton.Input active size="large" className={styles.skeleton} />- <Skeleton.Input active size="large" className={styles.skeleton} />- <Skeleton.Input active size="large" className={styles.skeleton} />+ {ROWS.map((row) => (+ <Skeleton.Input key={row} active block className={styles.skeleton} />+ ))}</div>);}diff --git a/frontend/src/pages/DashboardsListPageV2/components/states/NoResultsState/NoResultsState.module.scss b/frontend/src/pages/DashboardsListPageV2/components/states/NoResultsState/NoResultsState.module.scssindex c414aaf0c1..cba53f458f 100644--- a/frontend/src/pages/DashboardsListPageV2/components/states/NoResultsState/NoResultsState.module.scss+++ b/frontend/src/pages/DashboardsListPageV2/components/states/NoResultsState/NoResultsState.module.scss@@ -3,3 +3,15 @@padding: 105px 190px;gap: 8px;}++.title {+ color: var(--l1-foreground);+ font-size: var(--font-size-base);+ font-weight: var(--font-weight-medium);+}++.description {+ color: var(--l3-foreground);+ font-size: var(--font-size-sm);+ text-align: center;+}diff --git a/frontend/src/pages/DashboardsListPageV2/components/states/NoResultsState/NoResultsState.tsx b/frontend/src/pages/DashboardsListPageV2/components/states/NoResultsState/NoResultsState.tsxindex d637ca2ce7..98e5e4d92c 100644--- a/frontend/src/pages/DashboardsListPageV2/components/states/NoResultsState/NoResultsState.tsx+++ b/frontend/src/pages/DashboardsListPageV2/components/states/NoResultsState/NoResultsState.tsx@@ -5,16 +5,20 @@ import emptyStateUrl from '@/assets/Icons/emptyState.svg';import styles from './NoResultsState.module.scss';interface Props {- searchString: string;+ title: string;+ description?: string;}-function NoResultsState({ searchString }: Props): JSX.Element {+function NoResultsState({ title, description }: Props): JSX.Element {return (<div className={styles.wrapper}>- <img src={emptyStateUrl} alt="img" height={32} width={32} />- <Typography.Text>- No dashboards found for {searchString}. Create a new dashboard?- </Typography.Text>+ <img src={emptyStateUrl} alt="" height={32} width={32} />+ <Typography.Text className={styles.title}>{title}</Typography.Text>+ {description && (+ <Typography.Text className={styles.description}>+ {description}+ </Typography.Text>+ )}</div>);}diff --git a/frontend/src/pages/DashboardsListPageV2/filterQuery.ts b/frontend/src/pages/DashboardsListPageV2/filterQuery.tsnew file mode 100644index 0000000000..661a7a3214--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/filterQuery.ts@@ -0,0 +1,85 @@+// Pure, side-effect-free helpers that translate the UI filter state into the+// backend list-filter DSL string (`GET /api/v2/dashboards?query=…`). Kept+// testable and free of React so the same builder backs live filtering, saved+// views, and built-in views.+//+// DSL reference (subset used here):+// name CONTAINS 'text'+// updated_at >= '2026-06-01T00:00:00.000Z' (RFC3339)+// locked = true+// clauses joined with AND+import dayjs from 'dayjs';++import type { DashboardFilterState, UpdatedWindow } from './types';++export const DEFAULT_FILTER_STATE: DashboardFilterState = {+ search: '',+ createdBy: [],+ updated: 'any',+};++const UPDATED_WINDOW_DAYS: Record<Exclude<UpdatedWindow, 'any'>, number> = {+ today: 1,+ '7d': 7,+ '30d': 30,+};++// Single-quoted DSL string literal with embedded quotes escaped.+const literal = (value: string): string => `'${value.replace(/'/g, "\\'")}'`;++const updatedClause = (window: UpdatedWindow): string | null => {+ if (window === 'any') {+ return null;+ }+ const cutoff = dayjs()+ .subtract(UPDATED_WINDOW_DAYS[window], 'day')+ .toISOString();+ return `updated_at >= ${literal(cutoff)}`;+};++export const filterStateToQuery = (state: DashboardFilterState): string => {+ const clauses: string[] = [];++ const search = state.search.trim();+ if (search) {+ clauses.push(`name CONTAINS ${literal(search)}`);+ }++ if (state.createdBy.length === 1) {+ clauses.push(`created_by = ${literal(state.createdBy[0])}`);+ } else if (state.createdBy.length > 1) {+ clauses.push(`created_by IN [${state.createdBy.map(literal).join(', ')}]`);+ }++ const updated = updatedClause(state.updated);+ if (updated) {+ clauses.push(updated);+ }++ return clauses.join(' AND ');+};++// Combine independent query fragments (e.g. a built-in view's `locked = true`+// plus the live filter state) into a single AND-composed query.+export const combineQueries = (+ ...parts: (string | null | undefined)[]+): string =>+ parts+ .map((p) => p?.trim())+ .filter((p): p is string => !!p)+ .join(' AND ');++export const isFilterStateEmpty = (state: DashboardFilterState): boolean =>+ !state.search.trim() &&+ state.createdBy.length === 0 &&+ state.updated === 'any';++export const areFilterStatesEqual = (+ a: DashboardFilterState,+ b: DashboardFilterState,+): boolean =>+ a.search.trim() === b.search.trim() &&+ a.updated === b.updated &&+ a.createdBy.length === b.createdBy.length &&+ [...a.createdBy].sort().join(',') === [...b.createdBy].sort().join(',');diff --git a/frontend/src/pages/DashboardsListPageV2/hooks/useActiveView.ts b/frontend/src/pages/DashboardsListPageV2/hooks/useActiveView.tsnew file mode 100644index 0000000000..17fd7d4759--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/hooks/useActiveView.ts@@ -0,0 +1,142 @@+import { useCallback, useMemo } from 'react';+import { parseAsString, useQueryState, type Options } from 'nuqs';++import { DEFAULT_FILTER_STATE, areFilterStatesEqual } from '../filterQuery';+import { useDashboardViewsStore } from '../store/useDashboardViewsStore';+import type { DashboardFilterState, SavedView } from '../types';+import {+ BUILTIN_VIEWS,+ builtinViewQuery,+ builtinViewSnapshot,+ type BuiltinView,+ isClientView,+} from '../views';++const opts: Options = { history: 'push' };++interface UseActiveViewArgs {+ filters: DashboardFilterState;+ applyFilters: (next: DashboardFilterState) => void;+ userEmail: string;+}++export interface UseActiveViewResult {+ activeViewId: string;+ builtinViews: BuiltinView[];+ customViews: SavedView[];+ isCustomActive: boolean;+ // Current filters diverge from the active view's canonical snapshot.+ isModified: boolean;+ // Extra server-query fragment the active view contributes, and whether it+ // constrains the list client-side (favorites/recent).+ viewQuery: string;+ clientView: boolean;+ selectView: (id: string) => void;+ saveView: (name: string, icon: string) => void;+ saveActiveView: () => void;+ resetView: () => void;+ removeView: (id: string) => void;+}++// Orchestrates the active view: which view is selected (URL `view` param),+// merging built-in + persisted custom views, applying a view's snapshot on+// select, dirty detection, and save/reset/delete.+export function useActiveView({+ filters,+ applyFilters,+ userEmail,+}: UseActiveViewArgs): UseActiveViewResult {+ const [activeViewId, setActiveViewId] = useQueryState(+ 'view',+ parseAsString.withDefault('all').withOptions(opts),+ );++ const customViews = useDashboardViewsStore((s) => s.customViews);+ const addView = useDashboardViewsStore((s) => s.addView);+ const updateView = useDashboardViewsStore((s) => s.updateView);+ const deleteView = useDashboardViewsStore((s) => s.deleteView);++ const activeCustom = useMemo(+ () => customViews.find((v) => v.id === activeViewId),+ [customViews, activeViewId],+ );++ // The filter state the active view "is" — used to detect divergence.+ const canonicalSnapshot = useMemo<DashboardFilterState | null>(+ () =>+ activeCustom+ ? activeCustom.filters+ : builtinViewSnapshot(activeViewId, userEmail),+ [activeCustom, activeViewId, userEmail],+ );++ const isModified = canonicalSnapshot+ ? !areFilterStatesEqual(filters, canonicalSnapshot)+ : false;++ const selectView = useCallback(+ (id: string): void => {+ void setActiveViewId(id);+ const custom = customViews.find((v) => v.id === id);+ applyFilters(+ custom?.filters ??+ builtinViewSnapshot(id, userEmail) ??+ DEFAULT_FILTER_STATE,+ );+ },+ [setActiveViewId, customViews, applyFilters, userEmail],+ );++ const saveView = useCallback(+ (name: string, icon: string): void => {+ const id = `cv_${Date.now()}`;+ addView({+ id,+ name: name.trim(),+ icon,+ filters: { ...filters },+ createdAt: Date.now(),+ });+ void setActiveViewId(id);+ },+ [addView, filters, setActiveViewId],+ );++ const saveActiveView = useCallback((): void => {+ if (activeCustom) {+ updateView(activeCustom.id, { filters: { ...filters } });+ }+ }, [activeCustom, updateView, filters]);++ const resetView = useCallback((): void => {+ if (canonicalSnapshot) {+ applyFilters(canonicalSnapshot);+ }+ }, [canonicalSnapshot, applyFilters]);++ const removeView = useCallback(+ (id: string): void => {+ deleteView(id);+ if (activeViewId === id) {+ void setActiveViewId('all');+ applyFilters(DEFAULT_FILTER_STATE);+ }+ },+ [deleteView, activeViewId, setActiveViewId, applyFilters],+ );++ return {+ activeViewId,+ builtinViews: BUILTIN_VIEWS,+ customViews,+ isCustomActive: !!activeCustom,+ isModified,+ viewQuery: builtinViewQuery(activeViewId),+ clientView: isClientView(activeViewId),+ selectView,+ saveView,+ saveActiveView,+ resetView,+ removeView,+ };+}diff --git a/frontend/src/pages/DashboardsListPageV2/hooks/useDashboardFilters.ts b/frontend/src/pages/DashboardsListPageV2/hooks/useDashboardFilters.tsnew file mode 100644index 0000000000..0675ba33f8--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/hooks/useDashboardFilters.ts@@ -0,0 +1,102 @@+import { useCallback, useMemo } from 'react';+import {+ parseAsArrayOf,+ parseAsString,+ parseAsStringLiteral,+ useQueryState,+ type Options,+} from 'nuqs';++import {+ DEFAULT_FILTER_STATE,+ filterStateToQuery,+ isFilterStateEmpty,+} from '../filterQuery';+import type { DashboardFilterState, UpdatedWindow } from '../types';++const UPDATED_WINDOWS: UpdatedWindow[] = ['any', 'today', '7d', '30d'];++const opts: Options = { history: 'push' };++export interface UseDashboardFiltersResult {+ filters: DashboardFilterState;+ // The backend list-filter `query` string derived from the current filters.+ query: string;+ isEmpty: boolean;+ setSearch: (value: string) => void;+ setCreatedBy: (emails: string[]) => void;+ setUpdated: (window: UpdatedWindow) => void;+ // Replace the whole filter state at once — used when applying a saved view.+ applyFilters: (next: DashboardFilterState) => void;+ clearAll: () => void;+}++// Owns the dashboards-list filter state, synced to the URL (shareable links,+// back/forward) and projected into the backend `query` string. Sort/order/page+// live in their own query-param hooks; this hook is filters-only.+export function useDashboardFilters(): UseDashboardFiltersResult {+ const [search, setSearchState] = useQueryState(+ 'search',+ parseAsString.withDefault('').withOptions(opts),+ );+ const [createdBy, setCreatedByState] = useQueryState(+ 'createdBy',+ parseAsArrayOf(parseAsString).withDefault([]).withOptions(opts),+ );+ const [updated, setUpdatedState] = useQueryState(+ 'updated',+ parseAsStringLiteral(UPDATED_WINDOWS).withDefault('any').withOptions(opts),+ );++ const filters = useMemo<DashboardFilterState>(+ () => ({ search, createdBy, updated }),+ [search, createdBy, updated],+ );++ const query = useMemo(() => filterStateToQuery(filters), [filters]);++ const setSearch = useCallback(+ (value: string): void => {+ void setSearchState(value);+ },+ [setSearchState],+ );++ const setCreatedBy = useCallback(+ (emails: string[]): void => {+ void setCreatedByState(emails.length ? emails : null);+ },+ [setCreatedByState],+ );++ const setUpdated = useCallback(+ (window: UpdatedWindow): void => {+ void setUpdatedState(window);+ },+ [setUpdatedState],+ );++ const applyFilters = useCallback(+ (next: DashboardFilterState): void => {+ void setSearchState(next.search || null);+ void setCreatedByState(next.createdBy.length ? next.createdBy : null);+ void setUpdatedState(next.updated);+ },+ [setSearchState, setCreatedByState, setUpdatedState],+ );++ const clearAll = useCallback((): void => {+ applyFilters(DEFAULT_FILTER_STATE);+ }, [applyFilters]);++ return {+ filters,+ query,+ isEmpty: isFilterStateEmpty(filters),+ setSearch,+ setCreatedBy,+ setUpdated,+ applyFilters,+ clearAll,+ };+}diff --git a/frontend/src/pages/DashboardsListPageV2/store/useDashboardViewsStore.ts b/frontend/src/pages/DashboardsListPageV2/store/useDashboardViewsStore.tsnew file mode 100644index 0000000000..750981650b--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/store/useDashboardViewsStore.ts@@ -0,0 +1,75 @@+import { create } from 'zustand';+import { persist } from 'zustand/middleware';+import { LOCALSTORAGE } from 'constants/localStorage';++import type { SavedView } from '../types';++// Most-recently-viewed list is capped so it stays a useful shortlist.+const RECENT_LIMIT = 20;++// Client-side persistence for everything the views feature owns until the views+// API lands: user-saved views, favorite/recently-viewed dashboard ids, and the+// rail collapse preference. Mirrors `useDashboardsListVisibleColumnsStore`.+interface DashboardViewsState {+ customViews: SavedView[];+ favorites: string[]; // dashboard ids+ recent: string[]; // dashboard ids, most-recent first+ railCollapsed: boolean;+ addView: (view: SavedView) => void;+ updateView: (id: string, patch: Partial<Omit<SavedView, 'id'>>) => void;+ deleteView: (id: string) => void;+ toggleFavorite: (id: string) => void;+ markViewed: (id: string) => void;+ setRailCollapsed: (collapsed: boolean) => void;+}++const DEFAULT_STATE = {+ customViews: [] as SavedView[],+ favorites: [] as string[],+ recent: [] as string[],+ railCollapsed: false,+};++export const useDashboardViewsStore = create<DashboardViewsState>()(+ persist(+ (set) => ({+ ...DEFAULT_STATE,+ addView: (view): void => {+ set((s) => ({ customViews: [...s.customViews, view] }));+ },+ updateView: (id, patch): void => {+ set((s) => ({+ customViews: s.customViews.map((v) =>+ v.id === id ? { ...v, ...patch } : v,+ ),+ }));+ },+ deleteView: (id): void => {+ set((s) => ({ customViews: s.customViews.filter((v) => v.id !== id) }));+ },+ toggleFavorite: (id): void => {+ set((s) => ({+ favorites: s.favorites.includes(id)+ ? s.favorites.filter((f) => f !== id)+ : [...s.favorites, id],+ }));+ },+ markViewed: (id): void => {+ set((s) => ({+ recent: [id, ...s.recent.filter((r) => r !== id)].slice(0, RECENT_LIMIT),+ }));+ },+ setRailCollapsed: (collapsed): void => {+ set({ railCollapsed: collapsed });+ },+ }),+ {+ name: LOCALSTORAGE.DASHBOARDS_LIST_VIEWS,+ merge: (persisted, current) => ({+ ...current,+ ...DEFAULT_STATE,+ ...((persisted as Partial<DashboardViewsState>) ?? {}),+ }),+ },+ ),+);diff --git a/frontend/src/pages/DashboardsListPageV2/components/ConfigureMetadataModal/useDynamicColumns.ts b/frontend/src/pages/DashboardsListPageV2/store/useVisibleColumnsStore.tssimilarity index 100%rename from frontend/src/pages/DashboardsListPageV2/components/ConfigureMetadataModal/useDynamicColumns.tsrename to frontend/src/pages/DashboardsListPageV2/store/useVisibleColumnsStore.tsdiff --git a/frontend/src/pages/DashboardsListPageV2/types.ts b/frontend/src/pages/DashboardsListPageV2/types.tsnew file mode 100644index 0000000000..b5d1670838--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/types.ts@@ -0,0 +1,27 @@+// Relative "updated within" windows offered by the Updated filter chip.+export type UpdatedWindow = 'any' | 'today' | '7d' | '30d';++// The user-controllable filter state a view captures. (Tags are intentionally+// excluded for now — the tag filter UI is deferred.) Sort/order are handled+// separately via URL query params and are not part of a view snapshot.+export interface DashboardFilterState {+ search: string;+ createdBy: string[]; // emails (created_by)+ updated: UpdatedWindow;+}++// A saved view: a named, iconed snapshot of filter state. Persisted client-side+// (localStorage) until the views API lands.+export interface SavedView {+ id: string;+ name: string;+ icon: string; // @signozhq/icons icon name+ filters: DashboardFilterState;+ createdAt: number;+}++// Built-in views rendered above the user's saved views. Their result set is+// derived (a fixed query fragment or a client-side id set), never persisted.+export type BuiltinViewId = 'mine' | 'favorites' | 'recent' | 'all' | 'locked';++export type ViewSection = 'personal' | 'system' | 'custom';diff --git a/frontend/src/pages/DashboardsListPageV2/utils.ts b/frontend/src/pages/DashboardsListPageV2/utils.tsindex e616329934..eb3350353d 100644--- a/frontend/src/pages/DashboardsListPageV2/utils.ts+++ b/frontend/src/pages/DashboardsListPageV2/utils.ts@@ -1,6 +1,9 @@import dayjs from 'dayjs';import { isEmpty } from 'lodash-es';-import type { DashboardtypesListedDashboardV2DTO } from 'api/generated/services/sigNoz.schemas';+import type {+ DashboardtypesListedDashboardV2DTO,+ TagtypesPostableTagDTO,+} from 'api/generated/services/sigNoz.schemas';export type DashboardListItem = DashboardtypesListedDashboardV2DTO;@@ -11,6 +14,24 @@ export const tagsToStrings = (tag.key === tag.value ? tag.key : `${tag.key}:${tag.value}`,);+// Inverse of `tagsToStrings`: each comma-separated tag is "key:value" or a bare+// label (key === value).+export const toPostableTags = (raw: string): TagtypesPostableTagDTO[] =>+ raw+ .split(',')+ .map((label) => label.trim())+ .filter(Boolean)+ .map((label) => {+ const sep = label.indexOf(':');+ if (sep > 0) {+ return {+ key: label.slice(0, sep).trim(),+ value: label.slice(sep + 1).trim(),+ };+ }+ return { key: label, value: label };+ });+export const lastUpdatedLabel = (time: string | undefined): string => {if (!time || isEmpty(time)) {return 'No updates yet!';diff --git a/frontend/src/pages/DashboardsListPageV2/views.ts b/frontend/src/pages/DashboardsListPageV2/views.tsnew file mode 100644index 0000000000..f6e0a4efde--- /dev/null+++ b/frontend/src/pages/DashboardsListPageV2/views.ts@@ -0,0 +1,164 @@+// Built-in view catalogue + the pure logic that maps a view to how it+// constrains the list. Views fall into three mechanisms:+// - snapshot: selecting applies a filter snapshot (All, My dashboards, custom)+// - query: contributes an extra server clause AND-ed with the chips (Locked)+// - client: constrains by a client-side id set (Favorites, Recently viewed)+import {+ Activity,+ Bookmark,+ Clock,+ Code,+ Flag,+ Layers,+ Lock,+ Server,+ Star,+ Tag,+ User,+} from '@signozhq/icons';++import { DEFAULT_FILTER_STATE } from './filterQuery';+import type { BuiltinViewId, DashboardFilterState, ViewSection } from './types';+import type { DashboardListItem } from './utils';++// All @signozhq icons share this component type.+export type ViewIcon = typeof Star;++export interface BuiltinView {+ id: BuiltinViewId;+ label: string;+ icon: ViewIcon;+ section: Exclude<ViewSection, 'custom'>;+}++export const BUILTIN_VIEWS: BuiltinView[] = [+ { id: 'mine', label: 'My dashboards', icon: User, section: 'personal' },+ { id: 'favorites', label: 'Favorites', icon: Star, section: 'personal' },+ { id: 'recent', label: 'Recently viewed', icon: Clock, section: 'personal' },+ { id: 'all', label: 'All dashboards', icon: Layers, section: 'system' },+ { id: 'locked', label: 'Locked', icon: Lock, section: 'system' },+];++// Icons offered when naming a saved view; stored by name on the view.+export const VIEW_ICON_OPTIONS: { name: string; Icon: ViewIcon }[] = [+ { name: 'bookmark', Icon: Bookmark },+ { name: 'star', Icon: Star },+ { name: 'layers', Icon: Layers },+ { name: 'activity', Icon: Activity },+ { name: 'server', Icon: Server },+ { name: 'code', Icon: Code },+ { name: 'flag', Icon: Flag },+ { name: 'tag', Icon: Tag },+ { name: 'lock', Icon: Lock },+ { name: 'clock', Icon: Clock },+];++const ICON_BY_NAME = new Map(VIEW_ICON_OPTIONS.map((o) => [o.name, o.Icon]));++export const iconByName = (name: string): ViewIcon =>+ ICON_BY_NAME.get(name) ?? Bookmark;++// Favorites/Recently-viewed constrain by a client-side id set — the backend has+// no id filter, so these are filtered on the fetched rows.+export const isClientView = (id: string): boolean =>+ id === 'favorites' || id === 'recent';++// Extra server query fragment a built-in view contributes (AND-ed with chips).+export const builtinViewQuery = (id: string): string =>+ id === 'locked' ? 'locked = true' : '';++// The canonical filter snapshot a built-in view applies when selected. `null`+// for ids that aren't built-in (custom views carry their own snapshot).+export const builtinViewSnapshot = (+ id: string,+ userEmail: string,+): DashboardFilterState | null => {+ switch (id) {+ case 'mine':+ return {+ ...DEFAULT_FILTER_STATE,+ createdBy: userEmail ? [userEmail] : [],+ };+ case 'all':+ case 'favorites':+ case 'recent':+ case 'locked':+ return { ...DEFAULT_FILTER_STATE };+ default:+ return null;+ }+};++export interface EmptyStateCopy {+ title: string;+ description: string;+}++// Context-aware copy for the no-results state, so an empty Locked view doesn't+// read like a failed search ("No dashboards found for .").+export const noResultsCopy = (+ activeViewId: string,+ search: string,+ hasActiveFilters: boolean,+): EmptyStateCopy => {+ const trimmed = search.trim();+ if (trimmed) {+ return {+ title: `No dashboards match "${trimmed}"`,+ description: 'Try a different search term or clear your filters.',+ };+ }+ switch (activeViewId) {+ case 'favorites':+ return {+ title: 'No favorite dashboards yet',+ description: 'Star a dashboard to pin it here.',+ };+ case 'recent':+ return {+ title: 'No recently viewed dashboards',+ description: 'Dashboards you open will appear here.',+ };+ case 'locked':+ return {+ title: 'No locked dashboards',+ description: 'Dashboards locked for editing will appear here.',+ };+ case 'mine':+ return {+ title: "You haven't created any dashboards",+ description: 'Dashboards you create will appear here.',+ };+ default:+ return hasActiveFilters+ ? {+ title: 'No dashboards match your filters',+ description: 'Try adjusting or clearing your filters.',+ }+ : {+ title: 'No dashboards found',+ description: 'Create a dashboard to get started.',+ };+ }+};++// Apply a client-side view's id-set constraint to already-fetched rows.+// Recently-viewed preserves visit order regardless of the active sort.+export const applyClientView = (+ items: DashboardListItem[],+ id: string,+ favorites: string[],+ recent: string[],+): DashboardListItem[] => {+ if (id === 'favorites') {+ const set = new Set(favorites);+ return items.filter((d) => set.has(d.id));+ }+ if (id === 'recent') {+ const order = new Map(recent.map((rid, index) => [rid, index]));+ return items+ .filter((d) => order.has(d.id))+ .sort((a, b) => (order.get(a.id) ?? 0) - (order.get(b.id) ?? 0));+ }+ return items;+};