Skip to content

Commit

Permalink
Fix display of schedule final in preview mode (#4447)
Browse files Browse the repository at this point in the history
# What this PR does

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

Part of #4428
  • Loading branch information
teodosii authored Jun 4, 2024
1 parent d0dd154 commit 2f1ffcf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
37 changes: 20 additions & 17 deletions grafana-plugin/src/components/GTable/GTable.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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}
Expand All @@ -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%;
}
`,

fixed: css`
table {
table-layout: fixed;
}
`,

pagination: css`
margin-top: 20px;
`,
pagination: css`
margin-top: 20px;
`,

checkbox: css`
display: inline-flex;
`,
};
};
checkbox: css`
display: inline-flex;
`,
});
1 change: 1 addition & 0 deletions grafana-plugin/src/pages/schedules/Schedules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2f1ffcf

Please sign in to comment.