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

🐛 Use truncated first line of issue description everywhere we were using issue name #1186

Merged
merged 4 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Toolbar,
ToolbarContent,
ToolbarItem,
Truncate,
} from "@patternfly/react-core";
import { useTranslation } from "react-i18next";
import { AppPlaceholder, ConditionalRender } from "@app/shared/components";
Expand Down Expand Up @@ -44,8 +45,8 @@ export const AffectedApplications: React.FC = () => {
const { t } = useTranslation();

const { ruleset, rule } = useParams<IAffectedApplicationsRouteParams>();
const ruleReportName =
new URLSearchParams(useLocation().search).get("ruleReportName") ||
const issueTitle =
new URLSearchParams(useLocation().search).get("issueTitle") ||
"Active rule";

const tableControlState = useTableControlUrlParams({
Expand Down Expand Up @@ -140,7 +141,7 @@ export const AffectedApplications: React.FC = () => {
</Link>
</BreadcrumbItem>
<BreadcrumbItem to="#" isActive>
{ruleReportName}
{issueTitle}
</BreadcrumbItem>
</Breadcrumb>
</PageSection>
Expand All @@ -166,7 +167,7 @@ export const AffectedApplications: React.FC = () => {
</ToolbarItem>
</ToolbarContent>
</Toolbar>
<Table {...tableProps} aria-label="Migration waves table">
<Table {...tableProps} aria-label="Affected applications table">
<Thead>
<Tr>
<TableHeaderContentWithControls {...tableControls}>
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/pages/issues/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const getAffectedAppsUrl = ({
newPrefixedSerializedParams: {
[prefix("filters")]: serializeFilterUrlParams(toFilterValues).filters,
[FROM_ISSUES_PARAMS_KEY]: fromIssuesParams,
ruleReportName: ruleReport.name,
issueTitle: ruleReport.description.split("\n")[0],
},
})}`;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
TextContent,
Text,
Alert,
Truncate,
} from "@patternfly/react-core";
import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing";
import { AnalysisFileReport, AnalysisIssue } from "@app/api/models";
Expand Down Expand Up @@ -58,6 +59,8 @@ export const FileIncidentsDetailModal: React.FC<
isFetching ||
(firstFiveIncidents.length > 0 && activeTabIncidentId === undefined);

const issueTitle = issue.description.split("\n")[0];

return (
<Modal
title={fileReport.file}
Expand Down Expand Up @@ -99,13 +102,15 @@ export const FileIncidentsDetailModal: React.FC<
<Grid hasGutter className={spacing.mtLg}>
<GridItem span={6}>
<IncidentCodeSnipViewer
issueName={issue.name}
issueTitle={issueTitle}
incident={incident}
/>
</GridItem>
<GridItem span={6} className={spacing.plSm}>
<TextContent>
<Text component="h2">{issue.name}</Text>
<Text component="h2">
<Truncate content={issueTitle} />
</Text>
<Text component="small">Line {incident.line}</Text>
</TextContent>
<IssueDescriptionAndLinks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { LANGUAGES_BY_FILE_EXTENSION } from "config/monacoConstants";
const codeLineRegex = /^\s*([0-9]+)( {2})?(.*)$/; // Pattern: leading whitespace (line number) (2 spaces)? (code)

export interface IIncidentCodeSnipViewerProps {
issueName: string;
issueTitle: string;
incident: AnalysisIncident;
}

export const IncidentCodeSnipViewer: React.FC<IIncidentCodeSnipViewerProps> = ({
issueName,
issueTitle,
incident,
}) => {
const codeSnipNumberedLines = incident.codeSnip.split("\n");
Expand Down Expand Up @@ -63,7 +63,7 @@ export const IncidentCodeSnipViewer: React.FC<IIncidentCodeSnipViewerProps> = ({
// Red squiggly under the affected line
monaco.editor.setModelMarkers(model, "my-markers", [
{
message: issueName,
message: issueTitle,
severity: monaco.MarkerSeverity.Error,
startLineNumber: relativeLineNum,
startColumn:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
Tabs,
TabTitleText,
Tab,
Truncate,
} from "@patternfly/react-core";
import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing";
import { IssueAffectedFilesTable } from "./issue-affected-files-table";
Expand Down Expand Up @@ -60,7 +61,7 @@ export const IssueDetailDrawer: React.FC<IIssueDetailDrawerProps> = ({
{applicationName}
</Text>
<Title headingLevel="h2" size="lg" className={spacing.mtXs}>
{issue.name}
<Truncate content={issue.description.split("\n")[0]} />
</Title>
</TextContent>
<Tabs
Expand Down
Loading