Skip to content

Commit

Permalink
Remove all unused passed arguments to functions or components
Browse files Browse the repository at this point in the history
  • Loading branch information
jelly authored and martinpitt committed Aug 26, 2024
1 parent 5760f3f commit 94b5ada
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 22 deletions.
3 changes: 1 addition & 2 deletions src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ class AppActive extends React.Component {
<StoragePoolList storagePools={storagePools}
vms={vms}
loggedUser={systemInfo.loggedUser}
libvirtVersion={systemInfo.libvirtVersion}
onAddErrorNotification={this.onAddErrorNotification} />
libvirtVersion={systemInfo.libvirtVersion} />
}
{path.length > 0 && path[0] == 'networks' &&
<NetworkList networks={networks}
Expand Down
5 changes: 2 additions & 3 deletions src/components/networks/networkOverviewTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,13 @@ const NetworkAddStaticHostEntriesAction = ({ idPrefix, network, parentIndex }) =
onClick={() => setIsOpen(true)}>
{_("add entry")}
</Button>
{isOpen && <NetworkAddStaticHostEntries idPrefix={idPrefix}
network={network} parentIndex={parentIndex}
{isOpen && <NetworkAddStaticHostEntries network={network} parentIndex={parentIndex}
setIsOpen={setIsOpen} />}
</>
);
};

const NetworkAddStaticHostEntries = ({ idPrefix, network, parentIndex, setIsOpen }) => {
const NetworkAddStaticHostEntries = ({ network, parentIndex, setIsOpen }) => {
const [isSubmitted, setIsSubmitted] = useState(false);
const [ipAddress, setIpAddress] = useState('');
const [macAddress, setMacAddress] = useState('');
Expand Down
2 changes: 1 addition & 1 deletion src/components/storagePools/storagePool.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import cockpit from 'cockpit';

const _ = cockpit.gettext;

export const getStoragePoolRow = ({ storagePool, vms, onAddErrorNotification }) => {
export const getStoragePoolRow = ({ storagePool, vms }) => {
const idPrefix = `${storagePoolId(storagePool.name, storagePool.connectionName)}`;
const name = (
<span id={`${idPrefix}-name`}>
Expand Down
5 changes: 2 additions & 3 deletions src/components/storagePools/storagePoolList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class StoragePoolList extends React.Component {
}

render() {
const { storagePools, loggedUser, vms, onAddErrorNotification, libvirtVersion } = this.props;
const { storagePools, loggedUser, vms, libvirtVersion } = this.props;
const sortFunction = (storagePoolA, storagePoolB) => storagePoolA.name.localeCompare(storagePoolB.name);
const actions = (<CreateStoragePoolAction loggedUser={loggedUser} libvirtVersion={libvirtVersion} />);

Expand Down Expand Up @@ -77,7 +77,7 @@ export class StoragePoolList extends React.Component {
.map(storagePool => {
const filterVmsByConnection = vms.filter(vm => vm.connectionName == storagePool.connectionName);

return getStoragePoolRow({ storagePool, vms: filterVmsByConnection, onAddErrorNotification });
return getStoragePoolRow({ storagePool, vms: filterVmsByConnection });
})
}
/>
Expand All @@ -92,6 +92,5 @@ export class StoragePoolList extends React.Component {
StoragePoolList.propTypes = {
storagePools: PropTypes.array.isRequired,
vms: PropTypes.array.isRequired,
onAddErrorNotification: PropTypes.func.isRequired,
libvirtVersion: PropTypes.number,
};
4 changes: 1 addition & 3 deletions src/components/vm/disks/vmDisksCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class VmDisksCardLibvirt extends React.Component {
return areDiskStatsSupported;
}

prepareDiskData(disk, diskStats, idPrefix, storagePools) {
prepareDiskData(disk, diskStats, storagePools) {
diskStats = diskStats || {};

let used = diskStats.allocation;
Expand Down Expand Up @@ -139,14 +139,12 @@ export class VmDisksCardLibvirt extends React.Component {
render() {
const { vm, vms, storagePools, supportedDiskBusTypes, onAddErrorNotification } = this.props;

const idPrefix = `${vmId(vm.name)}-disks`;
const areDiskStatsSupported = this.getDiskStatsSupport(vm);

const disks = Object.getOwnPropertyNames(vm.disks)
.sort() // by 'target'
.map(target => this.prepareDiskData(vm.disks[target],
vm.disksStats && vm.disksStats[target],
`${idPrefix}-${target}`,
storagePools));
return (
<VmDisksCard
Expand Down
5 changes: 2 additions & 3 deletions src/components/vm/filesystems/vmFilesystemsCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ export const VmFilesystemActions = ({ connectionName, objPath, vmName, vmState }
function open() {
Dialogs.show(<VmFilesystemAddModal connectionName={connectionName}
vmName={vmName}
objPath={objPath}
vmState={vmState} />);
objPath={objPath} />);
}

const addButton = (
Expand All @@ -116,7 +115,7 @@ export const VmFilesystemActions = ({ connectionName, objPath, vmName, vmState }
return vmState == 'shut off' ? addButton : <Tooltip content={_("Adding shared directories is possible only when the guest is shut off")}>{addButton}</Tooltip>;
};

const VmFilesystemAddModal = ({ connectionName, objPath, vmName, vmState }) => {
const VmFilesystemAddModal = ({ connectionName, objPath, vmName }) => {
const Dialogs = useDialogs();
const [additionalOptionsExpanded, setAdditionalOptionsExpanded] = useState(false);
const [dialogError, setDialogError] = useState();
Expand Down
4 changes: 2 additions & 2 deletions src/components/vm/hostdevs/hostDevAdd.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import "./hostDevAdd.scss";

const _ = cockpit.gettext;

const TypeRow = ({ idPrefix, type, setType }) => {
const TypeRow = ({ type, setType }) => {
return (
<FormGroup fieldId="usb_device"
label={_("Type")}
Expand Down Expand Up @@ -217,7 +217,7 @@ const AddHostDev = ({ idPrefix, vm }) => {

const body = (
<Form isHorizontal>
<TypeRow idPrefix={idPrefix} type={type} setType={setTypeWrapper} />
<TypeRow type={type} setType={setTypeWrapper} />
<DevRow idPrefix={idPrefix} type={type} selectableDevices={selectableDevices} setSelectableDevices={setSelectableDevices} />
</Form>
);
Expand Down
5 changes: 2 additions & 3 deletions src/components/vm/nics/nicAdd.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const NetworkMacRow = ({ idPrefix, dialogValues, onValueChanged }) => {
);
};

const PermanentChange = ({ idPrefix, onValueChanged, dialogValues, vm }) => {
const PermanentChange = ({ idPrefix, onValueChanged, dialogValues }) => {
// By default for a running VM, the iface is attached until shut down only. Enable permanent change of the domain.xml
return (
<FormGroup label={_("Persistence")} fieldId={`${idPrefix}-permanent`} hasNoPaddingTop>
Expand Down Expand Up @@ -198,8 +198,7 @@ export class AddNIC extends React.Component {
{domainIsRunning(vm.state) && vm.persistent &&
<PermanentChange idPrefix={idPrefix}
dialogValues={this.state}
onValueChanged={this.onValueChanged}
vm={vm} />}
onValueChanged={this.onValueChanged} />}
</Form>
);

Expand Down
2 changes: 1 addition & 1 deletion src/components/vm/snapshots/vmSnapshotsCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const VmSnapshotsActions = ({ vm, config, storagePools }) => {
const Dialogs = useDialogs();
const id = vmId(vm.name);

const isExternal = vmSupportsExternalSnapshots(config, vm, storagePools);
const isExternal = vmSupportsExternalSnapshots(config, vm);

function open() {
Dialogs.show(<CreateSnapshotModal idPrefix={`${id}-create-snapshot`}
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ export function getStoragePoolPath(storagePools, poolName, connectionName) {
return pool?.target?.path;
}

export function vmSupportsExternalSnapshots(config, vm, storagePools) {
export function vmSupportsExternalSnapshots(config, vm) {
// External snapshot should only be used if the VM's os types/architecture allow it
// and if snapshot features are present among guest capabilities:
// https://libvirt.org/formatcaps.html#guest-capabilities
Expand Down

0 comments on commit 94b5ada

Please sign in to comment.