Sha256: 55f797fb19d74a1fc325dd0f29d3997115a27473901116254c689caca3cfeb99
Contents?: true
Size: 1.46 KB
Versions: 6
Compression:
Stored size: 1.46 KB
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { FieldLevelHelp } from 'patternfly-react'; import { translate as __ } from 'foremanReact/common/I18n'; import TextButtonField from './TextButtonField'; import ButtonTooltip from './ButtonTooltip'; const SyncSettingField = ({ setting, resetField, disabled, syncType }) => { const label = settingObj => `${__(settingObj.fullName)} `; const fieldSelector = settingObj => { if (settingObj.settingsType === 'boolean') { return 'checkbox'; } if (settingObj.selection.length !== 0) { return 'select'; } return 'text'; }; const tooltipContent = ( <div dangerouslySetInnerHTML={{ __html: __(setting.description), }} /> ); return ( <TextButtonField name={`${syncType}.${setting.name}`} label={label(setting)} blank={{}} item={setting} buttonText={<ButtonTooltip tooltipId={setting.name} />} buttonAction={resetField(`${syncType}.${setting.name}`, setting.value)} fieldSelector={fieldSelector} disabled={disabled} fieldRequired={setting.required} tooltipHelp={<FieldLevelHelp content={tooltipContent} />} > {setting.value} </TextButtonField> ); }; SyncSettingField.propTypes = { setting: PropTypes.object.isRequired, resetField: PropTypes.func.isRequired, disabled: PropTypes.bool.isRequired, syncType: PropTypes.string.isRequired, }; export default SyncSettingField;
Version data entries
6 entries across 6 versions & 1 rubygems