Skip to content

Commit

Permalink
remove duplicated Table component (#4625)
Browse files Browse the repository at this point in the history
# What this PR does

remove duplicated Table component

## Which issue(s) this PR closes

Closes #4623

<!--
*Note*: if you have more than one GitHub issue that this PR closes, be
sure to preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
  • Loading branch information
brojd authored Jul 8, 2024
1 parent 361a298 commit 3f80872
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 135 deletions.
13 changes: 7 additions & 6 deletions grafana-plugin/src/components/GTable/GTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface GTableProps<RecordType = unknown> extends TableProps<RecordType
expandable?: {
expandedRowKeys: string[];
expandedRowRender: (item: any) => React.ReactNode;
onExpandedRowsChange: (rows: string[]) => void;
onExpandedRowsChange?: (rows: string[]) => void;
expandRowByClick: boolean;
expandIcon?: (props: { expanded: boolean; record: any }) => React.ReactNode;
onExpand?: (expanded: boolean, item: any) => void;
Expand Down Expand Up @@ -47,7 +47,7 @@ export const GTable = <RT extends DefaultRecordType = DefaultRecordType>(props:
const { expanded, record } = props;
return (
<Icon
style={{ cursor: 'pointer' }}
className={styles.expandIcon}
name={expanded ? 'angle-down' : 'angle-right'}
onClick={(event) => {
event.stopPropagation();
Expand All @@ -61,8 +61,8 @@ export const GTable = <RT extends DefaultRecordType = DefaultRecordType>(props:
newExpandedRowKeys.splice(index, 1);
}

expandable.onExpand && expandable.onExpand(newExpanded, record);
expandable.onExpandedRowsChange(newExpandedRowKeys);
expandable.onExpand?.(newExpanded, record);
expandable.onExpandedRowsChange?.(newExpandedRowKeys);
}}
/>
);
Expand Down Expand Up @@ -161,12 +161,13 @@ const getGTableStyles = () => ({
width: 100%;
}
`,

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

checkbox: css`
display: inline-flex;
`,
expandIcon: css`
cursor: pointer;
`,
});
50 changes: 0 additions & 50 deletions grafana-plugin/src/components/Table/Table.styles.ts

This file was deleted.

74 changes: 0 additions & 74 deletions grafana-plugin/src/components/Table/Table.tsx

This file was deleted.

1 change: 0 additions & 1 deletion grafana-plugin/src/pages/schedules/Schedules.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const getSchedulesStyles = () => {
tableRoot: css`
td.rc-table-row-expand-icon-cell {
position: relative;
top: 5px;
left: 3px;
}
`,
Expand Down
7 changes: 3 additions & 4 deletions grafana-plugin/src/pages/schedules/Schedules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { RouteComponentProps, withRouter } from 'react-router-dom';
import { getUtilStyles } from 'styles/utils.styles';

import { Avatar } from 'components/Avatar/Avatar';
import { GTable, GTableProps } from 'components/GTable/GTable';
import { NewScheduleSelector } from 'components/NewScheduleSelector/NewScheduleSelector';
import { PluginLink } from 'components/PluginLink/PluginLink';
import { GTable } from 'components/Table/Table';
import { Text } from 'components/Text/Text';
import { TextEllipsisTooltip } from 'components/TextEllipsisTooltip/TextEllipsisTooltip';
import { TooltipBadge } from 'components/TooltipBadge/TooltipBadge';
Expand Down Expand Up @@ -62,7 +62,6 @@ class _SchedulesPage extends React.Component<SchedulesPageProps, SchedulesPageSt
const {
store: { userStore },
} = this.props;

userStore.fetchItems();
}

Expand Down Expand Up @@ -281,7 +280,7 @@ class _SchedulesPage extends React.Component<SchedulesPageProps, SchedulesPageSt
return <PluginLink query={{ page: 'schedules', id: item.id, ...query }}>{item.name}</PluginLink>;
};

renderOncallNow = (item: Schedule, _index: number) => {
renderOncallNow = (item: Schedule) => {
const { theme } = this.props;
const utilsStyles = getUtilStyles(theme);

Expand Down Expand Up @@ -406,7 +405,7 @@ class _SchedulesPage extends React.Component<SchedulesPageProps, SchedulesPageSt
};
};

getTableColumns = () => {
getTableColumns = (): GTableProps<Schedule>['columns'] => {
const { grafanaTeamStore } = this.props.store;
const styles = getSchedulesStyles();

Expand Down

0 comments on commit 3f80872

Please sign in to comment.