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 Dep.provider. #421

Merged
merged 17 commits into from
Jun 27, 2023
Merged

✨ Add Dep.provider. #421

merged 17 commits into from
Jun 27, 2023

Conversation

jortel
Copy link
Contributor

@jortel jortel commented Jun 23, 2023

Add Provider to: TechDependency model and REST resources.

Add new report to list applications with a specific dependency identified by (provider,name, version,sha).

Needed to change route:

/analyses/report/applications

To (for symmetry):

/analyses/report/issues/applications

Adds route:

/analyses/report/dependencies/applications

Adds migration 6.

Unrelated:
Fix next-migration script.
Add repository to hack/add/application.sh
Fixes unique index (issueA) on Issue to include AnalysisID. RuleSet,Rule must be unique within an analysis.
Fixes unique index (depA) on TechDependency to include AnalysisID. Provider,Name,Version,SHA must be unique within an analysis.


Routes:

/analyses/:id             
/analyses/dependencies    
/analyses/issues          
/analyses/issues/:id      
/analyses/issues/:id/incidents 
/analyses/report/rules    
/analyses/report/applications/:id/issues 
/analyses/report/issues/applications 
/analyses/report/issues/:id/files 
/analyses/report/dependencies 
/analyses/report/dependencies/applications

@jortel jortel changed the title Add Dep.provider. ✨ Add Dep.provider. Jun 23, 2023
@jortel jortel marked this pull request as ready for review June 24, 2023 01:56
// TechDependency report dependency.
type TechDependency struct {
Model
Provider string `gorm:"index:depA"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hint: added provider.

Signed-off-by: Jeff Ortel <jortel@redhat.com>
Signed-off-by: Jeff Ortel <jortel@redhat.com>
Signed-off-by: Jeff Ortel <jortel@redhat.com>
Signed-off-by: Jeff Ortel <jortel@redhat.com>
Signed-off-by: Jeff Ortel <jortel@redhat.com>
jortel added 10 commits June 26, 2023 06:59
Signed-off-by: Jeff Ortel <jortel@redhat.com>
Signed-off-by: Jeff Ortel <jortel@redhat.com>
Signed-off-by: Jeff Ortel <jortel@redhat.com>
Signed-off-by: Jeff Ortel <jortel@redhat.com>
Signed-off-by: Jeff Ortel <jortel@redhat.com>
Signed-off-by: Jeff Ortel <jortel@redhat.com>
Signed-off-by: Jeff Ortel <jortel@redhat.com>
Copy link
Collaborator

@mansam mansam left a comment

Choose a reason for hiding this comment

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

Looks good, but see comment regarding model.All() ordering.

// All builds all models.
// Models are enumerated such that each are listed after
// all the other models on which they may depend.
func All() []interface{} {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like the tool puts these in a semi-alphabetical order rather than dependency order. This usually won't cause a problem unless we're adding new models or foreign key relationships, but it makes the comment inaccurate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

replace with All() from v5.

Signed-off-by: Jeff Ortel <jortel@redhat.com>
@jortel jortel merged commit 1747a20 into konveyor:main Jun 27, 2023
8 of 9 checks passed
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