Skip to content

Commit

Permalink
🐛 Add conditional tooltip and update template
Browse files Browse the repository at this point in the history
Signed-off-by: ibolton336 <ibolton@redhat.com>
  • Loading branch information
ibolton336 committed Dec 18, 2023
1 parent fa663da commit 4964b78
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 10 deletions.
4 changes: 4 additions & 0 deletions client/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
"inheritedReviewTooltip_plural": "This application is inheriting reviews from {{count}} archetypes.",
"inheritedAssessmentTooltip": "This application is inheriting an assessment from an archetype.",
"inheritedAssessmentTooltip_plural": "This application is inheriting assessments from {{count}} archetypes.",
"dependentQuestionTooltip": "This question is conditionally included or excluded based on tags:",
"jiraInstanceNotConnected": "Jira instance {{name}} is not connected.",
"manageDependenciesInstructions": "Add northbound and southbound dependencies for the selected application here. Note that any selections made will be saved automatically. To undo any changes, you must manually delete the applications from the dropdowns.",
"noDataAvailableBody": "No data available to be shown here.",
Expand Down Expand Up @@ -302,6 +303,7 @@
"date": "Date",
"decision": "Decision",
"dependencies": "Dependencies",
"dependentQuestion": "Dependent question",
"description": "Description",
"details": "Details",
"displayName": "Display name",
Expand All @@ -310,6 +312,7 @@
"email": "Email",
"error": "Error",
"errorReport": "Error report",
"exclude": "Exclude",
"exportToIssue": "Export to Issue Manager",
"facts": "Facts",
"failed": "Failed",
Expand All @@ -327,6 +330,7 @@
"impactfulButNotAdvisableToMove": "Impactful but not advisable to move",
"image": "Image",
"imports": "Imports",
"include": "Include",
"importSummary": "Import summary",
"importSummaryDeleted": "Import summary deleted",
"inadvisable": "Inadvisable",
Expand Down
22 changes: 14 additions & 8 deletions client/public/templates/questionnaire-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,37 @@ sections:
- order: 1
text: What is the main technology in your application?
explanation: Identify the main framework or technology used in your application.
includeFor:
- category: Language
tag: Java
answers:
- order: 1
text: Quarkus
risk: green
rationale: Quarkus is a modern, container-friendly framework.
mitigation: No mitigation needed.
applyTags:
- category: Technology
- category: Runtime
tag: Quarkus
autoAnswerFor:
- category: Runtime
tag: Quarkus
- order: 2
text: Spring Boot
risk: green
rationale: Spring Boot is versatile and widely used.
mitigation: Ensure container compatibility.
applyTags:
- category: Technology
- category: Runtime
tag: Spring Boot
autoAnswerFor:
- category: Runtime
tag: Spring Boot
- order: 3
text: Legacy Monolithic Application
risk: red
rationale: Legacy monoliths are challenging for cloud adaptation.
mitigation: Consider refactoring into microservices.
applyTags:
- category: Architecture
tag: Monolith
- order: 2
text: Does your application use a microservices architecture?
explanation: Assess if the application is built using a microservices architecture.
Expand All @@ -42,9 +48,6 @@ sections:
risk: green
rationale: Microservices are well-suited for cloud environments.
mitigation: Continue monitoring service dependencies.
applyTags:
- category: Architecture
tag: Microservices
- order: 2
text: No
risk: yellow
Expand All @@ -59,6 +62,9 @@ sections:
- order: 3
text: Is your application's data storage cloud-optimized?
explanation: Evaluate if the data storage solution is optimized for cloud usage.
includeFor:
- category: Language
tag: Java
answers:
- order: 1
text: Cloud-Native Storage Solution
Expand Down
39 changes: 37 additions & 2 deletions client/src/app/components/questions-table/questions-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { useTranslation } from "react-i18next";
import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing";
import { Assessment, Question, Questionnaire } from "@app/api/models";
import { useLocalTableControls } from "@app/hooks/table-controls";
import { Label } from "@patternfly/react-core";
import { Label, Tooltip } from "@patternfly/react-core";
import { NoDataEmptyState } from "@app/components/NoDataEmptyState";
import AnswerTable from "@app/components/answer-table/answer-table";
import { AxiosError } from "axios";
Expand Down Expand Up @@ -99,6 +99,35 @@ const QuestionsTable: React.FC<{
data?.sections.find((section) =>
section.questions.includes(question)
)?.name || "";

const getConditionalTooltipContent = (question: Question) => {
const includeTags = question?.includeFor
?.map((tag) => tag.tag)
.join(", ");
const excludeTags = question?.excludeFor
?.map((tag) => tag.tag)
.join(", ");

return (
<div
className="pf-v5-c-tooltip__content pf-m-text-align-left"
id="conditional-tooltip-content"
>
<div>{t("message.dependentQuestionTooltip")}</div>
{includeTags && (
<div>
{t("terms.include")}: {includeTags}
</div>
)}
{excludeTags && (
<div>
{t("terms.exclude")}: {excludeTags}
</div>
)}
</div>
);
};

return (
<React.Fragment key={rowIndex}>
<Tr key={question.text} {...getTrProps({ item: question })}>
Expand All @@ -113,7 +142,13 @@ const QuestionsTable: React.FC<{
>
{(!!question?.includeFor?.length ||
!!question?.excludeFor?.length) && (
<Label className={spacing.mrSm}>Conditional</Label>
<Tooltip
content={getConditionalTooltipContent(question)}
>
<Label className={spacing.mrSm}>
{t("terms.dependentQuestion")}
</Label>
</Tooltip>
)}
{question.text}
</Td>
Expand Down

0 comments on commit 4964b78

Please sign in to comment.