Sha256: c76ae8f17f47a5635f565430740a9c79c9585deb637b012fc90408452fa5d0a6

Contents?: true

Size: 1.03 KB

Versions: 65

Compression:

Stored size: 1.03 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';

const AnsibleRoleInputs = props => {
  const { role, idx, resourceName } = props;

  const fieldName = attr =>
    `${resourceName}[${resourceName}_ansible_roles_attributes][${idx}][${attr}]`;

  const attrName = modelName => `${modelName}AnsibleRoleId`;

  const idField = (
    <input
      name={fieldName('id')}
      value={role[attrName(resourceName)]}
      type="hidden"
    />
  );
  return (
    <React.Fragment>
      {role[attrName(resourceName)] ? idField : null}
      <input
        name={fieldName('ansible_role_id')}
        value={role.id}
        type="hidden"
      />
      <input name={fieldName('position')} value={idx + 1} type="hidden" />
      <input
        name={fieldName('_destroy')}
        value={!!role.destroy}
        type="hidden"
      />
    </React.Fragment>
  );
};

AnsibleRoleInputs.propTypes = {
  role: PropTypes.object.isRequired,
  idx: PropTypes.number.isRequired,
  resourceName: PropTypes.string.isRequired,
};

export default AnsibleRoleInputs;

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
foreman_ansible-15.0.2 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-15.0.1 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-15.0.0 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-14.2.2 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-14.2.1 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-13.0.7 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-14.2.0 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-14.1.1 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-14.1.0 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-13.0.5 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-14.0.0 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-13.0.4 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-13.0.3 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-13.0.2 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-13.0.1 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-13.0.0 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-12.0.7 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-10.4.4 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-7.1.8 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js
foreman_ansible-12.0.6 webpack/components/AnsibleRolesSwitcher/components/AnsibleRoleInputs.js