diff --git a/libs/ui-lib/lib/common/components/hosts/MassChangeHostnameModal.tsx b/libs/ui-lib/lib/common/components/hosts/MassChangeHostnameModal.tsx index 27ef47cbe7..0e316d2baa 100644 --- a/libs/ui-lib/lib/common/components/hosts/MassChangeHostnameModal.tsx +++ b/libs/ui-lib/lib/common/components/hosts/MassChangeHostnameModal.tsx @@ -3,6 +3,7 @@ import { Button, ButtonType, ButtonVariant, + Content, Form, HelperText, HelperTextItem, @@ -56,6 +57,7 @@ const getNewHostnames = ( const [changeEnabled, reason] = canChangeHostname(h); const hostnameRes = { newHostname: changeEnabled ? templateToHostname(index, values) : undefined, + oldHostname: getHostname(h), reason: changeEnabled ? undefined : reason, }; if (changeEnabled) { @@ -176,6 +178,7 @@ const MassChangeHostnameForm = ({ const newHostnames = getNewHostnames(values, selectedHosts, canChangeHostname); const { t } = useTranslation(); + return (
@@ -206,44 +209,47 @@ const MassChangeHostnameForm = ({ {t('ai:Preview')} -
- {selectedHosts.map((h, index) => { - const { newHostname, reason } = newHostnames[index]; - return ( - - -
- {getHostname(h)} -
-
- -
- {'>'} -
-
- - {reason ? ( - {t('ai:Hostname cannot be changed')}
} - bodyContent={
{reason}
} + + + {newHostnames.map((host, i) => ( +
+ {host.oldHostname} +
+ ))} +
+ + {newHostnames.map((_, i) => ( +
+ {'>'} +
+ ))} +
+ + {newHostnames.map((host, i) => ( +
+ {host.reason ? ( + {t('ai:Hostname cannot be changed')}
} + bodyContent={
{host.reason}
} + > + - - ) : ( - newHostname || t('ai:New hostname will appear here...') - )} -
-
- ); - })} - + {t('ai:Not changeable')} + + + ) : ( + + {host.newHostname || t('ai:New hostname will appear here...')} + + )} + + ))} + +