import React from 'react'; import PropTypes from 'prop-types'; import { Icon, Button, MessageDialog, Table, inlineEditFormatterFactory, } from 'patternfly-react'; import * as resolve from 'table-resolver'; import { translate as __ } from 'foremanReact/common/I18n'; import Select from 'foremanReact/components/common/forms/Select'; import CommonForm from 'foremanReact/components/common/forms/CommonForm'; import RailsData from '../common/RailsData'; import { EasyHeaderFormatter } from '../../helper'; class ApplicationDefinitionImport extends React.Component { onFileChange = event => { // Update the state this.setState({ selectedFile: event.target.files[0] }); }; static isEditing({ rowData }) { return rowData.backup !== undefined; } componentDidMount() { const { ansiblePlaybookServices, hostgroups } = this.props; const { initApplicationDefinitionImport, changeEditApplicationDefinitionImportService, } = this.props; this.headerFormatter = EasyHeaderFormatter; const inlineEditFormatterImpl = { renderValue: (value, additionalData) => ( {value} ), renderEditSelect: (value, additionalData, options) => ( {ansiblePlaybookServices.length > 0 ? (
cellProps.children, }, }} > ({ role: 'row', isEditable: () => this.isEditing({ rowData }), last: ansiblePlaybookServices.length - 1, })} />
) : null} ); } } ApplicationDefinitionImport.defaultProps = { // error: {}, showAlertModal: false, alertModalText: '', alertModalTitle: '', columns: [], ansiblePlaybookServices: [], }; ApplicationDefinitionImport.propTypes = { hostgroups: PropTypes.object.isRequired, // error: PropTypes.object, ansiblePlaybookServices: PropTypes.array, // editMode: PropTypes.bool.isRequired, columns: PropTypes.array, showAlertModal: PropTypes.bool, alertModalText: PropTypes.string, alertModalTitle: PropTypes.string, changeEditApplicationDefinitionImportService: PropTypes.func.isRequired, closeAlertModal: PropTypes.func.isRequired, handleImportAnsiblePlaybook: PropTypes.func.isRequired, initApplicationDefinitionImport: PropTypes.func.isRequired, }; export default ApplicationDefinitionImport;