webpack/src/extensions/host/HostBootdiskButtons.js in foreman_bootdisk-19.0.9 vs webpack/src/extensions/host/HostBootdiskButtons.js in foreman_bootdisk-21.0.0
- old
+ new
@@ -1,9 +1,15 @@
import React, { useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { DropdownItem, DropdownGroup } from '@patternfly/react-core';
+import {
+ BanIcon,
+ BuildIcon,
+ BuilderImageIcon,
+ OutlinedQuestionCircleIcon,
+} from '@patternfly/react-icons';
import { get } from 'foremanReact/redux/API';
import { foremanUrl } from 'foremanReact/common/helpers';
import { sprintf, translate as __ } from 'foremanReact/common/I18n';
@@ -21,15 +27,28 @@
const dispatch = useDispatch();
const hostId = useSelector(selectHostId);
const isLoading = useSelector(selectIsLoading);
const options = useSelector(selectBootdiskOptions);
+ const iconComponent = icon => {
+ switch (icon) {
+ case 'host':
+ return <BuildIcon />;
+ case 'full_host':
+ return <BuilderImageIcon />;
+ case 'help':
+ return <OutlinedQuestionCircleIcon />;
+ default:
+ return null;
+ }
+ };
+
useEffect(() => {
dispatch(
get({
key: HOST_BOOTDISK_BUTTONS_REQUEST_KEY,
- url: foremanUrl(`/bootdisk/disks/bootdisk_options/${hostId}`),
+ url: foremanUrl(`/disks/bootdisk_options/${hostId}`),
})
);
}, [dispatch, hostId]);
let content = null;
@@ -38,10 +57,11 @@
<DropdownItem
key={`bootdisk-${i}`}
href={foremanUrl(action.link)}
isDisabled={action.disabled}
description={action.description}
+ icon={iconComponent(action.icon)}
>
{action.title}
</DropdownItem>
));
} else {
@@ -53,9 +73,10 @@
tooltip={sprintf(
__('Boot disk download not available for %s architecture'),
options.architectureName
)}
tooltipProps={{ entryDelay: 0, exitDelay: 0 }}
+ icon={<BanIcon />}
>
{__('Not available')}
</DropdownItem>
);
}