Unverified Commit 8f0cf22c authored by Marcos Iglesias's avatar Marcos Iglesias Committed by GitHub

Removes unnecessary ESLint rule; fixes no-use-before-define issues and removes ESLint rule (#537)

parent 82d843e9
...@@ -11,17 +11,12 @@ import { BrowsePage } from '..'; ...@@ -11,17 +11,12 @@ import { BrowsePage } from '..';
describe('BrowsePage', () => { describe('BrowsePage', () => {
const setup = () => { const setup = () => {
const wrapper = shallow<BrowsePage>(<BrowsePage />); return shallow<BrowsePage>(<BrowsePage />);
return { props, wrapper };
}; };
let props;
let wrapper; let wrapper;
beforeAll(() => { beforeAll(() => {
const setupResult = setup(); wrapper = setup();
props = setupResult.props;
wrapper = setupResult.wrapper;
}); });
describe('render', () => { describe('render', () => {
......
...@@ -9,18 +9,6 @@ import { filterFromObj } from 'ducks/utilMethods'; ...@@ -9,18 +9,6 @@ import { filterFromObj } from 'ducks/utilMethods';
import { UpdateSearchFilter, UpdateFilterRequest } from './reducer'; import { UpdateSearchFilter, UpdateFilterRequest } from './reducer';
/**
* Listens to actions triggers by user updates to the filter state..
*/
export function* filterWatcher(): SagaIterator {
/*
TODO: If we want to minimize api calls on checkbox quick-select,
we will have to debounce and accumulate filter updates elsewhere.
To be revisited when we have more checkbox filters
*/
yield takeEvery(UpdateSearchFilter.REQUEST, filterWorker);
}
/* /*
* Generates new filter shape from action payload. * Generates new filter shape from action payload.
* Then executes a search on current resource based with new filters and current search state values. * Then executes a search on current resource based with new filters and current search state values.
...@@ -50,3 +38,15 @@ export function* filterWorker(action: UpdateFilterRequest): SagaIterator { ...@@ -50,3 +38,15 @@ export function* filterWorker(action: UpdateFilterRequest): SagaIterator {
}) })
); );
} }
/**
* Listens to actions triggers by user updates to the filter state..
*/
export function* filterWatcher(): SagaIterator {
/*
TODO: If we want to minimize api calls on checkbox quick-select,
we will have to debounce and accumulate filter updates elsewhere.
To be revisited when we have more checkbox filters
*/
yield takeEvery(UpdateSearchFilter.REQUEST, filterWorker);
}
...@@ -38,6 +38,41 @@ import tableOwnersReducer, { ...@@ -38,6 +38,41 @@ import tableOwnersReducer, {
TableOwnerReducerState, TableOwnerReducerState,
} from './owners/reducer'; } from './owners/reducer';
export const initialPreviewState = {
data: {},
status: null,
};
export const initialTableDataState: TableMetadata = {
badges: [],
cluster: '',
columns: [],
database: '',
is_editable: false,
is_view: false,
key: '',
last_updated_timestamp: 0,
schema: '',
name: '',
description: '',
table_writer: { application_url: '', description: '', id: '', name: '' },
partition: { is_partitioned: false },
table_readers: [],
source: { source: '', source_type: '' },
resource_reports: [],
watermarks: [],
programmatic_descriptions: {},
};
export const initialState: TableMetadataReducerState = {
isLoading: true,
lastIndexed: null,
preview: initialPreviewState,
statusCode: null,
tableData: initialTableDataState,
tableOwners: initialOwnersState,
};
/* ACTIONS */ /* ACTIONS */
export function getTableData( export function getTableData(
key: string, key: string,
...@@ -53,6 +88,7 @@ export function getTableData( ...@@ -53,6 +88,7 @@ export function getTableData(
type: GetTableData.REQUEST, type: GetTableData.REQUEST,
}; };
} }
export function getTableDataFailure(): GetTableDataResponse { export function getTableDataFailure(): GetTableDataResponse {
return { return {
type: GetTableData.FAILURE, type: GetTableData.FAILURE,
...@@ -64,6 +100,7 @@ export function getTableDataFailure(): GetTableDataResponse { ...@@ -64,6 +100,7 @@ export function getTableDataFailure(): GetTableDataResponse {
}, },
}; };
} }
export function getTableDataSuccess( export function getTableDataSuccess(
data: TableMetadata, data: TableMetadata,
owners: OwnerDict, owners: OwnerDict,
...@@ -259,41 +296,6 @@ export interface TableMetadataReducerState { ...@@ -259,41 +296,6 @@ export interface TableMetadataReducerState {
tableOwners: TableOwnerReducerState; tableOwners: TableOwnerReducerState;
} }
export const initialPreviewState = {
data: {},
status: null,
};
export const initialTableDataState: TableMetadata = {
badges: [],
cluster: '',
columns: [],
database: '',
is_editable: false,
is_view: false,
key: '',
last_updated_timestamp: 0,
schema: '',
name: '',
description: '',
table_writer: { application_url: '', description: '', id: '', name: '' },
partition: { is_partitioned: false },
table_readers: [],
source: { source: '', source_type: '' },
resource_reports: [],
watermarks: [],
programmatic_descriptions: {},
};
export const initialState: TableMetadataReducerState = {
isLoading: true,
lastIndexed: null,
preview: initialPreviewState,
statusCode: null,
tableData: initialTableDataState,
tableOwners: initialOwnersState,
};
export default function reducer( export default function reducer(
state: TableMetadataReducerState = initialState, state: TableMetadataReducerState = initialState,
action action
......
...@@ -33,6 +33,13 @@ export function filterFromObj( ...@@ -33,6 +33,13 @@ export function filterFromObj(
}, {}); }, {});
} }
export function logAction(declaredProps: ActionLogParams) {
const inferredProps = {
location: window.location.pathname,
};
postActionLog({ ...inferredProps, ...declaredProps });
}
export function logClick( export function logClick(
event: React.MouseEvent<HTMLElement>, event: React.MouseEvent<HTMLElement>,
declaredProps?: ActionLogParams declaredProps?: ActionLogParams
...@@ -61,10 +68,3 @@ export function logClick( ...@@ -61,10 +68,3 @@ export function logClick(
logAction({ ...inferredProps, ...declaredProps }); logAction({ ...inferredProps, ...declaredProps });
} }
export function logAction(declaredProps: ActionLogParams) {
const inferredProps = {
location: window.location.pathname,
};
postActionLog({ ...inferredProps, ...declaredProps });
}
...@@ -282,7 +282,6 @@ ...@@ -282,7 +282,6 @@
"@typescript-eslint/naming-convention": "warn", "@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/no-unused-expressions": "warn", "@typescript-eslint/no-unused-expressions": "warn",
"@typescript-eslint/no-unused-vars": "warn", "@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/member-delimiter-style": [ "@typescript-eslint/member-delimiter-style": [
"off", "off",
{ {
...@@ -323,7 +322,6 @@ ...@@ -323,7 +322,6 @@
} }
} }
], ],
"@typescript-eslint/indent": "off",
"array-callback-return": "warn", "array-callback-return": "warn",
"camelcase": "off", "camelcase": "off",
"class-methods-use-this": "off", "class-methods-use-this": "off",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment