2024-05-28 19:09:04 +05:30
|
|
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
|
|
|
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
|
|
|
import './RightContainer.styles.scss';
|
|
|
|
|
|
2025-05-16 16:35:11 +05:30
|
|
|
import type { InputRef } from 'antd';
|
|
|
|
|
import {
|
|
|
|
|
AutoComplete,
|
|
|
|
|
Input,
|
|
|
|
|
InputNumber,
|
|
|
|
|
Select,
|
|
|
|
|
Space,
|
|
|
|
|
Switch,
|
|
|
|
|
Typography,
|
|
|
|
|
} from 'antd';
|
2022-03-22 12:10:31 +05:30
|
|
|
import TimePreference from 'components/TimePreferenceDropDown';
|
2025-02-12 11:29:07 +05:30
|
|
|
import { PANEL_TYPES, PanelDisplay } from 'constants/queryBuilder';
|
2024-04-09 13:36:19 +05:30
|
|
|
import GraphTypes, {
|
|
|
|
|
ItemsProps,
|
|
|
|
|
} from 'container/NewDashboard/ComponentsSlider/menuItems';
|
2023-12-15 17:08:35 +05:30
|
|
|
import useCreateAlerts from 'hooks/queryBuilder/useCreateAlerts';
|
2024-04-09 13:36:19 +05:30
|
|
|
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
2025-03-24 18:42:04 +05:30
|
|
|
import { ConciergeBell, LineChart, Plus, Spline } from 'lucide-react';
|
2025-05-16 16:35:11 +05:30
|
|
|
import { useDashboard } from 'providers/Dashboard/Dashboard';
|
2024-04-09 13:36:19 +05:30
|
|
|
import {
|
|
|
|
|
Dispatch,
|
|
|
|
|
SetStateAction,
|
|
|
|
|
useCallback,
|
|
|
|
|
useEffect,
|
2025-05-16 16:35:11 +05:30
|
|
|
useMemo,
|
|
|
|
|
useRef,
|
2024-04-09 13:36:19 +05:30
|
|
|
useState,
|
|
|
|
|
} from 'react';
|
2025-05-27 13:50:40 +05:30
|
|
|
import {
|
|
|
|
|
ColumnUnit,
|
|
|
|
|
LegendPosition,
|
|
|
|
|
Widgets,
|
|
|
|
|
} from 'types/api/dashboard/getAll';
|
2024-04-09 13:36:19 +05:30
|
|
|
import { DataSource } from 'types/common/queryBuilder';
|
2025-05-16 16:35:11 +05:30
|
|
|
import { popupContainer } from 'utils/selectPopupContainer';
|
2021-09-23 15:43:43 +05:30
|
|
|
|
2024-06-04 11:14:54 +05:30
|
|
|
import { ColumnUnitSelector } from './ColumnUnitSelector/ColumnUnitSelector';
|
2024-02-20 16:21:07 +05:30
|
|
|
import {
|
2024-06-05 07:07:49 +05:30
|
|
|
panelTypeVsBucketConfig,
|
2024-06-04 11:14:54 +05:30
|
|
|
panelTypeVsColumnUnitPreferences,
|
2024-02-20 16:21:07 +05:30
|
|
|
panelTypeVsCreateAlert,
|
|
|
|
|
panelTypeVsFillSpan,
|
2025-05-27 13:50:40 +05:30
|
|
|
panelTypeVsLegendPosition,
|
2025-03-24 18:42:04 +05:30
|
|
|
panelTypeVsLogScale,
|
2024-02-20 16:21:07 +05:30
|
|
|
panelTypeVsPanelTimePreferences,
|
|
|
|
|
panelTypeVsSoftMinMax,
|
2024-06-10 17:15:30 +05:30
|
|
|
panelTypeVsStackingChartPreferences,
|
2024-02-20 16:21:07 +05:30
|
|
|
panelTypeVsThreshold,
|
|
|
|
|
panelTypeVsYAxisUnit,
|
|
|
|
|
} from './constants';
|
2023-11-15 17:14:09 +05:30
|
|
|
import ThresholdSelector from './Threshold/ThresholdSelector';
|
|
|
|
|
import { ThresholdProps } from './Threshold/types';
|
2022-03-22 12:10:31 +05:30
|
|
|
import { timePreferance } from './timeItems';
|
|
|
|
|
import YAxisUnitSelector from './YAxisUnitSelector';
|
2021-09-23 15:43:43 +05:30
|
|
|
|
2022-03-22 12:10:31 +05:30
|
|
|
const { TextArea } = Input;
|
2023-03-07 12:25:59 +01:00
|
|
|
const { Option } = Select;
|
2022-03-22 12:10:31 +05:30
|
|
|
|
2025-03-24 18:42:04 +05:30
|
|
|
enum LogScale {
|
|
|
|
|
LINEAR = 'linear',
|
|
|
|
|
LOGARITHMIC = 'logarithmic',
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-16 16:35:11 +05:30
|
|
|
interface VariableOption {
|
|
|
|
|
value: string;
|
|
|
|
|
label: string;
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-24 18:42:04 +05:30
|
|
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
2022-03-22 12:10:31 +05:30
|
|
|
function RightContainer({
|
2021-09-23 15:43:43 +05:30
|
|
|
description,
|
|
|
|
|
setDescription,
|
|
|
|
|
setTitle,
|
|
|
|
|
title,
|
|
|
|
|
selectedGraph,
|
2024-06-05 07:07:49 +05:30
|
|
|
bucketCount,
|
|
|
|
|
bucketWidth,
|
2024-06-10 17:15:30 +05:30
|
|
|
stackedBarChart,
|
|
|
|
|
setStackedBarChart,
|
2024-06-05 07:07:49 +05:30
|
|
|
setBucketCount,
|
|
|
|
|
setBucketWidth,
|
2021-09-23 15:43:43 +05:30
|
|
|
setSelectedTime,
|
|
|
|
|
selectedTime,
|
2022-03-15 15:18:33 +05:30
|
|
|
yAxisUnit,
|
|
|
|
|
setYAxisUnit,
|
2023-03-07 12:25:59 +01:00
|
|
|
setGraphHandler,
|
2023-11-15 17:14:09 +05:30
|
|
|
thresholds,
|
2024-06-05 07:07:49 +05:30
|
|
|
combineHistogram,
|
|
|
|
|
setCombineHistogram,
|
2023-11-15 17:14:09 +05:30
|
|
|
setThresholds,
|
2023-11-13 13:54:31 +05:30
|
|
|
selectedWidget,
|
2023-11-15 18:25:02 +05:30
|
|
|
isFillSpans,
|
|
|
|
|
setIsFillSpans,
|
2024-01-09 14:19:23 +05:30
|
|
|
softMax,
|
|
|
|
|
softMin,
|
|
|
|
|
setSoftMax,
|
|
|
|
|
setSoftMin,
|
2024-06-04 11:14:54 +05:30
|
|
|
columnUnits,
|
|
|
|
|
setColumnUnits,
|
2025-03-24 18:42:04 +05:30
|
|
|
isLogScale,
|
|
|
|
|
setIsLogScale,
|
2025-05-27 13:50:40 +05:30
|
|
|
legendPosition,
|
|
|
|
|
setLegendPosition,
|
2022-03-22 12:10:31 +05:30
|
|
|
}: RightContainerProps): JSX.Element {
|
2025-05-16 16:35:11 +05:30
|
|
|
const { selectedDashboard } = useDashboard();
|
|
|
|
|
const [inputValue, setInputValue] = useState(title);
|
|
|
|
|
const [autoCompleteOpen, setAutoCompleteOpen] = useState(false);
|
|
|
|
|
const [cursorPos, setCursorPos] = useState(0);
|
|
|
|
|
const inputRef = useRef<InputRef>(null);
|
|
|
|
|
|
2021-09-23 15:43:43 +05:30
|
|
|
const onChangeHandler = useCallback(
|
2023-05-19 13:14:32 +05:30
|
|
|
(setFunc: Dispatch<SetStateAction<string>>, value: string) => {
|
2021-09-23 15:43:43 +05:30
|
|
|
setFunc(value);
|
|
|
|
|
},
|
|
|
|
|
[],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const selectedGraphType =
|
|
|
|
|
GraphTypes.find((e) => e.name === selectedGraph)?.display || '';
|
|
|
|
|
|
2024-07-16 14:18:59 +05:30
|
|
|
const onCreateAlertsHandler = useCreateAlerts(selectedWidget, 'panelView');
|
2023-11-13 13:54:31 +05:30
|
|
|
|
2023-11-16 15:27:48 +05:30
|
|
|
const allowThreshold = panelTypeVsThreshold[selectedGraph];
|
2024-01-09 14:19:23 +05:30
|
|
|
const allowSoftMinMax = panelTypeVsSoftMinMax[selectedGraph];
|
2024-02-20 16:21:07 +05:30
|
|
|
const allowFillSpans = panelTypeVsFillSpan[selectedGraph];
|
2025-03-24 18:42:04 +05:30
|
|
|
const allowLogScale = panelTypeVsLogScale[selectedGraph];
|
2024-02-20 16:21:07 +05:30
|
|
|
const allowYAxisUnit = panelTypeVsYAxisUnit[selectedGraph];
|
|
|
|
|
const allowCreateAlerts = panelTypeVsCreateAlert[selectedGraph];
|
2024-06-05 07:07:49 +05:30
|
|
|
const allowBucketConfig = panelTypeVsBucketConfig[selectedGraph];
|
2024-06-10 17:15:30 +05:30
|
|
|
const allowStackingBarChart =
|
|
|
|
|
panelTypeVsStackingChartPreferences[selectedGraph];
|
2024-02-20 16:21:07 +05:30
|
|
|
const allowPanelTimePreference =
|
|
|
|
|
panelTypeVsPanelTimePreferences[selectedGraph];
|
2025-05-27 13:50:40 +05:30
|
|
|
const allowLegendPosition = panelTypeVsLegendPosition[selectedGraph];
|
2024-01-09 14:19:23 +05:30
|
|
|
|
2024-06-04 11:14:54 +05:30
|
|
|
const allowPanelColumnPreference =
|
|
|
|
|
panelTypeVsColumnUnitPreferences[selectedGraph];
|
|
|
|
|
|
2024-04-09 13:36:19 +05:30
|
|
|
const { currentQuery } = useQueryBuilder();
|
|
|
|
|
|
|
|
|
|
const [graphTypes, setGraphTypes] = useState<ItemsProps[]>(GraphTypes);
|
|
|
|
|
|
2025-05-16 16:35:11 +05:30
|
|
|
// Get dashboard variables
|
|
|
|
|
const dashboardVariables = useMemo<VariableOption[]>(() => {
|
|
|
|
|
if (!selectedDashboard?.data?.variables) return [];
|
|
|
|
|
return Object.entries(selectedDashboard.data.variables).map(([, value]) => ({
|
|
|
|
|
value: value.name || '',
|
|
|
|
|
label: value.name || '',
|
|
|
|
|
}));
|
|
|
|
|
}, [selectedDashboard?.data?.variables]);
|
|
|
|
|
|
|
|
|
|
const updateCursorAndDropdown = (value: string, pos: number): void => {
|
|
|
|
|
setCursorPos(pos);
|
|
|
|
|
const lastDollar = value.lastIndexOf('$', pos - 1);
|
|
|
|
|
setAutoCompleteOpen(lastDollar !== -1 && pos >= lastDollar + 1);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const onInputChange = (value: string): void => {
|
|
|
|
|
setInputValue(value);
|
|
|
|
|
onChangeHandler(setTitle, value);
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
const pos = inputRef.current?.input?.selectionStart ?? 0;
|
|
|
|
|
updateCursorAndDropdown(value, pos);
|
|
|
|
|
}, 0);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleInputCursor = (): void => {
|
|
|
|
|
const pos = inputRef.current?.input?.selectionStart ?? 0;
|
|
|
|
|
updateCursorAndDropdown(inputValue, pos);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const onSelect = (selectedValue: string): void => {
|
|
|
|
|
const pos = cursorPos;
|
|
|
|
|
const value = inputValue;
|
|
|
|
|
const lastDollar = value.lastIndexOf('$', pos - 1);
|
|
|
|
|
const textBeforeDollar = value.substring(0, lastDollar);
|
|
|
|
|
const textAfterDollar = value.substring(lastDollar + 1);
|
|
|
|
|
const match = textAfterDollar.match(/^([a-zA-Z0-9_.]*)/);
|
|
|
|
|
const rest = textAfterDollar.substring(match ? match[1].length : 0);
|
|
|
|
|
const newValue = `${textBeforeDollar}$${selectedValue}${rest}`;
|
|
|
|
|
setInputValue(newValue);
|
|
|
|
|
onChangeHandler(setTitle, newValue);
|
|
|
|
|
setAutoCompleteOpen(false);
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
const newCursor = `${textBeforeDollar}$${selectedValue}`.length;
|
|
|
|
|
inputRef.current?.input?.setSelectionRange(newCursor, newCursor);
|
|
|
|
|
setCursorPos(newCursor);
|
|
|
|
|
}, 0);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const filterOption = (
|
|
|
|
|
inputValue: string,
|
|
|
|
|
option?: VariableOption,
|
|
|
|
|
): boolean => {
|
|
|
|
|
const pos = cursorPos;
|
|
|
|
|
const value = inputValue;
|
|
|
|
|
const lastDollar = value.lastIndexOf('$', pos - 1);
|
|
|
|
|
if (lastDollar === -1) return false;
|
|
|
|
|
const afterDollar = value.substring(lastDollar + 1, pos).toLowerCase();
|
|
|
|
|
return option?.value.toLowerCase().startsWith(afterDollar) || false;
|
|
|
|
|
};
|
|
|
|
|
|
2024-04-09 13:36:19 +05:30
|
|
|
useEffect(() => {
|
|
|
|
|
const queryContainsMetricsDataSource = currentQuery.builder.queryData.some(
|
|
|
|
|
(query) => query.dataSource === DataSource.METRICS,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (queryContainsMetricsDataSource) {
|
|
|
|
|
setGraphTypes((prev) =>
|
|
|
|
|
prev.filter((graph) => graph.name !== PANEL_TYPES.LIST),
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
setGraphTypes(GraphTypes);
|
|
|
|
|
}
|
|
|
|
|
}, [currentQuery]);
|
|
|
|
|
|
2024-01-09 14:19:23 +05:30
|
|
|
const softMinHandler = useCallback(
|
|
|
|
|
(value: number | null) => {
|
|
|
|
|
setSoftMin(value);
|
|
|
|
|
},
|
|
|
|
|
[setSoftMin],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const softMaxHandler = useCallback(
|
|
|
|
|
(value: number | null) => {
|
|
|
|
|
setSoftMax(value);
|
|
|
|
|
},
|
|
|
|
|
[setSoftMax],
|
|
|
|
|
);
|
2023-11-16 15:27:48 +05:30
|
|
|
|
2021-09-23 15:43:43 +05:30
|
|
|
return (
|
2024-05-28 19:09:04 +05:30
|
|
|
<div className="right-container">
|
|
|
|
|
<section className="header">
|
|
|
|
|
<div className="purple-dot" />
|
|
|
|
|
<Typography.Text className="header-text">Panel details</Typography.Text>
|
|
|
|
|
</section>
|
|
|
|
|
<section className="name-description">
|
|
|
|
|
<Typography.Text className="typography">Name</Typography.Text>
|
2025-05-16 16:35:11 +05:30
|
|
|
<AutoComplete
|
|
|
|
|
options={dashboardVariables}
|
|
|
|
|
value={inputValue}
|
|
|
|
|
onChange={onInputChange}
|
|
|
|
|
onSelect={onSelect}
|
|
|
|
|
filterOption={filterOption}
|
|
|
|
|
style={{ width: '100%' }}
|
|
|
|
|
getPopupContainer={popupContainer}
|
2024-05-28 19:09:04 +05:30
|
|
|
placeholder="Enter the panel name here..."
|
2025-05-16 16:35:11 +05:30
|
|
|
open={autoCompleteOpen}
|
|
|
|
|
>
|
|
|
|
|
<Input
|
|
|
|
|
rootClassName="name-input"
|
|
|
|
|
ref={inputRef}
|
|
|
|
|
onSelect={handleInputCursor}
|
|
|
|
|
onClick={handleInputCursor}
|
|
|
|
|
onBlur={(): void => setAutoCompleteOpen(false)}
|
|
|
|
|
/>
|
|
|
|
|
</AutoComplete>
|
2024-05-28 19:09:04 +05:30
|
|
|
<Typography.Text className="typography">Description</Typography.Text>
|
|
|
|
|
<TextArea
|
|
|
|
|
placeholder="Enter the panel description here..."
|
|
|
|
|
bordered
|
|
|
|
|
allowClear
|
|
|
|
|
value={description}
|
|
|
|
|
onChange={(event): void =>
|
|
|
|
|
onChangeHandler(setDescription, event.target.value)
|
|
|
|
|
}
|
|
|
|
|
rootClassName="description-input"
|
|
|
|
|
/>
|
|
|
|
|
</section>
|
|
|
|
|
<section className="panel-config">
|
|
|
|
|
<Typography.Text className="typography">Panel Type</Typography.Text>
|
|
|
|
|
<Select
|
|
|
|
|
onChange={setGraphHandler}
|
|
|
|
|
value={selectedGraph}
|
|
|
|
|
style={{ width: '100%' }}
|
|
|
|
|
className="panel-type-select"
|
2024-07-16 18:35:59 +05:30
|
|
|
data-testid="panel-change-select"
|
2024-05-28 19:09:04 +05:30
|
|
|
>
|
|
|
|
|
{graphTypes.map((item) => (
|
|
|
|
|
<Option key={item.name} value={item.name}>
|
|
|
|
|
<div className="select-option">
|
|
|
|
|
<div className="icon">{item.icon}</div>
|
|
|
|
|
<Typography.Text className="display">{item.display}</Typography.Text>
|
|
|
|
|
</div>
|
|
|
|
|
</Option>
|
|
|
|
|
))}
|
|
|
|
|
</Select>
|
|
|
|
|
|
|
|
|
|
{allowFillSpans && (
|
|
|
|
|
<Space className="fill-gaps">
|
|
|
|
|
<Typography className="fill-gaps-text">Fill gaps</Typography>
|
|
|
|
|
<Switch
|
|
|
|
|
checked={isFillSpans}
|
|
|
|
|
size="small"
|
|
|
|
|
onChange={(checked): void => setIsFillSpans(checked)}
|
|
|
|
|
/>
|
|
|
|
|
</Space>
|
|
|
|
|
)}
|
2021-09-23 15:43:43 +05:30
|
|
|
|
2024-02-20 16:21:07 +05:30
|
|
|
{allowPanelTimePreference && (
|
2024-05-28 19:09:04 +05:30
|
|
|
<>
|
|
|
|
|
<Typography.Text className="panel-time-text">
|
|
|
|
|
Panel Time Preference
|
|
|
|
|
</Typography.Text>
|
|
|
|
|
<TimePreference
|
|
|
|
|
{...{
|
|
|
|
|
selectedTime,
|
|
|
|
|
setSelectedTime,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</>
|
2024-02-20 16:21:07 +05:30
|
|
|
)}
|
|
|
|
|
|
2024-06-04 11:14:54 +05:30
|
|
|
{allowPanelColumnPreference && (
|
|
|
|
|
<ColumnUnitSelector
|
|
|
|
|
columnUnits={columnUnits}
|
|
|
|
|
setColumnUnits={setColumnUnits}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
2024-02-20 16:21:07 +05:30
|
|
|
{allowYAxisUnit && (
|
|
|
|
|
<YAxisUnitSelector
|
|
|
|
|
defaultValue={yAxisUnit}
|
|
|
|
|
onSelect={setYAxisUnit}
|
2024-09-14 13:11:04 +05:30
|
|
|
fieldLabel={
|
2025-02-12 11:29:07 +05:30
|
|
|
selectedGraphType === PanelDisplay.VALUE ||
|
|
|
|
|
selectedGraphType === PanelDisplay.PIE
|
2024-09-14 13:11:04 +05:30
|
|
|
? 'Unit'
|
|
|
|
|
: 'Y Axis Unit'
|
|
|
|
|
}
|
2024-02-20 16:21:07 +05:30
|
|
|
/>
|
|
|
|
|
)}
|
2024-05-28 19:09:04 +05:30
|
|
|
{allowSoftMinMax && (
|
|
|
|
|
<section className="soft-min-max">
|
|
|
|
|
<section className="container">
|
|
|
|
|
<Typography.Text className="text">Soft Min</Typography.Text>
|
|
|
|
|
<InputNumber
|
|
|
|
|
type="number"
|
|
|
|
|
value={softMin}
|
|
|
|
|
onChange={softMinHandler}
|
|
|
|
|
rootClassName="input"
|
|
|
|
|
/>
|
|
|
|
|
</section>
|
|
|
|
|
<section className="container">
|
|
|
|
|
<Typography.Text className="text">Soft Max</Typography.Text>
|
|
|
|
|
<InputNumber
|
|
|
|
|
value={softMax}
|
|
|
|
|
type="number"
|
|
|
|
|
rootClassName="input"
|
|
|
|
|
onChange={softMaxHandler}
|
|
|
|
|
/>
|
|
|
|
|
</section>
|
|
|
|
|
</section>
|
2023-11-13 13:54:31 +05:30
|
|
|
)}
|
2024-06-05 07:07:49 +05:30
|
|
|
|
2024-06-10 17:15:30 +05:30
|
|
|
{allowStackingBarChart && (
|
|
|
|
|
<section className="stack-chart">
|
|
|
|
|
<Typography.Text className="label">Stack series</Typography.Text>
|
|
|
|
|
<Switch
|
|
|
|
|
checked={stackedBarChart}
|
|
|
|
|
size="small"
|
|
|
|
|
onChange={(checked): void => setStackedBarChart(checked)}
|
|
|
|
|
/>
|
|
|
|
|
</section>
|
|
|
|
|
)}
|
|
|
|
|
|
2024-06-05 07:07:49 +05:30
|
|
|
{allowBucketConfig && (
|
|
|
|
|
<section className="bucket-config">
|
|
|
|
|
<Typography.Text className="label">Number of buckets</Typography.Text>
|
|
|
|
|
<InputNumber
|
|
|
|
|
value={bucketCount || null}
|
|
|
|
|
type="number"
|
|
|
|
|
min={0}
|
|
|
|
|
rootClassName="bucket-input"
|
|
|
|
|
placeholder="Default: 30"
|
|
|
|
|
onChange={(val): void => {
|
|
|
|
|
setBucketCount(val || 0);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<Typography.Text className="label bucket-size-label">
|
|
|
|
|
Bucket width
|
|
|
|
|
</Typography.Text>
|
|
|
|
|
<InputNumber
|
|
|
|
|
value={bucketWidth || null}
|
|
|
|
|
type="number"
|
|
|
|
|
precision={2}
|
|
|
|
|
placeholder="Default: Auto"
|
|
|
|
|
step={0.1}
|
|
|
|
|
min={0.0}
|
|
|
|
|
rootClassName="bucket-input"
|
|
|
|
|
onChange={(val): void => {
|
|
|
|
|
setBucketWidth(val || 0);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<section className="combine-hist">
|
|
|
|
|
<Typography.Text className="label">
|
|
|
|
|
Merge all series into one
|
|
|
|
|
</Typography.Text>
|
|
|
|
|
<Switch
|
|
|
|
|
checked={combineHistogram}
|
|
|
|
|
size="small"
|
|
|
|
|
onChange={(checked): void => setCombineHistogram(checked)}
|
|
|
|
|
/>
|
|
|
|
|
</section>
|
|
|
|
|
</section>
|
|
|
|
|
)}
|
2025-03-24 18:42:04 +05:30
|
|
|
|
|
|
|
|
{allowLogScale && (
|
|
|
|
|
<section className="log-scale">
|
|
|
|
|
<Typography.Text className="typography">Y Axis Scale</Typography.Text>
|
|
|
|
|
<Select
|
|
|
|
|
onChange={(value): void => setIsLogScale(value === LogScale.LOGARITHMIC)}
|
|
|
|
|
value={isLogScale ? LogScale.LOGARITHMIC : LogScale.LINEAR}
|
|
|
|
|
style={{ width: '100%' }}
|
|
|
|
|
className="panel-type-select"
|
|
|
|
|
defaultValue={LogScale.LINEAR}
|
|
|
|
|
>
|
|
|
|
|
<Option value={LogScale.LINEAR}>
|
|
|
|
|
<div className="select-option">
|
|
|
|
|
<div className="icon">
|
|
|
|
|
<LineChart size={16} />
|
|
|
|
|
</div>
|
|
|
|
|
<Typography.Text className="display">Linear</Typography.Text>
|
|
|
|
|
</div>
|
|
|
|
|
</Option>
|
|
|
|
|
<Option value={LogScale.LOGARITHMIC}>
|
|
|
|
|
<div className="select-option">
|
|
|
|
|
<div className="icon">
|
|
|
|
|
<Spline size={16} />
|
|
|
|
|
</div>
|
|
|
|
|
<Typography.Text className="display">Logarithmic</Typography.Text>
|
|
|
|
|
</div>
|
|
|
|
|
</Option>
|
|
|
|
|
</Select>
|
|
|
|
|
</section>
|
|
|
|
|
)}
|
2025-05-27 13:50:40 +05:30
|
|
|
|
|
|
|
|
{allowLegendPosition && (
|
|
|
|
|
<section className="legend-position">
|
|
|
|
|
<Typography.Text className="typography">Legend Position</Typography.Text>
|
|
|
|
|
<Select
|
|
|
|
|
onChange={(value: LegendPosition): void => setLegendPosition(value)}
|
|
|
|
|
value={legendPosition}
|
|
|
|
|
style={{ width: '100%' }}
|
|
|
|
|
className="panel-type-select"
|
|
|
|
|
defaultValue={LegendPosition.BOTTOM}
|
|
|
|
|
>
|
|
|
|
|
<Option value={LegendPosition.BOTTOM}>
|
|
|
|
|
<div className="select-option">
|
|
|
|
|
<Typography.Text className="display">Bottom</Typography.Text>
|
|
|
|
|
</div>
|
|
|
|
|
</Option>
|
|
|
|
|
<Option value={LegendPosition.RIGHT}>
|
|
|
|
|
<div className="select-option">
|
|
|
|
|
<Typography.Text className="display">Right</Typography.Text>
|
|
|
|
|
</div>
|
|
|
|
|
</Option>
|
|
|
|
|
</Select>
|
|
|
|
|
</section>
|
|
|
|
|
)}
|
2024-05-28 19:09:04 +05:30
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
{allowCreateAlerts && (
|
|
|
|
|
<section className="alerts" onClick={onCreateAlertsHandler}>
|
|
|
|
|
<div className="left-section">
|
|
|
|
|
<ConciergeBell size={14} className="bell-icon" />
|
|
|
|
|
<Typography.Text className="alerts-text">Alerts</Typography.Text>
|
|
|
|
|
</div>
|
|
|
|
|
<Plus size={14} className="plus-icon" />
|
|
|
|
|
</section>
|
2024-01-09 14:19:23 +05:30
|
|
|
)}
|
|
|
|
|
|
2023-11-16 15:27:48 +05:30
|
|
|
{allowThreshold && (
|
2024-05-28 19:09:04 +05:30
|
|
|
<section>
|
2023-11-16 15:27:48 +05:30
|
|
|
<ThresholdSelector
|
|
|
|
|
thresholds={thresholds}
|
|
|
|
|
setThresholds={setThresholds}
|
|
|
|
|
yAxisUnit={yAxisUnit}
|
|
|
|
|
selectedGraph={selectedGraph}
|
2024-10-21 15:51:22 +05:30
|
|
|
columnUnits={columnUnits}
|
2023-11-16 15:27:48 +05:30
|
|
|
/>
|
2024-05-28 19:09:04 +05:30
|
|
|
</section>
|
2023-11-16 15:27:48 +05:30
|
|
|
)}
|
2024-05-28 19:09:04 +05:30
|
|
|
</div>
|
2021-09-23 15:43:43 +05:30
|
|
|
);
|
2022-03-22 12:10:31 +05:30
|
|
|
}
|
2021-09-23 15:43:43 +05:30
|
|
|
|
|
|
|
|
interface RightContainerProps {
|
|
|
|
|
title: string;
|
2023-05-19 13:14:32 +05:30
|
|
|
setTitle: Dispatch<SetStateAction<string>>;
|
2021-09-23 15:43:43 +05:30
|
|
|
description: string;
|
2023-05-19 13:14:32 +05:30
|
|
|
setDescription: Dispatch<SetStateAction<string>>;
|
2021-09-23 15:43:43 +05:30
|
|
|
stacked: boolean;
|
2023-05-19 13:14:32 +05:30
|
|
|
setStacked: Dispatch<SetStateAction<boolean>>;
|
2021-09-23 15:43:43 +05:30
|
|
|
opacity: string;
|
2023-05-19 13:14:32 +05:30
|
|
|
setOpacity: Dispatch<SetStateAction<string>>;
|
2021-09-23 15:43:43 +05:30
|
|
|
selectedNullZeroValue: string;
|
2023-05-19 13:14:32 +05:30
|
|
|
setSelectedNullZeroValue: Dispatch<SetStateAction<string>>;
|
2023-07-26 15:06:07 +05:30
|
|
|
selectedGraph: PANEL_TYPES;
|
2023-05-19 13:14:32 +05:30
|
|
|
setSelectedTime: Dispatch<SetStateAction<timePreferance>>;
|
2021-09-23 15:43:43 +05:30
|
|
|
selectedTime: timePreferance;
|
2022-03-15 15:18:33 +05:30
|
|
|
yAxisUnit: string;
|
2024-06-10 17:15:30 +05:30
|
|
|
stackedBarChart: boolean;
|
|
|
|
|
setStackedBarChart: Dispatch<SetStateAction<boolean>>;
|
2024-06-05 07:07:49 +05:30
|
|
|
bucketWidth: number;
|
|
|
|
|
bucketCount: number;
|
|
|
|
|
combineHistogram: boolean;
|
|
|
|
|
setCombineHistogram: Dispatch<SetStateAction<boolean>>;
|
|
|
|
|
setBucketWidth: Dispatch<SetStateAction<number>>;
|
|
|
|
|
setBucketCount: Dispatch<SetStateAction<number>>;
|
2023-05-19 13:14:32 +05:30
|
|
|
setYAxisUnit: Dispatch<SetStateAction<string>>;
|
2023-07-26 15:06:07 +05:30
|
|
|
setGraphHandler: (type: PANEL_TYPES) => void;
|
2023-11-15 17:14:09 +05:30
|
|
|
thresholds: ThresholdProps[];
|
|
|
|
|
setThresholds: Dispatch<SetStateAction<ThresholdProps[]>>;
|
2023-11-13 13:54:31 +05:30
|
|
|
selectedWidget?: Widgets;
|
2023-11-15 18:25:02 +05:30
|
|
|
isFillSpans: boolean;
|
|
|
|
|
setIsFillSpans: Dispatch<SetStateAction<boolean>>;
|
2024-01-09 14:19:23 +05:30
|
|
|
softMin: number | null;
|
|
|
|
|
softMax: number | null;
|
2024-06-04 11:14:54 +05:30
|
|
|
columnUnits: ColumnUnit;
|
|
|
|
|
setColumnUnits: Dispatch<SetStateAction<ColumnUnit>>;
|
2024-01-09 14:19:23 +05:30
|
|
|
setSoftMin: Dispatch<SetStateAction<number | null>>;
|
|
|
|
|
setSoftMax: Dispatch<SetStateAction<number | null>>;
|
2025-03-24 18:42:04 +05:30
|
|
|
isLogScale: boolean;
|
|
|
|
|
setIsLogScale: Dispatch<SetStateAction<boolean>>;
|
2025-05-27 13:50:40 +05:30
|
|
|
legendPosition: LegendPosition;
|
|
|
|
|
setLegendPosition: Dispatch<SetStateAction<LegendPosition>>;
|
2021-09-23 15:43:43 +05:30
|
|
|
}
|
|
|
|
|
|
2023-11-13 13:54:31 +05:30
|
|
|
RightContainer.defaultProps = {
|
|
|
|
|
selectedWidget: undefined,
|
|
|
|
|
};
|
|
|
|
|
|
2021-09-23 15:43:43 +05:30
|
|
|
export default RightContainer;
|