Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MGMT-15251: Link to infra env page instead of networking in case of n… #2289

Merged
merged 5 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libs/locales/lib/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,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 <1>{pageURL.name}</1> page.": "It can be fixed in the <1>{pageURL.name}</1> 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 '@openshift-assisted/types/assisted-installer-service';
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 || ''}`,
name: 'infrastructure environment',
};
}
return undefined;
},
};

const reviewStepValidationsMap: WizardStepValidationMap = {
Expand Down
3 changes: 3 additions & 0 deletions libs/ui-lib/lib/cim/components/helpers/toAssisted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ 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'] || ''
}`,
};
});

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

Expand All @@ -88,7 +89,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 @@ -196,6 +206,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 @@ -56,6 +56,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 @@ -34,6 +34,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