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

✨ adding filter& sort by analysis to Application-inventory table #2100

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

HadasahR
Copy link

@HadasahR HadasahR commented Sep 18, 2024

Add filter&sort applications by analysis status #1745

@mguetta1 mguetta1 marked this pull request as draft September 18, 2024 17:15
@HadasahR HadasahR changed the title adding filter by analysis to Application inventory table ✨adding filter by analysis to Application inventory table Sep 19, 2024
@HadasahR HadasahR changed the title ✨adding filter by analysis to Application inventory table ✨adding filter by analysis to Application-inventory table Sep 19, 2024
@HadasahR HadasahR changed the title ✨adding filter by analysis to Application-inventory table ✨ adding filter by analysis to Application-inventory table Sep 19, 2024
@HadasahR HadasahR closed this Sep 22, 2024
@HadasahR HadasahR reopened this Sep 22, 2024
Signed-off-by: HadasahR <d025834828@gmail.com>
Signed-off-by: HadasahR <d025834828@gmail.com>
@HadasahR HadasahR force-pushed the hadassah_application-inventoy-table-add-filtering-by-analysis branch from 0fa725a to c142659 Compare September 22, 2024 10:13
@HadasahR HadasahR marked this pull request as ready for review September 22, 2024 10:29
@HadasahR HadasahR changed the title ✨ adding filter by analysis to Application-inventory table ✨ adding filter& sort by analysis to Application-inventory table Sep 24, 2024
Copy link

codecov bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 42.01%. Comparing base (b654645) to head (185573c).
Report is 237 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2100      +/-   ##
==========================================
+ Coverage   39.20%   42.01%   +2.81%     
==========================================
  Files         146      175      +29     
  Lines        4857     5617     +760     
  Branches     1164     1392     +228     
==========================================
+ Hits         1904     2360     +456     
- Misses       2939     3136     +197     
- Partials       14      121     +107     
Flag Coverage Δ
client 42.01% <ø> (+2.81%) ⬆️
server ?

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

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

@mguetta1 mguetta1 marked this pull request as draft September 26, 2024 19:08
@mguetta1 mguetta1 marked this pull request as ready for review September 26, 2024 20:04
Copy link
Collaborator

@rszwajko rszwajko left a comment

Choose a reason for hiding this comment

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

The code for new functionality is added in the correct places but there are some problems with mapping state values. Unfortunately adding code to legacy class of this size is never easy :)

General comments:

  1. wording: the PR title is OK (you could start with a capital letter though), the description is repeating the title so you could skip it. However leave a link to the issue/bug you are fixing i.e. Resolves: [BUG] Need to be able to filter & sort by application analysis status #1745 . In git history you will find some examples
  2. check out your IDE configuration - it seems the IDE is not auto-formatting on save action. We have a script for linting - run from command line (in the project root) npm run lint . You will see the list of all violations (we somehow accumulated few of them). Then you can fix (only) yours. General cleanup is a candidate for another PR (npm run lint -- --fix will auto-fix all easy formatting problems in the whole project)

@@ -345,6 +348,7 @@ export const ApplicationsTable: React.FC = () => {
businessService: app.businessService?.name || "",
tags: app.tags?.length || 0,
effort: app.effort || 0,
analysis:app.tasks.currentAnalyzer?.state || ""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sort values need to be the same as the values visible to the user. Otherwise the sort order may feel "random".

what: t("terms.analysis").toLowerCase(),
}) + "...",
selectOptions: Array.from(taskStateToAnalyze).map(
([taskState, displayStatus]) => ({
Copy link
Collaborator

@rszwajko rszwajko Sep 26, 2024

Choose a reason for hiding this comment

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

Unfortunately few values are mapped to the same value (see the screenshot below). You could remove duplicates in few ways but using a library is probably the fastest - here's an example from our code base. Note also that the values get sorted before the display.
Screenshot from 2024-09-26 21-26-22

selectOptions: Array.from(taskStateToAnalyze).map(
([taskState, displayStatus]) => ({
value: taskState,
label: t(`${displayStatus}`),
Copy link
Collaborator

Choose a reason for hiding this comment

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

The displayed values should match the values that the user sees in the table. Here the things get a bit tricky.
Basically you need to repeat the same flow as done in the table by ApplicationAnalysisStatus component. There the received state is mapped via taskStateToAnalyze BUT later on inside IconedStatus
it's mapped again - the label value is the value that the user sees.

label: t(`${displayStatus}`),
})
),
getItemValue: (item) => item?.tasks.currentAnalyzer?.state || "No Task",
Copy link
Collaborator

Choose a reason for hiding this comment

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

The value here should match the value prop in the selectOptions list. If this would not work please let me know - there are more options.

@HadasahR
Copy link
Author

HadasahR commented Sep 26, 2024 via email

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.

2 participants