Skip to content

Commit cd52ed6

Browse files
authored
Merge branch 'main' into mta-1844
2 parents fe1fb55 + da92005 commit cd52ed6

File tree

5 files changed

+127
-71
lines changed

5 files changed

+127
-71
lines changed

client/public/locales/en/translation.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,11 @@
165165
"archetypeNoApplications": "No applications currently match the criteria tags.",
166166
"archetypeAlreadyAssessed": "An assessment for one or more of the archetypes this application is associated with exists.",
167167
"archetypeAlreadyReviewed": "A review for one or more of the archetypes this application is associated with exists. Open the details drawer to view the review(s).",
168+
"autoSelectTagsLabel": "Automatically select tags based on the answers to the questionnaire. ",
168169
"appNotAssesedTitle": "Assessment has not been completed",
169170
"appNotAssessedBody": "In order to review an application it must be assessed first. Assess the application and try again.",
171+
"autoSelectTooltip": "Automatically select this answer based on tags associated with the application(s) or archetype.",
172+
"autoTagTooltip": "Automatically tag this application or archetype with these tags based on this answer to the questionnaire.",
170173
"assessmentStakeholderHeader": "Select the stakeholder(s) or stakeholder group(s) associated with this assessment.",
171174
"binaryPackaging": "Packaging will default to JAR if left empty.",
172175
"blockedDeleteTracker": "Cannot delete {{what}} because it is associated with a tracker.",
@@ -188,6 +191,7 @@
188191
"inheritedReviewTooltip_plural": "This application is inheriting reviews from {{count}} archetypes.",
189192
"inheritedAssessmentTooltip": "This application is inheriting an assessment from an archetype.",
190193
"inheritedAssessmentTooltip_plural": "This application is inheriting assessments from {{count}} archetypes.",
194+
"dependentQuestionTooltip": "This question is conditionally included or excluded based on tags:",
191195
"jiraInstanceNotConnected": "Jira instance {{name}} is not connected.",
192196
"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.",
193197
"noDataAvailableBody": "No data available to be shown here.",
@@ -302,6 +306,7 @@
302306
"date": "Date",
303307
"decision": "Decision",
304308
"dependencies": "Dependencies",
309+
"dependentQuestion": "Dependent question",
305310
"description": "Description",
306311
"details": "Details",
307312
"displayName": "Display name",
@@ -310,6 +315,7 @@
310315
"email": "Email",
311316
"error": "Error",
312317
"errorReport": "Error report",
318+
"exclude": "Exclude",
313319
"exportToIssue": "Export to Issue Manager",
314320
"facts": "Facts",
315321
"failed": "Failed",
@@ -327,6 +333,7 @@
327333
"impactfulButNotAdvisableToMove": "Impactful but not advisable to move",
328334
"image": "Image",
329335
"imports": "Imports",
336+
"include": "Include",
330337
"importSummary": "Import summary",
331338
"importSummaryDeleted": "Import summary deleted",
332339
"inadvisable": "Inadvisable",
@@ -514,7 +521,7 @@
514521
"packages": "Packages",
515522
"review": "Review",
516523
"rules": "Rules",
517-
"rulesTags": "rules tags",
524+
"rulesTags": "rules labels",
518525
"scope": "Scope",
519526
"setTargets": "Set targets",
520527
"source": "Source",

client/public/templates/questionnaire-template.yaml

+14-8
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,37 @@ sections:
88
- order: 1
99
text: What is the main technology in your application?
1010
explanation: Identify the main framework or technology used in your application.
11+
includeFor:
12+
- category: Language
13+
tag: Java
1114
answers:
1215
- order: 1
1316
text: Quarkus
1417
risk: green
1518
rationale: Quarkus is a modern, container-friendly framework.
1619
mitigation: No mitigation needed.
1720
applyTags:
18-
- category: Technology
21+
- category: Runtime
22+
tag: Quarkus
23+
autoAnswerFor:
24+
- category: Runtime
1925
tag: Quarkus
2026
- order: 2
2127
text: Spring Boot
2228
risk: green
2329
rationale: Spring Boot is versatile and widely used.
2430
mitigation: Ensure container compatibility.
2531
applyTags:
26-
- category: Technology
32+
- category: Runtime
33+
tag: Spring Boot
34+
autoAnswerFor:
35+
- category: Runtime
2736
tag: Spring Boot
2837
- order: 3
2938
text: Legacy Monolithic Application
3039
risk: red
3140
rationale: Legacy monoliths are challenging for cloud adaptation.
3241
mitigation: Consider refactoring into microservices.
33-
applyTags:
34-
- category: Architecture
35-
tag: Monolith
3642
- order: 2
3743
text: Does your application use a microservices architecture?
3844
explanation: Assess if the application is built using a microservices architecture.
@@ -42,9 +48,6 @@ sections:
4248
risk: green
4349
rationale: Microservices are well-suited for cloud environments.
4450
mitigation: Continue monitoring service dependencies.
45-
applyTags:
46-
- category: Architecture
47-
tag: Microservices
4851
- order: 2
4952
text: No
5053
risk: yellow
@@ -59,6 +62,9 @@ sections:
5962
- order: 3
6063
text: Is your application's data storage cloud-optimized?
6164
explanation: Evaluate if the data storage solution is optimized for cloud usage.
65+
includeFor:
66+
- category: Language
67+
tag: Java
6268
answers:
6369
- order: 1
6470
text: Cloud-Native Storage Solution

client/src/app/components/answer-table/answer-table.tsx

+68-56
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ import {
1010
} from "@app/components/TableControls";
1111
import { NoDataEmptyState } from "@app/components/NoDataEmptyState";
1212
import { Answer } from "@app/api/models";
13-
import { Label, Text } from "@patternfly/react-core";
13+
import { Label, Text, Tooltip } from "@patternfly/react-core";
1414
import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing";
1515
import { IconedStatus } from "@app/components/IconedStatus";
1616
import { TimesCircleIcon } from "@patternfly/react-icons";
1717
import { WarningTriangleIcon } from "@patternfly/react-icons";
1818
import { List, ListItem } from "@patternfly/react-core";
1919
import RiskIcon from "../risk-icon/risk-icon";
20+
import { InfoCircleIcon } from "@patternfly/react-icons";
2021

2122
export interface IAnswerTableProps {
2223
answers: Answer[];
@@ -101,63 +102,74 @@ const AnswerTable: React.FC<IAnswerTableProps> = ({
101102
}
102103
>
103104
<Tbody>
104-
{currentPageItems?.map((answer, rowIndex) => {
105-
return (
106-
<React.Fragment key={rowIndex}>
107-
<Tr key={answer.text} {...getTrProps({ item: answer })}>
108-
<TableRowContentWithControls
109-
{...tableControls}
110-
item={answer}
111-
rowIndex={rowIndex}
112-
>
113-
<Td width={40} {...getTdProps({ columnKey: "choice" })}>
114-
{answer.text}
115-
</Td>
116-
<Td width={20} {...getTdProps({ columnKey: "choice" })}>
117-
<RiskIcon risk={answer.risk} />
118-
</Td>
119-
</TableRowContentWithControls>
120-
</Tr>
121-
<Tr>
122-
{!!answer?.autoAnswerFor?.length && (
123-
<>
124-
<div style={{ display: "flex" }}>
125-
<Text
126-
className={spacing.mrSm}
127-
style={{ flex: "0 0 5em" }}
128-
>
129-
Auto answer if the following tags are present:
130-
</Text>
131-
{answer?.autoAnswerFor?.map((tag, index) => {
132-
return (
133-
<div key={index} style={{ flex: "0 0 6em" }}>
134-
<Label color="grey">{tag.tag}</Label>
105+
{currentPageItems?.map((answer, rowIndex) => (
106+
<React.Fragment key={rowIndex}>
107+
<Tr {...getTrProps({ item: answer })}>
108+
<TableRowContentWithControls
109+
{...tableControls}
110+
item={answer}
111+
rowIndex={rowIndex}
112+
>
113+
<Td width={40} {...getTdProps({ columnKey: "choice" })}>
114+
<div style={{ display: "flex", alignItems: "center" }}>
115+
<span>{answer.text}</span>
116+
{(!!answer?.autoAnswerFor?.length ||
117+
!!answer?.applyTags?.length) && (
118+
<Tooltip
119+
content={
120+
<div
121+
className="pf-v5-c-tooltip__content pf-m-text-align-left"
122+
id="conditional-tooltip-content"
123+
>
124+
{!!answer?.autoAnswerFor?.length && (
125+
<>
126+
<Text>
127+
{t("message.autoSelectTooltip")}
128+
</Text>
129+
<List isPlain>
130+
{answer.autoAnswerFor.map(
131+
(tag, index) => (
132+
<ListItem key={index}>
133+
<Label color="blue">
134+
{tag.tag}
135+
</Label>
136+
</ListItem>
137+
)
138+
)}
139+
</List>
140+
</>
141+
)}
142+
{!!answer?.applyTags?.length && (
143+
<>
144+
<Text>{t("message.autoTagTooltip")}</Text>
145+
<List isPlain>
146+
{answer.applyTags.map((tag, index) => (
147+
<ListItem key={index}>
148+
<Label color="blue">{tag.tag}</Label>
149+
</ListItem>
150+
))}
151+
</List>
152+
</>
153+
)}
135154
</div>
136-
);
137-
})}
138-
</div>
139-
</>
140-
)}
141-
</Tr>
142-
<Tr>
143-
{!!answer?.applyTags?.length && (
144-
<div style={{ display: "flex" }}>
145-
<Text className={spacing.mrSm}>
146-
Apply Tags for this answer choice:
147-
</Text>
148-
{answer?.applyTags?.map((tag, index) => {
149-
return (
150-
<div key={index} style={{ flex: "0 0 6em" }}>
151-
<Label color="grey">{tag.tag}</Label>
152-
</div>
153-
);
154-
})}
155+
}
156+
>
157+
<span className={spacing.mlXs}>
158+
<InfoCircleIcon />
159+
</span>
160+
</Tooltip>
161+
)}
155162
</div>
156-
)}
157-
</Tr>
158-
</React.Fragment>
159-
);
160-
})}
163+
</Td>
164+
165+
<Td width={20} {...getTdProps({ columnKey: "weight" })}>
166+
<RiskIcon risk={answer.risk} />
167+
</Td>
168+
</TableRowContentWithControls>
169+
</Tr>
170+
{/* ... other rows ... */}
171+
</React.Fragment>
172+
))}
161173
</Tbody>
162174
</ConditionalTableBody>
163175
</Table>

client/src/app/components/questionnaire-summary/questionnaire-summary.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ const QuestionnaireSummary: React.FC<QuestionnaireSummaryProps> = ({
8282
filteredSummaryData?.sections?.flatMap((section) => section.questions) ||
8383
[];
8484

85-
if (!summaryData) {
86-
return <div>No data available.</div>;
87-
}
88-
8985
const dynamicPath = isArchetype
9086
? formatPath(Paths.archetypeAssessmentActions, {
9187
archetypeId: (summaryData as Assessment)?.archetype?.id,

client/src/app/components/questions-table/questions-table.tsx

+37-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { useTranslation } from "react-i18next";
1717
import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing";
1818
import { Assessment, Question, Questionnaire } from "@app/api/models";
1919
import { useLocalTableControls } from "@app/hooks/table-controls";
20-
import { Label } from "@patternfly/react-core";
20+
import { Label, Tooltip } from "@patternfly/react-core";
2121
import { NoDataEmptyState } from "@app/components/NoDataEmptyState";
2222
import AnswerTable from "@app/components/answer-table/answer-table";
2323
import { AxiosError } from "axios";
@@ -99,6 +99,35 @@ const QuestionsTable: React.FC<{
9999
data?.sections.find((section) =>
100100
section.questions.includes(question)
101101
)?.name || "";
102+
103+
const getConditionalTooltipContent = (question: Question) => {
104+
const includeTags = question?.includeFor
105+
?.map((tag) => tag.tag)
106+
.join(", ");
107+
const excludeTags = question?.excludeFor
108+
?.map((tag) => tag.tag)
109+
.join(", ");
110+
111+
return (
112+
<div
113+
className="pf-v5-c-tooltip__content pf-m-text-align-left"
114+
id="conditional-tooltip-content"
115+
>
116+
<div>{t("message.dependentQuestionTooltip")}</div>
117+
{includeTags && (
118+
<div>
119+
{t("terms.include")}: {includeTags}
120+
</div>
121+
)}
122+
{excludeTags && (
123+
<div>
124+
{t("terms.exclude")}: {excludeTags}
125+
</div>
126+
)}
127+
</div>
128+
);
129+
};
130+
102131
return (
103132
<React.Fragment key={rowIndex}>
104133
<Tr key={question.text} {...getTrProps({ item: question })}>
@@ -113,7 +142,13 @@ const QuestionsTable: React.FC<{
113142
>
114143
{(!!question?.includeFor?.length ||
115144
!!question?.excludeFor?.length) && (
116-
<Label className={spacing.mrSm}>Conditional</Label>
145+
<Tooltip
146+
content={getConditionalTooltipContent(question)}
147+
>
148+
<Label className={spacing.mrSm}>
149+
{t("terms.dependentQuestion")}
150+
</Label>
151+
</Tooltip>
117152
)}
118153
{question.text}
119154
</Td>

0 commit comments

Comments
 (0)