Skip to content

Commit

Permalink
Removes gotoPage action in favor of setPage (elastic#33175)
Browse files Browse the repository at this point in the history
  • Loading branch information
crob611 committed Mar 13, 2019
1 parent a163fc8 commit 0e73ed6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
4 changes: 2 additions & 2 deletions x-pack/plugins/canvas/public/apps/workpad/routes.js
Expand Up @@ -10,7 +10,7 @@ import { getBaseBreadcrumb, getWorkpadBreadcrumb, setBreadcrumb } from '../../li
import { getDefaultWorkpad } from '../../state/defaults';
import { setWorkpad } from '../../state/actions/workpad';
import { setAssets, resetAssets } from '../../state/actions/assets';
import { gotoPage } from '../../state/actions/pages';
import { setPage } from '../../state/actions/pages';
import { getWorkpad } from '../../state/selectors/workpad';
import { isFirstLoad } from '../../state/selectors/app';
import { setCanUserWrite, setFirstLoad } from '../../state/actions/transient';
Expand Down Expand Up @@ -89,7 +89,7 @@ export const routes = [
// set the active page using the number provided in the url
const pageIndex = pageNumber - 1;
if (pageIndex !== workpad.page) {
dispatch(gotoPage(pageIndex));
dispatch(setPage(pageIndex));
}

// update the application's breadcrumb
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/canvas/public/state/actions/pages.js
Expand Up @@ -8,7 +8,6 @@ import { createAction } from 'redux-actions';

export const addPage = createAction('addPage');
export const duplicatePage = createAction('duplicatePage');
export const gotoPage = createAction('gotoPage');
export const movePage = createAction('movePage', (id, position) => ({ id, position }));
export const removePage = createAction('removePage');
export const stylePage = createAction('stylePage', (pageId, style) => ({ pageId, style }));
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/canvas/public/state/middleware/aeroelastic.js
Expand Up @@ -18,7 +18,7 @@ import {
} from '../actions/elements';
import { restoreHistory } from '../actions/history';
import { selectElement } from '../actions/transient';
import { addPage, removePage, duplicatePage, gotoPage } from '../actions/pages';
import { addPage, removePage, duplicatePage, setPage } from '../actions/pages';
import { appReady } from '../actions/app';
import { setWorkpad } from '../actions/workpad';
import { getNodes, getPages, getSelectedPage, getSelectedElement } from '../selectors/workpad';
Expand Down Expand Up @@ -59,7 +59,7 @@ const aeroelasticConfiguration = {

const isGroupId = id => id.startsWith(aeroelasticConfiguration.groupName);

const pageChangerActions = [gotoPage.toString(), duplicatePage.toString(), addPage.toString()];
const pageChangerActions = [duplicatePage.toString(), addPage.toString(), setPage.toString()];

/**
* elementToShape
Expand Down
10 changes: 0 additions & 10 deletions x-pack/plugins/canvas/public/state/reducers/pages.js
Expand Up @@ -80,16 +80,6 @@ export const pagesReducer = handleActions(
return setPageIndex(workpadState, payload);
},

[actions.gotoPage]: (workpadState, { payload }) => {
const newState = setPageIndex(workpadState, payload);

// changes to the page require navigation
const router = routerProvider();
router.navigateTo('loadWorkpad', { id: newState.id, page: newState.page + 1 });

return newState;
},

[actions.movePage]: (workpadState, { payload }) => {
const { id, position } = payload;
const pageIndex = getPageIndexById(workpadState, id);
Expand Down

0 comments on commit 0e73ed6

Please sign in to comment.