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

✨ Add tooltip for auto-answered assessment questions #1380

Merged
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
2 changes: 2 additions & 0 deletions client/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@
"reasonForError": "The reported reason for the error:",
"reviewInstructions": "Use this section to provide your assessment of the possible migration/modernization plan and effort estimation.",
"savingSelection": "Saving selection",
"selectedBecauseArchetypeTags": "Selected because the archetype's tags include {{tags}}",
"selectedBecauseAppOrArchetypeTags": "Selected because the application or archetype's tags include {{tags}}",
"selectOwnerFromStakeholdersList": "Select owner from list of stakeholders",
"suggestedAdoptionPlanHelpText": "The suggested approach to migration based on effort, priority, and dependencies.",
"taskInProgressForTags": "A new analysis is in-progress. Tags may be updated upon completion.",
Expand Down
1 change: 1 addition & 0 deletions client/src/app/api/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
identity?: Ref;
createTime?: string;
createUser?: string;
id: any;

Check warning on line 207 in client/src/app/api/models.ts

View workflow job for this annotation

GitHub Actions / unit-test (18.x)

Unexpected any. Specify a different type
enabled: boolean;
}

Expand Down Expand Up @@ -361,7 +361,7 @@

export interface TaskgroupTask {
name: string;
data: any;

Check warning on line 364 in client/src/app/api/models.ts

View workflow job for this annotation

GitHub Actions / unit-test (18.x)

Unexpected any. Specify a different type
application: Ref;
}

Expand Down Expand Up @@ -682,6 +682,7 @@
mitigation?: string;
applyTags?: CategorizedTag[];
autoAnswerFor?: CategorizedTag[];
autoAnswered?: boolean;
selected?: boolean;
}
export interface Thresholds {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import React, { useMemo } from "react";
import { Radio, Stack, StackItem } from "@patternfly/react-core";
import { Icon, Radio, Stack, StackItem, Tooltip } from "@patternfly/react-core";
import InfoCircleIcon from "@patternfly/react-icons/dist/esm/icons/info-circle-icon";

import { Question } from "@app/api/models";
import { HookFormPFGroupController } from "@app/components/HookFormPFFields";
import { useFormContext } from "react-hook-form";
import { getQuestionFieldName } from "../../../form-utils";
import { AssessmentWizardValues } from "@app/pages/assessment/components/assessment-wizard/assessment-wizard";
import useIsArchetype from "@app/hooks/useIsArchetype";
import { useTranslation } from "react-i18next";

export interface MultiInputSelectionProps {
question: Question;
Expand All @@ -21,6 +24,10 @@ export const MultiInputSelection: React.FC<MultiInputSelectionProps> = ({
}, [question]);

const questionFieldName = getQuestionFieldName(question, true);

const isArchetype = useIsArchetype();
const { t } = useTranslation();

return (
<Stack>
{sortedOptions.map((option, i) => (
Expand All @@ -37,7 +44,30 @@ export const MultiInputSelection: React.FC<MultiInputSelectionProps> = ({
onChange={(checked, e) => {
onChange(option.text);
}}
label={option.text}
aria-label={option.text}
label={
<>
{option.autoAnswered && option.autoAnswerFor?.length ? (
<Tooltip
content={t(
isArchetype
? "message.selectedBecauseArchetypeTags"
: "message.selectedBecauseAppOrArchetypeTags",
{
tags: option.autoAnswerFor
.map((t) => `"${t.tag}"`)
.join(", "),
}
)}
>
<Icon status="info">
<InfoCircleIcon />
</Icon>
</Tooltip>
) : null}{" "}
{option.text}
</>
}
value={option.text}
/>
)}
Expand Down
Loading