Palash Gupta e7a5eb7b22
feat: new dashboard page is updated (#3385)
* feat: dashboard widget page is refactored

* chore: key is updated

* chore: delete widget is updated

* chore: naming of the file is updated

* feat: dashboard changes are updated and selected dashboard and dashboardId is added

* chore: dashboard widget page is updated

* feat: setlayout is updated

* chore: selected dashboard is updated

* chore: dashboard is updated

* fix: feedback is updated

* chore: comments are resolved

* chore: empty widget id is updated

* fix: variables is updated

* chore: dashboard variable and name,description is now updated in hooks

* chore: build is fixed

* chore: loading experience is updated

* chore: title is updated

* fix: dashboard variables and other changes are updated

* feat: dashboard reducer is removed

* feat: widget header is updated

* feat: widget header is updated

* chore: dashboard is updated

* chore: feedback is updated

* fix: issues are fixed

* chore: delete is updated

* chore: warning message is updated

* chore: warning message is updated

* chore: widget graph component

* feat: dashboard condition is updated

* chore: getChartData is updated

* chore: widget details page is updated

* feat: tab sync is updated

* chore: layout is updated

* chore: labels is updated

* chore: message is updated

* chore: warining message is updated

---------

Co-authored-by: Rajat Dabade <rajat@signoz.io>
Co-authored-by: Vishal Sharma <makeavish786@gmail.com>
2023-10-08 23:21:17 +05:30

84 lines
2.2 KiB
TypeScript

import { CheckboxChangeEvent } from 'antd/es/checkbox';
import { ColumnType } from 'antd/es/table';
import { ChartData } from 'chart.js';
import { ColumnsKeyAndDataIndex, ColumnsTitle } from '../contants';
import { DataSetProps } from '../types';
import { getGraphManagerTableHeaderTitle } from '../utils';
import CustomCheckBox from './CustomCheckBox';
import { getLabel } from './GetLabel';
export const getGraphManagerTableColumns = ({
data,
checkBoxOnChangeHandler,
graphVisibilityState,
labelClickedHandler,
yAxisUnit,
}: GetGraphManagerTableColumnsProps): ColumnType<DataSetProps>[] => [
{
title: '',
width: 50,
dataIndex: ColumnsKeyAndDataIndex.Index,
key: ColumnsKeyAndDataIndex.Index,
render: (_: string, __: DataSetProps, index: number): JSX.Element => (
<CustomCheckBox
data={data}
index={index}
checkBoxOnChangeHandler={checkBoxOnChangeHandler}
graphVisibilityState={graphVisibilityState}
/>
),
},
{
title: ColumnsTitle[ColumnsKeyAndDataIndex.Label],
width: 300,
dataIndex: ColumnsKeyAndDataIndex.Label,
key: ColumnsKeyAndDataIndex.Label,
...getLabel(labelClickedHandler),
},
{
title: getGraphManagerTableHeaderTitle(
ColumnsTitle[ColumnsKeyAndDataIndex.Avg],
yAxisUnit,
),
width: 90,
dataIndex: ColumnsKeyAndDataIndex.Avg,
key: ColumnsKeyAndDataIndex.Avg,
},
{
title: getGraphManagerTableHeaderTitle(
ColumnsTitle[ColumnsKeyAndDataIndex.Sum],
yAxisUnit,
),
width: 90,
dataIndex: ColumnsKeyAndDataIndex.Sum,
key: ColumnsKeyAndDataIndex.Sum,
},
{
title: getGraphManagerTableHeaderTitle(
ColumnsTitle[ColumnsKeyAndDataIndex.Max],
yAxisUnit,
),
width: 90,
dataIndex: ColumnsKeyAndDataIndex.Max,
key: ColumnsKeyAndDataIndex.Max,
},
{
title: getGraphManagerTableHeaderTitle(
ColumnsTitle[ColumnsKeyAndDataIndex.Min],
yAxisUnit,
),
width: 90,
dataIndex: ColumnsKeyAndDataIndex.Min,
key: ColumnsKeyAndDataIndex.Min,
},
];
interface GetGraphManagerTableColumnsProps {
data: ChartData;
checkBoxOnChangeHandler: (e: CheckboxChangeEvent, index: number) => void;
labelClickedHandler: (labelIndex: number) => void;
graphVisibilityState: boolean[];
yAxisUnit?: string;
}