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-9.0.59 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-11.0.2 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-11.0.1 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-11.0.0 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-9.0.58 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-10.0.2 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-9.0.57 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-10.0.1 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-9.0.56 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-9.0.55 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-9.0.54 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-9.0.53 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-9.0.52 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-8.0.52 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-9.0.51 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-8.0.51 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-7.0.48 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-7.0.47 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-8.0.50 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js
foreman_rh_cloud-8.0.49 webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js