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
refactor(dashboard-v2): organize variable subsystem into components/ hooks/ utils/ (#12135)
Ashwin Bhatkal07fe353b947e
diff --git a/frontend/src/lib/dashboardVariables/variableReference.ts b/frontend/src/lib/dashboardVariables/variableReference.tsindex b6b13a0431..490605a983 100644--- a/frontend/src/lib/dashboardVariables/variableReference.ts+++ b/frontend/src/lib/dashboardVariables/variableReference.ts@@ -42,27 +42,19 @@ const ANY_VARIABLE_REFERENCE =/\{\{\s*\.?[\w.]+\s*\}\}|\[\[\s*[\w.]+\s*\]\]|\$(?!__)[a-zA-Z_][\w.]*/;/**- * Returns true if `text` contains a reference to any variable. Use when the set- * of variable names isn't known yet (e.g. before the fetch context initializes),- * so a name-based {@link textContainsVariableReference} check can't run.+ * Use when the set of variable names isn't known yet (e.g. before the fetch+ * context initializes), so a name-based {@link textContainsVariableReference}+ * check can't run.*/export function containsAnyVariableReference(text: string): boolean {return !!text && ANY_VARIABLE_REFERENCE.test(text);}-/**- * Extracts all text strings from a widget Query that could contain variable- * references. Covers:- * - QUERY_BUILDER: filter items' string values + filter.expression- * - PROM: each promql[].query- * - CLICKHOUSE: each clickhouse_sql[].query- */function extractQueryBuilderTexts(query: Query): string[] {const texts: string[] = [];const queryDataList = query.builder?.queryData;if (isArray(queryDataList)) {queryDataList.forEach((queryData) => {- // Collect string values from filter itemsqueryData.filters?.items?.forEach((filter: TagFilterItem) => {if (isArray(filter.value)) {filter.value.forEach((v) => {@@ -75,7 +67,6 @@ function extractQueryBuilderTexts(query: Query): string[] {}});- // Collect filter expressionif (queryData.filter?.expression) {texts.push(queryData.filter.expression);}@@ -132,11 +123,8 @@ export function extractQueryTextStrings(query: Query): string[] {}/**- * Given a widget Query and an array of variable names, returns the subset of- * variable names that are referenced in the query text.- *- * This performs text-based detection only. Structural checks (like- * filter.key.key matching a variable attribute) are NOT included.+ * Text-based detection only. Structural checks (like filter.key.key matching a+ * variable attribute) are NOT included.*/export function getVariableReferencesInQuery(query: Query,diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardPageToolbar.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardPageToolbar.module.scssindex 5aba7ba876..6849376eaa 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardPageToolbar.module.scss+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardPageToolbar.module.scss@@ -22,9 +22,9 @@width: 100%;}-.toolbarRow2 {+.toolbarRow {width: 100%;- margin-top: 12px;+ margin-top: 10px;&::after {display: block;@@ -35,5 +35,5 @@.timeCluster {float: right;- margin: 0 0 0 16px;+ margin: 8px 0 0 16px;}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/index.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/index.tsxindex bdb5a860e7..1867288df4 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/index.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/index.tsx@@ -190,7 +190,7 @@ function DashboardPageToolbar(props: DashboardPageToolbarProps): JSX.Element {{/* Row 2: the time selector floats top-right (declared first so thevariables bar's content wraps around it); the variables barcollapses to one line and, when expanded, wraps full-width under it. */}- <div className={styles.toolbarRow2}>+ <div className={styles.toolbarRow}><div className={styles.timeCluster}><DateTimeSelectionV2 showAutoRefresh hideShareModal /></div>diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableForm/useVariableForm.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableForm/useVariableForm.tsindex ac1fc513aa..64745130a5 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableForm/useVariableForm.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableForm/useVariableForm.ts@@ -4,7 +4,7 @@ import type { PayloadVariables } from 'types/api/dashboard/variables/query';import type { VariableSelectionMap } from '../../../VariablesBar/selectionTypes';import { useDashboardStore } from '../../../store/useDashboardStore';-import { detectVariableCycle } from '../variableDependencies';+import { detectVariableCycle } from '../utils/variableCycleDetection';import {sortValuesByOrder,type VariableFormModel,diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableImpactDialog/VariableImpactDialog.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableImpactDialog/VariableImpactDialog.module.scssindex 48dff17544..9cb78b06aa 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableImpactDialog/VariableImpactDialog.module.scss+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableImpactDialog/VariableImpactDialog.module.scss@@ -74,11 +74,6 @@opacity: 0.6;}-.warning {- color: var(--warning-foreground, #d97706);- font-size: 11px;-}-.footer {display: flex;justify-content: flex-end;diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableImpactDialog/VariableImpactDialog.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableImpactDialog/VariableImpactDialog.tsxindex b31bf1de73..4e7a1e16a2 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableImpactDialog/VariableImpactDialog.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableImpactDialog/VariableImpactDialog.tsx@@ -7,7 +7,10 @@ import { Checkbox, Input as AntdInput } from 'antd';import cx from 'classnames';import { textContainsVariableReference } from 'lib/dashboardVariables/variableReference';-import type { VariableImpactMode, VariableUsage } from '../variableUsages';+import type {+ VariableImpactMode,+ VariableUsage,+} from '../utils/variableUsages';import { useVariableImpactState } from './useVariableImpactState';import styles from './VariableImpactDialog.module.scss';@@ -125,8 +128,9 @@ function VariableImpactDialog({Current</Typography.Text><AntdInput.TextArea- className={cx(styles.textArea, !row.included && styles.disabled)}+ className={styles.textArea}value={row.currentText}+ disabledreadOnlyautoSize={{ minRows: 1, maxRows: 4 }}/>@@ -142,7 +146,7 @@ function VariableImpactDialog({data-testid={`variable-impact-result-${row.id}`}/>{stillReferences ? (- <Typography.Text className={styles.warning}>+ <Typography.Text size={'small'} color="warning">Still references ${variableName}</Typography.Text>) : null}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableImpactDialog/useVariableImpactState.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableImpactDialog/useVariableImpactState.tsindex df48a004a0..28d9b9ed90 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableImpactDialog/useVariableImpactState.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableImpactDialog/useVariableImpactState.ts@@ -1,6 +1,6 @@import { useCallback, useEffect, useState } from 'react';-import type { VariableUsage } from '../variableUsages';+import type { VariableUsage } from '../utils/variableUsages';/** A usage row plus whether its edit will be applied on confirm. */export interface EditableVariableUsage extends VariableUsage {diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/Variables.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/Variables.module.scssindex 8fecbbeae0..739b5201c1 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/Variables.module.scss+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/Variables.module.scss@@ -9,153 +9,3 @@justify-content: flex-end;gap: 16px;}--.titleRow {- display: flex;- align-items: baseline;- flex-wrap: wrap;- gap: 8px;-}--.title {- font-size: 14px;- font-weight: 500;- color: var(--l1-foreground);-}--.subtitle {- font-size: 12px;- color: var(--l2-foreground);-}--// Two-column (Variable / Description) table matching the V1 variables listing.-$grid-columns: minmax(0, 2fr) minmax(0, 3fr);--.table {- display: flex;- flex-direction: column;- border: 1px solid var(--l2-border);- border-radius: 6px;- overflow: hidden;-}--.headerRow {- display: grid;- grid-template-columns: $grid-columns;- padding: 0 16px;- border-bottom: 1px solid var(--l2-border);-}--.headerCell {- padding: 12px 0;- font-size: 13px;- font-weight: 500;- color: var(--l1-foreground);-- &:first-child {- padding-right: 16px;- border-right: 1px solid var(--l2-border);- }-- &:last-child {- padding-left: 16px;- }-}--.list {- display: flex;- flex-direction: column;-}--.row {- position: relative;- display: grid;- grid-template-columns: $grid-columns;- padding: 0 16px;- background: var(--l1-background);-- &:not(:last-child) {- border-bottom: 1px solid var(--l2-border);- }-- &:hover {- background: var(--l2-background);- }-}--.varCell {- display: flex;- align-items: flex-start;- gap: 8px;- min-width: 0;- padding: 12px 16px 12px 0;- border-right: 1px solid var(--l2-border);-}--.dragHandle {- display: flex;- flex-shrink: 0;- align-items: center;- margin-top: 1px;- color: var(--l3-foreground);- cursor: grab;- touch-action: none;-}--.varName {- min-width: 0;- font-family: 'Space Mono', monospace;- font-size: 13px;- color: var(--bg-robin-400);- word-break: break-all;-}--.descCell {- position: relative;- min-width: 0;- padding: 12px 0 12px 16px;-}--.varDesc {- font-family: 'Space Mono', monospace;- font-size: 13px;- color: var(--bg-sienna-400);- white-space: pre-wrap;- word-break: break-word;-}--.varDescEmpty {- color: var(--l3-foreground);-}--.rowActions {- position: absolute;- top: 8px;- right: 0;- display: flex;- align-items: center;- gap: 2px;- padding-left: 16px;- background: var(--l2-background);- opacity: 0;- transition: opacity 120ms ease;-}--.row:hover .rowActions {- opacity: 1;-}--.rowActionsVisible {- opacity: 1;-}--.confirmText {- margin-right: 4px;- font-size: 12px;- color: var(--l2-foreground);-}--.applyAllButton {- font-size: 12px;- white-space: nowrap;-}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/__tests__/applyVariableToPanelsPatch.test.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/__tests__/applyVariableToPanelsPatch.test.tsindex 1054ac11b2..870282bff5 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/__tests__/applyVariableToPanelsPatch.test.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/__tests__/applyVariableToPanelsPatch.test.ts@@ -7,7 +7,7 @@ import {buildApplyVariableToPanelsPatch,buildSyncVariableToPanelsPatch,getPanelIdsReferencingVariable,-} from '../applyVariableToPanelsPatch';+} from '../utils/applyVariableToPanelsPatch';/** Minimal builder-query panel wrapped in a CompositeQuery, with a given filter. */function compositePanel(filterExpression: string): unknown {diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/__tests__/variableUsages.test.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/__tests__/variableUsages.test.tsindex 07896aff93..2580b7da6a 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/__tests__/variableUsages.test.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/__tests__/variableUsages.test.ts@@ -4,7 +4,7 @@ import {emptyVariableFormModel,type VariableFormModel,} from '../variableFormModel';-import { findVariableUsages } from '../variableUsages';+import { findVariableUsages } from '../utils/variableUsages';// Identity adapter so `spec.variables` can be plain form models in the test.jest.mock('../variableAdapters', () => ({diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/components/VariableRow/VariableRow.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/components/VariableRow/VariableRow.module.scssnew file mode 100644index 0000000000..df658ac09e--- /dev/null+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/components/VariableRow/VariableRow.module.scss@@ -0,0 +1,95 @@+// Keep $grid-columns in sync with VariablesList.module.scss so header and rows align.+$grid-columns: minmax(0, 2fr) minmax(0, 3fr);++.row {+ position: relative;+ display: grid;+ grid-template-columns: $grid-columns;+ padding: 0 16px;+ background: var(--l1-background);++ &:not(:last-child) {+ border-bottom: 1px solid var(--l2-border);+ }++ &:hover {+ background: var(--l2-background);+ }+}++.varCell {+ display: flex;+ align-items: flex-start;+ gap: 8px;+ min-width: 0;+ padding: 12px 16px 12px 0;+ border-right: 1px solid var(--l2-border);+}++.dragHandle {+ display: flex;+ flex-shrink: 0;+ align-items: center;+ margin-top: 1px;+ color: var(--l3-foreground);+ cursor: grab;+ touch-action: none;+}++.varName {+ min-width: 0;+ font-family: 'Space Mono', monospace;+ font-size: 13px;+ color: var(--bg-robin-400);+ word-break: break-all;+}++.descCell {+ position: relative;+ min-width: 0;+ padding: 12px 0 12px 16px;+}++.varDesc {+ font-family: 'Space Mono', monospace;+ font-size: 13px;+ color: var(--bg-sienna-400);+ white-space: pre-wrap;+ word-break: break-word;+}++.varDescEmpty {+ color: var(--l3-foreground);+}++.rowActions {+ position: absolute;+ top: 8px;+ right: 0;+ display: flex;+ align-items: center;+ gap: 2px;+ padding-left: 16px;+ background: var(--l2-background);+ opacity: 0;+ transition: opacity 120ms ease;+}++.row:hover .rowActions {+ opacity: 1;+}++.rowActionsVisible {+ opacity: 1;+}++.confirmText {+ margin-right: 4px;+ font-size: 12px;+ color: var(--l2-foreground);+}++.applyAllButton {+ font-size: 12px;+ white-space: nowrap;+}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableRow.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/components/VariableRow/VariableRow.tsxsimilarity index 97%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableRow.tsxrename to frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/components/VariableRow/VariableRow.tsxindex 6eb344b866..e443da49c1 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariableRow.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/components/VariableRow/VariableRow.tsx@@ -7,8 +7,8 @@ import { TooltipSimple } from '@signozhq/ui/tooltip';import { Typography } from '@signozhq/ui/typography';import cx from 'classnames';-import type { VariableFormModel } from './variableFormModel';-import styles from './Variables.module.scss';+import type { VariableFormModel } from '../../variableFormModel';+import styles from './VariableRow.module.scss';interface VariableRowProps {variable: VariableFormModel;diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/components/VariablesList/VariablesList.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/components/VariablesList/VariablesList.module.scssnew file mode 100644index 0000000000..996d5d74a1--- /dev/null+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/components/VariablesList/VariablesList.module.scss@@ -0,0 +1,39 @@+// Two-column (Variable / Description) table matching the V1 variables listing.+// Keep $grid-columns in sync with VariableRow.module.scss so header and rows align.+$grid-columns: minmax(0, 2fr) minmax(0, 3fr);++.table {+ display: flex;+ flex-direction: column;+ border: 1px solid var(--l2-border);+ border-radius: 6px;+ overflow: hidden;+}++.headerRow {+ display: grid;+ grid-template-columns: $grid-columns;+ padding: 0 16px;+ border-bottom: 1px solid var(--l2-border);+}++.headerCell {+ padding: 12px 0;+ font-size: 13px;+ font-weight: 500;+ color: var(--l1-foreground);++ &:first-child {+ padding-right: 16px;+ border-right: 1px solid var(--l2-border);+ }++ &:last-child {+ padding-left: 16px;+ }+}++.list {+ display: flex;+ flex-direction: column;+}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariablesList.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/components/VariablesList/VariablesList.tsxsimilarity index 93%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariablesList.tsxrename to frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/components/VariablesList/VariablesList.tsxindex 3929791ff3..e40ff89f4d 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/VariablesList.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/components/VariablesList/VariablesList.tsx@@ -11,9 +11,9 @@ import {verticalListSortingStrategy,} from '@dnd-kit/sortable';-import VariableRow from './VariableRow';-import type { VariableFormModel } from './variableFormModel';-import styles from './Variables.module.scss';+import VariableRow from '../VariableRow/VariableRow';+import type { VariableFormModel } from '../../variableFormModel';+import styles from './VariablesList.module.scss';interface VariablesListProps {variables: VariableFormModel[];diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/useSaveVariables.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/hooks/useSaveVariables.tssimilarity index 77%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/useSaveVariables.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/hooks/useSaveVariables.tsindex 5bb2115da9..359e259bc1 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/useSaveVariables.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/hooks/useSaveVariables.ts@@ -3,11 +3,11 @@ import { toast } from '@signozhq/ui/sonner';import { useErrorModal } from 'providers/ErrorModalProvider';import APIError from 'types/api/error';-import { useOptimisticPatch } from '../../hooks/useOptimisticPatch';-import { useDashboardStore } from '../../store/useDashboardStore';-import { formModelToDto } from './variableAdapters';-import type { VariableFormModel } from './variableFormModel';-import { buildVariablesPatch } from './variablePatchOps';+import { useOptimisticPatch } from '../../../hooks/useOptimisticPatch';+import { useDashboardStore } from '../../../store/useDashboardStore';+import { formModelToDto } from '../variableAdapters';+import type { VariableFormModel } from '../variableFormModel';+import { buildVariablesPatch } from '../utils/variablePatchOps';interface UseSaveVariables {save: (variables: VariableFormModel[]) => Promise<boolean>;diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/useVariableListActions.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/hooks/useVariableListActions.tssimilarity index 95%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/useVariableListActions.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/hooks/useVariableListActions.tsindex c607ee1028..a913ebfd7c 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/useVariableListActions.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/hooks/useVariableListActions.ts@@ -10,18 +10,18 @@ import type {DashboardtypesJSONPatchOperationDTO,} from 'api/generated/services/sigNoz.schemas';-import { buildSyncVariableToPanelsPatch } from './applyVariableToPanelsPatch';-import type { VariableFormModel } from './variableFormModel';+import { buildSyncVariableToPanelsPatch } from '../utils/applyVariableToPanelsPatch';+import type { VariableFormModel } from '../variableFormModel';import {applyVariableQueryEdits,buildVariableImpactPatch,-} from './variableImpactPatch';+} from '../utils/variableImpactPatch';import {findVariableUsages,type VariableImpactMode,type VariableUsage,-} from './variableUsages';-import type { EditingState } from './types';+} from '../utils/variableUsages';+import type { EditingState } from '../types';/*** A pending rename/delete that touches other queries — resolved via the impactdiff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/index.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/index.tsxindex 2fcb4465c7..79a3160d4e 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/index.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/index.tsx@@ -9,9 +9,9 @@ import { useDashboardStore } from '../../store/useDashboardStore';import {buildApplyVariableToPanelsPatch,getPanelIdsReferencingVariable,-} from './applyVariableToPanelsPatch';-import { useSaveVariables } from './useSaveVariables';-import { useVariableListActions } from './useVariableListActions';+} from './utils/applyVariableToPanelsPatch';+import { useSaveVariables } from './hooks/useSaveVariables';+import { useVariableListActions } from './hooks/useVariableListActions';import { dtoToFormModel } from './variableAdapters';import {emptyVariableFormModel,@@ -19,7 +19,7 @@ import {} from './variableFormModel';import VariableForm from './VariableForm/VariableForm';import VariableImpactDialog from './VariableImpactDialog/VariableImpactDialog';-import VariablesList from './VariablesList';+import VariablesList from './components/VariablesList/VariablesList';import styles from './Variables.module.scss';import AddVariableButton from './components/AddVariableButton';import ApplyToAllDialog from './components/ApplyToAllDialog/ApplyToAllDialog';@@ -154,7 +154,6 @@ function VariablesSettings({ dashboard }: VariablesSettingsProps): JSX.Element {);}- // Master view — the variables list.return (<div className={cx(styles.container, settingsStyles.settingsCard)}>{variables.length === 0 ? (diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/applyVariableToPanelsPatch.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/utils/applyVariableToPanelsPatch.tssimilarity index 100%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/applyVariableToPanelsPatch.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/utils/applyVariableToPanelsPatch.tsdiff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variableDependencies.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/utils/variableCycleDetection.tssimilarity index 93%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variableDependencies.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/utils/variableCycleDetection.tsindex 4ba52c5046..fe1712cff5 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variableDependencies.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/utils/variableCycleDetection.ts@@ -4,7 +4,7 @@ import {} from 'container/DashboardContainer/DashboardVariablesSelection/util';import type { IDashboardVariable } from 'types/api/dashboard/getAll';-import type { VariableFormModel } from './variableFormModel';+import type { VariableFormModel } from '../variableFormModel';/*** Detects a circular reference among QUERY variables (a query referencingdiff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variableImpactPatch.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/utils/variableImpactPatch.tssimilarity index 96%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variableImpactPatch.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/utils/variableImpactPatch.tsindex c67bf4998b..eb4a9f97b4 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variableImpactPatch.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/utils/variableImpactPatch.ts@@ -6,8 +6,8 @@ import type {} from 'api/generated/services/sigNoz.schemas';import { cloneDeep } from 'lodash-es';-import { formModelToDto } from './variableAdapters';-import type { VariableFormModel } from './variableFormModel';+import { formModelToDto } from '../variableAdapters';+import type { VariableFormModel } from '../variableFormModel';import { buildVariablesPatch } from './variablePatchOps';import type { VariableUsage, VariableUsageKind } from './variableUsages';diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variablePatchOps.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/utils/variablePatchOps.tssimilarity index 100%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variablePatchOps.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/utils/variablePatchOps.tsdiff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variableUsages.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/utils/variableUsages.tssimilarity index 97%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variableUsages.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/utils/variableUsages.tsindex 18deb8d111..923d8d53d0 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variableUsages.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/utils/variableUsages.ts@@ -8,8 +8,8 @@ import {textContainsVariableReference,} from 'lib/dashboardVariables/variableReference';-import { toQueryEnvelopes } from '../../queryV5/buildQueryRangeRequest';-import { dtoToFormModel } from './variableAdapters';+import { toQueryEnvelopes } from '../../../queryV5/buildQueryRangeRequest';+import { dtoToFormModel } from '../variableAdapters';/** The kind of query text a variable is referenced from. */export type VariableUsageKind =diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/hooks/useDrilldownDashboardVariables.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/hooks/useDrilldownDashboardVariables.tsxindex 3db0d9fe5e..f8746cfd7c 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/hooks/useDrilldownDashboardVariables.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/hooks/useDrilldownDashboardVariables.tsx@@ -11,7 +11,7 @@ import {emptyVariableFormModel,type VariableFormModel,} from 'pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variableFormModel';-import { buildVariablesPatch } from 'pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/variablePatchOps';+import { buildVariablesPatch } from 'pages/DashboardPageV2/DashboardContainer/DashboardSettings/Variables/utils/variablePatchOps';import { useDashboardFetchRequired } from 'pages/DashboardPageV2/DashboardContainer/hooks/useDashboardFetchRequired';import { useOptimisticPatch } from 'pages/DashboardPageV2/DashboardContainer/hooks/useOptimisticPatch';import { selectVariableValues } from 'pages/DashboardPageV2/DashboardContainer/store/slices/variableSelectionSlice';@@ -23,7 +23,6 @@ interface UseDrilldownDashboardVariablesArgs {filters: FilterData[];/** Clicked query's telemetry signal — seeds a created variable's `dynamicSignal`. */signal?: TelemetrytypesSignalDTO;- /** Close the popover after an action. */onClose: () => void;}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/VariablesBar.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/VariablesBar.module.scssindex 2e7baef351..6677cb82eb 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/VariablesBar.module.scss+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/VariablesBar.module.scss@@ -6,12 +6,6 @@min-width: 0;}-.addVariable {- flex: none;- border-style: dashed !important;- border-color: var(--l3-border) !important;-}-.strip {display: flow-root;// Collapsed: one line only, so the trailing add "+" never wraps below.@@ -21,6 +15,7 @@.stripExpanded {display: flex;flex-wrap: wrap;+ align-items: flex-end;gap: 8px;padding-top: 12px;overflow: visible;@@ -54,7 +49,7 @@display: inline-flex;align-items: center;margin-right: 8px;- vertical-align: top;+ vertical-align: bottom;}.variableSlotHidden {@@ -64,161 +59,16 @@.moreButton {display: inline-flex;margin-right: 8px;- vertical-align: top;+ vertical-align: bottom;}.addSlot {display: inline-flex;- vertical-align: top;-}--.variableItem {- position: relative;- display: flex;- align-items: center;-}--// Loading indicator: an indeterminate bar flush along the control's bottom edge,-// full width and overlaying the border so it reads as the input's own edge rather-// than a separate element. Non-interactive so the name/description stays hoverable.-.loadingBar {- position: absolute;- right: 0;- bottom: 0;- left: 0;- height: 2px;- overflow: hidden;- border-radius: 0 0 2px 2px;- background: color-mix(in srgb, var(--bg-robin-500) 20%, transparent);- pointer-events: none;-}--.loadingBar::after {- content: '';- position: absolute;- top: 0;- bottom: 0;- left: 0;- width: 40%;- border-radius: 2px;- background: var(--bg-robin-500);- animation: variable-loading-slide 1.1s ease-in-out infinite;-}--@keyframes variable-loading-slide {- 0% {- left: -40%;- }-- 100% {- left: 100%;- }-}--@media (prefers-reduced-motion: reduce) {- .loadingBar::after {- left: 0;- width: 100%;- animation: none;- opacity: 0.7;- }-}--.variableName {- display: flex;- min-width: 56px;- height: 32px;- align-items: center;- gap: 4px;- padding: 6px 6px 6px 8px;- border: 1px solid var(--l3-border);- border-radius: 2px 0 0 2px;- background: var(--l3-background);- color: var(--bg-robin-400);- font-family: Inter;- font-size: 12px;- font-weight: 400;- line-height: 16px;- white-space: nowrap;-}--.infoIcon {- display: inline-flex;- margin-left: 6px;- color: var(--l2-foreground);- vertical-align: middle;-}--.tooltipContent {- display: flex;- flex-direction: column;- gap: 8px;- max-width: 240px;-}--.tooltipDescription {- font-size: 12px;- line-height: 1.5;-}--// Divider and labels use the tooltip's own text color at reduced opacity so they-// read on the tooltip surface in either theme without hard-coding a palette.-.tooltipDivider {- height: 1px;- background: currentColor;- opacity: 0.16;-}--.tooltipSection {- display: flex;- flex-direction: column;- gap: 4px;-}--.tooltipLabel {- font-size: 10px;- font-weight: 600;- letter-spacing: 0.06em;- text-transform: uppercase;-}--.tooltipRefs {- display: flex;- flex-wrap: wrap;- gap: 4px;-}--.tooltipRef {- font-size: 12px;-}--// Directional colors: parents (Depends on) in forest, children (Used by) in amber.-.dependsColor {- color: var(--bg-forest-500);-}--.usedByColor {- color: var(--bg-amber-500);-}--.variableValue {- display: flex;- min-width: 120px;- height: 32px;- align-items: center;- border: 1px solid var(--l3-border);- border-left: none;- border-radius: 0 2px 2px 0;- background: var(--l2-background);- color: var(--l2-foreground);- font-size: 12px;-- &:hover,- &:focus-within {- outline: 1px solid var(--bg-robin-400);- }+ vertical-align: bottom;}+// Shared by the Text and value selectors: strips the antd control chrome so the+// selector blends into the variable pill..control {width: 100%;min-width: 120px;@@ -230,6 +80,12 @@background: transparent !important;box-shadow: none !important;}++ // Keep the multi-select's tags on one line (paired with maxTagCount) so a+ // selected value never wraps the control onto a second row.+ :global(.ant-select-selection-overflow) {+ flex-wrap: nowrap;+ }}.overflowTooltip {diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/VariablesBar.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/VariablesBar.tsxindex 1d7ff2b2c4..14db9bf101 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/VariablesBar.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/VariablesBar.tsx@@ -7,11 +7,11 @@ import { useInlineOverflowCount } from 'hooks/useInlineOverflowCount';import { selectVariablesExpanded } from '../store/slices/collapseSlice';import { useDashboardStore } from '../store/useDashboardStore';-import AddVariableFull from './AddVariableFull';-import AddVariableIcon from './AddVariableIcon';+import AddVariableFull from './components/AddVariable/AddVariableFull';+import AddVariableIcon from './components/AddVariable/AddVariableIcon';import type { VariableSelection } from './selectionTypes';-import { useVariableSelection } from './useVariableSelection';-import VariableSelector from './VariableSelector';+import { useVariableSelection } from './hooks/useVariableSelection';+import VariableSelector from './components/VariableSelector/VariableSelector';import styles from './VariablesBar.module.scss';// Short display of a variable's current selection, for the collapsed +N tooltip.diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/__tests__/resolveVariableSelection.test.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/__tests__/resolveVariableSelection.test.tsindex 73ab522daf..8cb4d7c3a8 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/__tests__/resolveVariableSelection.test.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/__tests__/resolveVariableSelection.test.ts@@ -6,7 +6,7 @@ import {configuredDefaultValue,reconcileWithOptions,resolveDefaultSelection,-} from '../resolveVariableSelection';+} from '../utils/resolveVariableSelection';function model(overrides: Partial<VariableFormModel>): VariableFormModel {return { ...emptyVariableFormModel(), ...overrides };diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/__tests__/useAutoSelect.test.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/__tests__/useAutoSelect.test.tsxindex d3fff55f69..d601561e6d 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/__tests__/useAutoSelect.test.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/__tests__/useAutoSelect.test.tsx@@ -5,7 +5,7 @@ import {type VariableFormModel,} from '../../DashboardSettings/Variables/variableFormModel';import type { VariableSelection } from '../selectionTypes';-import { useAutoSelect } from '../useAutoSelect';+import { useAutoSelect } from '../hooks/useAutoSelect';function model(overrides: Partial<VariableFormModel>): VariableFormModel {return { ...emptyVariableFormModel(), ...overrides };diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/__tests__/useSeedVariableSelection.test.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/__tests__/useSeedVariableSelection.test.tsxindex dd8f2ad618..045d2f5777 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/__tests__/useSeedVariableSelection.test.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/__tests__/useSeedVariableSelection.test.tsx@@ -6,7 +6,7 @@ import {type VariableFormModel,} from '../../DashboardSettings/Variables/variableFormModel';import { useDashboardStore } from '../../store/useDashboardStore';-import { useSeedVariableSelection } from '../useSeedVariableSelection';+import { useSeedVariableSelection } from '../hooks/useSeedVariableSelection';const mockSetUrlValues = jest.fn();let mockUrlValues: Record<string, unknown> | null = null;diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/AddVariable/AddVariable.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/AddVariable/AddVariable.module.scssnew file mode 100644index 0000000000..78459aacd5--- /dev/null+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/AddVariable/AddVariable.module.scss@@ -0,0 +1,5 @@+.addVariable {+ flex: none;+ border-style: dashed !important;+ border-color: var(--l3-border) !important;+}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/AddVariableFull.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/AddVariable/AddVariableFull.tsxsimilarity index 85%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/AddVariableFull.tsxrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/AddVariable/AddVariableFull.tsxindex fe7cce3c69..7c310c31bd 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/AddVariableFull.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/AddVariable/AddVariableFull.tsx@@ -1,8 +1,8 @@import { Plus } from '@signozhq/icons';import { Button } from '@signozhq/ui/button';-import { useDashboardStore } from '../store/useDashboardStore';-import styles from './VariablesBar.module.scss';+import { useDashboardStore } from '../../../store/useDashboardStore';+import styles from './AddVariable.module.scss';/*** Full-width labelled "Add variable" button shown in the empty state, before anydiff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/AddVariableIcon.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/AddVariable/AddVariableIcon.tsxsimilarity index 87%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/AddVariableIcon.tsxrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/AddVariable/AddVariableIcon.tsxindex 865a994d4f..8e51c8a044 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/AddVariableIcon.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/AddVariable/AddVariableIcon.tsx@@ -2,8 +2,8 @@ import { Plus } from '@signozhq/icons';import { Button } from '@signozhq/ui/button';import { TooltipSimple } from '@signozhq/ui/tooltip';-import { useDashboardStore } from '../store/useDashboardStore';-import styles from './VariablesBar.module.scss';+import { useDashboardStore } from '../../../store/useDashboardStore';+import styles from './AddVariable.module.scss';/*** Compact "+" trigger (label on hover) shown after the variable pills once atdiff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableSelector/VariableSelector.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableSelector/VariableSelector.module.scssnew file mode 100644index 0000000000..e44c345bc1--- /dev/null+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableSelector/VariableSelector.module.scss@@ -0,0 +1,105 @@+.variableItem {+ position: relative;+ display: flex;+ width: 160px;+ flex-direction: column;+ padding-top: 7px;+}++// Loading indicator: an indeterminate bar flush along the control's bottom edge,+// full width and overlaying the border so it reads as the input's own edge rather+// than a separate element. Non-interactive so the name/description stays hoverable.+.loadingBar {+ position: absolute;+ right: 0;+ bottom: 0;+ left: 0;+ height: 2px;+ overflow: hidden;+ border-radius: 0 0 2px 2px;+ background: color-mix(in srgb, var(--bg-robin-500) 20%, transparent);+ pointer-events: none;+}++.loadingBar::after {+ content: '';+ position: absolute;+ top: 0;+ bottom: 0;+ left: 0;+ width: 40%;+ border-radius: 2px;+ background: var(--bg-robin-500);+ animation: variable-loading-slide 1.1s ease-in-out infinite;+}++@keyframes variable-loading-slide {+ 0% {+ left: -40%;+ }++ 100% {+ left: 100%;+ }+}++@media (prefers-reduced-motion: reduce) {+ .loadingBar::after {+ left: 0;+ width: 100%;+ animation: none;+ opacity: 0.7;+ }+}++.variableName {+ --typography-text-display: flex;+ position: absolute;+ top: -3px;+ left: 4px;+ z-index: 1;+ align-items: center;+ gap: 5px;+ // Equal left/right inset: left:8px in, and 8px reserved on the right (16 total),+ // so a truncated name + info icon has matching space on both sides.+ max-width: calc(100% - 10px);+ overflow: hidden;+ padding: 0 2px;+ background-color: var(--l1-background);+ color: var(--l2-foreground);+ font-family: Inter;+ font-size: 11px;+ font-weight: 500;+ line-height: 14px;+}++.name {+ overflow: hidden;+ min-width: 0;+ white-space: nowrap;+ text-overflow: ellipsis;+}++.infoIcon {+ display: inline-flex;+ align-self: center;+ flex-shrink: 0;+ color: var(--l2-foreground);+}++.variableValue {+ display: flex;+ width: 100%;+ height: 33px;+ align-items: center;+ border: 1px solid var(--l3-border);+ border-radius: 2px;+ background: var(--l2-background);+ color: var(--l2-foreground);+ font-size: 12px;++ &:hover,+ &:focus-within {+ outline: 1px solid var(--bg-robin-400);+ }+}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/VariableSelector.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableSelector/VariableSelector.tsxsimilarity index 80%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/VariableSelector.tsxrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableSelector/VariableSelector.tsxindex 0c74d709e3..6c7eba9d38 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/VariableSelector.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableSelector/VariableSelector.tsx@@ -4,14 +4,17 @@ import { Typography } from '@signozhq/ui/typography';// eslint-disable-next-line signoz/no-antd-components -- lightweight description tooltip, matches V1import { Tooltip } from 'antd';-import type { VariableFormModel } from '../DashboardSettings/Variables/variableFormModel';-import type { VariableSelection, VariableSelectionMap } from './selectionTypes';-import { computeVariableDependencies } from './variableDependencies';-import TextSelector from './selectors/TextSelector';-import VariableValueControl from './selectors/VariableValueControl';-import { useVariableFetchState } from './useVariableFetchState';-import styles from './VariablesBar.module.scss';-import VariableTooltip from './VariableTooltip';+import type { VariableFormModel } from '../../../DashboardSettings/Variables/variableFormModel';+import type {+ VariableSelection,+ VariableSelectionMap,+} from '../../selectionTypes';+import { computeVariableDependencies } from '../../utils/variableDependencies';+import TextSelector from '../selectors/TextSelector';+import VariableValueControl from '../selectors/VariableValueControl';+import { useVariableFetchState } from '../../hooks/useVariableFetchState';+import styles from './VariableSelector.module.scss';+import VariableTooltip from '../VariableTooltip/VariableTooltip';interface VariableSelectorProps {variable: VariableFormModel;@@ -83,7 +86,9 @@ function VariableSelector({data-testid={`variable-${variable.name}`}><Typography.Text className={styles.variableName}>- ${variable.name}+ <span className={styles.name} title={`$${variable.name}`}>+ ${variable.name}+ </span>{hasTooltip ? (<Tooltiptitle={@@ -94,7 +99,7 @@ function VariableSelector({/>}>- <SolidInfoCircle className={styles.infoIcon} size={14} />+ <SolidInfoCircle className={styles.infoIcon} size={12} /></Tooltip>) : null}</Typography.Text>diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableTooltip/TooltipRefSection.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableTooltip/TooltipRefSection.tsxnew file mode 100644index 0000000000..3b86d1b7d5--- /dev/null+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableTooltip/TooltipRefSection.tsx@@ -0,0 +1,41 @@+import { ArrowDown, ArrowUp } from '@signozhq/icons';+import cx from 'classnames';++import styles from './VariableTooltip.module.scss';++interface TooltipRefSectionProps {+ label: string;+ /** Variable names, rendered as `$name` chips. */+ refs: string[];+ /** Up = this variable depends on others (parents); down = others use it (children). */+ direction: 'up' | 'down';+ colorClassName: string;+}++/** One directional dependency list in the variable tooltip (Depends on / Used by). */+function TooltipRefSection({+ label,+ refs,+ direction,+ colorClassName,+}: TooltipRefSectionProps): JSX.Element {+ const Arrow = direction === 'up' ? ArrowUp : ArrowDown;++ return (+ <div className={styles.tooltipSection}>+ <div className={cx(styles.tooltipLabel, colorClassName)}>+ <Arrow size={10} />+ {label}+ </div>+ <div className={styles.tooltipRefs}>+ {refs.map((name) => (+ <span key={name} className={cx(styles.tooltipRef, colorClassName)}>+ ${name}+ </span>+ ))}+ </div>+ </div>+ );+}++export default TooltipRefSection;diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableTooltip/VariableTooltip.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableTooltip/VariableTooltip.module.scssnew file mode 100644index 0000000000..53275e27a1--- /dev/null+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableTooltip/VariableTooltip.module.scss@@ -0,0 +1,54 @@+.tooltipContent {+ display: flex;+ flex-direction: column;+ gap: 8px;+ max-width: 240px;+}++.tooltipDescription {+ font-size: 12px;+ line-height: 1.5;+}++// Divider and labels use the tooltip's own text color at reduced opacity so they+// read on the tooltip surface in either theme without hard-coding a palette.+.tooltipDivider {+ height: 1px;+ background: currentColor;+ opacity: 0.16;+}++.tooltipSection {+ display: flex;+ flex-direction: column;+ gap: 4px;+}++.tooltipLabel {+ display: inline-flex;+ align-items: center;+ gap: 4px;+ font-size: 10px;+ font-weight: 600;+ letter-spacing: 0.06em;+ text-transform: uppercase;+}++.tooltipRefs {+ display: flex;+ flex-wrap: wrap;+ gap: 4px;+}++.tooltipRef {+ font-size: 12px;+}++// Directional colors: parents (Depends on) in forest, children (Used by) in amber.+.dependsColor {+ color: var(--bg-forest-500);+}++.usedByColor {+ color: var(--bg-amber-500);+}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/VariableTooltip.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableTooltip/VariableTooltip.tsxsimilarity index 50%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/VariableTooltip.tsxrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableTooltip/VariableTooltip.tsxindex 332fb370ca..3df100c92f 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/VariableTooltip.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/VariableTooltip/VariableTooltip.tsx@@ -1,6 +1,5 @@-import cx from 'classnames';--import styles from './VariablesBar.module.scss';+import styles from './VariableTooltip.module.scss';+import TooltipRefSection from './TooltipRefSection';interface VariableTooltipProps {description?: string;@@ -28,35 +27,20 @@ function VariableTooltip({<>{description ? <div className={styles.tooltipDivider} /> : null}{dependsOn.length > 0 ? (- <div className={styles.tooltipSection}>- <div className={cx(styles.tooltipLabel, styles.dependsColor)}>- Depends on- </div>- <div className={styles.tooltipRefs}>- {dependsOn.map((name) => (- <span- key={name}- className={cx(styles.tooltipRef, styles.dependsColor)}- >- ${name}- </span>- ))}- </div>- </div>+ <TooltipRefSection+ label="Depends on"+ refs={dependsOn}+ direction="up"+ colorClassName={styles.dependsColor}+ />) : null}{usedBy.length > 0 ? (- <div className={styles.tooltipSection}>- <div className={cx(styles.tooltipLabel, styles.usedByColor)}>- Used by- </div>- <div className={styles.tooltipRefs}>- {usedBy.map((name) => (- <span key={name} className={cx(styles.tooltipRef, styles.usedByColor)}>- ${name}- </span>- ))}- </div>- </div>+ <TooltipRefSection+ label="Used by"+ refs={usedBy}+ direction="down"+ colorClassName={styles.usedByColor}+ />) : null}</>) : null}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectors/TextSelector.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/selectors/TextSelector.tsxsimilarity index 93%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectors/TextSelector.tsxrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/selectors/TextSelector.tsxindex 49979721b5..2d09946031 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectors/TextSelector.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/selectors/TextSelector.tsx@@ -3,8 +3,8 @@ import type { InputRef } from 'antd';// eslint-disable-next-line signoz/no-antd-components -- match V1 textbox behaviour (commit on blur/Enter, borderless)import { Input } from 'antd';-import type { VariableSelection } from '../selectionTypes';-import styles from '../VariablesBar.module.scss';+import type { VariableSelection } from '../../selectionTypes';+import styles from '../../VariablesBar.module.scss';interface TextSelectorProps {selection: VariableSelection;diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectors/ValueSelector.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/selectors/ValueSelector.tsxsimilarity index 96%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectors/ValueSelector.tsxrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/selectors/ValueSelector.tsxindex f15901bf55..769f00da61 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectors/ValueSelector.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/selectors/ValueSelector.tsx@@ -2,8 +2,8 @@ import { useMemo } from 'react';import { CustomMultiSelect, CustomSelect } from 'components/NewSelect';import type { OptionData } from 'components/NewSelect/types';-import type { VariableSelection } from '../selectionTypes';-import styles from '../VariablesBar.module.scss';+import type { VariableSelection } from '../../selectionTypes';+import styles from '../../VariablesBar.module.scss';interface ValueSelectorProps {options: string[];diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectors/VariableValueControl.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/selectors/VariableValueControl.tsxsimilarity index 85%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectors/VariableValueControl.tsxrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/selectors/VariableValueControl.tsxindex 9c3209a9cc..50dd618efb 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectors/VariableValueControl.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/components/selectors/VariableValueControl.tsx@@ -1,11 +1,11 @@-import type { VariableFormModel } from '../../DashboardSettings/Variables/variableFormModel';+import type { VariableFormModel } from '../../../DashboardSettings/Variables/variableFormModel';import type {VariableSelection,VariableSelectionMap,-} from '../selectionTypes';-import { useAutoSelect } from '../useAutoSelect';+} from '../../selectionTypes';+import { useAutoSelect } from '../../hooks/useAutoSelect';import ValueSelector from './ValueSelector';-import { useVariableOptions } from './useVariableOptions';+import { useVariableOptions } from '../../hooks/useVariableOptions';interface VariableValueControlProps {variable: VariableFormModel;diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/useAutoSelect.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useAutoSelect.tssimilarity index 76%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/useAutoSelect.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useAutoSelect.tsindex 117ae56fbb..361e7a18ec 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/useAutoSelect.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useAutoSelect.ts@@ -1,8 +1,8 @@import { useEffect } from 'react';-import type { VariableFormModel } from '../DashboardSettings/Variables/variableFormModel';-import { reconcileWithOptions } from './resolveVariableSelection';-import type { VariableSelection } from './selectionTypes';+import type { VariableFormModel } from '../../DashboardSettings/Variables/variableFormModel';+import { reconcileWithOptions } from '../utils/resolveVariableSelection';+import type { VariableSelection } from '../selectionTypes';/*** Reconciles a variable's selection with its freshly-fetched options and firesdiff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectors/useFetchedVariableOptions.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useFetchedVariableOptions.tssimilarity index 96%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectors/useFetchedVariableOptions.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useFetchedVariableOptions.tsindex 3805549ff3..95fb8fdc5a 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectors/useFetchedVariableOptions.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useFetchedVariableOptions.ts@@ -17,10 +17,10 @@ import {} from '../../DashboardSettings/Variables/variableFormModel';import type { VariableFormModel } from '../../DashboardSettings/Variables/variableFormModel';import { useDashboardStore } from '../../store/useDashboardStore';-import { buildExistingDynamicVariableQuery } from '../dynamicFilter';+import { buildExistingDynamicVariableQuery } from '../utils/dynamicFilter';import type { VariableSelectionMap } from '../selectionTypes';-import { selectionToPayload } from '../selectionUtils';-import { useVariableFetchState } from '../useVariableFetchState';+import { selectionToPayload } from '../utils/selectionUtils';+import { useVariableFetchState } from './useVariableFetchState';export interface VariableOptions {options: string[];diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/useSeedVariableSelection.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useSeedVariableSelection.tssimilarity index 87%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/useSeedVariableSelection.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useSeedVariableSelection.tsindex 62431e8f1c..b117108af5 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/useSeedVariableSelection.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useSeedVariableSelection.ts@@ -2,21 +2,21 @@ import { useEffect, useMemo } from 'react';import type { DashboardtypesGettableDashboardV2DTO } from 'api/generated/services/sigNoz.schemas';import { useQueryState } from 'nuqs';-import { dtoToFormModel } from '../DashboardSettings/Variables/variableAdapters';-import type { VariableFormModel } from '../DashboardSettings/Variables/variableFormModel';-import { selectVariableValues } from '../store/slices/variableSelectionSlice';-import { useDashboardStore } from '../store/useDashboardStore';-import { resolveDefaultSelection } from './resolveVariableSelection';+import { dtoToFormModel } from '../../DashboardSettings/Variables/variableAdapters';+import type { VariableFormModel } from '../../DashboardSettings/Variables/variableFormModel';+import { selectVariableValues } from '../../store/slices/variableSelectionSlice';+import { useDashboardStore } from '../../store/useDashboardStore';+import { resolveDefaultSelection } from '../utils/resolveVariableSelection';import type {SelectedVariableValue,VariableSelection,VariableSelectionMap,-} from './selectionTypes';+} from '../selectionTypes';import {deriveFetchContext,type VariableFetchContext,-} from './variableDependencies';-import { ALL_SELECTED, variablesUrlParser } from './variablesUrlState';+} from '../utils/variableDependencies';+import { ALL_SELECTED, variablesUrlParser } from '../utils/variablesUrlState';// The `__ALL__` sentinel only means "ALL" for variables that support it — a// legitimate value of "__ALL__" (e.g. a text var) is taken literally.diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/useVariableFetchState.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useVariableFetchState.tssimilarity index 93%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/useVariableFetchState.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useVariableFetchState.tsindex bae3a467ff..bc02e3a38b 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/useVariableFetchState.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useVariableFetchState.ts@@ -3,8 +3,8 @@ import {selectVariableFetchedOnce,selectVariableFetchState,VariableFetchState,-} from '../store/slices/variableFetchSlice';-import { useDashboardStore } from '../store/useDashboardStore';+} from '../../store/slices/variableFetchSlice';+import { useDashboardStore } from '../../store/useDashboardStore';export interface VariableFetchStateResult {variableFetchState: VariableFetchState;diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectors/useVariableOptions.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useVariableOptions.tssimilarity index 100%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectors/useVariableOptions.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useVariableOptions.tsdiff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/useVariableSelection.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useVariableSelection.tssimilarity index 94%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/useVariableSelection.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useVariableSelection.tsindex faca7c2235..47ad7f6bd9 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/useVariableSelection.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/hooks/useVariableSelection.ts@@ -5,10 +5,13 @@ import { useSelector } from 'react-redux';import type { AppState } from 'store/reducers';import type { GlobalReducer } from 'types/reducer/globalTime';-import type { VariableFormModel } from '../DashboardSettings/Variables/variableFormModel';-import { selectVariableValues } from '../store/slices/variableSelectionSlice';-import { useDashboardStore } from '../store/useDashboardStore';-import type { VariableSelection, VariableSelectionMap } from './selectionTypes';+import type { VariableFormModel } from '../../DashboardSettings/Variables/variableFormModel';+import { selectVariableValues } from '../../store/slices/variableSelectionSlice';+import { useDashboardStore } from '../../store/useDashboardStore';+import type {+ VariableSelection,+ VariableSelectionMap,+} from '../selectionTypes';import { useSeedVariableSelection } from './useSeedVariableSelection';/**diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/dynamicFilter.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/dynamicFilter.tssimilarity index 90%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/dynamicFilter.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/dynamicFilter.tsindex f7c7bc873d..aefaeb2077 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/dynamicFilter.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/dynamicFilter.ts@@ -1,5 +1,5 @@-import type { VariableFormModel } from '../DashboardSettings/Variables/variableFormModel';-import type { VariableSelectionMap } from './selectionTypes';+import type { VariableFormModel } from '../../DashboardSettings/Variables/variableFormModel';+import type { VariableSelectionMap } from '../selectionTypes';function formatQueryValue(val: string): string {const num = Number(val);diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/resolveVariableSelection.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/resolveVariableSelection.tssimilarity index 97%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/resolveVariableSelection.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/resolveVariableSelection.tsindex ce000ff52b..3c20b785ab 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/resolveVariableSelection.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/resolveVariableSelection.ts@@ -1,8 +1,8 @@-import type { VariableFormModel } from '../DashboardSettings/Variables/variableFormModel';+import type { VariableFormModel } from '../../DashboardSettings/Variables/variableFormModel';import type {SelectedVariableValue,VariableSelection,-} from './selectionTypes';+} from '../selectionTypes';import { ALL_SELECTED } from './variablesUrlState';// One default resolver, shared by the seed, the post-fetch reconcile and thediff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectionUtils.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/selectionUtils.tssimilarity index 93%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectionUtils.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/selectionUtils.tsindex 92dbdc3fc2..32fba4a14e 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/selectionUtils.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/selectionUtils.ts@@ -1,9 +1,9 @@-import type { VariableType } from '../DashboardSettings/Variables/variableFormModel';+import type { VariableType } from '../../DashboardSettings/Variables/variableFormModel';import type {SelectedVariableValue,VariableSelection,VariableSelectionMap,-} from './selectionTypes';+} from '../selectionTypes';/** A selection counts as resolved (usable as a parent value) when it's non-empty. */export function isResolved(selection?: VariableSelection): boolean {diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/variableDependencies.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/variableDependencies.tssimilarity index 99%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/variableDependencies.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/variableDependencies.tsindex f1bf0b1d1f..f8a52f7217 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/variableDependencies.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/variableDependencies.ts@@ -3,7 +3,7 @@ import { textContainsVariableReference } from 'lib/dashboardVariables/variableReimport type {VariableFormModel,VariableType,-} from '../DashboardSettings/Variables/variableFormModel';+} from '../../DashboardSettings/Variables/variableFormModel';/*** Inter-variable dependency graph for runtime selection. A QUERY variablediff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/variablesUrlState.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/variablesUrlState.tssimilarity index 86%rename from frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/variablesUrlState.tsrename to frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/variablesUrlState.tsindex 165f0eef13..2406be531e 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/variablesUrlState.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/VariablesBar/utils/variablesUrlState.ts@@ -1,6 +1,6 @@import { parseAsJson } from 'nuqs';-import type { SelectedVariableValue } from './selectionTypes';+import type { SelectedVariableValue } from '../selectionTypes';/** URL sentinel for an "ALL values selected" state (matches V1). */export const ALL_SELECTED = '__ALL__';diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/hooks/useIsPanelWaitingOnVariable.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/hooks/useIsPanelWaitingOnVariable.tsindex ade961f3ed..eccf63eab8 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/hooks/useIsPanelWaitingOnVariable.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/hooks/useIsPanelWaitingOnVariable.ts@@ -1,4 +1,4 @@-import { hasUsableValue } from '../VariablesBar/selectionUtils';+import { hasUsableValue } from '../VariablesBar/utils/selectionUtils';import { VariableFetchState } from '../store/slices/variableFetchSlice';import { selectVariableValues } from '../store/slices/variableSelectionSlice';import { useDashboardStore } from '../store/useDashboardStore';diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/queryV5/buildVariablesPayload.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/queryV5/buildVariablesPayload.tsindex 17b6989b63..5731c1bfbf 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/queryV5/buildVariablesPayload.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/queryV5/buildVariablesPayload.ts@@ -8,7 +8,7 @@ import type {VariableFormModel,VariableType,} from '../DashboardSettings/Variables/variableFormModel';-import { configuredDefaultValue } from '../VariablesBar/resolveVariableSelection';+import { configuredDefaultValue } from '../VariablesBar/utils/resolveVariableSelection';import type {VariableSelection,VariableSelectionMap,diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/store/slices/__tests__/variableFetchSlice.test.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/store/slices/__tests__/variableFetchSlice.test.tsindex f219f5f036..1dbf54a6ea 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/store/slices/__tests__/variableFetchSlice.test.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/store/slices/__tests__/variableFetchSlice.test.ts@@ -5,7 +5,7 @@ import {import {deriveFetchContext,type VariableFetchContext,-} from '../../../VariablesBar/variableDependencies';+} from '../../../VariablesBar/utils/variableDependencies';import { useDashboardStore } from '../../useDashboardStore';function model(overrides: Partial<VariableFormModel>): VariableFormModel {diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/store/slices/variableFetchSlice.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/store/slices/variableFetchSlice.tsindex b21b20416d..1c205fd57e 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/store/slices/variableFetchSlice.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/store/slices/variableFetchSlice.ts@@ -1,8 +1,8 @@import type { StateCreator } from 'zustand';-import { hasUsableValue } from '../../VariablesBar/selectionUtils';+import { hasUsableValue } from '../../VariablesBar/utils/selectionUtils';import type { VariableSelectionMap } from '../../VariablesBar/selectionTypes';-import type { VariableFetchContext } from '../../VariablesBar/variableDependencies';+import type { VariableFetchContext } from '../../VariablesBar/utils/variableDependencies';import type { DashboardStore } from '../useDashboardStore';import { selectVariableValues } from './variableSelectionSlice';import {@@ -132,13 +132,11 @@ export const createVariableFetchSlice: StateCreator<initVariableFetch: (names, context): void => {const maps = cloneMaps(get());const resolvedEmpty = { ...get().variableResolvedEmpty };- // Initialize new variables to idle, preserving existing states.names.forEach((name) => {if (!maps.states[name]) {maps.states[name] = VariableFetchState.Idle;}});- // Drop entries for variables that no longer exist.const nameSet = new Set(names);Object.keys(maps.states).forEach((name) => {if (!nameSet.has(name)) {diff --git a/frontend/src/pages/DashboardPageV2/PanelEditorPage/PanelEditorPage.tsx b/frontend/src/pages/DashboardPageV2/PanelEditorPage/PanelEditorPage.tsxindex fcad14d758..ee49fdef6b 100644--- a/frontend/src/pages/DashboardPageV2/PanelEditorPage/PanelEditorPage.tsx+++ b/frontend/src/pages/DashboardPageV2/PanelEditorPage/PanelEditorPage.tsx@@ -23,7 +23,7 @@ import {import { useSyncVariablesForSuggestions } from '../DashboardContainer/hooks/useSyncVariablesForSuggestions';import { createDefaultPanel } from '../DashboardContainer/patchOps';import { useDashboardStore } from '../DashboardContainer/store/useDashboardStore';-import { useSeedVariableSelection } from '../DashboardContainer/VariablesBar/useSeedVariableSelection';+import { useSeedVariableSelection } from '../DashboardContainer/VariablesBar/hooks/useSeedVariableSelection';import { buildNewPanelSeed } from './newPanelSeed';import styles from './PanelEditorPage.module.scss';