forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Page copying and delete confirmation (elastic#172)
* fix: globally set the confirm modal font color * chore: move getId into its own module * feat: add page duplication action, reducer, and the UI controls * fix: middleware to update elements when duplicating a page, all the elements on that page need to be loaded * feat: add confirmation to page delete * chore: bump react dependencies
- Loading branch information
Showing
16 changed files
with
143 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export const PageControls = ({ pageId, movePage, duplicatePage, removePage }) => ( | ||
<div className="canvas__page-manager--page-controls"> | ||
<span className="fa fa-angle-double-left move-left" onClick={() => movePage(pageId, -1)} /> | ||
<span className="fa fa-trash delete" onClick={() => removePage(pageId)} /> | ||
<span className="fa fa-files-o duplicate" onClick={() => duplicatePage(pageId)} /> | ||
<span className="fa fa-angle-double-right move-right" onClick={() => movePage(pageId, 1)} /> | ||
</div> | ||
); | ||
|
||
PageControls.propTypes = { | ||
pageId: PropTypes.string.isRequired, | ||
movePage: PropTypes.func.isRequired, | ||
duplicatePage: PropTypes.func.isRequired, | ||
removePage: PropTypes.func.isRequired, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import uuid from 'uuid/v4'; | ||
|
||
export function getId(type) { | ||
return `${type}-${uuid()}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { duplicatePage } from '../actions/pages'; | ||
import { fetchRenderable } from '../actions/elements'; | ||
import { getPages } from '../selectors/workpad'; | ||
|
||
export const workpadUpdate = ({ dispatch, getState }) => next => (action) => { | ||
next(action); | ||
|
||
if (action.type === duplicatePage.toString()) { | ||
const pages = getPages(getState()); | ||
const newPage = pages[pages.length - 1]; | ||
|
||
return newPage.elements.forEach(element => dispatch(fetchRenderable(element))); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.