From 126416dcc474598bbd6dc8affb9bd592ce71eb91 Mon Sep 17 00:00:00 2001 From: mathieu-suen-sonarsource <59278745+mathieu-suen-sonarsource@users.noreply.github.com> Date: Mon, 18 May 2020 16:01:23 +0200 Subject: [PATCH] SONAR-12266 Remove favorite icon for file. --- .../SourceViewer/SourceViewerHeader.tsx | 15 +++----------- .../SourceViewer/SourceViewerHeaderSlim.tsx | 20 ++++--------------- .../__tests__/SourceViewerHeaderSlim-test.tsx | 8 -------- server/sonar-web/src/main/js/types/types.d.ts | 1 - 4 files changed, 7 insertions(+), 37 deletions(-) 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 d80c0606ea5..9c4be2d5a84 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx @@ -31,10 +31,10 @@ import { formatMeasure } from 'sonar-ui-common/helpers/measures'; import { collapsedDirFromPath, fileFromPath } from 'sonar-ui-common/helpers/path'; import { omitNil } from 'sonar-ui-common/helpers/request'; import { getBaseUrl, getPathUrlAsString } from 'sonar-ui-common/helpers/urls'; -import { getBranchLikeQuery, isMainBranch } from '../../helpers/branch-like'; +import { getBranchLikeQuery } from '../../helpers/branch-like'; import { getBranchLikeUrl, getCodeUrl, getComponentIssuesUrl } from '../../helpers/urls'; import { BranchLike } from '../../types/branch-like'; -import Favorite from '../controls/Favorite'; +import { ComponentQualifier } from '../../types/component'; import { WorkspaceContextShape } from '../workspace/context'; import MeasuresOverlay from './components/MeasuresOverlay'; @@ -124,7 +124,7 @@ export default class SourceViewerHeader extends React.PureComponent - {this.props.sourceViewerFile.canMarkAsFavorite && - (!this.props.branchLike || isMainBranch(this.props.branchLike)) && ( - - )} 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 21cda47cb63..5e7a12efbff 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.tsx @@ -28,11 +28,10 @@ import DeferredSpinner from 'sonar-ui-common/components/ui/DeferredSpinner'; import { translate } from 'sonar-ui-common/helpers/l10n'; import { collapsedDirFromPath, fileFromPath } from 'sonar-ui-common/helpers/path'; import { getPathUrlAsString } from 'sonar-ui-common/helpers/urls'; -import { getBranchLikeQuery, isMainBranch } from '../../helpers/branch-like'; +import { getBranchLikeQuery } from '../../helpers/branch-like'; import { getBranchLikeUrl, getComponentIssuesUrl } from '../../helpers/urls'; import { BranchLike } from '../../types/branch-like'; import { ComponentQualifier } from '../../types/component'; -import Favorite from '../controls/Favorite'; import './SourceViewerHeaderSlim.css'; export interface Props { @@ -56,14 +55,14 @@ export default function SourceViewerHeaderSlim(props: Props) { sourceViewerFile } = props; const { - key, measures, path, project, projectName, q, subProject, - subProjectName + subProjectName, + uuid } = sourceViewerFile; const projectNameLabel = ( @@ -104,17 +103,6 @@ export default function SourceViewerHeaderSlim(props: Props) {
- - {sourceViewerFile.canMarkAsFavorite && (!branchLike || isMainBranch(branchLike)) && ( -
- -
- )} {measures.issues !== undefined && ( @@ -125,7 +113,7 @@ export default function SourceViewerHeaderSlim(props: Props) { {translate('source_viewer.view_all_issues')} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeaderSlim-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeaderSlim-test.tsx index be24e09f5f4..521e5e8d4df 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeaderSlim-test.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeaderSlim-test.tsx @@ -29,14 +29,6 @@ it('should render correctly', () => { expect(shallowRender({ displayProjectName: false })).toMatchSnapshot('no project name'); }); -it('should allow to mark as favorite', () => { - expect( - shallowRender({ sourceViewerFile: mockSourceViewerFile({ canMarkAsFavorite: true }) }) - .find('Favorite') - .exists() - ).toBe(true); -}); - it('should render correctly for subproject', () => { expect( shallowRender({ diff --git a/server/sonar-web/src/main/js/types/types.d.ts b/server/sonar-web/src/main/js/types/types.d.ts index 0ae48e4efbe..a04d7a4c7c4 100644 --- a/server/sonar-web/src/main/js/types/types.d.ts +++ b/server/sonar-web/src/main/js/types/types.d.ts @@ -800,7 +800,6 @@ declare namespace T { export type SourceLineCoverageStatus = 'uncovered' | 'partially-covered' | 'covered'; export interface SourceViewerFile { - canMarkAsFavorite?: boolean; fav?: boolean; key: string; leakPeriodDate?: string; -- 2.39.5