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

✨ Remove pathfinder and convert assessment wizard to use new api #1315

Merged
merged 2 commits into from
Aug 31, 2023

Conversation

ibolton336
Copy link
Member

@ibolton336 ibolton336 commented Aug 25, 2023

Screen.Recording.2023-08-30.at.10.19.07.AM.mov

This pull request aims to start the development of the single-app application assessment flow. It includes the addition of a full flow for the assessment process against the new data model, updates to match the latest Go structs from the hub PR, removal of pathfinder-specific elements, creation of msw mocks to handle assessment initial post and patch operations, and a few other things.

Changes Made:

  • Single-App Application Assessment Flow: Added a complete flow for single-app application assessment. This flow includes handling initial posts and patch operations.
  • Model Updates: Updated the models to align with the latest Go structs from the hub PR.
  • MSW Mocks Creation: Created msw mocks to handle assessment initial post and patch requests.

TODO:

  • Comments Feature: Comments feature is currently commented out in the assessments flow.
  • Stakeholders & Stakeholder Groups: Identified that the code related to stakeholders and stakeholder groups is not yet added to the assessment struct on the API. Collaboration with the hub team is needed to incorporate this functionality, as assessments can have associated stakeholders.
  • Mock Endpoint Enhancement: Need to add support for /applications/:id/assessments when available
  • Tests Update: Need to evaluate existing tests & update to match the new data format for assessments.
  • Assessment Risks Component: Will need to wire this up depending on the future availability of the calculatedRisk assessment field from the API
  • Hub Derived Fields for Assessments: Hub-derived fields for calculated risk not yet available. These fields are planned to be calculated by the hub after the final assessment submission, facilitating categorization in the reports screen.
  • Old Report Cards Consideration: Although the components for report cards still exist in the repository, their usage in reports.tsx has been commented out.

@ibolton336 ibolton336 force-pushed the convert-assessment-wizard branch 3 times, most recently from 48a8986 to 0072127 Compare August 30, 2023 14:08
@ibolton336 ibolton336 marked this pull request as ready for review August 30, 2023 14:08
@ibolton336 ibolton336 changed the title [WIP] Remove pathfinder and convert assessment wizard to use new api ✨ Remove pathfinder and convert assessment wizard to use new api Aug 30, 2023
@codecov
Copy link

codecov bot commented Aug 30, 2023

Codecov Report

Patch coverage: 52.17% and project coverage change: -0.38% ⚠️

Comparison is base (5757dcd) 42.92% compared to head (a9282ba) 42.54%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1315      +/-   ##
==========================================
- Coverage   42.92%   42.54%   -0.38%     
==========================================
  Files         146      136      -10     
  Lines        4454     4207     -247     
  Branches     1040     1000      -40     
==========================================
- Hits         1912     1790     -122     
+ Misses       2530     2405     -125     
  Partials       12       12              
Flag Coverage Δ
client 42.54% <52.17%> (-0.38%) ⬇️
server ∅ <ø> (∅)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
client/src/app/queries/applications.ts 47.36% <ø> (+0.59%) ⬆️
client/src/app/queries/assessments.ts 19.51% <25.00%> (+1.65%) ⬆️
client/src/app/api/rest.ts 55.62% <54.54%> (+0.32%) ⬆️
...hooks/useAssessApplication/useAssessApplication.ts 90.00% <100.00%> (ø)
...ep-nav-description/wizard-step-nav-description.tsx 100.00% <100.00%> (ø)
.../applications/application-assessment/form-utils.ts 100.00% <100.00%> (ø)

... and 11 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mturley mturley self-requested a review August 31, 2023 13:09
Copy link
Member

@sjd78 sjd78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok that was a lot to look through, but lots of consistent object/name changes.

Overall my impressions are it looks good. Maybe a bit more thought will need to go in to handling multiple assessments for a single application (no matter where the assessments are sourced) in terms of showing application/assessment statuses. A single status icon may not be comprehensive enough in the table. Not sure on that.

client/src/app/api/rest.ts Show resolved Hide resolved
client/src/app/api/rest.ts Show resolved Hide resolved
Comment on lines +215 to +217
export const getAssessmentsPromise = (filters: {
applicationId?: number | string;
}): Promise<Assessment[]> => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about just using destructuring (also kinda a nit-pick):

Suggested change
export const getAssessmentsPromise = (filters: {
applicationId?: number | string;
}): Promise<Assessment[]> => {
export const getAssessmentsPromise = ({ applicationId }: {
applicationId?: number | string;
}): Promise<Assessment[]> => {

and then just using applicationId later?

Not that it is applicable here, but default values are pretty easy this way. For example:

export const getAssessments = ({
  applicationId = 1,
}: { applicationId?: number | string } = {}) => {
  const query: string[] = buildQuery({ applicationId });
  return axios.get(`${ASSESSMENTS}?${query.join("&")}`);
};

(the extra default param = {} takes care of calls like getAssessments() or getAssessments(null))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is a good idea. All of this code is also going to be deleted as soon as the back end guys finish the /applications/:id/assessments endpoint. This query param will go away entirely.

client/src/app/queries/questionnaires.ts Outdated Show resolved Hide resolved
</ApplicationAssessmentPageHeader>
);
expect(wrapper).toMatchSnapshot();
it.skip("Renders without crashing", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought on the render tests --

We can reuse the MSW layer to provide simple applications/assessments/etc for the render tests. It would be a step towards a fully mocked static demo UI. For some basic background on MSW on node/jest: https://mswjs.io/docs/getting-started/integrate/node

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to open an issue for this to circle back on.

@@ -39,11 +39,10 @@ export const AssessmentStakeholdersForm: React.FC = () => {
const { setValue, control, formState } =
useFormContext<ApplicationAssessmentWizardValues>();

const { stakeholders } = useFetchStakeholders();
// const { stakeholders } = useFetchStakeholders();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self - stakeholder work is on the TODO list

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we need the hub guys to add stakeholders/stakeholderGroups to the assessment struct.

const { t } = useTranslation();
const { assessment } = useFetchAssessmentByID(assessments?.[0]?.id || 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Limiting the application to a the single first assessment is temporary?

Will there be times where the status of multiple assessments for a single application will be available and shown?

If there are multiple, will the 0th assessment always be the most current one and that is the one to show the status on?

Copy link
Member Author

@ibolton336 ibolton336 Aug 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a great question re: how are we showing net questionnaire status with multiple potential active questionnaires/assessments.

I raised this with Justin & Jeff. Not sure if we can expect a hub status for applications / archetypes around status. Probably need to think about if we want to perform an operation to check if "some" of the assessments have an in progress status etc. I will open an issue around this.

#1324

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like currently there is an "assessed" bool on the application within the hub struct. So maybe we just keep it simple for now and use that.

Signed-off-by: ibolton336 <ibolton@redhat.com>
Signed-off-by: ibolton336 <ibolton@redhat.com>
Copy link
Member

@sjd78 sjd78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good.

@ibolton336 ibolton336 merged commit e041fe3 into konveyor:main Aug 31, 2023
6 checks passed
@ibolton336 ibolton336 deleted the convert-assessment-wizard branch August 31, 2023 18:30
Copy link
Collaborator

@mturley mturley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little late finishing my review but LGTM :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants