Skip to content

Commit

Permalink
[Enhancement] Added the ability to pass supported data types when exp…
Browse files Browse the repository at this point in the history
…orting (#1336)

* Added the ability to pass supported data types when exporting
* add defaultProps

Signed-off-by: Shan He <heshan0131@gmail.com>
Co-authored-by: Ilija Puaca <ilija@unfolded.ai>
  • Loading branch information
heshan0131 and ilijapuaca committed Dec 3, 2020
1 parent 239051f commit 335f82a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/components/modal-container.js
Expand Up @@ -26,6 +26,7 @@ import {createSelector} from 'reselect';
import get from 'lodash.get';
import document from 'global/document';

import {EXPORT_DATA_TYPE_OPTIONS} from 'constants/default-settings';
import ModalDialogFactory from './modals/modal-dialog';
import {exportJson, exportHtml, exportData, exportImage, exportMap} from 'utils/export-utils';
import {isValidMapInfo} from 'utils/map-info-utils';
Expand Down Expand Up @@ -375,6 +376,7 @@ export default function ModalContainerFactory(
template = (
<ExportDataModal
{...uiState.exportData}
supportedDataTypes={EXPORT_DATA_TYPE_OPTIONS}
datasets={datasets}
applyCPUFilter={this.props.visStateActions.applyCPUFilter}
onClose={this._closeModal}
Expand Down
7 changes: 6 additions & 1 deletion src/components/modals/export-data-modal.js
Expand Up @@ -82,6 +82,7 @@ const ExportDataModalFactory = () => {

render() {
const {
supportedDataTypes,
datasets,
selectedDataset,
dataType,
Expand Down Expand Up @@ -125,7 +126,7 @@ const ExportDataModalFactory = () => {
</div>
</div>
<div className="selection">
{EXPORT_DATA_TYPE_OPTIONS.map(op => (
{supportedDataTypes.map(op => (
<StyledType
key={op.id}
selected={dataType === op.id}
Expand Down Expand Up @@ -182,6 +183,10 @@ const ExportDataModalFactory = () => {
}
}
ExportDataModal.propTypes = propTypes;
ExportDataModal.defaultProps = {
supportedDataTypes: EXPORT_DATA_TYPE_OPTIONS
};

return injectIntl(ExportDataModal);
};

Expand Down

0 comments on commit 335f82a

Please sign in to comment.