File tree 4 files changed +20
-5
lines changed
client/src/app/pages/issues
file-incidents-detail-modal
4 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 1
1
import { Location , LocationDescriptor } from "history" ;
2
- import { AnalysisIssueReport , AnalysisRuleReport } from "@app/api/models" ;
2
+ import {
3
+ AnalysisIssue ,
4
+ AnalysisIssueReport ,
5
+ AnalysisRuleReport ,
6
+ } from "@app/api/models" ;
3
7
import {
4
8
FilterCategory ,
5
9
FilterType ,
@@ -113,11 +117,12 @@ export const getAffectedAppsUrl = ({
113
117
. replace ( "/:rule/" , `/${ encodeURIComponent ( ruleReport . rule ) } /` ) ;
114
118
const prefix = ( key : string ) =>
115
119
`${ TableURLParamKeyPrefix . issuesAffectedApps } :${ key } ` ;
120
+
116
121
return `${ baseUrl } ?${ trimAndStringifyUrlParams ( {
117
122
newPrefixedSerializedParams : {
118
123
[ prefix ( "filters" ) ] : serializeFilterUrlParams ( toFilterValues ) . filters ,
119
124
[ FROM_ISSUES_PARAMS_KEY ] : fromIssuesParams ,
120
- issueTitle : ruleReport . description . split ( "\n" ) [ 0 ] ,
125
+ issueTitle : getIssueTitle ( ruleReport ) ,
121
126
} ,
122
127
} ) } `;
123
128
} ;
@@ -195,3 +200,10 @@ export const parseReportLabels = (
195
200
} ) ;
196
201
return { sources, targets, otherLabels } ;
197
202
} ;
203
+
204
+ export const getIssueTitle = (
205
+ issueReport : AnalysisRuleReport | AnalysisIssue | AnalysisIssueReport
206
+ ) =>
207
+ issueReport ?. description ?. split ( "\n" ) [ 0 ] ||
208
+ issueReport ?. name ?. split ( "\n" ) [ 0 ] ||
209
+ "*Unnamed*" ;
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import { useFetchIncidents } from "@app/queries/issues";
22
22
import { IncidentCodeSnipViewer } from "./incident-code-snip-viewer" ;
23
23
import { FileAllIncidentsTable } from "./file-all-incidents-table" ;
24
24
import { IssueDescriptionAndLinks } from "../../components/issue-description-and-links" ;
25
+ import { getIssueTitle } from "../../helpers" ;
25
26
26
27
export interface IFileIncidentsDetailModalProps {
27
28
issue : AnalysisIssue ;
@@ -58,7 +59,7 @@ export const FileIncidentsDetailModal: React.FC<
58
59
isFetching ||
59
60
( firstFiveIncidents . length > 0 && activeTabIncidentId === undefined ) ;
60
61
61
- const issueTitle = issue . description . split ( "\n" ) [ 0 ] ;
62
+ const issueTitle = getIssueTitle ( issue ) ;
62
63
63
64
return (
64
65
< Modal
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import { IssueAffectedFilesTable } from "./issue-affected-files-table";
17
17
import { useFetchIssue } from "@app/queries/issues" ;
18
18
import { AppPlaceholder } from "@app/components/AppPlaceholder" ;
19
19
import { StateNoData } from "@app/components/StateNoData" ;
20
+ import { getIssueTitle } from "../helpers" ;
20
21
21
22
export interface IIssueDetailDrawerProps
22
23
extends Pick < IPageDrawerContentProps , "onCloseClick" > {
@@ -61,7 +62,7 @@ export const IssueDetailDrawer: React.FC<IIssueDetailDrawerProps> = ({
61
62
{ applicationName }
62
63
</ Text >
63
64
< Title headingLevel = "h2" size = "lg" className = { spacing . mtXs } >
64
- < Truncate content = { issue . description . split ( "\n" ) [ 0 ] } />
65
+ < Truncate content = { getIssueTitle ( issue ) } />
65
66
</ Title >
66
67
</ TextContent >
67
68
< Tabs
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ import {
56
56
parseReportLabels ,
57
57
getIssuesSingleAppSelectedLocation ,
58
58
useSharedAffectedApplicationFilterCategories ,
59
+ getIssueTitle ,
59
60
} from "./helpers" ;
60
61
import { IssueFilterGroups } from "./issues" ;
61
62
import {
@@ -354,7 +355,7 @@ export const IssuesTable: React.FC<IIssuesTableProps> = ({ mode }) => {
354
355
{ ...getTdProps ( { columnKey : "description" } ) }
355
356
modifier = "truncate"
356
357
>
357
- { report . description . split ( "\n" ) [ 0 ] }
358
+ { getIssueTitle ( report ) }
358
359
</ Td >
359
360
< Td width = { 20 } { ...getTdProps ( { columnKey : "category" } ) } >
360
361
{ report . category }
You can’t perform that action at this time.
0 commit comments