Skip to content

Commit

Permalink
Fix table manipulation. (#22728)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcenizal authored and jen-huang committed Sep 7, 2018
1 parent 786bb2b commit 25aa4bf
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,16 @@ const COLUMNS = [{
export class JobTableUi extends Component {
static propTypes = {
jobs: PropTypes.array,
pager: PropTypes.object.isRequired,
filter: PropTypes.string.isRequired,
sortField: PropTypes.string.isRequired,
isSortAscending: PropTypes.bool.isRequired,
closeDetailPanel: PropTypes.func.isRequired,
filterChanged: PropTypes.func.isRequired,
pageChanged: PropTypes.func.isRequired,
pageSizeChanged: PropTypes.func.isRequired,
sortChanged: PropTypes.func.isRequired,
dispatch: PropTypes.func.isRequired,
}

static defaultProps = {
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/rollup/public/crud_app/store/action_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ export const CLEAR_CREATE_JOB_ERRORS = 'CLEAR_CREATE_JOB_ERRORS';
export const DELETE_JOBS_SUCCESS = 'DELETE_JOBS_SUCCESS';

// Table state
export const APPLY_FILTERS = 'APPLY_FILTERS';
export const FILTERS_APPLIED = 'FILTERS_APPLIED';
export const FILTER_CHANGED = 'FILTER_CHANGED';
export const PAGE_CHANGED = 'PAGE_CHANGED';
export const PAGE_SIZE_CHANGED = 'PAGE_SIZE_CHANGED';
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/rollup/public/crud_app/store/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export {
} from './detail_panel';

export {
applyFilters,
filtersApplied,
filterChanged,
pageChanged,
pageSizeChanged,
Expand Down
26 changes: 8 additions & 18 deletions x-pack/plugins/rollup/public/crud_app/store/actions/table_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,36 @@
*/

import {
APPLY_FILTERS,
FILTERS_APPLIED,
FILTER_CHANGED,
PAGE_CHANGED,
PAGE_SIZE_CHANGED,
SORT_CHANGED,
} from '../action_types';

export const applyFilters = () => (dispatch) => {
dispatch({
type: APPLY_FILTERS,
});
};

export const filtersApplied = () => (dispatch) => {
dispatch({
type: FILTERS_APPLIED,
});
};

export const filterChanged = () => (dispatch) => {
export const filterChanged = ({ filter }) => (dispatch) => {
dispatch({
type: FILTER_CHANGED,
payload: { filter },
});
};

export const pageChanged = () => (dispatch) => {
export const pageChanged = ({ pageNumber }) => (dispatch) => {
dispatch({
type: PAGE_CHANGED,
payload: { pageNumber },
});
};

export const pageSizeChanged = () => (dispatch) => {
export const pageSizeChanged = ({ pageSize }) => (dispatch) => {
dispatch({
type: PAGE_SIZE_CHANGED,
payload: { pageSize },
});
};

export const sortChanged = () => (dispatch) => {
export const sortChanged = ({ sortField, isSortAscending }) => (dispatch) => {
dispatch({
type: SORT_CHANGED,
payload: { sortField, isSortAscending },
});
};

0 comments on commit 25aa4bf

Please sign in to comment.