All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.js.export.ExportModal.js Maven / Gradle / Ivy

/**
 * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */

import ClayButton from '@clayui/button';
import ClayModal from '@clayui/modal';
import PropTypes from 'prop-types';
import React from 'react';

import {exportStatus, fetchExportedFile} from '../BatchPlannerExport';
import Poller from '../Poller';
import ExportModalBody from './ExportModalBody';

const ExportModal = ({
	closeModal,
	formDataQuerySelector,
	formSubmitURL,
	observer,
}) => {
	const {downloadFile, errorMessage, loading, percentage, ready} = Poller(
		formDataQuerySelector,
		formSubmitURL,
		exportStatus,
		fetchExportedFile
	);

	let modalStatus;

	if (ready) {
		modalStatus = 'success';
	}
	else if (errorMessage) {
		modalStatus = 'danger';
	}
	else {
		modalStatus = 'info';
	}

	return (
		
			
				{Liferay.Language.get('export-file')}
			

			

			
						
							{Liferay.Language.get('back-to-the-list')}
						

						
							{loading && (
								
									
								
							)}

							{Liferay.Language.get('download')}
						
					
				}
			/>
		
	);
};

ExportModal.propTypes = {
	closeModal: PropTypes.func.isRequired,
	formDataQuerySelector: PropTypes.string.isRequired,
	formSubmitURL: PropTypes.string.isRequired,
	namespace: PropTypes.string.isRequired,
	observer: PropTypes.object.isRequired,
};

export default ExportModal;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy