Skip to content

Commit

Permalink
Merge branch 'extend_react_app' of https://github.com/ATIX-AG/foreman…
Browse files Browse the repository at this point in the history
…_fog_proxmox into extend_react_app
  • Loading branch information
Manisha15 committed Jul 11, 2024
2 parents e895a39 + 18645cb commit 531d642
Show file tree
Hide file tree
Showing 20 changed files with 1,452 additions and 1,190 deletions.
6 changes: 3 additions & 3 deletions webpack/components/ProxmoxComputeSelectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const ProxmoxComputeSelectors = {
proxmoxControllersCloudinitMap: [
{ value: 'ide', label: 'IDE' },
{ value: 'sata', label: 'SATA' },
{ value: 'scsi', label: 'SCSI' }
{ value: 'scsi', label: 'SCSI' },
],

proxmoxScsiControllersMap: [
Expand All @@ -16,7 +16,7 @@ const ProxmoxComputeSelectors = {
{ value: 'virtio-scsi-pci', label: 'VirtIO SCSI' },
{ value: 'virtio-scsi-single', label: 'VirtIO SCSI Single' },
{ value: 'megasas', label: 'MegaRAID SAS 8708EM2' },
{ value: 'pvscsi', label: 'VMware PVSCSI' }
{ value: 'pvscsi', label: 'VMware PVSCSI' },
],

proxmoxArchsMap: [
Expand Down Expand Up @@ -134,7 +134,7 @@ const ProxmoxComputeSelectors = {

ProxmoxComputeSelectors.proxmoxControllersHDDMap = [
...ProxmoxComputeSelectors.proxmoxControllersCloudinitMap,
{ value: 'virtio', label: 'VirtIO Block' }
{ value: 'virtio', label: 'VirtIO Block' },
];

export default ProxmoxComputeSelectors;
86 changes: 41 additions & 45 deletions webpack/components/ProxmoxContainer/MountPoint.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import {
Title,
Divider,
PageSection,
} from '@patternfly/react-core';
import { Title, Divider, PageSection } from '@patternfly/react-core';
import InputField from '../common/FormInputs';
import ProxmoxComputeSelectors from '../ProxmoxComputeSelectors';

Expand All @@ -13,48 +9,48 @@ const MountPoint = ({ id }) => {
const handleHdStorage = (hdStorage, event) => {
setHdStorage(hdStorage);
};
console.log("hdd key", {id});

console.log('hdd key', { id });

return (
<div >
<Divider component="li" style={{ marginBottom: '2rem' }} />
<InputField
label="Storage"
type="select"
options={ProxmoxComputeSelectors.proxmoxOperatingSystemsMap}
value={hdStorage}
onChange={e => setHdStorage(e.target.value)}
/>
<InputField
label="Path"
type="select"
options={ProxmoxComputeSelectors.proxmoxControllersCloudinitMap}
value={hdStorage}
onChange={e => setHdStorage(e.target.value)}
/>
<InputField
label="Size"
type="number"
value={hdStorage}
onChange={e => setHdStorage(e.target.value)}
/>
<Divider component="li" style={{ marginBottom: '2rem' }} />
<InputField
label="Storage Type"
value={hdStorage}
onChange={e => setHdStorage(e.target.value)}
/>
<InputField
label="Device"
value={hdStorage}
onChange={e => setHdStorage(e.target.value)}
/>
<InputField
label="ID"
value={hdStorage}
onChange={e => setHdStorage(e.target.value)}
/>
<div>
<Divider component="li" style={{ marginBottom: '2rem' }} />
<InputField
label="Storage"
type="select"
options={ProxmoxComputeSelectors.proxmoxOperatingSystemsMap}
value={hdStorage}
onChange={e => setHdStorage(e.target.value)}
/>
<InputField
label="Path"
type="select"
options={ProxmoxComputeSelectors.proxmoxControllersCloudinitMap}
value={hdStorage}
onChange={e => setHdStorage(e.target.value)}
/>
<InputField
label="Size"
type="number"
value={hdStorage}
onChange={e => setHdStorage(e.target.value)}
/>
<Divider component="li" style={{ marginBottom: '2rem' }} />
<InputField
label="Storage Type"
value={hdStorage}
onChange={e => setHdStorage(e.target.value)}
/>
<InputField
label="Device"
value={hdStorage}
onChange={e => setHdStorage(e.target.value)}
/>
<InputField
label="ID"
value={hdStorage}
onChange={e => setHdStorage(e.target.value)}
/>
</div>
);
};
Expand Down
110 changes: 54 additions & 56 deletions webpack/components/ProxmoxContainer/ProxmoxContainerHardware.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,76 +13,74 @@ import {
ExpandableSectionToggle,
} from '@patternfly/react-core';

const ProxmoxContainerHardware = ({hardware}) => {

const ProxmoxContainerHardware = ({ hardware }) => {
const [hw, setHw] = useState(hardware);

const handleChange = (e) => {
const handleChange = e => {
const { name, value } = e.target;
const updatedKey = Object.keys(hw).find(key => hw[key].name === name);

setHw(prevHw => ({
...prevHw,
[updatedKey]: { ...prevHw[updatedKey], value: value },
[updatedKey]: { ...prevHw[updatedKey], value },
}));
};

return (
<div>
<PageSection padding={{ default: 'noPadding' }}>
<Title headingLevel="h3">CPU</Title>
<Divider component="li" style={{ marginBottom: '2rem' }} />
<InputField
name={hw.arch.name}
label="Arctitecture"
type="select"
options={ProxmoxComputeSelectors.proxmoxCpuFlagsMap}
value={hw.arch.value}
onChange={handleChange}
/>
<InputField
name={hw.cores.name}
label="Cores"
type="number"
value={hw.cores.value}
onChange={handleChange}
/>
<InputField
name={hw.cpulimit.name}
label="CPU limit"
type="number"
value={hw.cpulimit.value}
onChange={handleChange}
/>
<InputField
name={hw.cpuunits.name}
label="CPU units"
type="number"
value={hw.cpuunits.value}
onChange={handleChange}
/>
</PageSection>
<PageSection padding={{ default: 'noPadding' }}>
<Title headingLevel="h3">Memory</Title>
<Divider component="li" style={{ marginBottom: '2rem' }} />
<InputField
name={hw.memory.name}
label="Memory (MB)"
type="text"
value={hw.memory.value}
onChange={handleChange}
/>
<InputField
name={hw.swap.name}
label="Swap (MB)"
type="text"
value={hw.swap.value}
onChange={handleChange}
/>
</PageSection>
</div>
<Title headingLevel="h3">CPU</Title>
<Divider component="li" style={{ marginBottom: '2rem' }} />
<InputField
name={hw.arch.name}
label="Arctitecture"
type="select"
options={ProxmoxComputeSelectors.proxmoxCpuFlagsMap}
value={hw.arch.value}
onChange={handleChange}
/>
<InputField
name={hw.cores.name}
label="Cores"
type="number"
value={hw.cores.value}
onChange={handleChange}
/>
<InputField
name={hw.cpulimit.name}
label="CPU limit"
type="number"
value={hw.cpulimit.value}
onChange={handleChange}
/>
<InputField
name={hw.cpuunits.name}
label="CPU units"
type="number"
value={hw.cpuunits.value}
onChange={handleChange}
/>
</PageSection>
<PageSection padding={{ default: 'noPadding' }}>
<Title headingLevel="h3">Memory</Title>
<Divider component="li" style={{ marginBottom: '2rem' }} />
<InputField
name={hw.memory.name}
label="Memory (MB)"
type="text"
value={hw.memory.value}
onChange={handleChange}
/>
<InputField
name={hw.swap.name}
label="Swap (MB)"
type="text"
value={hw.swap.value}
onChange={handleChange}
/>
</PageSection>
</div>
);
};

export default ProxmoxContainerHardware;

Loading

0 comments on commit 531d642

Please sign in to comment.