-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd605c4
commit 8a87ed6
Showing
27 changed files
with
445 additions
and
428 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
63 changes: 63 additions & 0 deletions
63
x-pack/plugins/canvas/public/apps/export/export/export_app.component.tsx
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,63 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { FC, useEffect } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
// @ts-expect-error untyped library | ||
import Style from 'style-it'; | ||
// @ts-expect-error untyped local | ||
import { WorkpadPage } from '../../../components/workpad_page'; | ||
import { Link } from '../../../components/link'; | ||
import { CanvasWorkpad } from '../../../../types'; | ||
|
||
interface Props { | ||
workpad: CanvasWorkpad; | ||
selectedPageIndex: number; | ||
initializeWorkpad: () => void; | ||
} | ||
|
||
export const ExportApp: FC<Props> = ({ workpad, selectedPageIndex, initializeWorkpad }) => { | ||
const { id, pages, height, width } = workpad; | ||
const activePage = pages[selectedPageIndex]; | ||
const pageElementCount = activePage.elements.length; | ||
|
||
useEffect(() => initializeWorkpad); | ||
|
||
return ( | ||
<div className="canvasExport" data-shared-page={selectedPageIndex + 1}> | ||
<div className="canvasExport__stage"> | ||
<div className="canvasLayout__stageHeader"> | ||
<Link name="loadWorkpad" params={{ id }}> | ||
Edit Workpad | ||
</Link> | ||
</div> | ||
{Style.it( | ||
workpad.css, | ||
<div className="canvasExport__stageContent" data-shared-items-count={pageElementCount}> | ||
<WorkpadPage | ||
isSelected | ||
key={activePage.id} | ||
pageId={activePage.id} | ||
height={height} | ||
width={width} | ||
registerLayout={() => {}} | ||
unregisterLayout={() => {}} | ||
/> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
ExportApp.propTypes = { | ||
workpad: PropTypes.shape({ | ||
id: PropTypes.string.isRequired, | ||
pages: PropTypes.array.isRequired, | ||
}).isRequired, | ||
selectedPageIndex: PropTypes.number.isRequired, | ||
initializeWorkpad: PropTypes.func.isRequired, | ||
}; |
59 changes: 0 additions & 59 deletions
59
x-pack/plugins/canvas/public/apps/export/export/export_app.js
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
x-pack/plugins/canvas/public/apps/export/export/export_app.ts
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,21 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { connect } from 'react-redux'; | ||
import { initializeWorkpad } from '../../../state/actions/workpad'; | ||
import { getWorkpad, getSelectedPageIndex } from '../../../state/selectors/workpad'; | ||
import { ExportApp as Component } from './export_app.component'; | ||
import { State } from '../../../../types'; | ||
|
||
export const ExportApp = connect( | ||
(state: State) => ({ | ||
workpad: getWorkpad(state), | ||
selectedPageIndex: getSelectedPageIndex(state), | ||
}), | ||
(dispatch) => ({ | ||
initializeWorkpad: () => dispatch(initializeWorkpad()), | ||
}) | ||
)(Component); |
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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.