2023-03-07 12:25:59 +01:00
|
|
|
import { Input, Select } from 'antd';
|
2021-09-23 15:43:43 +05:30
|
|
|
import InputComponent from 'components/Input';
|
2022-03-22 12:10:31 +05:30
|
|
|
import TimePreference from 'components/TimePreferenceDropDown';
|
2021-09-23 15:43:43 +05:30
|
|
|
import { GRAPH_TYPES } from 'container/NewDashboard/ComponentsSlider';
|
2023-03-07 12:25:59 +01:00
|
|
|
import GraphTypes, {
|
|
|
|
|
ITEMS,
|
|
|
|
|
} from 'container/NewDashboard/ComponentsSlider/menuItems';
|
2023-05-19 13:14:32 +05:30
|
|
|
import { Dispatch, SetStateAction, useCallback } from 'react';
|
2021-09-23 15:43:43 +05:30
|
|
|
|
2022-03-24 12:06:57 +05:30
|
|
|
import { Container, Title } from './styles';
|
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
|
|
|
|
|
|
|
|
function RightContainer({
|
2021-09-23 15:43:43 +05:30
|
|
|
description,
|
|
|
|
|
setDescription,
|
|
|
|
|
setTitle,
|
|
|
|
|
title,
|
|
|
|
|
selectedGraph,
|
|
|
|
|
setSelectedTime,
|
|
|
|
|
selectedTime,
|
2022-03-15 15:18:33 +05:30
|
|
|
yAxisUnit,
|
|
|
|
|
setYAxisUnit,
|
2023-03-07 12:25:59 +01:00
|
|
|
setGraphHandler,
|
2022-03-22 12:10:31 +05:30
|
|
|
}: RightContainerProps): JSX.Element {
|
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 || '';
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Container>
|
2023-03-07 12:25:59 +01:00
|
|
|
<Title>Panel Type</Title>
|
|
|
|
|
<Select
|
2023-03-07 17:49:18 +05:30
|
|
|
onChange={setGraphHandler}
|
2023-03-07 12:25:59 +01:00
|
|
|
value={selectedGraph}
|
2023-03-07 17:49:18 +05:30
|
|
|
disabled
|
2023-03-07 12:25:59 +01:00
|
|
|
style={{ width: '100%', marginBottom: 24 }}
|
|
|
|
|
>
|
|
|
|
|
{GraphTypes.map((item) => (
|
|
|
|
|
<Option key={item.name} value={item.name}>
|
|
|
|
|
{item.display}
|
|
|
|
|
</Option>
|
|
|
|
|
))}
|
|
|
|
|
</Select>
|
2021-09-23 15:43:43 +05:30
|
|
|
<Title>Panel Attributes</Title>
|
|
|
|
|
|
|
|
|
|
<InputComponent
|
|
|
|
|
label="Panel Title"
|
|
|
|
|
size="middle"
|
|
|
|
|
placeholder="Title"
|
|
|
|
|
labelOnTop
|
|
|
|
|
onChangeHandler={(event): void =>
|
|
|
|
|
onChangeHandler(setTitle, event.target.value)
|
|
|
|
|
}
|
|
|
|
|
value={title}
|
|
|
|
|
/>
|
|
|
|
|
|
2022-03-22 12:10:31 +05:30
|
|
|
<Title light="true">Description</Title>
|
2021-09-23 15:43:43 +05:30
|
|
|
|
|
|
|
|
<TextArea
|
|
|
|
|
placeholder="Write something describing the panel"
|
|
|
|
|
bordered
|
|
|
|
|
allowClear
|
|
|
|
|
value={description}
|
|
|
|
|
onChange={(event): void =>
|
|
|
|
|
onChangeHandler(setDescription, event.target.value)
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
|
2021-10-11 16:35:20 +05:30
|
|
|
{/* <TextContainer>
|
2021-09-23 15:43:43 +05:30
|
|
|
<Typography>Stacked Graphs :</Typography>
|
|
|
|
|
<Switch
|
|
|
|
|
checked={stacked}
|
|
|
|
|
onChange={(): void => {
|
|
|
|
|
setStacked((value) => !value);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2021-10-11 16:35:20 +05:30
|
|
|
</TextContainer> */}
|
2021-09-23 15:43:43 +05:30
|
|
|
|
2021-10-11 16:35:20 +05:30
|
|
|
{/* <Title light={'true'}>Fill Opacity: </Title> */}
|
2021-09-23 15:43:43 +05:30
|
|
|
|
2021-10-11 16:35:20 +05:30
|
|
|
{/* <Slider
|
2021-09-23 15:43:43 +05:30
|
|
|
value={parseInt(opacity, 10)}
|
|
|
|
|
marks={{
|
|
|
|
|
0: '0',
|
|
|
|
|
33: '33',
|
|
|
|
|
66: '66',
|
|
|
|
|
100: '100',
|
|
|
|
|
}}
|
|
|
|
|
onChange={(number): void => onChangeHandler(setOpacity, number.toString())}
|
|
|
|
|
step={1}
|
2021-10-11 16:35:20 +05:30
|
|
|
/> */}
|
2021-09-23 15:43:43 +05:30
|
|
|
|
2021-10-11 16:35:20 +05:30
|
|
|
{/* <Title light={'true'}>Null/Zero values: </Title>
|
2021-09-23 15:43:43 +05:30
|
|
|
|
|
|
|
|
<NullButtonContainer>
|
|
|
|
|
{nullValueButtons.map((button) => (
|
|
|
|
|
<Button
|
|
|
|
|
type={button.check === selectedNullZeroValue ? 'primary' : 'default'}
|
|
|
|
|
key={button.name}
|
|
|
|
|
onClick={(): void =>
|
|
|
|
|
onChangeHandler(setSelectedNullZeroValue, button.check)
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
{button.name}
|
|
|
|
|
</Button>
|
|
|
|
|
))}
|
2021-10-11 16:35:20 +05:30
|
|
|
</NullButtonContainer> */}
|
2021-09-23 15:43:43 +05:30
|
|
|
|
2022-03-22 12:10:31 +05:30
|
|
|
<Title light="true">Panel Time Preference</Title>
|
2021-09-23 15:43:43 +05:30
|
|
|
|
|
|
|
|
<TimePreference
|
|
|
|
|
{...{
|
|
|
|
|
selectedTime,
|
|
|
|
|
setSelectedTime,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2022-03-23 22:03:57 +05:30
|
|
|
<YAxisUnitSelector
|
|
|
|
|
defaultValue={yAxisUnit}
|
|
|
|
|
onSelect={setYAxisUnit}
|
|
|
|
|
fieldLabel={selectedGraphType === 'Value' ? 'Unit' : 'Y Axis Unit'}
|
|
|
|
|
/>
|
2021-09-23 15:43:43 +05:30
|
|
|
</Container>
|
|
|
|
|
);
|
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>>;
|
2021-09-23 15:43:43 +05:30
|
|
|
selectedGraph: GRAPH_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;
|
2023-05-19 13:14:32 +05:30
|
|
|
setYAxisUnit: Dispatch<SetStateAction<string>>;
|
2023-03-07 12:25:59 +01:00
|
|
|
setGraphHandler: (type: ITEMS) => void;
|
2021-09-23 15:43:43 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default RightContainer;
|