-
Notifications
You must be signed in to change notification settings - Fork 43
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
✨ Dynamic assess button and view assessments page #1325
Conversation
1514222
to
68133cc
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1325 +/- ##
==========================================
- Coverage 42.69% 42.29% -0.41%
==========================================
Files 136 137 +1
Lines 4223 4287 +64
Branches 1000 1005 +5
==========================================
+ Hits 1803 1813 +10
- Misses 2408 2462 +54
Partials 12 12
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
28bed3c
to
a66ca60
Compare
2114e86
to
6944d47
Compare
6944d47
to
dd8b2f4
Compare
e0527b2
to
88c5234
Compare
fa44853
to
e9899cd
Compare
// rest.get(AppRest.APPLICATIONS, (req, res, ctx) => { | ||
// return res(ctx.json(mockApplicationArray)); | ||
// }), | ||
// Commented out to avoid conflict with the real API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to commit these uncommented or comment them back out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks.
// const commentValues = values["comments"]; | ||
// const fieldName = getCommentFieldName(category, false); | ||
// const commentValue = commentValues[fieldName]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove the commented out code here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what we are doing about comments since they are yet another thing not available on the new API. Wa just going to leave them for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, ok. I wonder if we should leave a TODO then.
e9899cd
to
f066ed2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM, just a couple things.
status: "STARTED", | ||
}; | ||
|
||
await patchAssessment(payload); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we want to switch to using a useMutation
here eventually for these patchAssessment
calls so we can separate API logic from the component. Sounds out of scope for this PR though since it's a preexisting pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
const AssessmentSummaryPage: React.FC = () => { | ||
const { assessmentId } = useParams<AssessmentSummaryRouteParams>(); | ||
|
||
const { t } = useTranslation(); | ||
|
||
const [activeSectionIndex, setActiveSectionIndex] = React.useState< | ||
"all" | number | ||
>("all"); | ||
|
||
const handleTabClick = ( | ||
_event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent, | ||
tabKey: string | number | ||
) => { | ||
setActiveSectionIndex(tabKey as "all" | number); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create a component shared by AssessmentSummaryPage
and QuestionnairePage
for the layout of tabs and search logic instead of copying that code here? I think maybe there's a higher level of stuff we can reuse here than just the QuestionsTable. We could create something like a QuestionnaireSummary
that can handle either the questionnaire itself or an assessment with conditional logic for the parts that differ.
If that's too much hassle for this PR we could do it in a followup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing"; | ||
import { Question } from "@app/api/models"; | ||
|
||
const QuestionnaireSectionTabTitle: React.FC<{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this component is straight up copied from the other page, I bet it could exist in one place and be used in the shared component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
const determineButtonBackgroundColor = () => { | ||
const action = determineAction(); | ||
if (action === AssessmentAction.Continue) { | ||
return "#5ba353"; // Continue background color | ||
} else if (action === AssessmentAction.Retake) { | ||
return "#F0AB01"; // Retake background color | ||
} else { | ||
return ""; // Default background color for "Take" | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if instead we should conditionally apply CSS classNames to the buttons and define these colors in CSS?
Also we could use the CSS variables from the PF color palette instead of hard coded hash values. That way if we ever introduce dark mode the colors should be able to adjust automatically.
3186ed3
to
abd3144
Compare
a32cefd
to
b69ce33
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome!
<div | ||
style={{ | ||
backgroundColor: "var(--pf-v5-global--BackgroundColor--100)", | ||
}} | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point we might want to see if we can get rid of this inline style somehow
|
||
export const ApplicationAssessment: React.FC = () => { | ||
const { t } = useTranslation(); | ||
|
||
const { assessmentId } = useParams<AssessmentRoute>(); | ||
const { assessment, isFetching, fetchError } = | ||
useFetchAssessmentByID(assessmentId); | ||
useFetchAssessmentById(assessmentId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
8c87d63
to
a481e0b
Compare
Signed-off-by: ibolton336 <ibolton@redhat.com> Take/retake flow for assessments Share questions and answers tables Hide answer key in assessment review screen Navigate back to assessment actions after assessment Signed-off-by: ibolton336 <ibolton@redhat.com> Separate out archived questionnaires Add continue button logic Add delete assessment mock and functionality Move shared questionnaire data Signed-off-by: ibolton336 <ibolton@redhat.com> Add comments Signed-off-by: ibolton336 <ibolton@redhat.com> Use RQ for patchAssessment Signed-off-by: ibolton336 <ibolton@redhat.com> Refactor assessment / questionnaire summary Signed-off-by: ibolton336 <ibolton@redhat.com> wire up delete for mock apps Signed-off-by: ibolton336 <ibolton@redhat.com> cleanup Signed-off-by: ibolton336 <ibolton@redhat.com> Fix invalidate queries after assessment patch Signed-off-by: ibolton336 <ibolton@redhat.com> Fix css Signed-off-by: ibolton336 <ibolton@redhat.com> Updates to match api Signed-off-by: ibolton336 <ibolton@redhat.com> Match hub status with api Signed-off-by: ibolton336 <ibolton@redhat.com> Test question updates Signed-off-by: ibolton336 <ibolton@redhat.com> Fix questionnaire by ID Signed-off-by: ibolton336 <ibolton@redhat.com> update tests Signed-off-by: ibolton336 <ibolton@redhat.com>
a481e0b
to
b3c085b
Compare
Resolves #1299 #1301 #1300
Note: Will need to uncomment these lines for testing https://github.com/konveyor/tackle2-ui/pull/1325/files#diff-b0560fce9e9111641c87e7daa6648f4d60fd0b620522ff84501ec5dadd7f4128R38-R51