From 2dcac2b9a9834dd4532df2932040b74e26bc5ccd Mon Sep 17 00:00:00 2001 From: Maxim Date: Thu, 13 Oct 2022 11:02:00 +0100 Subject: [PATCH] review fixes --- grafana-plugin/src/components/Table/Table.tsx | 12 ++++++------ grafana-plugin/src/pages/schedule/Schedule.tsx | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/grafana-plugin/src/components/Table/Table.tsx b/grafana-plugin/src/components/Table/Table.tsx index 94abe0fb..8c656de5 100644 --- a/grafana-plugin/src/components/Table/Table.tsx +++ b/grafana-plugin/src/components/Table/Table.tsx @@ -33,14 +33,14 @@ export interface Props extends TableProps { } const GTable: FC = (props) => { - const { columns, data, className, pagination, loading, rowKey, expandable: expandableProp, ...restProps } = props; + const { columns, data, className, pagination, loading, rowKey, expandable, ...restProps } = props; const { page, total: numberOfPages, onChange: onNavigate } = pagination || {}; - const expandable = useMemo(() => { - return expandableProp + const expandableFn = useMemo(() => { + return expandable ? { - ...expandableProp, + ...expandable, expandIcon: ({ expanded, record }) => { return (
@@ -51,7 +51,7 @@ const GTable: FC = (props) => { expandedRowClassName: (record, index) => (index % 2 === 0 ? cx('row-even') : cx('row-odd')), } : null; - }, [expandableProp]); + }, [expandable]); return ( @@ -60,7 +60,7 @@ const GTable: FC = (props) => { className={cx('root', className)} columns={columns} data={data} - expandable={expandable} + expandable={expandableFn} rowClassName={(record, index) => (index % 2 === 0 ? cx('row-even') : cx('row-odd'))} {...restProps} /> diff --git a/grafana-plugin/src/pages/schedule/Schedule.tsx b/grafana-plugin/src/pages/schedule/Schedule.tsx index 0bb145d2..c5427f37 100644 --- a/grafana-plugin/src/pages/schedule/Schedule.tsx +++ b/grafana-plugin/src/pages/schedule/Schedule.tsx @@ -30,7 +30,7 @@ import ScheduleFinal from 'containers/Rotations/ScheduleFinal'; import ScheduleOverrides from 'containers/Rotations/ScheduleOverrides'; import ScheduleForm from 'containers/ScheduleForm/ScheduleForm'; import UsersTimezones from 'containers/UsersTimezones/UsersTimezones'; -import { Shift } from 'models/schedule/schedule.types'; +import { ScheduleType, Shift } from 'models/schedule/schedule.types'; import { Timezone } from 'models/timezone/timezone.types'; import { WithStoreProps } from 'state/types'; import { withMobXProviderContext } from 'state/withStore';