-
Notifications
You must be signed in to change notification settings - Fork 40
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,10 @@ import { useFetchTagsWithTagItems } from "@app/queries/tags"; | |
|
||
// Relative components | ||
import { AnalysisWizard } from "../analysis-wizard/analysis-wizard"; | ||
import { ApplicationAnalysisStatus } from "../components/application-analysis-status"; | ||
import { | ||
ApplicationAnalysisStatus, | ||
taskStateToAnalyze, | ||
} from "../components/application-analysis-status"; | ||
import { ApplicationAssessmentStatus } from "../components/application-assessment-status"; | ||
import { ApplicationBusinessService } from "../components/application-business-service"; | ||
import { ApplicationDependenciesForm } from "@app/components/ApplicationDependenciesFormContainer/ApplicationDependenciesForm"; | ||
|
@@ -335,7 +338,7 @@ export const ApplicationsTable: React.FC = () => { | |
sort: "sessionStorage", | ||
}, | ||
isLoading: isFetchingApplications, | ||
sortableColumns: ["name", "businessService", "tags", "effort"], | ||
sortableColumns: ["name", "businessService", "tags", "effort","analysis"], | ||
initialSort: { columnKey: "name", direction: "asc" }, | ||
initialColumns: { | ||
name: { isIdentity: true }, | ||
|
@@ -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 || "" | ||
}), | ||
filterCategories: [ | ||
{ | ||
|
@@ -499,7 +503,24 @@ export const ApplicationsTable: React.FC = () => { | |
], | ||
getItemValue: (item) => normalizeRisk(item.risk) ?? "", | ||
}, | ||
{ | ||
categoryKey: "analysis", | ||
title: t("terms.analysis"), | ||
type: FilterType.multiselect, | ||
placeholderText: | ||
t("actions.filterBy", { | ||
what: t("terms.analysis").toLowerCase(), | ||
}) + "...", | ||
selectOptions: Array.from(taskStateToAnalyze).map( | ||
([taskState, displayStatus]) => ({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
value: taskState, | ||
label: t(`${displayStatus}`), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
}) | ||
), | ||
getItemValue: (item) => item?.tasks.currentAnalyzer?.state || "No Task", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The value here should match the |
||
}, | ||
], | ||
|
||
initialItemsPerPage: 10, | ||
hasActionsColumn: true, | ||
isSelectionEnabled: true, | ||
|
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.
Sort values need to be the same as the values visible to the user. Otherwise the sort order may feel "random".