Sha256: 7dd3493c93e75708212a307fe5fb7b8f4da4f6fc6e174572cd793ce26a3e7d7a

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { get } from 'lodash';

import { FieldLevelHelp } from 'patternfly-react';
import RenderField from './TextButtonField/RenderField';
import ButtonTooltip from './ButtonTooltip';

import {
  tooltipContent,
  label,
} from './NewTemplateSyncForm/NewTemplateSyncFormHelpers';

const ProxySettingField = ({ setting, resetField, field, form, fieldName }) => (
  <RenderField
    label={label(setting)}
    fieldSelector={_ => 'select'}
    tooltipHelp={<FieldLevelHelp content={tooltipContent(setting)} />}
    buttonAttrs={{
      buttonText: <ButtonTooltip tooltipId={fieldName} />,
      buttonAction: () =>
        resetField(fieldName, setting.value)(form.setFieldValue),
    }}
    blank={{}}
    item={setting}
    disabled={false}
    fieldRequired
    meta={{
      touched: get(form.touched, fieldName),
      error: get(form.errors, fieldName),
    }}
    input={field}
  />
);

ProxySettingField.propTypes = {
  setting: PropTypes.object.isRequired,
  resetField: PropTypes.func.isRequired,
  field: PropTypes.object.isRequired,
  form: PropTypes.object.isRequired,
  fieldName: PropTypes.string.isRequired,
};

export default ProxySettingField;

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_templates-10.0.3 webpack/components/NewTemplateSync/components/ProxySettingField.js