this.props.component.key !== previous.component.key ||
this.props.location.query.hotspots !== previous.location.query.hotspots ||
SECURITY_STANDARDS.some(s => this.props.location.query[s] !== previous.location.query[s]) ||
- this.props.location.query.file !== previous.location.query.file
+ this.props.location.query.files !== previous.location.query.files
) {
this.fetchInitialData();
}
const filterByCWE: string | undefined = location.query.cwe;
- const filterByFile: string | undefined = location.query.file;
+ const filterByFile: string | undefined = location.query.files;
this.setState({ filterByCategory, filterByCWE, filterByFile, hotspotKeys });
getBranchLikeUrl,
getCodeUrl,
getComponentIssuesUrl,
+ getComponentSecurityHotspotsUrl,
getPathUrlAsString
} from '../../helpers/urls';
import { BranchLike } from '../../types/branch-like';
import { ComponentQualifier } from '../../types/component';
-import { IssueType, Measure, SourceViewerFile } from '../../types/types';
+import { IssueType } from '../../types/issues';
+import { Measure, SourceViewerFile } from '../../types/types';
import Link from '../common/Link';
import { WorkspaceContextShape } from '../workspace/context';
import MeasuresOverlay from './components/MeasuresOverlay';
const measure = componentMeasures.find(
m => m.metric === ISSUETYPE_METRIC_KEYS_MAP[type].metric
);
+
+ const linkUrl =
+ type === IssueType.SecurityHotspot
+ ? getComponentSecurityHotspotsUrl(sourceViewerFile.project, params)
+ : getComponentIssuesUrl(sourceViewerFile.project, params);
+
return (
<div className="source-viewer-header-measure" key={type}>
<span className="source-viewer-header-measure-label">
{translate('issue.type', type)}
</span>
<span className="source-viewer-header-measure-value">
- <Link to={getComponentIssuesUrl(sourceViewerFile.project, params)}>
- {formatMeasure((measure && measure.value) || 0, 'INT')}
- </Link>
+ <Link to={linkUrl}>{formatMeasure((measure && measure.value) || 0, 'INT')}</Link>
</span>
</div>
);
* Generate URL for a component's security hotspot page
*/
export function getComponentSecurityHotspotsUrl(componentKey: string, query: Query = {}): Path {
- const { branch, pullRequest, inNewCodePeriod, hotspots, assignedToMe, file } = query;
+ const { branch, pullRequest, inNewCodePeriod, hotspots, assignedToMe, files } = query;
return {
pathname: '/security_hotspots',
search: queryToSearch({
inNewCodePeriod,
hotspots,
assignedToMe,
- file,
+ files,
...pick(query, [
SecurityStandard.OWASP_TOP10_2021,
SecurityStandard.OWASP_TOP10,