Fix display of schedule final in preview mode (#4447)

# What this PR does

- Fixes the display of preview schedule when you click on a row

Part of #4428
This commit is contained in:
Rares Mardare 2024-06-04 11:16:25 +03:00 committed by GitHub
parent d0dd15453e
commit 2f1ffcf2ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 17 deletions

View file

@ -1,7 +1,6 @@
import React, { useCallback, useMemo, ChangeEvent, ReactElement } from 'react';
import { css, cx } from '@emotion/css';
import { GrafanaTheme2 } from '@grafana/data';
import { Pagination, Checkbox, Icon, useStyles2 } from '@grafana/ui';
import Table from 'rc-table';
import { TableProps } from 'rc-table/lib/Table';
@ -136,7 +135,7 @@ export const GTable = <RT extends DefaultRecordType = DefaultRecordType>(props:
}, [rowSelection, columnsProp, data]);
return (
<div className={styles.root} data-testid="test__gTable">
<div className={cx(styles.root, { [styles.fixed]: props.tableLayout === 'fixed' })} data-testid="test__gTable">
<Table<RT>
expandable={expandable}
rowKey={rowKey}
@ -156,20 +155,24 @@ export const GTable = <RT extends DefaultRecordType = DefaultRecordType>(props:
);
};
const getGTableStyles = (_theme: GrafanaTheme2) => {
return {
root: css`
table {
width: 100%;
}
`,
const getGTableStyles = () => ({
root: css`
table {
width: 100%;
}
`,
pagination: css`
margin-top: 20px;
`,
fixed: css`
table {
table-layout: fixed;
}
`,
checkbox: css`
display: inline-flex;
`,
};
};
pagination: css`
margin-top: 20px;
`,
checkbox: css`
display: inline-flex;
`,
});

View file

@ -115,6 +115,7 @@ class _SchedulesPage extends React.Component<SchedulesPageProps, SchedulesPageSt
total: results ? Math.ceil((count || 0) / page_size) : 0,
onChange: this.handlePageChange,
}}
tableLayout="fixed"
rowKey="id"
expandable={{
expandedRowKeys: expandedRowKeys,