Skip to content

Commit

Permalink
MGMT-15251: Link to infra env page instead of networking in case of n…
Browse files Browse the repository at this point in the history
…tp failure
  • Loading branch information
rawagner committed Aug 12, 2023
1 parent b270560 commit 5a2398f
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions libs/locales/lib/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@
"ai:IP allocation from the DHCP server timed out.": "IP allocation from the DHCP server timed out.",
"ai:iPXE script file is ready to be downloaded": "iPXE script file is ready to be downloaded",
"ai:iPXE script file URL": "iPXE script file URL",
"ai:It can be fixed in the <2>{pageURL.name}</2> page.": "It can be fixed in the <2>{pageURL.name}</2> page.",
"ai:It can be fixed in the <2></2> step.": "It can be fixed in the <2></2> step.",
"ai:It is not possible to remove a host which is being installed.": "It is not possible to remove a host that is being installed.",
"ai:It is not possible to remove a node from a cluster during installation.": "It is not possible to remove a node from a cluster during installation.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Host } from '../../../common';
import {
getAllClusterWizardSoftValidationIds,
getWizardStepClusterStatus,
Expand Down Expand Up @@ -68,6 +69,15 @@ const networkingStepValidationsMap: WizardStepValidationMap = {
// TODO(mlibra): remove that container-images-available from soft validations and let backend drive it via disabling it.
// Depends on: https://issues.redhat.com/browse/MGMT-5265
softValidationIds: ['ntp-synced', 'container-images-available'],
getPageURL: (host: Host, validationID: string) => {
if (validationID === 'ntp-synced') {
return {
url: `multicloud/infrastructure/environments/details/${host.infraEnvId}`,

Check failure on line 75 in libs/ui-lib/lib/cim/components/ClusterDeployment/wizardTransition.ts

View workflow job for this annotation

GitHub Actions / lint

Invalid type "string | undefined" of template literal expression
name: 'infrastructure environment',
};
}
return undefined;
},
};

const reviewStepValidationsMap: WizardStepValidationMap = {
Expand Down
1 change: 1 addition & 0 deletions libs/ui-lib/lib/cim/components/helpers/toAssisted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const getAIHosts = (
progressStages: agentProgress?.progressStages,
bootstrap: agent.status?.bootstrap,
installationDiskId: agent.spec.installation_disk_id || agent.status?.installation_disk_id,
infraEnvId: `${agent.metadata?.namespace}/${agent.metadata?.labels?.['infraenvs.agent-install.openshift.io']}`,

Check failure on line 66 in libs/ui-lib/lib/cim/components/helpers/toAssisted.ts

View workflow job for this annotation

GitHub Actions / lint

Invalid type "string | undefined" of template literal expression

Check failure on line 66 in libs/ui-lib/lib/cim/components/helpers/toAssisted.ts

View workflow job for this annotation

GitHub Actions / lint

Invalid type "string | undefined" of template literal expression
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const FailingValidation = <S extends string>({
setCurrentStepId,
wizardStepNames,
wizardStepsValidationsMap,
host,
}: FailingValidationsProps<S>) => {
const { t } = useTranslation();

Expand All @@ -85,7 +86,16 @@ const FailingValidation = <S extends string>({
// no sooner step, so the user can not do anything about it ...
fix = t('ai:Please wait till all checks are finished.');
} else if (step) {
fix = (
const pageURL = host
? wizardStepsValidationsMap[step].getPageURL?.(host, validation.id)
: undefined;
fix = pageURL ? (
<>
<Trans t={t}>
ai:It can be fixed in the <a href={pageURL.url}>{pageURL.name}</a> page.
</Trans>
</>
) : (
<>
<Trans t={t}>
ai:It can be fixed in the{' '}
Expand Down Expand Up @@ -193,6 +203,7 @@ export const HostsValidations = <S extends string, V extends string[]>({
<FailingValidation<S>
key={validationId}
validation={validation}
host={host}
hostGroup={group}
severity={severity}
setCurrentStepId={setCurrentStepId}
Expand Down
1 change: 1 addition & 0 deletions libs/ui-lib/lib/common/components/clusterWizard/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export type FailingValidationsProps<S extends string> = {
severity?: 'danger' | 'warning';
wizardStepNames: { [key in S]: string };
wizardStepsValidationsMap: WizardStepsValidationMap<S>;
host?: Host;
};

export type ValidationActionLinkProps<S extends string> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ export type WizardStepValidationMap = {
validationIds: HostValidationId[];
};
softValidationIds: (HostValidationId | ClusterValidationId)[];
getPageURL?: (
host: Host,
validationId: string,
) =>
| {
url: string;
name: string;
}
| undefined;
};

export type WizardStepsValidationMap<T extends string> = {
Expand Down

0 comments on commit 5a2398f

Please sign in to comment.