import React from 'react'; import PropTypes from 'prop-types'; import { Col, Button } from 'patternfly-react'; import { useForemanModal } from 'foremanReact/components/ForemanModal/ForemanModalHooks'; import { translate as __ } from 'foremanReact/common/I18n'; import { UNLOCK_MODAL, FORCE_UNLOCK_MODAL, } from '../../TaskActions/TaskActionsConstants'; export const TaskButtons = ({ canEdit, dynflowEnableConsole, taskReloadStart, taskProgressToggle, taskReload, externalId, id, action, state, resumable, cancellable, hasSubTasks, parentTask, cancelTaskRequest, resumeTaskRequest, }) => { const unlockModalActions = useForemanModal({ id: UNLOCK_MODAL, }); const forceUnlockModalActions = useForemanModal({ id: FORCE_UNLOCK_MODAL, }); const editActionsTitle = canEdit ? undefined : __('You do not have permission'); const dynflowTitle = dynflowEnableConsole ? undefined : `dynflow_enable_console ${__('Setting is off')}`; return ( {parentTask && ( )} {hasSubTasks && ( )} ); }; TaskButtons.propTypes = { canEdit: PropTypes.bool, dynflowEnableConsole: PropTypes.bool, taskReloadStart: PropTypes.func.isRequired, taskProgressToggle: PropTypes.func.isRequired, taskReload: PropTypes.bool, externalId: PropTypes.string, id: PropTypes.string.isRequired, action: PropTypes.string, state: PropTypes.string, resumable: PropTypes.bool, cancellable: PropTypes.bool, hasSubTasks: PropTypes.bool, parentTask: PropTypes.string, cancelTaskRequest: PropTypes.func, resumeTaskRequest: PropTypes.func, }; TaskButtons.defaultProps = { canEdit: false, dynflowEnableConsole: false, taskReload: false, externalId: '', action: '', state: '', resumable: false, cancellable: false, hasSubTasks: false, parentTask: '', cancelTaskRequest: () => null, resumeTaskRequest: () => null, };