aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx52
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.css (renamed from server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.css)4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx (renamed from server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.tsx)28
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.css2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/IssueSourceViewerHeader-test.tsx (renamed from server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeaderSlim-test.tsx)10
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/ComponentSourceSnippetGroupViewer-test.tsx.snap2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/IssueSourceViewerHeader-test.tsx.snap (renamed from server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeaderSlim-test.tsx.snap)0
-rw-r--r--server/sonar-web/src/main/js/apps/issues/styles.css4
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/SourceViewer.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx1
11 files changed, 57 insertions, 60 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx
index 00a82856a42..08a9d12d6aa 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx
@@ -23,7 +23,6 @@ import Issue from '../../../components/issue/Issue';
import SecondaryIssue from '../../../components/issue/SecondaryIssue';
import getCoverageStatus from '../../../components/SourceViewer/helpers/getCoverageStatus';
import { locationsByLine } from '../../../components/SourceViewer/helpers/indexing';
-import SourceViewerHeaderSlim from '../../../components/SourceViewer/SourceViewerHeaderSlim';
import { getBranchLikeQuery } from '../../../helpers/branch-like';
import { BranchLike } from '../../../types/branch-like';
import { isFile } from '../../../types/component';
@@ -40,6 +39,7 @@ import {
SourceLine,
SourceViewerFile
} from '../../../types/types';
+import IssueSourceViewerHeader from './IssueSourceViewerHeader';
import SnippetViewer from './SnippetViewer';
import {
createSnippets,
@@ -422,7 +422,7 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
return (
<div className="component-source-container" ref={this.rootNodeRef}>
- <SourceViewerHeaderSlim
+ <IssueSourceViewerHeader
branchLike={branchLike}
expandable={!fullyShown && isFile(snippetGroup.component.q)}
loading={loading}
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx
index b3b93d314f3..0457ce290df 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx
@@ -268,29 +268,35 @@ export default class CrossComponentSourceViewer extends React.PureComponent<Prop
})}
{locationsByComponent.length === 0 && (
- <ComponentSourceSnippetGroupViewer
- branchLike={this.props.branchLike}
- duplications={duplications}
- duplicationsByLine={duplicationsByLine}
- highlightedLocationMessage={this.props.highlightedLocationMessage}
- issue={issue}
- issuePopup={this.state.issuePopup}
- issuesByLine={issuesByComponent[issue.component] || {}}
- isLastOccurenceOfPrimaryComponent={true}
- lastSnippetGroup={true}
- loadDuplications={this.fetchDuplications}
- locations={[]}
- onIssueChange={this.props.onIssueChange}
- onIssueSelect={this.props.onIssueSelect}
- onIssuePopupToggle={this.handleIssuePopupToggle}
- onLocationSelect={this.props.onLocationSelect}
- renderDuplicationPopup={this.renderDuplicationPopup}
- scroll={this.props.scroll}
- snippetGroup={{
- locations: [getPrimaryLocation(issue)],
- ...components[issue.component]
- }}
- />
+ <SourceViewerContext.Provider
+ value={{
+ branchLike: this.props.branchLike,
+ file: components[issue.component].component
+ }}>
+ <ComponentSourceSnippetGroupViewer
+ branchLike={this.props.branchLike}
+ duplications={duplications}
+ duplicationsByLine={duplicationsByLine}
+ highlightedLocationMessage={this.props.highlightedLocationMessage}
+ issue={issue}
+ issuePopup={this.state.issuePopup}
+ issuesByLine={issuesByComponent[issue.component] || {}}
+ isLastOccurenceOfPrimaryComponent={true}
+ lastSnippetGroup={true}
+ loadDuplications={this.fetchDuplications}
+ locations={[]}
+ onIssueChange={this.props.onIssueChange}
+ onIssueSelect={this.props.onIssueSelect}
+ onIssuePopupToggle={this.handleIssuePopupToggle}
+ onLocationSelect={this.props.onLocationSelect}
+ renderDuplicationPopup={this.renderDuplicationPopup}
+ scroll={this.props.scroll}
+ snippetGroup={{
+ locations: [getPrimaryLocation(issue)],
+ ...components[issue.component]
+ }}
+ />
+ </SourceViewerContext.Provider>
)}
</div>
);
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.css b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.css
index 813f73a0555..4f70cddf426 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.css
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.css
@@ -18,8 +18,8 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
.source-viewer-header-slim {
- padding: 4px 10px 4px;
- border-bottom: 1px solid var(--gray80);
+ padding: 4px 10px;
+ border: 1px solid var(--gray80);
background-color: var(--barBackgroundColor);
align-items: center;
min-height: 25px;
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx
index b6a6ac4774f..69b4465cbe1 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeaderSlim.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx
@@ -20,19 +20,19 @@
import classNames from 'classnames';
import * as React from 'react';
import { Link } from 'react-router-dom';
-import { ButtonIcon } from '../../components/controls/buttons';
-import { ClipboardIconButton } from '../../components/controls/clipboard';
-import ExpandSnippetIcon from '../../components/icons/ExpandSnippetIcon';
-import QualifierIcon from '../../components/icons/QualifierIcon';
-import DeferredSpinner from '../../components/ui/DeferredSpinner';
-import { getBranchLikeQuery } from '../../helpers/branch-like';
-import { translate } from '../../helpers/l10n';
-import { collapsedDirFromPath, fileFromPath } from '../../helpers/path';
-import { getBranchLikeUrl, getComponentIssuesUrl, getPathUrlAsString } from '../../helpers/urls';
-import { BranchLike } from '../../types/branch-like';
-import { ComponentQualifier } from '../../types/component';
-import { SourceViewerFile } from '../../types/types';
-import './SourceViewerHeaderSlim.css';
+import { ButtonIcon } from '../../../components/controls/buttons';
+import { ClipboardIconButton } from '../../../components/controls/clipboard';
+import ExpandSnippetIcon from '../../../components/icons/ExpandSnippetIcon';
+import QualifierIcon from '../../../components/icons/QualifierIcon';
+import DeferredSpinner from '../../../components/ui/DeferredSpinner';
+import { getBranchLikeQuery } from '../../../helpers/branch-like';
+import { translate } from '../../../helpers/l10n';
+import { collapsedDirFromPath, fileFromPath } from '../../../helpers/path';
+import { getBranchLikeUrl, getComponentIssuesUrl, getPathUrlAsString } from '../../../helpers/urls';
+import { BranchLike } from '../../../types/branch-like';
+import { ComponentQualifier } from '../../../types/component';
+import { SourceViewerFile } from '../../../types/types';
+import './IssueSourceViewerHeader.css';
export interface Props {
branchLike: BranchLike | undefined;
@@ -44,7 +44,7 @@ export interface Props {
sourceViewerFile: SourceViewerFile;
}
-export default function SourceViewerHeaderSlim(props: Props) {
+export default function IssueSourceViewerHeader(props: Props) {
const {
branchLike,
expandable,
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.css b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.css
index 3f49652df25..b3b151ce897 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.css
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.css
@@ -18,7 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
.snippet {
- margin: var(--gridSize);
+ margin: var(--gridSize) 0;
border: 1px solid var(--gray80);
overflow-x: auto;
overflow-y: hidden;
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeaderSlim-test.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/IssueSourceViewerHeader-test.tsx
index e9b49afdd41..06655111a37 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeaderSlim-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/IssueSourceViewerHeader-test.tsx
@@ -19,10 +19,10 @@
*/
import { shallow } from 'enzyme';
import * as React from 'react';
-import { mockMainBranch } from '../../../helpers/mocks/branch-like';
-import { mockSourceViewerFile } from '../../../helpers/mocks/sources';
-import { ComponentQualifier } from '../../../types/component';
-import SourceViewerHeaderSlim, { Props } from '../SourceViewerHeaderSlim';
+import { mockMainBranch } from '../../../../helpers/mocks/branch-like';
+import { mockSourceViewerFile } from '../../../../helpers/mocks/sources';
+import { ComponentQualifier } from '../../../../types/component';
+import IssueSourceViewerHeader, { Props } from '../IssueSourceViewerHeader';
it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot();
@@ -39,7 +39,7 @@ it('should render correctly', () => {
function shallowRender(props: Partial<Props> = {}) {
return shallow(
- <SourceViewerHeaderSlim
+ <IssueSourceViewerHeader
branchLike={mockMainBranch()}
expandable={true}
onExpand={jest.fn()}
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/ComponentSourceSnippetGroupViewer-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/ComponentSourceSnippetGroupViewer-test.tsx.snap
index 58f647c8012..9825cb22d5c 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/ComponentSourceSnippetGroupViewer-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/ComponentSourceSnippetGroupViewer-test.tsx.snap
@@ -4,7 +4,7 @@ exports[`should render correctly 1`] = `
<div
className="component-source-container"
>
- <SourceViewerHeaderSlim
+ <IssueSourceViewerHeader
branchLike={
Object {
"analysisDate": "2018-01-01",
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeaderSlim-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/IssueSourceViewerHeader-test.tsx.snap
index 0b6e42a0fb3..0b6e42a0fb3 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/__snapshots__/SourceViewerHeaderSlim-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/__snapshots__/IssueSourceViewerHeader-test.tsx.snap
diff --git a/server/sonar-web/src/main/js/apps/issues/styles.css b/server/sonar-web/src/main/js/apps/issues/styles.css
index 0e5328c913b..44e4a054e81 100644
--- a/server/sonar-web/src/main/js/apps/issues/styles.css
+++ b/server/sonar-web/src/main/js/apps/issues/styles.css
@@ -137,10 +137,6 @@
color: white;
}
-.component-source-container {
- border: 1px solid var(--gray80);
-}
-
.component-source-container + .component-source-container {
margin-top: var(--gridSize);
}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewer.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewer.tsx
index 3c43b8ce50b..7f24e85d95d 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewer.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewer.tsx
@@ -60,7 +60,6 @@ import defaultLoadIssues from './helpers/loadIssues';
import SourceViewerCode from './SourceViewerCode';
import { SourceViewerContext } from './SourceViewerContext';
import SourceViewerHeader from './SourceViewerHeader';
-import SourceViewerHeaderSlim from './SourceViewerHeaderSlim';
import './styles.css';
export interface Props {
@@ -92,7 +91,6 @@ export interface Props {
selectedIssue?: string;
showMeasures?: boolean;
metricKey?: string;
- slimHeader?: boolean;
}
interface State {
@@ -605,10 +603,8 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
);
}
- renderHeader(branchLike: BranchLike | undefined, sourceViewerFile: SourceViewerFile) {
- return this.props.slimHeader ? (
- <SourceViewerHeaderSlim branchLike={branchLike} sourceViewerFile={sourceViewerFile} />
- ) : (
+ renderHeader(sourceViewerFile: SourceViewerFile) {
+ return (
<WorkspaceContext.Consumer>
{({ openComponent }) => (
<SourceViewerHeader
@@ -653,7 +649,7 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
return (
<SourceViewerContext.Provider value={{ branchLike: this.props.branchLike, file: component }}>
<div className="source-viewer" ref={node => (this.node = node)}>
- {this.renderHeader(this.props.branchLike, component)}
+ {this.renderHeader(component)}
{sourceRemoved && (
<Alert className="spacer-top" variant="warning">
{translate('code_viewer.no_source_code_displayed_due_to_source_removed')}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx
index e8a35ab3ad9..0039a2b5d3d 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx
@@ -397,7 +397,6 @@ function getSourceViewerUi(override?: Partial<SourceViewer['props']>) {
onLoaded={jest.fn()}
onLocationSelect={jest.fn()}
scroll={jest.fn()}
- slimHeader={true}
{...override}
/>
);