Skip to content

Commit

Permalink
Fix column caret display on schedules (#4612)
Browse files Browse the repository at this point in the history
# What this PR does

- Fixed column spacing

## Which issue(s) this PR closes

Closes #4480
  • Loading branch information
teodosii authored Jul 8, 2024
1 parent 24aa3a5 commit 37f661a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
8 changes: 1 addition & 7 deletions grafana-plugin/src/components/GTable/GTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const GTable = <RT extends DefaultRecordType = DefaultRecordType>(props:
}, [rowSelection, columnsProp, data]);

return (
<div className={cx(styles.root, { [styles.fixed]: props.tableLayout === 'fixed' })} data-testid="test__gTable">
<div className={styles.root} data-testid="test__gTable">
<Table<RT>
expandable={expandable}
rowKey={rowKey}
Expand All @@ -162,12 +162,6 @@ const getGTableStyles = () => ({
}
`,

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

pagination: css`
margin-top: 20px;
`,
Expand Down
6 changes: 1 addition & 5 deletions grafana-plugin/src/components/Table/Table.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ export const getTableStyles = (theme: GrafanaTheme2) => {
width: 100%;
}
table :global(.rc-table-row-expand-icon-cell) > span {
pointer-events: none;
}
tr {
min-height: 56px;
}
Expand Down Expand Up @@ -43,7 +39,7 @@ export const getTableStyles = (theme: GrafanaTheme2) => {
transition: transform 0.2s;
&--expanded {
transform: rotate(0deg);
transform: rotate(0deg) translateY(-5px); // to manually compensate for top: 3px
}
`,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const ServiceNowTokenSection: React.FC<ServiceNowTokenSectionProps> = obs

function renderGenerateButton() {
return (
<Button variant="secondary" onClick={onTokenGenerate} disabled={isLoading} className={'aaaa'}>
<Button variant="secondary" onClick={onTokenGenerate} disabled={isLoading}>
{isExistingToken ? 'Regenerate' : 'Generate'}
</Button>
);
Expand Down
8 changes: 8 additions & 0 deletions grafana-plugin/src/pages/schedules/Schedules.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ export const getSchedulesStyles = () => {
position: relative;
`,

tableRoot: css`
td.rc-table-row-expand-icon-cell {
position: relative;
top: 5px;
left: 3px;
}
`,

table: css`
td {
padding-top: 5px;
Expand Down
11 changes: 8 additions & 3 deletions grafana-plugin/src/pages/schedules/Schedules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class _SchedulesPage extends React.Component<SchedulesPageProps, SchedulesPageSt
onChange={this.handleSchedulesFiltersChange}
/>
</div>
<div data-testid="schedules-table">
<div className={cx(styles.tableRoot)} data-testid="schedules-table">
<GTable
className={styles.table}
columns={this.getTableColumns()}
Expand All @@ -115,10 +115,9 @@ 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,
expandedRowKeys,
onExpand: this.handleExpandRow,
expandedRowRender: this.renderSchedule,
expandRowByClick: true,
Expand Down Expand Up @@ -412,6 +411,12 @@ class _SchedulesPage extends React.Component<SchedulesPageProps, SchedulesPageSt
const styles = getSchedulesStyles();

return [
{
// Allow space for icon (>)
width: '40px',
title: '',
render: () => <></>,
},
{
width: '10%',
title: 'Type',
Expand Down

0 comments on commit 37f661a

Please sign in to comment.