Sha256: 656f6767ed34dfd443de004defa5e881e9a9558935b89041c7171233943332d3

Contents?: true

Size: 950 Bytes

Versions: 80

Compression:

Stored size: 950 Bytes

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { useSelector, useDispatch } from 'react-redux';
import { selectSettings } from '../InventorySettingsSelectors';
import { handleToggle } from './AdvancedSettingActions';
import SwitcherPF4 from '../../../../common/Switcher/SwitcherPF4';
import { settingsDict } from './AdvancedSettingsConstants';

const AdvancedSetting = ({ setting }) => {
  const settingValue = useSelector(store => selectSettings(store)[setting]);
  const dispatch = useDispatch();
  const onToggle = () =>
    dispatch(handleToggle(settingsDict[setting].name, settingValue));
  return (
    <SwitcherPF4
      id={settingsDict[setting].name}
      label={settingsDict[setting].label}
      tooltip={settingsDict[setting].tooltip}
      isChecked={settingValue}
      onChange={onToggle}
    />
  );
};

AdvancedSetting.propTypes = {
  setting: PropTypes.string.isRequired,
};

export default AdvancedSetting;

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
foreman_rh_cloud-8.0.48 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-8.0.47 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-8.0.46 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-6.0.45 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-5.0.46 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-5.0.45 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-7.0.46 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-5.0.44 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-7.0.45 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-6.0.44 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-5.0.43 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-4.0.36 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-3.0.33 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-6.0.42.2 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-6.0.42.1 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-6.0.43 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-5.0.42 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-6.0.42 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-5.0.41 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-5.0.39 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js