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

✨ Add new IssueReport. #417

Merged
merged 4 commits into from
Jun 26, 2023
Merged

✨ Add new IssueReport. #417

merged 4 commits into from
Jun 26, 2023

Conversation

jortel
Copy link
Contributor

@jortel jortel commented Jun 22, 2023

Add IssueReport needed for single-application flow. Making this a separate report because joining with the (very large) Incident table is very expensive if not qualified by application.

Updated the RuleReport, since the query got updated to group by RuleSet, Rule, correlating using the map isn't necessary.

Signed-off-by: Jeff Ortel <jortel@redhat.com>
@jortel jortel changed the title Add new IssueReport. ✨ Add new IssueReport. Jun 22, 2023
AnalysisReportDepRoot = AnalysesReportRoot + "/dependencies"
AnalysisReportRuleRoot = AnalysesReportRoot + "/rules"
AnalysisReportAppRoot = AnalysesReportRoot + "/applications"
AnalysisReportIssueRoot = AnalysisReportAppRoot + "/:" + ID + "/issues"
Copy link
Contributor Author

@jortel jortel Jun 22, 2023

Choose a reason for hiding this comment

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

hint: Added ^

Signed-off-by: Jeff Ortel <jortel@redhat.com>
@jortel jortel requested a review from mansam June 23, 2023 21:36
jortel added 2 commits June 23, 2023 18:55
Signed-off-by: Jeff Ortel <jortel@redhat.com>
@jortel jortel requested review from aufi and removed request for mansam June 26, 2023 13:16
Copy link
Member

@aufi aufi left a comment

Choose a reason for hiding this comment

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

LGTM

@jortel jortel merged commit d1b4e46 into konveyor:main Jun 26, 2023
mturley added a commit to konveyor/tackle2-ui that referenced this pull request Jun 28, 2023
… inventory detail drawer (#1069)

Implements the contents of the "Single application" tab of the Issues
page, which is also reachable from a link in each application's details
drawer on the Application Inventory page.

* When navigating to `/issues/single-app` with no app id, an empty state
is shown that directs the user to select an application from a dropdown
in the toolbar above the table.
* If the user is navigating here from the "all issues" tab and they have
filters applied, they will get a warning modal confirming that it is
okay to clear those filters in order to navigate away. The same warning
appears if you have filters in the "single application" tab and you
click the "all issues" tab. See the `ConfirmDialog` now rendered in the
`issues.tsx` page.
* After selecting an application (or clicking the Issues link in the app
inventory details drawer), the user is redirected to the new
`/issues/single-app/:applicationId` route, where the table is rendered.
* When doing this redirect, if there are any filters applied to a
previously selected application, they get preserved. See
`getIssuesSingleAppSelectedLocation`.
* This table renders `AnalysisIssueReport` objects, which are almost
identical to the `AnalysisRuleReport` except that they have the issue
`id` on them, and they have a number of `files` instead of a number of
`applications`.
* The "single application" issues table and the "all issues" table are
nearly identical: the only difference is that instead of an "Affected
applications" column, we have an "Affected files" column and clicking
the number of files opens the IssueDetailDrawer directly instead of
navigating to another page that uses that drawer (as the "All issues"
view does by opening the "Affected applications" table). To support
this:
* The table code has been moved from `issues.tsx` to `issues-table.tsx`,
where it has a prop `mode: "allIssues" | "singleApp"`, and some pieces
of the table conditionally render depending on the `mode`.
* In addition to `useFetchRuleReports`, the table now also calls
`useFetchIssueReports`. Only one of these queries will be enabled
depending on the table's mode, and the data array passed into
`useTableControlProps` comes from whichever is the active query, and has
the type `(AnalysisRuleReport | AnalysisIssueReport)[]`. Because these
two types share most of the same properties, most of the table code
still works as-is without caring which type is being used. In the places
where we need to access a property specific to RuleReport or
IssueReport, we use an `as` type assertion localized to those few lines
of code.
* The `issue-detail-drawer` folder and all its components has been moved
out of the `affected-applications` folder and is now a sibling of
`issues-table.tsx`, where it is used directly if you are in `singleApp`
mode. It is still used in the affected applications table with updated
imports.
* This drawer is identical between the "issues -> single application"
table and the "issues -> all issues -> affected applications" table --
selecting a row in either table means you are selecting one Issue object
(identified uniquely by the intersection of app id, ruleset and rule).
* However, the two tables where this drawer is used are listing
different types of objects: IssueReport and AppReport respectively. The
drawer component previously accepted `ruleReport` as a prop. It has been
refactored to simply accept an `issueId` and an `applicationName`, and
it fetches the underlying Issue object internally instead of relying on
the issue-related properties on the report (which are structured
differently between the IssueReport and AppReport models). This will
also make it easier in the future if we want to show more
Issue-object-related fields in additional tabs in this drawer.
* Filter categories which were already abstracted out into
`useSharedFilterCategoriesForIssuesAndAffectedApps()` are now only used
for the `allIssues` mode.
* Query hooks and axios fetch calls have been added for listing
`AnalysisIssueReport`s and fetching individual `AnalysisIssue` objects.
Some constants in these files have been renamed for readability.
* Note: this is a new model introduced in
konveyor/tackle2-hub#417.
* The hub URL for fetching `AnalysisAppReport` objects has been renamed
from `/analyses/report/applications` to
`/analyses/report/issues/applications`, for compatibility with
konveyor/tackle2-hub#421.
* In the drawer's Affected Files table, the `effort` filter has been
enabled because it is now supported in the hub.
* The FilterToolbar components have been updated to support an
`isDisabled` prop, so we can disable all filters on the single-app
issues table when there is no application selected.

## NOTE FOR REVIEWERS
* The `issues-table.tsx` and `issue-detail-drawer.tsx` diffs are hard to
read because git treated them as full rewrites.
* Most of the contents of `issues-table.tsx` are moved as-is from
`issues.tsx`, the only changes being the conditionals to support
multiple modes and fetch the two types of reports. To see only the part
of the diff after this file was moved, click here, wait for the
auto-scroll after the page fully loads, then click "Load diff":
cf3d2b3...mturley:issues-single-app#diff-fb394ab07ab689b297c8bc6c036ca7c501cbcdc5e7ff84e4f6127a48af46680b
* Most of the contents of `issue-detail-drawer.tsx` are the same, except
that the file has moved and it now has a `useFetchIssue` call at the
top. To see only the part of the diff after this file was moved, click
here and wait for the auto-scroll after the page fully loads:
37fdbce...mturley:issues-single-app#diff-764c7126e9c4a05ad639b4bb9fbcff8bee0b9cfbb0c9df812c4b9f4f4b5128ee
* Due to model changes in the hub, you will need to delete your hub
database and bounce the hub pod before testing these changes.
  
## Screenshots
Clicking the "single application" tab while filters are applied on the
"all issues" tab:
![Screenshot 2023-06-28 at 4 25 27
PM](https://github.com/konveyor/tackle2-ui/assets/811963/469a8017-4270-48a8-a9eb-c370a4e93873)

The "single application" tab with no app selected:
![Screenshot 2023-06-28 at 4 25 50
PM](https://github.com/konveyor/tackle2-ui/assets/811963/e7b6361b-77a4-47cd-84b1-879d4ace6793)

The dropdown for selecting an app, with an inline filter by app name:
![Screenshot 2023-06-28 at 4 28 27
PM](https://github.com/konveyor/tackle2-ui/assets/811963/1c4f5b2b-0c2e-4467-8334-9f5057553644)

The details drawer on the Application Inventory page with the Issues
link to take you to "single application" with an app selected:
![Screenshot 2023-06-28 at 4 26 42
PM](https://github.com/konveyor/tackle2-ui/assets/811963/438d19d1-cc94-4433-9670-d8176acfbf69)

The "single application" tab after selecting an app (via the dropdown or
via the Issues link in the app inventory details drawer):
![Screenshot 2023-06-28 at 4 27 41
PM](https://github.com/konveyor/tackle2-ui/assets/811963/65d38681-039d-4386-998a-a3e49bf9de33)

The "single application" tab with the issue details drawer open, after
clicking the number of affected files in a row. This is the same exact
drawer view that is reachable by finding this issue on the "all issues"
table, clicking the number of affected apps, then clicking this app.
![Screenshot 2023-06-28 at 4 28 56
PM](https://github.com/konveyor/tackle2-ui/assets/811963/941713e2-ebc8-40a3-b4ce-3cda7d80c23e)

---------

Signed-off-by: Mike Turley <mike.turley@alum.cs.umass.edu>
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