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

✨ Issues: Add affected file details modal with incident details and code snippet viewer, adjust for hub change from IssueReport to AppReport #966

Merged
merged 24 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
07095d6
Skeleton and data loading for file detail modal
mturley Jun 1, 2023
5254116
Compatibility with hub change from IssueReport -> AppReport
mturley Jun 2, 2023
42effd9
Use specific names for currentPageItems
mturley Jun 5, 2023
7a4937d
Hub changes to AppReport
mturley Jun 5, 2023
3584f19
Add empty tabs to incident modal
mturley Jun 6, 2023
dd0ba2d
Set up CodeEditor and render codeSnip
mturley Jun 6, 2023
49dc8f4
Layout to the side of code snippet
mturley Jun 6, 2023
0c5dd40
Add markdown rendering for incident message
mturley Jun 6, 2023
d02ce80
Add marker for error line in code editor
mturley Jun 6, 2023
4a2ae9e
Use semantic h2 for issue name in modal
mturley Jun 7, 2023
6c264d6
Move snip viewer to its own file, add missing files
mturley Jun 7, 2023
3c46600
Prevent crash if lineNumber is invalid when showing error marker
mturley Jun 7, 2023
79cf86a
Remove broken import
mturley Jun 7, 2023
c4d09a4
Move issue-affected-file-detail-modal and associated files into their…
mturley Jun 7, 2023
9f3f49c
Cleanup
mturley Jun 7, 2023
e045fb2
Renaming files
mturley Jun 7, 2023
70a28b9
Add all incidents table
mturley Jun 7, 2023
a3f71ad
Add alert above all incidents table, CSS tweak
mturley Jun 7, 2023
fc47295
Cleanup
mturley Jun 7, 2023
89e0c3c
Add incidents column to affected apps
mturley Jun 7, 2023
9cd3394
Add effort column to affected apps
mturley Jun 7, 2023
8af66e6
Clarify comment
mturley Jun 7, 2023
be160d7
Move react-markdown to client package
mturley Jun 7, 2023
f3359d3
Remove unused fields createTime, createUser, updateUser
mturley Jun 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions client/config/webpack.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import CopyPlugin from "copy-webpack-plugin";
import Dotenv from "dotenv-webpack";
import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
import { Configuration, WatchIgnorePlugin } from "webpack";
import MonacoWebpackPlugin from "monaco-editor-webpack-plugin";

const BG_IMAGES_DIRNAME = "images";

Expand Down Expand Up @@ -162,6 +163,17 @@ const config: Configuration = {
exports: "xmllint",
},
},
// For monaco-editor-webpack-plugin
{
test: /\.css$/,
include: [path.resolve(__dirname, "../../node_modules/monaco-editor")],
use: ["style-loader", "css-loader"],
},
// For monaco-editor-webpack-plugin
{
test: /\.ttf$/,
type: "asset/resource",
},
],
},
plugins: [
Expand Down Expand Up @@ -195,6 +207,7 @@ const config: Configuration = {
new WatchIgnorePlugin({
paths: [/\.js$/, /\.d\.ts$/],
}),
new MonacoWebpackPlugin(),
],
resolve: {
alias: {
Expand Down
5 changes: 5 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@migtools/lib-ui": "^8.8.0",
"@patternfly/patternfly": "^4.224.2",
"@patternfly/react-charts": "^6.67.1",
"@patternfly/react-code-editor": "^4.82.115",
"@patternfly/react-core": "^4.214.1",
"@patternfly/react-table": "^4.83.1",
"@patternfly/react-tokens": "^4.66.1",
Expand All @@ -38,13 +39,16 @@
"i18next-http-backend": "^1.0.22",
"js-yaml": "^4.1.0",
"keycloak-js": "^18.0.1",
"monaco-editor": "^0.39.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-hook-form": "^7.43.1",
"react-hot-loader": "^4.13.1",
"react-i18next": "^11.8.5",
"react-image-file-resizer": "^0.4.8",
"react-markdown": "^8.0.7",
"react-measure": "^2.5.2",
"react-monaco-editor": "^0.52.0",
"react-router-dom": "^5.2.0",
"typesafe-actions": "^5.1.0",
"web-vitals": "^0.2.4",
Expand Down Expand Up @@ -89,6 +93,7 @@
"jest-resolve": "^27.4.6",
"jest-watch-typeahead": "^1.0.0",
"mini-css-extract-plugin": "^2.5.2",
"monaco-editor-webpack-plugin": "^7.0.1",
"prettier": "^2.2.1",
"pretty-quick": "^3.1.3",
"raw-loader": "^4.0.2",
Expand Down
1 change: 1 addition & 0 deletions client/src/app/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,5 @@ export enum TableURLParamKeyPrefix {
issues = "i",
affectedApps = "a",
affectedFiles = "f",
remainingIncidents = "r",
}
33 changes: 25 additions & 8 deletions client/src/app/api/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,16 +576,24 @@ interface AnalysisIssuesCommonFields {
// Hub type: Issue
export interface AnalysisIssue extends AnalysisIssuesCommonFields {
id: number;
createTime?: string; // ISO-8601 timestamp
createUser?: string;
updateUser?: string;
}

// Hub type: IssueReport - Issues collated by application (but filtered by ruleset/rule)
export interface AnalysisIssueReport extends AnalysisIssue {
application: { id: number; name: string; effort: number };
files: number;
// Hub type: AppReport - Issues collated by application (but filtered by ruleset/rule)
// When filtered by ruleset/rule, this object matches exactly one issue and includes that issue's details
export interface AnalysisAppReport extends AnalysisIssue {
id: number;
name: string;
description: string;
effort: number;
businessService: string;
incidents: number;
files: number;
issue: {
id: number;
name: string;
ruleset: string;
rule: string;
};
}

// Hub type: RuleReport - Issues collated by ruleset/rule
Expand All @@ -599,12 +607,21 @@ export interface AnalysisRuleReport extends BaseAnalysisRuleReport {

// Hub type: FileReport - Incidents collated by file
export interface AnalysisFileReport {
issueId: string;
issueId: number;
file: string;
incidents: number;
effort: number;
}

export interface AnalysisIncident {
id: number;
file: string;
line: number;
message: string;
codeSnip: string;
facts: Record<string, string>; // TODO what's actually in here?
}

export type TicketStatus = "" | "New" | "In Progress" | "Done" | "Error";

export type AggregateTicketStatus =
Expand Down
18 changes: 14 additions & 4 deletions client/src/app/api/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { APIClient } from "@app/axios-config";
import {
AnalysisDependency,
BaseAnalysisRuleReport,
AnalysisIssueReport,
AnalysisIssue,
AnalysisAppReport,
AnalysisFileReport,
AnalysisIncident,
Application,
ApplicationAdoptionPlan,
ApplicationDependency,
Expand Down Expand Up @@ -79,9 +80,10 @@ export const CACHE = HUB + "/cache/m2";

export const ANALYSIS_DEPENDENCIES = HUB + "/analyses/dependencies";
export const ANALYSIS_REPORT_RULES = HUB + "/analyses/report/rules";
export const ANALYSIS_REPORT_ISSUES = HUB + "/analyses/report/issues";
export const ANALYSIS_REPORT_APPS = HUB + "/analyses/report/applications";
export const ANALYSIS_REPORT_FILES = HUB + "/analyses/report/issues/:id/files";
export const ANALYSIS_ISSUES = HUB + "/analyses/issues";
export const ANALYSIS_ISSUE_INCIDENTS = HUB + "/analyses/issues/:id/incidents";

// PATHFINDER
export const PATHFINDER = "/hub/pathfinder";
Expand Down Expand Up @@ -558,8 +560,8 @@ export const getHubPaginatedResult = <T>(
export const getRuleReports = (params: HubRequestParams = {}) =>
getHubPaginatedResult<BaseAnalysisRuleReport>(ANALYSIS_REPORT_RULES, params);

export const getIssueReports = (params: HubRequestParams = {}) =>
getHubPaginatedResult<AnalysisIssueReport>(ANALYSIS_REPORT_ISSUES, params);
export const getAppReports = (params: HubRequestParams = {}) =>
getHubPaginatedResult<AnalysisAppReport>(ANALYSIS_REPORT_APPS, params);

export const getIssues = (params: HubRequestParams = {}) =>
getHubPaginatedResult<AnalysisIssue>(ANALYSIS_ISSUES, params);
Expand All @@ -575,6 +577,14 @@ export const getFileReports = (
)
: Promise.reject();

export const getIncidents = (issueId?: number, params: HubRequestParams = {}) =>
issueId
? getHubPaginatedResult<AnalysisIncident>(
ANALYSIS_ISSUE_INCIDENTS.replace("/:id/", `/${String(issueId)}/`),
params
)
: Promise.reject();

export const getDependencies = (params: HubRequestParams = {}) =>
getHubPaginatedResult<AnalysisDependency>(ANALYSIS_DEPENDENCIES, params);

Expand Down
17 changes: 17 additions & 0 deletions client/src/app/components/markdown-pf-components.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as React from "react";
import { Components } from "react-markdown";
import { Text } from "@patternfly/react-core";

export const markdownPFComponents: Components = {
h1: (props) => <Text component="h1" {...props} />,
h2: (props) => <Text component="h2" {...props} />,
h3: (props) => <Text component="h3" {...props} />,
h4: (props) => <Text component="h4" {...props} />,
h5: (props) => <Text component="h5" {...props} />,
h6: (props) => <Text component="h6" {...props} />,
p: (props) => <Text component="p" {...props} />,
a: (props) => <Text component="a" {...props} />,
small: (props) => <Text component="small" {...props} />,
blockquote: (props) => <Text component="blockquote" {...props} />,
pre: (props) => <Text component="pre" {...props} />,
};
Loading