Re-enable rule sort-comp (#10872)
This commit is contained in:
parent
a75c36281d
commit
d93b2b99b2
|
|
@ -128,7 +128,6 @@ module.exports = {
|
||||||
'react/no-unused-prop-types': 0,
|
'react/no-unused-prop-types': 0,
|
||||||
'react/prop-types': 0,
|
'react/prop-types': 0,
|
||||||
'react/require-default-props': 0,
|
'react/require-default-props': 0,
|
||||||
'react/sort-comp': 0, // disabled temporarily
|
|
||||||
'react/state-in-constructor': 0, // disabled temporarily
|
'react/state-in-constructor': 0, // disabled temporarily
|
||||||
'react/static-property-placement': 0, // re-enable up for discussion
|
'react/static-property-placement': 0, // re-enable up for discussion
|
||||||
'prettier/prettier': 'error',
|
'prettier/prettier': 'error',
|
||||||
|
|
@ -246,7 +245,6 @@ module.exports = {
|
||||||
'react/no-unused-prop-types': 0,
|
'react/no-unused-prop-types': 0,
|
||||||
'react/prop-types': 0,
|
'react/prop-types': 0,
|
||||||
'react/require-default-props': 0,
|
'react/require-default-props': 0,
|
||||||
'react/sort-comp': 0, // disabled temporarily
|
|
||||||
'react/state-in-constructor': 0, // disabled temporarily
|
'react/state-in-constructor': 0, // disabled temporarily
|
||||||
'react/static-property-placement': 0, // disabled temporarily
|
'react/static-property-placement': 0, // disabled temporarily
|
||||||
'prettier/prettier': 'error',
|
'prettier/prettier': 'error',
|
||||||
|
|
|
||||||
|
|
@ -246,12 +246,12 @@ class SqlEditor extends React.PureComponent {
|
||||||
this.props.actions.estimateQueryCost(query);
|
this.props.actions.estimateQueryCost(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleWindowResize() {
|
|
||||||
this.setState({ height: this.getSqlEditorHeight() });
|
|
||||||
}
|
|
||||||
handleToggleAutocompleteEnabled = () => {
|
handleToggleAutocompleteEnabled = () => {
|
||||||
this.setState({ autocompleteEnabled: !this.state.autocompleteEnabled });
|
this.setState({ autocompleteEnabled: !this.state.autocompleteEnabled });
|
||||||
};
|
};
|
||||||
|
handleWindowResize() {
|
||||||
|
this.setState({ height: this.getSqlEditorHeight() });
|
||||||
|
}
|
||||||
elementStyle(dimension, elementSize, gutterSize) {
|
elementStyle(dimension, elementSize, gutterSize) {
|
||||||
return {
|
return {
|
||||||
[dimension]: `calc(${elementSize}% - ${
|
[dimension]: `calc(${elementSize}% - ${
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,13 @@ export default class FilterableTable extends PureComponent<
|
||||||
expandedColumns: [],
|
expandedColumns: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
list: List<Datum>;
|
||||||
|
complexColumns: Record<string, boolean>;
|
||||||
|
widthsForColumnsByKey: Record<string, number>;
|
||||||
|
totalTableWidth: number;
|
||||||
|
totalTableHeight: number;
|
||||||
|
container: React.RefObject<HTMLDivElement>;
|
||||||
|
|
||||||
constructor(props: FilterableTableProps) {
|
constructor(props: FilterableTableProps) {
|
||||||
super(props);
|
super(props);
|
||||||
this.list = List(this.formatTableData(props.data));
|
this.list = List(this.formatTableData(props.data));
|
||||||
|
|
@ -228,13 +235,6 @@ export default class FilterableTable extends PureComponent<
|
||||||
return this.complexColumns[columnKey] ? truncated : content;
|
return this.complexColumns[columnKey] ? truncated : content;
|
||||||
}
|
}
|
||||||
|
|
||||||
list: List<Datum>;
|
|
||||||
complexColumns: Record<string, boolean>;
|
|
||||||
widthsForColumnsByKey: Record<string, number>;
|
|
||||||
totalTableWidth: number;
|
|
||||||
totalTableHeight: number;
|
|
||||||
container: React.RefObject<HTMLDivElement>;
|
|
||||||
|
|
||||||
formatTableData(data: Record<string, unknown>[]): Datum[] {
|
formatTableData(data: Record<string, unknown>[]): Datum[] {
|
||||||
const formattedData = data.map(row => {
|
const formattedData = data.map(row => {
|
||||||
const newRow = {};
|
const newRow = {};
|
||||||
|
|
|
||||||
|
|
@ -40,23 +40,6 @@ class DashboardTable extends React.PureComponent<
|
||||||
DashboardTableProps,
|
DashboardTableProps,
|
||||||
DashboardTableState
|
DashboardTableState
|
||||||
> {
|
> {
|
||||||
state = {
|
|
||||||
dashboards: [],
|
|
||||||
dashboard_count: 0,
|
|
||||||
loading: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps: DashboardTableProps) {
|
|
||||||
if (prevProps.search !== this.props.search) {
|
|
||||||
this.fetchDataDebounced({
|
|
||||||
pageSize: PAGE_SIZE,
|
|
||||||
pageIndex: 0,
|
|
||||||
sortBy: this.initialSort,
|
|
||||||
filters: [],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
columns = [
|
columns = [
|
||||||
{
|
{
|
||||||
accessor: 'dashboard_title',
|
accessor: 'dashboard_title',
|
||||||
|
|
@ -109,6 +92,23 @@ class DashboardTable extends React.PureComponent<
|
||||||
|
|
||||||
initialSort = [{ id: 'changed_on_delta_humanized', desc: true }];
|
initialSort = [{ id: 'changed_on_delta_humanized', desc: true }];
|
||||||
|
|
||||||
|
state = {
|
||||||
|
dashboards: [],
|
||||||
|
dashboard_count: 0,
|
||||||
|
loading: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidUpdate(prevProps: DashboardTableProps) {
|
||||||
|
if (prevProps.search !== this.props.search) {
|
||||||
|
this.fetchDataDebounced({
|
||||||
|
pageSize: PAGE_SIZE,
|
||||||
|
pageIndex: 0,
|
||||||
|
sortBy: this.initialSort,
|
||||||
|
filters: [],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fetchData = ({ pageIndex, pageSize, sortBy, filters }: FetchDataConfig) => {
|
fetchData = ({ pageIndex, pageSize, sortBy, filters }: FetchDataConfig) => {
|
||||||
this.setState({ loading: true });
|
this.setState({ loading: true });
|
||||||
const filterExps = Object.keys(filters)
|
const filterExps = Object.keys(filters)
|
||||||
|
|
@ -159,6 +159,8 @@ class DashboardTable extends React.PureComponent<
|
||||||
.finally(() => this.setState({ loading: false }));
|
.finally(() => this.setState({ loading: false }));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// sort-comp disabled because of conflict with no-use-before-define rule
|
||||||
|
// eslint-disable-next-line react/sort-comp
|
||||||
fetchDataDebounced = debounce(this.fetchData, 200);
|
fetchDataDebounced = debounce(this.fetchData, 200);
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue