Compare commits

..

12 Commits

Author SHA1 Message Date
Manika Malhotra
5f240876fe test(alerts): drop a mock of a helper AlertThreshold does not use 2026-11-30 14:49:01 +05:30
Manika Malhotra
8b3ea4bd89 chore(dashboard): keep PANEL_ACTION_META and drop a link to the deleted isResolved 2026-11-30 14:44:37 +05:30
Manika Malhotra
8f4d724ca6 fix(alerts): keep the check that SPEC_FIELDS lists every channel field 2026-11-30 14:44:16 +05:30
Manika Malhotra
08e7ad7609 refactor(frontend): keep the exports of code that stays 2026-11-30 13:56:37 +05:30
Manika Malhotra
85939b183c chore(frontend): remove dead global styles 2026-11-30 13:28:37 +05:30
Manika Malhotra
f23907d430 chore(frontend): remove unused CSS module classes 2026-11-30 13:28:34 +05:30
Manika Malhotra
05e394f633 refactor(dashboard): remove unused exports 2026-11-30 13:28:23 +05:30
Manika Malhotra
3f34166c43 refactor(alerts): remove unused exports 2026-11-30 13:28:17 +05:30
Manika Malhotra
8d48af6722 refactor(infra-monitoring): remove unused exports 2026-11-30 13:28:11 +05:30
Manika Malhotra
d9c4cf3df4 chore(dashboard): remove the unused first-section migration flow 2026-11-30 13:28:04 +05:30
Manika Malhotra
e792c299af test(dashboard): remove the test of the unused histogram chart options 2026-11-30 13:28:03 +05:30
Manika Malhotra
2be92484b5 chore(frontend): remove unused files 2026-11-30 13:28:02 +05:30
113 changed files with 12 additions and 2385 deletions

View File

@@ -29,33 +29,6 @@
min-width: 0;
}
.overflowTrigger {
all: unset;
cursor: pointer;
}
.labelPopover {
display: flex;
flex-direction: column;
gap: 6px;
padding: 8px;
max-height: 300px;
overflow-y: auto;
}
.labelTooltip {
display: flex;
flex-direction: column;
gap: 6px;
max-height: 300px;
overflow-y: auto;
}
.labelValue {
text-overflow: ellipsis;
overflow: hidden;
}
.tooltipContent {
display: flex;
align-items: center;

View File

@@ -1,29 +1,5 @@
import type { BadgeColorType } from '@signozhq/ui/badge';
export const STATE_ORDER = ['firing', 'pending', 'inactive', 'disabled'];
export const SEVERITY_ORDER = ['critical', 'error', 'warning', 'info'];
export const STATE_LABELS: Record<string, string> = {
firing: 'Firing',
pending: 'Pending',
inactive: 'OK',
disabled: 'Disabled',
};
export const STATE_COLORS: Record<string, string> = {
firing: 'var(--bg-cherry-500)',
pending: 'var(--bg-amber-500)',
inactive: 'var(--bg-forest-500)',
disabled: 'var(--l2-foreground)',
};
export const SEVERITY_COLORS: Record<string, string> = {
critical: 'var(--bg-cherry-500)',
error: 'var(--bg-cherry-400)',
warning: 'var(--bg-amber-500)',
info: 'var(--bg-robin-500)',
};
export const SEVERITY_BADGE_COLORS: Record<string, BadgeColorType> = {
critical: 'danger',
error: 'danger',

View File

@@ -24,11 +24,6 @@
flex-wrap: wrap;
}
.filtersLabel {
color: var(--l2-foreground);
margin-right: 2px;
}
.filterControls {
display: flex;
align-items: center;

View File

@@ -8,8 +8,3 @@
border-top: 1px solid var(--l2-border);
background: var(--l1-background);
}
.count {
font-size: var(--label-small-400-font-size);
color: var(--l3-foreground);
}

View File

@@ -74,10 +74,6 @@
padding: 1px 6px;
}
.deleteName {
color: var(--danger-background);
}
.row {
position: relative;
display: flex;

View File

@@ -62,16 +62,6 @@ $custom-border-color: #2c3044;
}
}
.all-selected-text {
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
color: var(--l2-foreground);
z-index: 1;
pointer-events: none;
}
.ant-select-selector {
max-height: 200px;
overflow: auto;
@@ -450,8 +440,7 @@ $custom-border-color: #2c3044;
width: 100%;
background-color: var(--l2-background);
.select-all-option,
.custom-value-option {
.select-all-option {
padding: 8px 12px;
border-bottom: 1px solid $custom-border-color;
margin-bottom: 8px;
@@ -461,16 +450,6 @@ $custom-border-color: #2c3044;
z-index: 1;
}
.selected-values-section {
padding: 0 0 8px 0;
border-bottom: 1px solid $custom-border-color;
margin-bottom: 8px;
.selected-option {
padding: 4px 12px;
}
}
.select-group {
margin-bottom: 12px;
overflow: hidden;
@@ -656,14 +635,6 @@ $custom-border-color: #2c3044;
font-weight: 500;
}
// Custom option styles for keyboard navigation
.custom-option {
&.focused,
&.ant-select-item-option-active {
background-color: var(--l1-border) !important;
}
}
// Improve the sticky headers appearance
.custom-select-dropdown-container {
.group-label,
@@ -744,12 +715,6 @@ $custom-border-color: #2c3044;
.custom-multiselect-dropdown {
@include custom-scrollbar;
// Main content area
.options-container {
@include custom-scrollbar;
padding-right: 2px; // Add slight padding to prevent content touching scrollbar
}
// Non-sectioned options
.no-section-options {
@include nested-scrollbar;
@@ -762,11 +727,6 @@ $custom-border-color: #2c3044;
.custom-select-dropdown-container,
.custom-multiselect-dropdown-container {
@include custom-scrollbar;
// Add subtle shadow inside to indicate scrollable area
&.has-overflow {
box-shadow: inset 0 -10px 10px -10px rgba(0, 0, 0, 0.2);
}
}
// Light Mode Overrides
@@ -958,16 +918,11 @@ $custom-border-color: #2c3044;
}
.custom-multiselect-dropdown {
.select-all-option,
.custom-value-option {
.select-all-option {
border-bottom: 1px solid #f0f0f0;
background-color: #fafafa;
}
.selected-values-section {
border-bottom: 1px solid #f0f0f0;
}
.status-message {
color: rgba(0, 0, 0, 0.65);
border-top: 1px dashed #f0f0f0;
@@ -984,13 +939,6 @@ $custom-border-color: #2c3044;
background-color: rgba(24, 144, 255, 0.2);
}
.custom-option {
&.focused,
&.ant-select-item-option-active {
background-color: #f5f5f5 !important;
}
}
.custom-select-dropdown-container {
.group-label,
.ant-select-item-group {

View File

@@ -94,21 +94,9 @@
&__text {
color: var(--l2-foreground);
line-height: 18px;
.bold-text {
color: var(--l1-foreground);
}
}
&__button-wrapper {
margin-top: 12px;
.configure-alert-rule-button {
padding: 8px 16px;
border-radius: 2px;
background: var(--l3-background);
border-width: 0;
color: var(--l1-foreground);
display: flex;
align-items: center;
}
}
}
}

View File

@@ -19,14 +19,4 @@
line-height: 18px;
letter-spacing: -0.06px;
}
&__chart {
.chart-placeholder {
width: 100%;
height: 52px;
background: color-mix(in srgb, var(--l1-foreground) 12%, transparent);
display: flex;
align-items: center;
justify-content: center;
}
}
}

View File

@@ -104,7 +104,6 @@ jest.mock('hooks/notificationChannels/useChannelOptions', () => ({
// Mock alert format categories
jest.mock('constants/formats/alertFormatCategories', () => ({
getCategoryByOptionId: jest.fn(() => ({ name: 'bytes' })),
getCategorySelectOptionByName: jest.fn(() => [
{ label: 'Bytes', value: 'bytes' },
{ label: 'KB', value: 'kb' },

View File

@@ -205,46 +205,6 @@
}
}
}
.recovery-threshold-input-group {
display: flex;
align-items: center;
gap: 0;
margin-left: 28px;
.recovery-threshold-label {
pointer-events: none;
cursor: default;
}
.recovery-threshold-btn {
pointer-events: none;
cursor: default;
color: var(--muted-foreground);
background-color: var(--surface-2) !important;
border: 1px solid var(--l1-border);
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
}
.ant-input {
background-color: var(--surface-2);
border: 1px solid var(--l1-border);
color: var(--l1-foreground);
height: 32px;
&:hover {
border-color: var(--l1-border);
}
&:focus {
border-color: var(--l1-border);
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}
}
}
}
}
@@ -275,15 +235,10 @@
gap: 4px;
}
}
.ant-typography {
color: var(--accent-primary);
}
}
}
.condensed-alert-threshold-container,
.condensed-anomaly-threshold-container {
.condensed-alert-threshold-container {
width: 100%;
}

View File

@@ -11,11 +11,6 @@
gap: 16px;
padding: 16px;
.ant-typography {
color: var(--l1-foreground);
font-size: 13px;
}
.ant-btn-group {
.ant-btn {
border: 1px solid var(--l1-border);
@@ -133,12 +128,6 @@
flex-direction: column;
gap: 4px;
.ant-typography {
color: var(--l1-foreground);
font-size: 13px;
font-weight: 500;
}
.ant-select {
border: 1px solid var(--l1-border);

View File

@@ -1,53 +1,3 @@
.evaluation-settings-container {
margin: 16px;
.evaluate-alert-conditions-container {
display: flex;
align-items: center;
gap: 16px;
background-color: var(--l2-background);
padding: 16px;
border-radius: 4px;
border: 1px solid var(--l1-border);
margin-bottom: 16px;
.ant-typography {
color: var(--l2-foreground);
}
.evaluate-alert-conditions-separator {
flex: 1;
height: 1px;
border-top: 1px dashed var(--l1-border);
}
.ant-btn {
display: flex;
align-items: center;
justify-content: space-between;
background-color: var(--l2-background);
border: 1px solid var(--l1-border);
.evaluate-alert-conditions-button-left {
color: var(--l2-foreground);
padding-right: 16px;
}
.evaluate-alert-conditions-button-right {
display: flex;
align-items: center;
color: var(--muted-foreground);
gap: 8px;
.evaluate-alert-conditions-button-right-text {
background-color: var(--l2-background);
padding: 1px 4px;
}
}
}
}
}
.advanced-options-container {
.ant-collapse {
.ant-collapse-item {
@@ -118,18 +68,9 @@
margin: 0 -16px;
padding: 4px 16px;
.ant-typography {
color: var(--muted-foreground);
font-weight: 400;
}
&.active {
background-color: var(--l1-background);
border-left: 2px solid var(--bg-robin-500);
.ant-typography {
font-weight: 500;
color: var(--l1-foreground);
}
}
&:hover {
@@ -147,25 +88,12 @@
gap: 16px;
width: 400px;
.ant-typography {
color: var(--muted-foreground);
}
.ant-btn {
width: fit-content;
}
}
}
.evaluation-window-footer {
display: flex;
justify-content: flex-end;
gap: 8px;
background-color: var(--l2-background);
border-top: 1px solid var(--l1-border);
padding: 16px;
}
.ant-btn {
background-color: var(--l3-background);
border: 1px solid var(--l1-border);
@@ -188,13 +116,6 @@
display: flex;
flex-direction: column;
gap: 2px;
.ant-typography {
color: var(--l3-foreground);
font-size: 11px;
line-height: 18px;
font-weight: 500;
}
}
.time-select-group {
@@ -218,12 +139,6 @@
}
}
.ant-typography {
color: var(--l2-foreground);
font-size: 13px;
font-weight: 500;
}
.ant-select {
width: 60%;
background-color: var(--l2-background);

View File

@@ -57,14 +57,6 @@ export interface IEvaluationCadencePreviewProps {
setIsOpen: Dispatch<SetStateAction<boolean>>;
}
export interface TimeInputProps {
value?: string; // Format: "HH:MM:SS"
onChange?: (value: string) => void;
placeholder?: string;
disabled?: boolean;
className?: string;
}
export interface IEditCustomScheduleProps {
setIsEvaluationCadenceDetailsVisible: (isOpen: boolean) => void;
setIsPreviewVisible: (isOpen: boolean) => void;

View File

@@ -101,84 +101,12 @@
display: flex;
flex-direction: column;
gap: 8px;
.ant-typography {
display: flex;
gap: 4px;
align-items: center;
}
}
.ant-select {
width: 300px;
}
}
.re-notification-container {
display: flex;
flex-direction: column;
gap: 16px;
background-color: var(--l2-background);
border: 1px solid var(--l1-border);
padding: 16px;
margin-top: 16px;
.advanced-option-item {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 16px;
.advanced-option-item-left-content {
display: flex;
flex-direction: column;
gap: 6px;
}
}
.border-bottom {
border-bottom: 1px solid var(--l1-border);
width: 100%;
margin-left: -16px;
margin-right: -32px;
}
.re-notification-condition {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: nowrap;
.ant-typography {
color: var(--l2-foreground);
white-space: nowrap;
}
.ant-select {
width: 200px;
height: 32px;
flex-shrink: 0;
.ant-select-selector {
border: 1px solid var(--l1-border);
&:hover {
border-color: var(--l1-border);
}
&:focus {
border-color: var(--l1-border);
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}
}
}
.ant-input {
width: 200px;
flex-shrink: 0;
border: 1px solid var(--l1-border);
}
}
}
}
}

View File

@@ -15,11 +15,6 @@
border-bottom: none;
margin-bottom: -1px;
.prom-ql-icon {
height: 13px;
width: 13px;
}
.explorer-view-option {
display: flex;
align-items: center;

View File

@@ -64,13 +64,6 @@ export interface ICreateAlertProviderProps {
ruleId?: string;
}
export enum AlertCreationStep {
ALERT_DEFINITION = 0,
ALERT_CONDITION = 1,
EVALUATION_SETTINGS = 2,
NOTIFICATION_SETTINGS = 3,
}
export interface AlertState {
name: string;
labels: Labels;

View File

@@ -1,21 +1,5 @@
import { AlertTypes } from 'types/api/alerts/alertTypes';
import {
AdvancedOptionsState,
AlertState,
AlertThresholdState,
EvaluationWindowState,
NotificationSettingsState,
} from './context/types';
export interface CreateAlertProps {
alertType: AlertTypes;
}
export interface GetCreateAlertLocalStateFromAlertDefReturn {
basicAlertState: AlertState;
thresholdState: AlertThresholdState;
advancedOptionsState: AdvancedOptionsState;
evaluationWindowState: EvaluationWindowState;
notificationSettingsState: NotificationSettingsState;
}

View File

@@ -13,10 +13,6 @@
border-color: var(--l1-border);
margin: 16px 0;
}
.breadcrumb-divider {
margin-top: 10px;
}
}
.create-alert__breadcrumb {
@@ -26,16 +22,7 @@
align-items: center;
}
.breadcrumb-item {
color: var(--l2-foreground);
font-size: 14px;
line-height: 20px;
letter-spacing: 0.25px;
padding: 0;
}
.ant-breadcrumb-separator,
.breadcrumb-item--last {
.ant-breadcrumb-separator {
color: var(--muted-foreground);
font-family: var(--code-base-400-font-family);
}

View File

@@ -11,10 +11,6 @@
padding: var(--spacing-4) var(--spacing-5) 0;
}
.title {
font-weight: var(--label-base-500-font-weight);
}
.body {
display: flex;
flex-direction: column;

View File

@@ -5,46 +5,12 @@
--row-control-height: 28px;
}
.row {
display: flex;
align-items: center;
gap: var(--spacing-2);
margin-bottom: var(--spacing-2);
}
.field {
flex: 1 1 0;
min-width: 0;
max-width: 300px;
}
.row > :not(.field) {
flex: 0 0 auto;
}
.heading {
font-size: 11px;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--muted-foreground);
}
.add {
/* Sits with the blocks it adds to, not against the next field's label. */
margin-top: var(--spacing-2);
--button-height: var(--row-control-height);
}
@media (max-width: 720px) {
.row {
flex-wrap: wrap;
}
.field {
max-width: none;
}
}
/* One entry per block, every input labelled. A row of bare boxes gave no way to
tell which column was which once a value was typed. The block keeps a readable
width while the rest of the form fills the page, so its two columns do not
@@ -70,12 +36,6 @@
--button-icon-size: 14px;
}
.entryIndex {
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--muted-foreground);
}
.entryGrid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));

View File

@@ -1,8 +0,0 @@
import { Button as ButtonComponent } from 'antd';
import styled from 'styled-components';
export const Button = styled(ButtonComponent)`
&&& {
margin-right: 1rem;
}
`;

View File

@@ -11,18 +11,4 @@
.threshold-alert-uplot-chart-container {
height: calc(100% - 24px);
}
.anomaly-alert-evaluation-view-loading-container {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.anomaly-alert-evaluation-view-error-container {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
}

View File

@@ -11,11 +11,6 @@
align-items: center;
justify-content: center;
gap: 8px;
.prom-ql-icon {
height: 14px;
width: 14px;
}
}
.ant-btn-default {
border-color: transparent;

View File

@@ -12,19 +12,6 @@
position: relative;
overflow-y: auto;
:global(.periscope-btn) {
&.ghost:not(:disabled) {
border: none;
background: transparent;
&:hover {
background: transparent;
color: var(--bg-robin-500) !important;
font-weight: 500;
}
}
}
&::-webkit-scrollbar {
width: 8px;
height: 8px;

View File

@@ -24,10 +24,6 @@
gap: var(--spacing-2);
}
.statusToggleItem {
flex: unset;
}
.statusDot {
width: 8px;
height: 8px;

View File

@@ -1,14 +1,3 @@
.entityGroupHeader {
padding-left: var(--spacing-5);
gap: var(--spacing-5);
display: flex;
align-items: center;
}
.hostnameColumnHeader {
display: block;
}
.progressContainer {
display: flex;
align-items: center;
@@ -17,8 +6,3 @@
width: 100%;
}
}
.progressBar {
flex: 1;
margin-right: 8px;
}

View File

@@ -30,7 +30,6 @@ import { INFRA_MONITORING_DETAILS_CACHE_TIME } from 'constants/queryCacheTime';
export type {
CustomTab,
CustomTabRenderProps,
K8sBaseDetailsProps,
K8sDetailsCountConfig,
K8sDetailsFilters,

View File

@@ -19,10 +19,6 @@
width: 100%;
}
.k8SFiltersButton {
flex: 0 0 auto;
}
.k8SDateTimeSelection {
margin-left: auto;
display: flex;

View File

@@ -36,26 +36,6 @@ export type K8sBaseFilters = {
};
};
export type K8sListResponse<T> = {
type: 'list' | 'grouped_list';
records: T[];
total: number;
endTimeBeforeRetention?: boolean;
error?: string | null;
};
/**
* Type for table row data with required key fields.
* Used when rendering raw data in the table.
*/
export type K8sTableRowData<T> = T & {
key: string;
id: string;
itemKey: string;
/** Metadata about which attributes were used for grouping */
groupedByMeta?: Record<string, string>;
};
export interface K8sDetailsMetadataConfig<T> {
label: string;
getValue: (entity: T) => string | number;
@@ -156,4 +136,3 @@ export interface K8sBaseDetailsContentProps<T> {
// Aliases for backward compatibility
export type CustomTab<T> = K8sDetailsCustomTab<T>;
export type CustomTabRenderProps<T> = K8sDetailsCustomTabRenderProps<T>;

View File

@@ -41,9 +41,3 @@ export const useDrawerHistoryStore = create<IDrawerHistoryStore>()(
export const resetDrawerHistory = (): void =>
useDrawerHistoryStore.getState().reset();
export const pushDrawerHistory = (entry: DrawerHistoryEntry): void =>
useDrawerHistoryStore.getState().push(entry);
export const getDrawerHistoryDepth = (): number =>
useDrawerHistoryStore.getState().entries.length;

View File

@@ -1,114 +0,0 @@
import { create } from 'zustand';
import { persist } from 'zustand/middleware';
export interface IEntityColumn {
label: string;
value: string;
id: string;
defaultVisibility: boolean;
canBeHidden: boolean;
behavior: 'hidden-on-expand' | 'hidden-on-collapse' | 'always-visible';
}
export interface IInfraMonitoringTableColumnsStore {
columns: Record<string, IEntityColumn[]>;
columnsHidden: Record<string, string[]>;
addColumn: (page: string, columnId: string) => void;
removeColumn: (page: string, columnId: string) => void;
initializePageColumns: (page: string, columns: IEntityColumn[]) => void;
}
export const useInfraMonitoringTableColumnsStore =
create<IInfraMonitoringTableColumnsStore>()(
persist(
(set, get) => ({
columns: {},
columnsHidden: {},
addColumn: (page, columnId): void => {
const state = get();
const columnDefinition = state.columns[page]?.find(
(c) => c.id === columnId,
);
if (!columnDefinition) {
return;
}
if (!columnDefinition.canBeHidden) {
return;
}
const columnsHidden = state.columnsHidden[page];
if (columnsHidden.includes(columnId)) {
set({
columnsHidden: {
...state.columnsHidden,
[page]: columnsHidden.filter((id) => id !== columnId),
},
});
}
},
removeColumn: (page, columnId): void => {
const state = get();
const columnDefinition = state.columns[page]?.find(
(c) => c.id === columnId,
);
if (!columnDefinition) {
return;
}
if (!columnDefinition.canBeHidden) {
return;
}
const columnsHidden = state.columnsHidden[page];
if (!columnsHidden.includes(columnId)) {
set({
columnsHidden: {
...state.columnsHidden,
[page]: [...columnsHidden, columnId],
},
});
}
},
initializePageColumns: (page, columns): void => {
const state = get();
set({
columns: {
...state.columns,
[page]: columns,
},
});
if (state.columnsHidden[page] === undefined) {
set({
columnsHidden: {
...state.columnsHidden,
[page]: columns
.filter((c) => c.defaultVisibility === false)
.map((c) => c.id),
},
});
}
},
}),
{
name: '@signoz/infra-monitoring-columns',
},
),
);
export const useInfraMonitoringTableColumnsForPage = (
page: string,
): [columns: IEntityColumn[], columnsHidden: string[]] => {
const state = useInfraMonitoringTableColumnsStore((s) => s.columns);
const columnsHidden = useInfraMonitoringTableColumnsStore(
(s) => s.columnsHidden,
);
return [state[page] ?? [], columnsHidden[page] ?? []];
};

View File

@@ -25,8 +25,3 @@
.title {
font-weight: 600;
}
.subtitle {
font-weight: 400;
color: var(--muted-foreground);
}

View File

@@ -64,11 +64,6 @@
width: fit-content;
}
}
.skeletonContainer {
height: 100%;
padding: 16px;
}
}
.listContainer {

View File

@@ -12,19 +12,6 @@
position: relative;
overflow-y: auto;
:global(.periscope-btn) {
&.ghost:not(:disabled) {
border: none;
background: transparent;
&:hover {
background: transparent;
color: var(--bg-robin-500) !important;
font-weight: 500;
}
}
}
&::-webkit-scrollbar {
width: 8px;
height: 8px;
@@ -50,14 +37,6 @@
border-right: 1px solid var(--l1-border);
}
.quickFiltersContainerHeader {
padding: 8px;
border-bottom: 1px solid var(--l1-border);
display: flex;
align-items: center;
justify-content: space-between;
}
.listContainer {
flex: 1;
max-width: 100%;

View File

@@ -247,13 +247,6 @@ export function getStrokeColorForPercent(
return (match ?? thresholds[thresholds.length - 1]).color;
}
export function getStrokeColor(
type: EntityProgressBarType,
value: number,
): string {
return getStrokeColorForPercent(type, Number((value * 100).toFixed(1)));
}
const PROGRESS_COLOR_BY_STROKE: Record<string, ProgressColorType> = {
[Color.BG_FOREST_500]: 'success',
[Color.BG_AMBER_200]: 'warning',

View File

@@ -32,8 +32,3 @@
align-items: baseline;
gap: var(--spacing-2);
}
.range {
white-space: nowrap;
font-variant-numeric: tabular-nums;
}

View File

@@ -186,35 +186,6 @@ export const K8sCategories = {
/** The section the Kubernetes view opens on when a link names none. */
export const DEFAULT_K8S_CATEGORY = K8sCategories.CONTAINERS;
const dotMap = {
[InfraMonitoringEntity.HOSTS]:
INFRA_MONITORING_ATTR_KEYS.SYSTEM_CPU_LOAD_AVERAGE_15M,
[InfraMonitoringEntity.PODS]: INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
[InfraMonitoringEntity.NODES]: INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CPU_USAGE,
[InfraMonitoringEntity.NAMESPACES]:
INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
[InfraMonitoringEntity.CLUSTERS]:
INFRA_MONITORING_ATTR_KEYS.K8S_NODE_CPU_USAGE,
[InfraMonitoringEntity.DEPLOYMENTS]:
INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
[InfraMonitoringEntity.STATEFULSETS]:
INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
[InfraMonitoringEntity.DAEMONSETS]:
INFRA_MONITORING_ATTR_KEYS.K8S_POD_CPU_USAGE,
[InfraMonitoringEntity.CONTAINERS]:
INFRA_MONITORING_ATTR_KEYS.CONTAINER_CPU_USAGE,
[InfraMonitoringEntity.JOBS]:
INFRA_MONITORING_ATTR_KEYS.K8S_JOB_DESIRED_SUCCESSFUL_PODS,
[InfraMonitoringEntity.VOLUMES]:
INFRA_MONITORING_ATTR_KEYS.K8S_VOLUME_CAPACITY,
};
export function GetK8sEntityToAggregateAttribute(
category: InfraMonitoringEntity,
): string {
return dotMap[category];
}
export function GetPodsQuickFiltersConfig(): IQuickFiltersConfig[] {
return [
{

View File

@@ -36,10 +36,6 @@
gap: 4px;
}
.icons {
color: white;
}
.actionContainer {
display: flex;
gap: 24px;

View File

@@ -9,8 +9,6 @@ import { dataSourceForAlertType } from 'constants/alerts';
import type { AlertRule, RuleListFilter } from './types';
export const ALERT_RULES_REFRESH_INTERVAL = 30_000;
export const ALERT_ACTIONS = {
TOGGLE: 'toggle',
EDIT: 'edit',

View File

@@ -94,11 +94,6 @@
height: 62px;
}
.expression {
font-family: var(--code-base-400-font-family);
font-size: 13px;
}
.timeText {
display: inline-block;
white-space: nowrap;
@@ -121,20 +116,6 @@
color: var(--l2-foreground);
}
.emptyTitle {
color: var(--l1-foreground);
font-size: 16px;
font-weight: 500;
line-height: 24px;
}
.emptySubtitle {
color: var(--l2-foreground);
font-size: 14px;
line-height: 20px;
max-width: 420px;
}
.docsLink {
color: var(--l2-foreground);
font-size: 13px;

View File

@@ -8,15 +8,6 @@
.ant-modal-header {
background-color: var(--l2-background);
.ant-typography {
margin: 0;
color: var(--l1-foreground);
font-family: Inter;
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 20px;
}
}
.downtime-schedule-btn {
@@ -55,16 +46,6 @@
}
}
.alert-rule-form {
display: flex;
gap: 8px;
align-items: end;
.alert-rule-info {
color: var(--l2-foreground);
}
}
.alert-rule-scope {
margin-bottom: 12px;
margin-top: 8px;
@@ -78,10 +59,6 @@
}
}
.alert-rule-all-warning {
color: var(--l2-foreground);
}
.formItemWithBullet {
margin-bottom: 0;
}
@@ -119,42 +96,11 @@
.ant-modal-body {
padding: 0px 16px 28px 16px;
.ant-typography {
color: var(--l2-foreground);
font-size: var(--paragraph-base-400-font-size);
font-style: normal;
font-weight: var(--paragraph-base-400-font-weight);
line-height: 20px;
letter-spacing: -0.07px;
}
.save-view-input {
margin-top: 8px;
display: flex;
gap: 8px;
}
.ant-color-picker-trigger {
padding: 6px;
border-radius: 2px;
border: 1px solid var(--l1-border);
background: var(--l3-background);
width: 32px;
height: 32px;
.ant-color-picker-color-block {
border-radius: 50px;
width: 16px;
height: 16px;
flex-shrink: 0;
.ant-color-picker-color-block-inner {
display: flex;
justify-content: center;
align-items: center;
}
}
}
}
.ant-modal-footer {

View File

@@ -66,31 +66,6 @@ export const getAlertOptionsFromIds = (
alertIds?.includes(alert.value as string),
);
export const recurrenceInfo = (
schedule?: AlertmanagertypesScheduleDTO | null,
): string => {
if (!schedule) {
return 'No';
}
const { startTime, endTime, timezone, recurrence } = schedule;
if (!recurrence) {
return 'No';
}
const { duration, repeatOn, repeatType } = recurrence;
const formattedStartTime = startTime
? formatDateTime(startTime, timezone)
: '';
const formattedEndTime = endTime
? `to ${formatDateTime(endTime, timezone)}`
: '';
const weeklyRepeatString = repeatOn ? `on ${repeatOn.join(', ')}` : '';
const durationString = duration ? `- Duration: ${duration}` : '';
return `Repeats - ${repeatType} ${weeklyRepeatString} from ${formattedStartTime} ${formattedEndTime} ${durationString}`;
};
export const defaultInitialValues: Partial<AlertmanagertypesPlannedMaintenanceDTO> =
{
name: '',

View File

@@ -121,20 +121,6 @@
color: var(--l2-foreground);
}
.emptyTitle {
color: var(--l1-foreground);
font-size: 16px;
font-weight: 500;
line-height: 24px;
}
.emptySubtitle {
color: var(--l2-foreground);
font-size: 14px;
line-height: 20px;
max-width: 420px;
}
.docsLink {
color: var(--l2-foreground);
font-size: 13px;

View File

@@ -120,28 +120,6 @@ export function getAppContextMockState(
};
}
export function mockLocation(pathname: string): jest.Mock {
return jest.fn().mockReturnValue({
pathname,
});
}
export function mockQueryParams(
params: Record<string, string | null>,
): URLSearchParams {
const realUrlQuery = new URLSearchParams();
Object.entries(params).forEach(([key, value]) => {
if (value !== null) {
realUrlQuery.set(key, value);
}
});
return Object.create(URLSearchParams.prototype, {
toString: { value: (): string => realUrlQuery.toString() },
get: { value: (key: string): string | null => realUrlQuery.get(key) },
});
}
export function convertRoutingPolicyToApiResponse(
routingPolicy: RoutingPolicy,
): ApiRoutingPolicy {

View File

@@ -8,15 +8,6 @@
.ant-modal-header {
background-color: var(--l2-background);
.ant-typography {
margin: 0;
color: var(--l1-foreground);
font-family: Inter;
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 20px;
}
}
}
@@ -30,15 +21,6 @@
flex-direction: column;
gap: 4px;
.ant-typography {
color: var(--muted-foreground);
font-size: 14px;
font-style: normal;
font-weight: 500;
line-height: 20px;
padding-bottom: 6px;
}
.ant-input {
width: 100%;
border-radius: 2px;
@@ -98,42 +80,11 @@
.ant-modal-body {
padding: 0px 16px 28px 16px;
.ant-typography {
color: var(--l2-foreground);
font-size: var(--paragraph-base-400-font-size);
font-style: normal;
font-weight: var(--paragraph-base-400-font-weight);
line-height: 20px;
letter-spacing: -0.07px;
}
.save-view-input {
margin-top: 8px;
display: flex;
gap: 8px;
}
.ant-color-picker-trigger {
padding: 6px;
border-radius: 2px;
border: 1px solid var(--l1-border);
background: var(--l3-background);
width: 32px;
height: 32px;
.ant-color-picker-color-block {
border-radius: 50px;
width: 16px;
height: 16px;
flex-shrink: 0;
.ant-color-picker-color-block-inner {
display: flex;
justify-content: center;
align-items: center;
}
}
}
}
.ant-modal-footer {

View File

@@ -7,17 +7,6 @@
padding-top: var(--spacing-8);
}
.header {
position: relative;
z-index: 10;
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 1rem;
flex-shrink: 0;
padding: 0 var(--spacing-8);
}
.filtersRow {
position: relative;
z-index: 10;
@@ -98,23 +87,6 @@
color: var(--l2-foreground);
}
.filterBadge {
display: inline-flex;
align-items: center;
gap: 4px;
margin-right: 3px;
}
.filterBadgeClose {
cursor: pointer;
opacity: 0.7;
transition: opacity 0.15s ease;
&:hover {
opacity: 1;
}
}
.paginationContainer {
padding-right: var(--spacing-12);
height: 62px;

View File

@@ -12,10 +12,6 @@
color: var(--bg-forest-500);
}
.emptyStateIconMuted {
color: var(--l2-foreground);
}
.emptyStateTitle {
font-size: 18px;
font-weight: 600;

View File

@@ -69,12 +69,6 @@
margin-bottom: 16px;
}
.legends-list-container {
width: 100%;
overflow: hidden;
overflow-y: auto;
}
.save-cancel-container {
flex-basis: 20%;
display: flex;

View File

@@ -1,24 +1,5 @@
import { PanelTypeAndGraphManagerVisibilityProps } from 'container/WidgetCard/Card/FullView/types';
export enum ColumnsKeyAndDataIndex {
Index = 'index',
Legend = 'legend',
Label = 'label',
Avg = 'avg',
Sum = 'sum',
Max = 'max',
Min = 'min',
}
export const ColumnsTitle = {
[ColumnsKeyAndDataIndex.Index]: 'Index',
[ColumnsKeyAndDataIndex.Label]: 'Label',
[ColumnsKeyAndDataIndex.Avg]: 'Avg',
[ColumnsKeyAndDataIndex.Sum]: 'Sum',
[ColumnsKeyAndDataIndex.Max]: 'Max',
[ColumnsKeyAndDataIndex.Min]: 'Min',
};
export const PANEL_TYPES_VS_FULL_VIEW_TABLE: PanelTypeAndGraphManagerVisibilityProps =
{
TIME_SERIES: true,

View File

@@ -1,5 +1,4 @@
import { PANEL_TYPES } from 'constants/queryBuilder';
import { themeColors } from 'constants/theme';
import styled, { css, FlattenSimpleInterpolation } from 'styled-components';
import { GraphContainerProps } from 'container/WidgetCard/Card/FullView/types';
@@ -40,15 +39,3 @@ export const GraphContainer = styled.div<GraphContainerProps>`
height: ${({ isGraphLegendToggleAvailable }): string =>
isGraphLegendToggleAvailable ? '50%' : '100%'};
`;
export const LabelContainer = styled.button<{
isDarkMode?: boolean;
disabled?: boolean;
}>`
max-width: 18.75rem;
cursor: ${(props): string => (props.disabled ? 'no-drop' : 'pointer')};
border: none;
background-color: transparent;
color: ${(props): string =>
props.isDarkMode ? themeColors.white : themeColors.black};
`;

View File

@@ -7,18 +7,6 @@ import { OnClickPluginOpts } from 'lib/uPlotLib/plugins/onClickPlugin';
import { Widgets } from 'types/api/widgets/widget';
import uPlot from 'uplot';
export interface DataSetProps {
index: number;
data: number | null;
label: string;
borderWidth: number;
spanGaps: boolean;
animations: boolean;
borderColor: string;
showLine: boolean;
pointRadius: number;
}
export interface LegendEntryProps {
label: string;
show: boolean;
@@ -29,13 +17,6 @@ export type PanelTypeAndGraphManagerVisibilityProps = Record<
boolean
>;
export interface LabelProps {
labelClickedHandler: (labelIndex: number) => void;
labelIndex: number;
label: string;
disabled?: boolean;
}
export interface FullViewProps {
widget: Widgets;
fullViewOptions?: boolean;

View File

@@ -3,61 +3,11 @@ import setLocalStorageKey from 'api/browser/localstorage/set';
import { LOCALSTORAGE } from 'constants/localStorage';
import getLabelName from 'lib/getLabelName';
import { QueryData } from 'types/api/widgets/getQuery';
import uPlot from 'uplot';
import {
LegendEntryProps,
SaveLegendEntriesToLocalStoreProps,
} from 'container/WidgetCard/Card/FullView/types';
import { ExtendedChartDataset } from 'lib/visualization/charts/types';
function convertToTwoDecimalsOrZero(value: number): number {
if (
typeof value === 'number' &&
!Number.isNaN(value) &&
value !== Infinity &&
value !== -Infinity
) {
const result = value ? value.toFixed(20).match(/^-?\d*\.?0*\d{0,2}/) : null;
return result ? parseFloat(result[0]) : 0;
}
return 0;
}
export const getDefaultTableDataSet = (
options: uPlot.Options,
data: uPlot.AlignedData,
): ExtendedChartDataset[] =>
options.series.map(
(item: uPlot.Series, index: number): ExtendedChartDataset => {
let arr: number[];
if (data[index]) {
arr = data[index] as number[];
} else {
arr = [];
}
return {
...item,
index,
show: true,
sum: convertToTwoDecimalsOrZero(arr.reduce((a, b) => a + b, 0) || 0),
avg: convertToTwoDecimalsOrZero(
(arr.reduce((a, b) => a + b, 0) || 0) / (arr.length || 1),
),
max: convertToTwoDecimalsOrZero(Math.max(...arr)),
min: convertToTwoDecimalsOrZero(Math.min(...arr)),
};
},
);
export const getAbbreviatedLabel = (label: string): string => {
let newLabel = label;
if (label.length > 30) {
newLabel = `${label.substring(0, 30)}...`;
}
return newLabel;
};
export const showAllDataSetFromApiResponse = (
apiResponse: QueryData[],
@@ -71,14 +21,6 @@ export const showAllDataSetFromApiResponse = (
show: true,
}));
export const showAllDataSet = (options: uPlot.Options): LegendEntryProps[] =>
options.series
.map((item): LegendEntryProps => ({
label: item.label || '',
show: true,
}))
.filter((_, index) => index !== 0);
export const saveLegendEntriesToLocalStorage = ({
options,
graphVisibilityState,
@@ -119,11 +61,3 @@ export const saveLegendEntriesToLocalStorage = ({
console.error('Error setting LEGEND_GRAPH to local storage', error);
}
};
export const getGraphManagerTableHeaderTitle = (
title: string,
yAxisUnit?: string,
): string => {
const yAxisUnitText = yAxisUnit ? `(in ${yAxisUnit})` : '';
return `${title} ${yAxisUnitText}`;
};

View File

@@ -11,13 +11,3 @@ export const Modal = styled(ModalComponent)<Props>`
min-height: ${({ height = '80vh' }): string => height};
}
`;
export const FullViewContainer = styled.div`
height: 70vh;
`;
export const ErrorContainer = styled.div`
margin-top: 2rem;
padding-left: 2rem;
padding-right: 2rem;
`;

View File

@@ -1,6 +1,5 @@
import { Dispatch, MutableRefObject, ReactNode, SetStateAction } from 'react';
import { Dispatch, ReactNode, SetStateAction } from 'react';
import { UseQueryResult } from 'react-query';
import { ToggleGraphProps } from 'components/Graph/types';
import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
import { RowData } from 'lib/query/createTableColumnsFromQuery';
import { OnClickPluginOpts } from 'lib/uPlotLib/plugins/onClickPlugin';
@@ -72,14 +71,3 @@ export interface GridCardGraphProps {
customTimeRangeWindowForCoRelation?: string | undefined;
enableDrillDown?: boolean;
}
export interface GetGraphVisibilityStateOnLegendClickProps {
options: uPlot.Options;
isExpandedName: boolean;
name: string;
}
export interface ToggleGraphsVisibilityInChartProps {
graphsVisibilityStates: GraphVisibilityLegendEntryProps['graphVisibilityStates'];
lineChartRef: MutableRefObject<ToggleGraphProps | undefined>;
}

View File

@@ -15,15 +15,8 @@ import { DataSource } from 'types/common/queryBuilder';
import { GraphClickProps } from 'container/WidgetCard/hooks/useGraphClickToShowButton';
import { NavigateToExplorerPagesProps } from 'container/WidgetCard/hooks/useNavigateToExplorerPages';
import { LegendEntryProps } from 'container/WidgetCard/Card/FullView/types';
import {
showAllDataSet,
showAllDataSetFromApiResponse,
} from 'container/WidgetCard/Card/FullView/utils';
import {
GetGraphVisibilityStateOnLegendClickProps,
GraphVisibilityLegendEntryProps,
ToggleGraphsVisibilityInChartProps,
} from 'container/WidgetCard/Card/types';
import { showAllDataSetFromApiResponse } from 'container/WidgetCard/Card/FullView/utils';
import { GraphVisibilityLegendEntryProps } from 'container/WidgetCard/Card/types';
export const getLocalStorageGraphVisibilityState = ({
apiResponse,
@@ -87,66 +80,6 @@ export const getLocalStorageGraphVisibilityState = ({
return visibilityStateAndLegendEntry;
};
export const getGraphVisibilityStateOnDataChange = ({
options,
isExpandedName,
name,
}: GetGraphVisibilityStateOnLegendClickProps): GraphVisibilityLegendEntryProps => {
const visibilityStateAndLegendEntry: GraphVisibilityLegendEntryProps = {
graphVisibilityStates: Array(options.series.length).fill(true),
legendEntry: showAllDataSet(options),
};
if (getLocalStorageKey(LOCALSTORAGE.GRAPH_VISIBILITY_STATES) !== null) {
const legendGraphFromLocalStore = getLocalStorageKey(
LOCALSTORAGE.GRAPH_VISIBILITY_STATES,
);
let legendFromLocalStore: {
name: string;
dataIndex: LegendEntryProps[];
}[] = [];
try {
legendFromLocalStore = JSON.parse(legendGraphFromLocalStore || '[]');
} catch (error) {
console.error(
'Error parsing GRAPH_VISIBILITY_STATES from local storage',
error,
);
}
const newGraphVisibilityStates = Array(options.series.length).fill(true);
legendFromLocalStore.forEach((item) => {
const newName = isExpandedName ? `${name}expanded` : name;
if (item.name === newName) {
visibilityStateAndLegendEntry.legendEntry = item.dataIndex;
options.series.forEach((datasets, i) => {
if (i !== 0) {
const index = item.dataIndex.findIndex(
(dataKey) => dataKey.label === datasets.label,
);
if (index !== -1) {
newGraphVisibilityStates[i] = item.dataIndex[index].show;
}
}
});
visibilityStateAndLegendEntry.graphVisibilityStates =
newGraphVisibilityStates;
}
});
}
return visibilityStateAndLegendEntry;
};
export const toggleGraphsVisibilityInChart = ({
graphsVisibilityStates,
lineChartRef,
}: ToggleGraphsVisibilityInChartProps): void => {
graphsVisibilityStates?.forEach((showLegendData, index) => {
lineChartRef?.current?.toggleGraph(index, showLegendData);
});
};
export const isDataAvailableByPanelType = (
data?: MetricRangePayloadProps['data'],
panelType?: string,

View File

@@ -1,30 +1 @@
import { CSSProperties } from 'react';
import { themeColors } from 'constants/theme';
import { limit } from 'lib/getChartData';
const positionCss: CSSProperties['position'] = 'absolute';
export const spinnerStyles = {
position: positionCss,
top: '0',
right: '0',
};
export const tooltipStyles = {
fontSize: '1rem',
top: '0.313rem',
position: positionCss,
right: '0.313rem',
color: themeColors.errorColor,
};
export const errorTooltipPosition = 'top';
export const overlayStyles: CSSProperties = {
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
position: 'absolute',
};
export const WARNING_MESSAGE = `Too many timeseries in the result. UI has restricted to showing the top ${limit}. Please check the query if this is needed and contact support@signoz.io if you need to show >${limit} timeseries in the panel`;

View File

@@ -1,42 +1,8 @@
import styled from 'styled-components';
export const HeaderContainer = styled.div<{ hover: boolean }>`
width: 100%;
text-align: center;
padding: 0.25rem 0;
font-size: 0.8rem;
position: absolute;
top: 0;
left: 0;
`;
export const HeaderContentContainer = styled.span`
cursor: pointer;
position: relative;
text-align: center;
`;
export const ThesholdContainer = styled.span`
margin-top: -0.3rem;
`;
export const DisplayThresholdContainer = styled.div`
display: flex;
align-items: center;
width: auto;
justify-content: space-between;
`;
export const WidgetHeaderContainer = styled.div`
display: flex;
align-items: center;
justify-content: flex-end;
align-items: center;
height: 30px;
width: 100%;
left: 0;
`;
export const ArrowContainer = styled.span<{ hover: boolean }>`
visibility: ${({ hover }: { hover: boolean }): string => (hover ? 'visible' : 'hidden')};
`;

View File

@@ -2,10 +2,7 @@ import { TableProps } from 'antd';
import { PrecisionOption } from 'components/Graph/types';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { LogsExplorerTableProps } from 'container/LogsExplorerTable/LogsExplorerTable.interfaces';
import {
ThresholdOperators,
ThresholdProps,
} from 'types/api/widgets/threshold';
import { ThresholdProps } from 'types/api/widgets/threshold';
import { QueryTableProps } from 'container/QueryTable/QueryTable.intefaces';
import { RowData } from 'lib/query/createTableColumnsFromQuery';
import { ColumnUnit } from 'types/api/widgets/columnUnit';
@@ -36,12 +33,3 @@ export type GridTableComponentProps = {
hiddenColumns?: string[];
} & Pick<LogsExplorerTableProps, 'data'> &
Omit<TableProps<RowData>, 'columns' | 'dataSource'>;
export type RequiredThresholdProps = Omit<
ThresholdProps,
'thresholdTableOptions' | 'thresholdOperator' | 'thresholdValue'
> & {
thresholdTableOptions: string;
thresholdOperator: ThresholdOperators;
thresholdValue: number;
};

View File

@@ -1,118 +0,0 @@
import { getUplotHistogramChartOptions } from 'lib/uPlotLib/getUplotHistogramChartOptions';
import uPlot from 'uplot';
// Mock dependencies
jest.mock('lib/uPlotLib/plugins/tooltipPlugin', () => jest.fn(() => ({})));
jest.mock('lib/uPlotLib/plugins/onClickPlugin', () => jest.fn(() => ({})));
const mockApiResponse = {
data: {
result: [
{
metric: { __name__: 'test_metric' },
queryName: 'test_query',
values: [[1640995200, '10'] as [number, string]],
},
],
resultType: 'time_series',
newResult: {
data: {
result: [],
resultType: 'time_series',
},
},
},
};
const mockDimensions = { width: 800, height: 400 };
const mockHistogramData: uPlot.AlignedData = [[1640995200], [10]];
const TEST_HISTOGRAM_ID = 'test-histogram';
describe('Histogram Chart Options Legend Scroll Position', () => {
let originalRequestAnimationFrame: typeof global.requestAnimationFrame;
beforeEach(() => {
jest.clearAllMocks();
originalRequestAnimationFrame = global.requestAnimationFrame;
});
afterEach(() => {
global.requestAnimationFrame = originalRequestAnimationFrame;
});
it('should set up scroll position tracking in histogram chart ready hook', () => {
const mockSetScrollPosition = jest.fn();
const options = getUplotHistogramChartOptions({
id: TEST_HISTOGRAM_ID,
dimensions: mockDimensions,
isDarkMode: false,
apiResponse: mockApiResponse,
histogramData: mockHistogramData,
legendScrollPosition: 0,
setLegendScrollPosition: mockSetScrollPosition,
});
// Create mock chart with legend element
const mockChart = {
root: document.createElement('div'),
} as unknown as uPlot;
const legend = document.createElement('div');
legend.className = 'u-legend';
mockChart.root.appendChild(legend);
const addEventListenerSpy = jest.spyOn(legend, 'addEventListener');
// Execute ready hook
if (options.hooks?.ready) {
options.hooks.ready.forEach((hook) => hook?.(mockChart));
}
// Verify that scroll event listener was added and cleanup function was stored
expect(addEventListenerSpy).toHaveBeenCalledWith(
'scroll',
expect.any(Function),
);
expect(
(mockChart as uPlot & { _legendScrollCleanup?: () => void })
._legendScrollCleanup,
).toBeDefined();
});
it('should restore histogram chart scroll position when provided', () => {
const mockScrollPosition = 50;
const mockSetScrollPosition = jest.fn();
const options = getUplotHistogramChartOptions({
id: TEST_HISTOGRAM_ID,
dimensions: mockDimensions,
isDarkMode: false,
apiResponse: mockApiResponse,
histogramData: mockHistogramData,
legendScrollPosition: mockScrollPosition,
setLegendScrollPosition: mockSetScrollPosition,
});
// Create mock chart with legend element
const mockChart = {
root: document.createElement('div'),
} as unknown as uPlot;
const legend = document.createElement('div');
legend.className = 'u-legend';
legend.scrollTop = 0;
mockChart.root.appendChild(legend);
// Mock requestAnimationFrame
const mockRequestAnimationFrame = jest.fn((callback) => callback());
global.requestAnimationFrame = mockRequestAnimationFrame;
// Execute ready hook
if (options.hooks?.ready) {
options.hooks.ready.forEach((hook) => hook?.(mockChart));
}
// Verify that requestAnimationFrame was called and scroll position was restored
expect(mockRequestAnimationFrame).toHaveBeenCalledWith(expect.any(Function));
expect(legend.scrollTop).toBe(mockScrollPosition);
});
});

View File

@@ -1,5 +1,4 @@
import { defaultStyles } from '@visx/tooltip';
import { Query } from 'types/api/queryBuilder/queryBuilderData';
export const tooltipStyles = {
...defaultStyles,
@@ -14,34 +13,6 @@ export const tooltipStyles = {
padding: '5px 10px',
};
export const getLabel = (
label: string,
query: Query,
queryName: string,
isQueryContentMultipleResult = false, // If there are more than one aggregation return by the query, this should be set to true. Default is false.
): string => {
let finalQuery;
if (!isQueryContentMultipleResult) {
finalQuery = query.builder.queryData.find((q) => q.queryName === queryName);
if (!finalQuery) {
// If the query is not found in queryData, then check in queryFormulas
finalQuery = query.builder.queryFormulas.find(
(q) => q.queryName === queryName,
);
}
}
if (finalQuery) {
if (finalQuery.legend !== '') {
return finalQuery.legend;
}
if (label !== undefined) {
return label;
}
return queryName;
}
return label;
};
// Function to convert a hex color to RGB format
const hexToRgb = (
color: string,
@@ -74,23 +45,6 @@ export const lightenColor = (color: string, opacity: number): string => {
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
};
export const getTimeRangeFromUplotAxis = (
axis: any,
xValue: number,
): { startTime: number; endTime: number } => {
let gap =
(axis as any)._splits && (axis as any)._splits.length > 1
? (axis as any)._splits[1] - (axis as any)._splits[0]
: 600; // 10 minutes in seconds
gap = Math.max(gap, 600); // Minimum gap of 10 minutes in seconds
const startTime = xValue - gap;
const endTime = xValue + gap;
return { startTime, endTime };
};
export const isApmMetric = (metric = ''): boolean =>
// if metric starts with 'signoz_', then it is an apm metric
metric.startsWith('signoz_');

View File

@@ -1,83 +1,3 @@
.fullscreen-grid-container {
overflow: auto;
margin: 8px -8px;
margin-right: 0;
margin-bottom: 64px;
.react-grid-layout {
border: none !important;
margin-top: 0;
.row-panel {
border-radius: 4px;
background: color-mix(in srgb, var(--surface-2) 40%, transparent);
padding: 8px;
display: flex;
gap: 6px;
align-items: center;
.settings-icon {
color: var(--l2-foreground);
cursor: pointer;
}
.row-icon {
color: var(--l2-foreground);
cursor: pointer;
}
.grip {
cursor: move;
}
.section-title {
color: var(--l2-foreground);
}
}
.widget-graph-component-container {
.widget-graph-container {
&.graph-panel-container {
height: 100%;
}
}
}
}
.footer {
display: flex;
flex-direction: column;
position: fixed;
bottom: 0;
width: -webkit-fill-available;
.locked-text {
align-self: flex-end;
width: 80px;
border: none;
cursor: default;
display: inline-flex;
padding: 4px 6px;
align-items: center;
gap: 4px;
border-radius: 4px 0px 0px 0px;
background: var(--bg-sakura-500);
color: var(--l1-foreground);
backdrop-filter: blur(6px);
.ant-btn-icon {
margin-inline-end: 0px;
}
}
.locked-bar {
background: var(--bg-sakura-500);
height: 6px;
width: 100%;
}
}
}
.widget-graph-component-container {
.widget-graph-container {
height: 100%;
@@ -128,126 +48,6 @@
box-shadow: 4px 10px 16px 2px rgba(0, 0, 0, 0.2);
backdrop-filter: blur(20px);
padding: 0px;
.menu-content {
.section-1 {
.rename-btn,
.new-panel-btn {
display: flex;
align-items: center;
gap: 6px;
color: var(--l2-foreground);
padding: 14px;
width: 100%;
.ant-btn-icon {
margin-inline-end: 0px;
}
}
.rename-btn {
padding-bottom: 10px;
}
}
.section-2 {
border-top: 1px solid var(--l1-border);
.remove-section {
display: flex;
align-items: center;
width: 100%;
gap: 6px;
color: var(--l2-foreground);
padding: 10px 18px 12px 14px;
color: var(--bg-cherry-400);
.ant-btn-icon {
margin-inline-end: 0px;
}
}
}
}
}
}
.rename-section {
.ant-modal-content {
width: 384px;
height: auto;
flex-shrink: 0;
border-radius: 4px;
border: 1px solid var(--l1-border);
background: var(--l2-background);
box-shadow: 0px -4px 16px 2px rgba(0, 0, 0, 0.2);
padding: 0px;
.ant-modal-header {
padding: 16px;
background: var(--l2-background);
border-bottom: 1px solid var(--l1-border);
margin-bottom: 0px;
.ant-modal-title {
color: var(--l1-foreground);
}
}
.ant-modal-body {
padding: 12px 16px 16px 16px;
.typography {
color: var(--l1-foreground);
}
.ant-form-item {
margin-bottom: 0px;
.ant-input {
margin-top: 8px;
margin-bottom: 24px;
}
.action-btns {
display: flex;
align-items: center;
flex-direction: row-reverse;
gap: 12px;
.ok-btn {
display: flex;
align-items: center;
color: var(--l1-foreground);
display: flex;
width: 140px;
padding: 4px 8px;
justify-content: center;
align-items: center;
gap: 4px;
border-radius: 2px;
background: var(--primary-background);
.ant-btn-icon {
margin-inline-end: 0px;
}
}
.cancel-btn {
display: flex;
align-items: center;
color: var(--l2-foreground);
display: flex;
padding: 4px 8px;
justify-content: center;
align-items: center;
gap: 4px;
border-radius: 2px;
background: var(--l1-border);
.ant-btn-icon {
margin-inline-end: 0px;
}
}
}
}
}
}
}

View File

@@ -1,21 +1,3 @@
import { PANEL_TYPES } from 'constants/queryBuilder';
import { MenuItemKeys } from 'container/WidgetCard/Header/contants';
export const ViewMenuAction = [MenuItemKeys.View];
export const EditMenuAction = [
MenuItemKeys.Clone,
MenuItemKeys.Delete,
MenuItemKeys.Edit,
MenuItemKeys.CreateAlerts,
];
export const headerMenuList = [...ViewMenuAction];
export const EMPTY_WIDGET_LAYOUT = {
i: PANEL_TYPES.EMPTY_WIDGET,
w: 6,
x: 0,
h: 6,
y: 0,
};

View File

@@ -1,12 +1,8 @@
import RGL, { WidthProvider } from 'react-grid-layout';
import { Button as ButtonComponent, Card as CardComponent } from 'antd';
import Space from 'periscope/components/Space/Space';
import { Card as CardComponent } from 'antd';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { StyledCSS } from 'types/styledComponents';
import styled, { css } from 'styled-components';
const ReactGridLayoutComponent = WidthProvider(RGL);
interface CardProps {
$panelType: PANEL_TYPES;
isDarkMode: boolean;
@@ -87,36 +83,3 @@ export const CardContainer = styled.div<Props>`
}
}
`;
export const ReactGridLayout = styled(ReactGridLayoutComponent)`
border: 1px solid #434343;
margin-top: 1rem;
position: relative;
min-height: 40vh;
margin: 16px;
.react-grid-item.react-grid-placeholder {
background: grey;
opacity: 0.2;
transition-duration: 100ms;
z-index: 2;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
`;
export const ButtonContainer = styled(Space)`
display: flex;
justify-content: end;
`;
export const Button = styled(ButtonComponent)`
&&& {
display: flex;
justify-content: center;
align-items: center;
}
`;

View File

@@ -1,5 +1,4 @@
import { Layout } from 'react-grid-layout';
import { FORMULA_REGEXP } from 'constants/regExp';
import { IBuilderQuery, Query } from 'types/api/queryBuilder/queryBuilderData';
export type PanelMap = Record<
@@ -118,16 +117,6 @@ export function applyRowCollapse(
return { updatedLayout: updatedDashboardLayout, updatedPanelMap };
}
export const removeUndefinedValuesFromLayout = (layout: Layout[]): Layout[] =>
layout.map((obj) =>
Object.fromEntries(
Object.entries(obj).filter(([, value]) => value !== undefined),
),
) as Layout[];
export const isFormula = (queryName: string): boolean =>
FORMULA_REGEXP.test(queryName);
/**
* Extracts query names from a formula expression
* Specifically targets capital letters A-Z as query names, as after Z we dont have any query names

View File

@@ -24,6 +24,3 @@ export const LEGEND_MAX_BOTTOM_ROWS = 2;
/** Must match `.inlineToolbar`'s height and margin-bottom, or it eats a row. */
export const LEGEND_TOOLBAR_HEIGHT = 24;
export const LEGEND_TOOLBAR_GAP = 4;
/** Hover delay before a row's full-name tooltip opens. */
export const LEGEND_TOOLTIP_DELAY_MS = 500;

View File

@@ -140,11 +140,6 @@ export interface ScaleProps {
asinhThreshold?: number;
}
export enum DisconnectedValuesMode {
Never = 'never',
Threshold = 'threshold',
}
/**
* Props for configuring a series
*/

View File

@@ -1,29 +1,6 @@
/** Bucket count used when a histogram panel doesn't specify one. */
export const DEFAULT_BUCKET_COUNT = 30;
// prettier-ignore
export const histogramBucketSizes = [
1e-9, 2e-9, 2.5e-9, 4e-9, 5e-9,
1e-8, 2e-8, 2.5e-8, 4e-8, 5e-8,
1e-7, 2e-7, 2.5e-7, 4e-7, 5e-7,
1e-6, 2e-6, 2.5e-6, 4e-6, 5e-6,
1e-5, 2e-5, 2.5e-5, 4e-5, 5e-5,
1e-4, 2e-4, 2.5e-4, 4e-4, 5e-4,
1e-3, 2e-3, 2.5e-3, 4e-3, 5e-3,
1e-2, 2e-2, 2.5e-2, 4e-2, 5e-2,
1e-1, 2e-1, 2.5e-1, 4e-1, 5e-1,
1, 2, 4, 5,
1e+1, 2e+1, 2.5e+1, 4e+1, 5e+1,
1e+2, 2e+2, 2.5e+2, 4e+2, 5e+2,
1e+3, 2e+3, 2.5e+3, 4e+3, 5e+3,
1e+4, 2e+4, 2.5e+4, 4e+4, 5e+4,
1e+5, 2e+5, 2.5e+5, 4e+5, 5e+5,
1e+6, 2e+6, 2.5e+6, 4e+6, 5e+6,
1e+7, 2e+7, 2.5e+7, 4e+7, 5e+7,
1e+8, 2e+8, 2.5e+8, 4e+8, 5e+8,
1e+9, 2e+9, 2.5e+9, 4e+9, 5e+9,
];
/** How a null run is rendered: dropped, kept as-is, or expanded to a visible gap. */
export const NULL_REMOVE = 0;
export const NULL_RETAIN = 1;

View File

@@ -33,37 +33,19 @@
}
}
.alert-empty-card {
margin-top: 50px;
.ant-empty-description {
color: var(--l2-foreground);
}
}
.alert-details {
margin-top: 10px;
&__divider {
margin: 16px 0;
}
.breadcrumb-divider {
margin-top: 10px;
}
&__breadcrumb {
ol {
align-items: center;
}
padding-left: 16px;
.breadcrumb-item {
color: var(--l2-foreground);
font-size: 14px;
line-height: 20px;
letter-spacing: 0.25px;
padding: 0;
}
.ant-breadcrumb-separator,
.breadcrumb-item--last {
.ant-breadcrumb-separator {
color: var(--muted-foreground);
font-family: var(--code-base-400-font-family);
}
@@ -130,9 +112,6 @@
.alert-details-v2 {
.alert-details__breadcrumb {
padding-left: 32px;
.breadcrumb-item {
font-size: 13px;
}
}
.alert-info {

View File

@@ -14,20 +14,6 @@
color: var(--l2-foreground);
}
.title {
color: var(--l1-foreground);
font-size: 16px;
font-weight: 500;
line-height: 24px;
}
.subtitle {
color: var(--l2-foreground);
font-size: 14px;
line-height: 20px;
max-width: 420px;
}
/* The button sizes to its label here, so "New channel" is never clipped. */
.actions {
display: flex;

View File

@@ -3,10 +3,6 @@ import { AlertmanagertypesChannelKindDTO } from 'api/generated/services/sigNoz.s
export const SEARCH_KEY = 'search';
export const KIND_KEY = 'kind';
export const PAGE_KEY = 'page';
export const PAGE_SIZE = 20;
export const SEARCH_DEBOUNCE_MS = 300;
export const CHANNEL_KIND_LABEL: Record<
AlertmanagertypesChannelKindDTO,

View File

@@ -63,8 +63,6 @@ export const RULE_STATES = [
'nodata',
] as const;
export type RuleState = (typeof RULE_STATES)[number];
export const RULE_STATE_CHOICES = ['mixed', ...RULE_STATES] as const;
export type RuleStateChoice = (typeof RULE_STATE_CHOICES)[number];

View File

@@ -10,10 +10,6 @@
0 6px 12px -10px var(--l2-border);
}
.dashboardPageToolbarSubContainer {
width: 100%;
}
.dashboardInfoWithActions {
display: flex;
align-items: flex-start;

View File

@@ -1,20 +1,3 @@
.tabsContent {
padding-left: 0 !important;
padding-right: 0 !important;
}
.placeholder {
padding: 24px;
}
.tabLabel {
display: inline-flex;
align-items: center;
gap: 6px;
line-height: 1;
padding-top: 4px;
}
// shared "settings card" wrapper, used by the dashboard-info form and cross-panel sync
.settingsCard {
padding: 24px 16px;

View File

@@ -24,15 +24,6 @@
color-mix(in srgb, var(--primary-background) 40%, transparent);
}
.unsavedChanges {
color: var(--bg-robin-400);
font-family: Inter;
font-size: 14px;
font-weight: 400;
line-height: 24px;
letter-spacing: -0.07px;
}
.footerActionButtons {
display: flex;
gap: 8px;

View File

@@ -8,10 +8,3 @@
flex-direction: column;
gap: 8px;
}
.fieldLabel {
color: var(--l2-foreground);
font-size: 12px;
font-weight: 500;
line-height: 1;
}

View File

@@ -51,21 +51,6 @@
}
}
/* Picker row (label left, tabs right); the bottom divider separates type from
config. Single line — the tab row scrolls (never wraps) when narrow. */
.typePicker {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding-bottom: 12px;
border-bottom: 1px solid var(--l2-border);
@media (max-width: 1440px) {
flex-wrap: wrap;
}
}
.typeContent {
display: flex;
flex-direction: column;

View File

@@ -4,12 +4,6 @@
gap: 12px;
}
.intro {
color: var(--l2-foreground);
font-size: 13px;
line-height: 1.5;
}
.rows {
display: flex;
flex-direction: column;
@@ -55,13 +49,6 @@
gap: 4px;
}
.fieldLabel {
color: var(--l2-foreground);
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.textArea {
font-family: var(--code-small-400-font-family);
font-size: 12px;

View File

@@ -36,14 +36,6 @@ $grid-columns: minmax(0, 2fr) minmax(0, 3fr);
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;
@@ -83,9 +75,3 @@ $grid-columns: minmax(0, 2fr) minmax(0, 3fr);
.rowActionsVisible {
opacity: 1;
}
.confirmText {
margin-right: 4px;
font-size: 12px;
color: var(--l2-foreground);
}

View File

@@ -148,10 +148,3 @@ export function formModelToDto(
},
};
}
/** Maps the V2 plugin/envelope to the four UI-facing variable types. */
export function variableTypeOf(
dto: DashboardtypesVariableDTO,
): VariableFormModel['type'] {
return dtoToFormModel(dto).type;
}

View File

@@ -31,8 +31,3 @@
flex: none;
color: var(--l2-foreground);
}
.label {
flex: 1;
text-align: left;
}

View File

@@ -29,18 +29,6 @@
background-color: var(--primary);
}
.title {
display: flex;
align-items: baseline;
gap: 9px;
white-space: nowrap;
}
.subtitle {
font-size: 12px;
color: var(--text-vanilla-400);
}
.eyebrow {
display: block;
padding: 18px 20px 12px;

View File

@@ -49,8 +49,3 @@
white-space: nowrap;
text-overflow: ellipsis;
}
.empty {
font-size: 12px;
color: var(--text-vanilla-400);
}

View File

@@ -36,22 +36,3 @@
gap: 8px;
min-width: 0;
}
.name,
.source {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.name {
flex: 1 1 auto;
text-align: start;
}
.source {
color: var(--l3-foreground);
font-size: 12px;
flex: 0 1 auto;
}

View File

@@ -4,7 +4,6 @@ import {
} from 'pages/DashboardPage/DashboardContainer/Panels/kinds/TextPanel/background/presets';
import {
type PanelTheme,
type ResolvedTextBackground,
TextBackgroundKind,
type TextBackgroundPreset,
type TextBackgroundSelection,
@@ -30,19 +29,6 @@ const BASE_TITLES: Record<BaseSelection, string> = {
default: 'Default panel',
};
export function backgroundTitle(background: ResolvedTextBackground): string {
switch (background.kind) {
case TextBackgroundKind.Preset:
return background.preset ? PRESET_TITLES[background.preset] : 'Custom';
case TextBackgroundKind.Custom:
return `Custom ${background.surface?.toUpperCase() ?? ''}`.trim();
case TextBackgroundKind.None:
return BASE_TITLES.none;
default:
return BASE_TITLES.default;
}
}
const BASE_TOOLTIPS: Record<BaseSelection, string> = {
none: 'Transparent — no card, border or title bar',
default: 'Default panel color',

View File

@@ -11,12 +11,6 @@
align-items: center;
}
.title {
font-size: 12px;
font-weight: 500;
color: var(--l2-foreground);
}
.body {
display: flex;
flex-wrap: wrap;
@@ -30,8 +24,3 @@
align-items: center;
gap: 8px;
}
.hint {
font-size: 11px;
color: var(--l3-foreground);
}

View File

@@ -1,8 +0,0 @@
.dropdown {
width: 260px;
/* The dropdown portals to body; lift it above the query builder's antd
* popups (1050) so it stays clickable, incl. inside the View modal.
* TODO: remove after the antd -> @signozhq/ui migration
**/
z-index: 1100;
}

View File

@@ -71,17 +71,6 @@
color: var(--text-panel-ink, inherit);
}
.state {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 24px;
color: var(--l2-forground);
font-size: 13px;
text-align: center;
}
.dateTimeSelector {
margin-left: auto;
}

View File

@@ -40,19 +40,6 @@
background: var(--bg-cherry-500-transparent, rgba(231, 64, 64, 0.12));
}
.title {
font-size: 13px;
font-weight: 500;
color: var(--l1-foreground);
}
.description {
font-size: 12px;
color: var(--l2-foreground);
max-width: 280px;
overflow-wrap: anywhere;
}
.actions {
display: flex;
flex-wrap: wrap;

View File

@@ -310,6 +310,3 @@ export type SectionEditorProps<K extends SectionKind> = {
} & (K extends ControlledSectionKind
? { controls: SectionControls[K] }
: unknown);
export type SectionControlsOf<K extends SectionKind> =
K extends ControlledSectionKind ? SectionControls[K] : undefined;

View File

@@ -23,10 +23,6 @@
color: var(--text-panel-ink, inherit);
}
.badge {
margin-inline-end: 0;
}
// Actions sit inside the drag-handle row but opt out of dragging
// (`panel-no-drag`); reset the grab cursor so the menu reads as clickable.
.actions {

View File

@@ -1,5 +0,0 @@
@use '../../../../../../styles/scrollbar' as *;
:global([data-testid='panel-type-drawer-body']) {
@include custom-scrollbar;
}

View File

@@ -3,8 +3,3 @@
padding: 12px 16px;
overflow: auto;
}
.emptyState {
padding: 48px;
text-align: center;
}

View File

@@ -1,69 +0,0 @@
import { useCallback, useState } from 'react';
import { Plus } from '@signozhq/icons';
import { Button } from '@signozhq/ui/button';
import type { DashboardtypesLayoutDTO } from 'api/generated/services/sigNoz.schemas';
import type { DashboardSection } from '../../../utils';
import { useAddSection } from '../hooks/useAddSection';
import { useFirstSectionMigration } from '../hooks/useFirstSectionMigration';
import FirstSectionMigrationModal from '../FirstSectionMigrationModal';
const DEFAULT_SECTION_TITLE = 'New section';
interface AddSectionControlProps {
sections: DashboardSection[];
layouts: DashboardtypesLayoutDTO[] | undefined | null;
isSectioned: boolean;
}
function AddSectionControl({
sections,
layouts,
isSectioned,
}: AddSectionControlProps): JSX.Element {
const [isMigrationOpen, setIsMigrationOpen] = useState(false);
const { addSection } = useAddSection({ layouts });
const { migrate, isSaving } = useFirstSectionMigration({ sections });
// Free-flowing dashboard with existing panels → must migrate before sections
// can coexist (every panel must belong to a section once any exists).
const needsMigration =
!isSectioned && sections.some((s) => s.items.length > 0);
const handleClick = useCallback((): void => {
if (needsMigration) {
setIsMigrationOpen(true);
return;
}
void addSection(DEFAULT_SECTION_TITLE);
}, [needsMigration, addSection]);
const handleConfirmMigration = useCallback(async (): Promise<void> => {
await migrate(DEFAULT_SECTION_TITLE);
setIsMigrationOpen(false);
}, [migrate]);
return (
<>
<Button
size="md"
color="secondary"
type="button"
variant="ghost"
onClick={handleClick}
testId="add-section"
prefix={<Plus size={14} />}
>
Add section
</Button>
<FirstSectionMigrationModal
open={isMigrationOpen}
isSaving={isSaving}
onClose={(): void => setIsMigrationOpen(false)}
onConfirm={handleConfirmMigration}
/>
</>
);
}
export default AddSectionControl;

View File

@@ -1,48 +0,0 @@
import { Modal } from 'antd';
import { Typography } from '@signozhq/ui/typography';
interface FirstSectionMigrationModalProps {
open: boolean;
isSaving: boolean;
onClose: () => void;
onConfirm: () => void;
}
/**
* Shown when the user adds the first section to a free-flowing dashboard that
* already has panels. Confirms grouping the existing panels into a section
* before proceeding.
*/
function FirstSectionMigrationModal({
open,
isSaving,
onClose,
onConfirm,
}: FirstSectionMigrationModalProps): JSX.Element {
return (
<Modal
open={open}
title="Group panels into sections?"
onCancel={onClose}
onOk={onConfirm}
okText="Continue"
okButtonProps={{ disabled: isSaving, 'data-testid': 'confirm-migration' }}
destroyOnClose
>
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
textOverflow="wrap"
>
This dashboard&apos;s panels are currently free-flowing. Adding a section
will move the existing panels into their own section, and a new empty
section will be added below. You can rename sections afterwards.
</Typography>
</Modal>
);
}
export default FirstSectionMigrationModal;

View File

@@ -10,14 +10,6 @@
outline-offset: 2px;
}
.dragging {
opacity: 0.8;
}
.deleteModal :global(.ant-modal-confirm-body) {
align-items: center;
}
.emptySection {
display: flex;
justify-content: center;

View File

@@ -23,15 +23,6 @@
--button-justify-content: flex-start;
}
.title {
margin-left: 4px;
color: var(--l1-foreground);
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.repeatBadge {
margin-left: 8px;
opacity: 0.6;

View File

@@ -1,68 +0,0 @@
import { useCallback, useState } from 'react';
import logEvent from 'api/common/logEvent';
import type { DashboardtypesJSONPatchOperationDTO } from 'api/generated/services/sigNoz.schemas';
import { DashboardDetailEvents } from 'pages/DashboardPage/constants/events';
import { useErrorModal } from 'providers/ErrorModalProvider';
import APIError from 'types/api/error';
import { useOptimisticPatch } from '../../../hooks/useOptimisticPatch';
import { addSectionOp, titleUntitledSectionOp } from '../../../patchOps';
import { useDashboardStore } from '../../../store/useDashboardStore';
import type { DashboardSection } from '../../../utils';
interface Params {
sections: DashboardSection[];
}
interface Result {
migrate: (newSectionTitle: string) => Promise<void>;
isSaving: boolean;
}
/**
* Converts a free-flowing dashboard into a sectioned one: every existing
* untitled layout that holds panels is titled in place ("Section 1", "Section
* 2", …), then the brand-new section the user asked for is appended — all in one
* atomic patch. Used once the user confirms the migration prompt.
*/
export function useFirstSectionMigration({ sections }: Params): Result {
const dashboardId = useDashboardStore((s) => s.dashboardId);
const { patchAsync } = useOptimisticPatch();
const [isSaving, setIsSaving] = useState(false);
const { showErrorModal } = useErrorModal();
const migrate = useCallback(
async (newSectionTitle: string): Promise<void> => {
const trimmed = newSectionTitle.trim();
if (!dashboardId || !trimmed) {
return;
}
const ops: DashboardtypesJSONPatchOperationDTO[] = [];
let counter = 1;
sections.forEach((s) => {
if (!s.title && s.items.length > 0) {
ops.push(titleUntitledSectionOp(s.layoutIndex, `Section ${counter}`));
counter += 1;
}
});
ops.push(addSectionOp(trimmed));
try {
setIsSaving(true);
await patchAsync(ops);
void logEvent(DashboardDetailEvents.FirstSectionMigrationConfirmed, {
dashboardId,
});
} catch (error) {
showErrorModal(error as APIError);
} finally {
setIsSaving(false);
}
},
[sections, dashboardId, patchAsync, showErrorModal],
);
return { migrate, isSaving };
}

View File

@@ -5,24 +5,9 @@ import type {
VariableSelectionMap,
} from '../selectionTypes';
/** A selection counts as resolved (usable as a parent value) when it's non-empty. */
export function isResolved(selection?: VariableSelection): boolean {
if (!selection) {
return false;
}
if (selection.allSelected) {
return true;
}
const { value } = selection;
if (Array.isArray(value)) {
return value.length > 0;
}
return value !== '' && value !== null && value !== undefined;
}
/**
* Whether a selection carries a value usable when scheduling a dependent
* variable/panel fetch. Unlike {@link isResolved}, an ALL selection counts only
* variable/panel fetch. An ALL selection counts only
* once it holds the concrete option array — for QUERY that's after its fetch, for
* CUSTOM it's materialized synchronously (no fetch). A DYNAMIC ALL is usable
* immediately via the `__all__` sentinel.

View File

@@ -24,39 +24,6 @@ export function extractPanelIdFromRef(ref: string | undefined): string | null {
return ref.slice(PANEL_REF_PREFIX.length);
}
export function flattenGridLayout(
layouts: DashboardtypesLayoutDTO[] | undefined | null,
panels: Record<string, DashboardtypesPanelDTO | undefined> | undefined,
): GridItem[] {
if (!layouts?.length) {
return [];
}
const items: GridItem[] = [];
layouts.forEach((layoutEnvelope) => {
if (layoutEnvelope?.kind !== 'Grid') {
return;
}
const gridItems = layoutEnvelope.spec?.items ?? [];
gridItems.forEach((item) => {
const id = extractPanelIdFromRef(item.content?.$ref);
if (!id) {
return;
}
items.push({
id,
x: item.x ?? 0,
y: item.y ?? 0,
width: item.width ?? 6,
height: item.height ?? 6,
panel: panels?.[id],
});
});
});
return items;
}
/**
* A section corresponds to one entry in `spec.layouts`. If the Grid has a
* `display.title`, it renders with a collapsible header; otherwise it is a

View File

@@ -23,7 +23,6 @@ export enum DashboardDetailEvents {
SectionAction = 'Dashboard Detail V2: Section action',
SectionCollapsed = 'Dashboard Detail V2: Section collapsed',
SectionsReordered = 'Dashboard Detail V2: Sections reordered',
FirstSectionMigrationConfirmed = 'Dashboard Detail V2: First section migration confirmed',
// Panels
PanelAdded = 'Dashboard Detail V2: Panel added',

Some files were not shown because too many files have changed in this diff Show More