aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/FileFacet.tsx38
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/FileFacet-test.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/FileFacet-test.tsx.snap2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/utils.ts6
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.tsx13
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeader-test.tsx.snap8
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeaderSlim-test.tsx.snap8
9 files changed, 29 insertions, 64 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/FileFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/FileFacet.tsx
index 451aef2dd6c..cd6a0f1dee3 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/FileFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/FileFacet.tsx
@@ -29,46 +29,28 @@ import ListStyleFacet from '../../../components/facet/ListStyleFacet';
import { getBranchLikeQuery } from '../../../helpers/branch-like';
import { BranchLike } from '../../../types/branch-like';
import { TreeComponentWithPath } from '../../../types/component';
-import { Facet, Query, ReferencedComponent } from '../utils';
+import { Facet, Query } from '../utils';
interface Props {
branchLike?: BranchLike;
componentKey: string;
fetching: boolean;
- fileUuids: string[];
+ files: string[];
loadSearchResultCount: (property: string, changes: Partial<Query>) => Promise<Facet>;
onChange: (changes: Partial<Query>) => void;
onToggle: (property: string) => void;
open: boolean;
query: Query;
- referencedComponents: T.Dict<ReferencedComponent>;
stats: Facet | undefined;
}
export default class FileFacet extends React.PureComponent<Props> {
- getFilePath = (fileUuid: string) => {
- const { referencedComponents } = this.props;
- return referencedComponents[fileUuid]
- ? collapsePath(referencedComponents[fileUuid].path || '', 15)
- : fileUuid;
- };
-
- getReferencedComponent = (key: string) => {
- const { referencedComponents } = this.props;
- const fileUuid = Object.keys(referencedComponents).find(uuid => {
- return referencedComponents[uuid].key === key;
- });
- return fileUuid ? referencedComponents[fileUuid] : undefined;
- };
-
- getFacetItemText = (fileUuid: string) => {
- const { referencedComponents } = this.props;
- return referencedComponents[fileUuid] ? referencedComponents[fileUuid].path || '' : fileUuid;
+ getFacetItemText = (path: string) => {
+ return path;
};
getSearchResultKey = (file: TreeComponentWithPath) => {
- const component = this.getReferencedComponent(file.key);
- return component ? component.uuid : file.key;
+ return file.path;
};
getSearchResultText = (file: TreeComponentWithPath) => {
@@ -94,8 +76,7 @@ export default class FileFacet extends React.PureComponent<Props> {
return this.props.loadSearchResultCount('files', {
files: files
.map(file => {
- const component = this.getReferencedComponent(file.key);
- return component && component.uuid;
+ return file.path;
})
.filter(isDefined)
});
@@ -108,9 +89,8 @@ export default class FileFacet extends React.PureComponent<Props> {
</>
);
- renderFacetItem = (fileUuid: string) => {
- const name = this.getFilePath(fileUuid);
- return this.renderFile(name);
+ renderFacetItem = (path: string) => {
+ return this.renderFile(path);
};
renderSearchResult = (file: TreeComponentWithPath, term: string) => {
@@ -137,7 +117,7 @@ export default class FileFacet extends React.PureComponent<Props> {
renderSearchResult={this.renderSearchResult}
searchPlaceholder={translate('search.search_for_files')}
stats={this.props.stats}
- values={this.props.fileUuids}
+ values={this.props.files}
/>
);
}
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
index 878cac3cae8..a9f69fff513 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
@@ -88,9 +88,8 @@ export class Sidebar extends React.PureComponent<Props> {
<FileFacet
branchLike={branchLike}
fetching={loadingFacets.files === true}
- fileUuids={query.files}
+ files={query.files}
open={!!openFacets.files}
- referencedComponents={this.props.referencedComponentsById}
stats={facets.files}
{...commonProps}
/>
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/FileFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/FileFacet-test.tsx
index cac5c92b52b..e2df44d6079 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/FileFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/FileFacet-test.tsx
@@ -24,7 +24,7 @@ import ListStyleFacet from '../../../../components/facet/ListStyleFacet';
import { mockBranch } from '../../../../helpers/mocks/branch-like';
import { mockComponent } from '../../../../helpers/testMocks';
import { TreeComponentWithPath } from '../../../../types/component';
-import { Query, ReferencedComponent } from '../../utils';
+import { Query } from '../../utils';
import FileFacet from '../FileFacet';
jest.mock('../../../../api/components', () => ({
@@ -76,12 +76,12 @@ describe("ListStyleFacet's callback props", () => {
});
it('#getSearchResultKey()', () => {
- expect(instance.getSearchResultKey({ key: 'foo' } as TreeComponentWithPath)).toBe('fooUuid');
- expect(instance.getSearchResultKey({ key: 'bar' } as TreeComponentWithPath)).toBe('bar');
+ expect(instance.getSearchResultKey({ key: 'bar', path: 'bar' } as TreeComponentWithPath)).toBe(
+ 'bar'
+ );
});
it('#getFacetItemText()', () => {
- expect(instance.getFacetItemText('fooUuid')).toBe('foo/bar.js');
expect(instance.getFacetItemText('bar')).toBe('bar');
});
});
@@ -92,15 +92,12 @@ function shallowRender(props: Partial<FileFacet['props']> = {}) {
branchLike={branch}
componentKey={component.key}
fetching={false}
- fileUuids={['foo', 'bar']}
+ files={['foo', 'bar']}
loadSearchResultCount={jest.fn()}
onChange={jest.fn()}
onToggle={jest.fn()}
open={false}
query={{} as Query}
- referencedComponents={{
- fooUuid: { key: 'foo', uuid: 'fooUuid', path: 'foo/bar.js' } as ReferencedComponent
- }}
stats={undefined}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/FileFacet-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/FileFacet-test.tsx.snap
index e0c34a44074..0a5a99c9daf 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/FileFacet-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/FileFacet-test.tsx.snap
@@ -50,6 +50,6 @@ exports[`should render correctly 3`] = `
className="little-spacer-right"
qualifier="FIL"
/>
- foo/bar.js
+ fooUuid
</React.Fragment>
`;
diff --git a/server/sonar-web/src/main/js/apps/issues/utils.ts b/server/sonar-web/src/main/js/apps/issues/utils.ts
index 5d25e6d22a0..8dc99ee6329 100644
--- a/server/sonar-web/src/main/js/apps/issues/utils.ts
+++ b/server/sonar-web/src/main/js/apps/issues/utils.ts
@@ -87,7 +87,7 @@ export function parseQuery(query: T.RawQuery): Query {
createdInLast: parseAsString(query.createdInLast),
cwe: parseAsArray(query.cwe, parseAsString),
directories: parseAsArray(query.directories, parseAsString),
- files: parseAsArray(query.fileUuids, parseAsString),
+ files: parseAsArray(query.files, parseAsString),
issues: parseAsArray(query.issues, parseAsString),
languages: parseAsArray(query.languages, parseAsString),
modules: parseAsArray(query.moduleUuids, parseAsString),
@@ -125,7 +125,7 @@ export function serializeQuery(query: Query): T.RawQuery {
createdInLast: serializeString(query.createdInLast),
cwe: serializeStringArray(query.cwe),
directories: serializeStringArray(query.directories),
- fileUuids: serializeStringArray(query.files),
+ files: serializeStringArray(query.files),
issues: serializeStringArray(query.issues),
languages: serializeStringArray(query.languages),
moduleUuids: serializeStringArray(query.modules),
@@ -161,7 +161,6 @@ export interface Facet {
export function mapFacet(facet: string) {
const propertyMapping: T.Dict<string> = {
- files: 'fileUuids',
modules: 'moduleUuids'
};
return propertyMapping[facet] || facet;
@@ -174,7 +173,6 @@ export function parseFacets(facets: RawFacet[]): T.Dict<Facet> {
// for readability purpose
const propertyMapping: T.Dict<string> = {
- fileUuids: 'files',
moduleUuids: 'modules'
};
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx
index 63f01ef746c..48b0b8d0b00 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx
@@ -81,7 +81,7 @@ export default class SourceViewerHeader extends React.PureComponent<Props, State
{ISSUE_TYPES.map((type: T.IssueType) => {
const params = {
...getBranchLikeQuery(branchLike),
- fileUuids: sourceViewerFile.uuid,
+ files: sourceViewerFile.path,
resolved: 'false',
types: type
};
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.tsx
index 5e7a12efbff..3306ca2dc3c 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.tsx
@@ -54,16 +54,7 @@ export default function SourceViewerHeaderSlim(props: Props) {
onExpand,
sourceViewerFile
} = props;
- const {
- measures,
- path,
- project,
- projectName,
- q,
- subProject,
- subProjectName,
- uuid
- } = sourceViewerFile;
+ const { measures, path, project, projectName, q, subProject, subProjectName } = sourceViewerFile;
const projectNameLabel = (
<>
@@ -113,7 +104,7 @@ export default function SourceViewerHeaderSlim(props: Props) {
<Link
to={getComponentIssuesUrl(project, {
...getBranchLikeQuery(branchLike),
- fileUuids: uuid,
+ files: path,
resolved: 'false'
})}>
{translate('source_viewer.view_all_issues')}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeader-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeader-test.tsx.snap
index 92f4a5eb87f..6e53dad11aa 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeader-test.tsx.snap
+++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeader-test.tsx.snap
@@ -377,7 +377,7 @@ exports[`should render correctly if issue details are passed 1`] = `
Object {
"pathname": "/project/issues",
"query": Object {
- "fileUuids": "foo-bar",
+ "files": "foo/bar.ts",
"id": "my-project",
"resolved": "false",
"types": "BUG",
@@ -408,7 +408,7 @@ exports[`should render correctly if issue details are passed 1`] = `
Object {
"pathname": "/project/issues",
"query": Object {
- "fileUuids": "foo-bar",
+ "files": "foo/bar.ts",
"id": "my-project",
"resolved": "false",
"types": "VULNERABILITY",
@@ -439,7 +439,7 @@ exports[`should render correctly if issue details are passed 1`] = `
Object {
"pathname": "/project/issues",
"query": Object {
- "fileUuids": "foo-bar",
+ "files": "foo/bar.ts",
"id": "my-project",
"resolved": "false",
"types": "CODE_SMELL",
@@ -470,7 +470,7 @@ exports[`should render correctly if issue details are passed 1`] = `
Object {
"pathname": "/project/issues",
"query": Object {
- "fileUuids": "foo-bar",
+ "files": "foo/bar.ts",
"id": "my-project",
"resolved": "false",
"types": "SECURITY_HOTSPOT",
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeaderSlim-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeaderSlim-test.tsx.snap
index 6d59238df6d..dc4035a4fae 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeaderSlim-test.tsx.snap
+++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeaderSlim-test.tsx.snap
@@ -58,7 +58,7 @@ exports[`should render correctly 1`] = `
Object {
"pathname": "/project/issues",
"query": Object {
- "fileUuids": "foo-bar",
+ "files": "foo/bar.ts",
"id": "my-project",
"resolved": "false",
},
@@ -152,7 +152,7 @@ exports[`should render correctly for subproject 1`] = `
Object {
"pathname": "/project/issues",
"query": Object {
- "fileUuids": "foo-bar",
+ "files": "foo/bar.ts",
"id": "my-project",
"resolved": "false",
},
@@ -232,7 +232,7 @@ exports[`should render correctly: no link to project 1`] = `
Object {
"pathname": "/project/issues",
"query": Object {
- "fileUuids": "foo-bar",
+ "files": "foo/bar.ts",
"id": "my-project",
"resolved": "false",
},
@@ -301,7 +301,7 @@ exports[`should render correctly: no project name 1`] = `
Object {
"pathname": "/project/issues",
"query": Object {
- "fileUuids": "foo-bar",
+ "files": "foo/bar.ts",
"id": "my-project",
"resolved": "false",
},