]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10239 Stop using "External link" icon
authorStas Vilchik <stas.vilchik@sonarsource.com>
Thu, 11 Jan 2018 10:46:20 +0000 (11:46 +0100)
committerStas Vilchik <stas.vilchik@sonarsource.com>
Fri, 12 Jan 2018 16:37:53 +0000 (17:37 +0100)
server/sonar-web/src/main/js/apps/code/components/Component.tsx
server/sonar-web/src/main/js/apps/code/components/ComponentDetach.tsx [deleted file]
server/sonar-web/src/main/js/apps/code/components/ComponentLink.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.js
server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.js
server/sonar-web/src/main/js/components/SourceViewer/styles.css

index f4198dcc0600ab4d45ffdf868b1c663d11360cd1..98bd83e638ba7bded9184fb88d7994afd4e23831 100644 (file)
@@ -21,7 +21,7 @@ import * as classNames from 'classnames';
 import * as React from 'react';
 import ComponentName from './ComponentName';
 import ComponentMeasure from './ComponentMeasure';
-import ComponentDetach from './ComponentDetach';
+import ComponentLink from './ComponentLink';
 import ComponentPin from './ComponentPin';
 import { Component as IComponent } from '../types';
 
@@ -90,7 +90,7 @@ export default class Component extends React.PureComponent<Props> {
           componentAction = <ComponentPin branch={branch} component={component} />;
           break;
         default:
-          componentAction = <ComponentDetach branch={branch} component={component} />;
+          componentAction = <ComponentLink branch={branch} component={component} />;
       }
     }
 
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentDetach.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentDetach.tsx
deleted file mode 100644 (file)
index 0a237c5..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-import * as React from 'react';
-import { Link } from 'react-router';
-import { translate } from '../../../helpers/l10n';
-import { Component } from '../types';
-
-interface Props {
-  branch?: string;
-  component: Component;
-}
-
-export default function ComponentDetach({ component, branch }: Props) {
-  return (
-    <Link
-      to={{ pathname: '/dashboard', query: { branch, id: component.refKey || component.key } }}
-      className="icon-detach"
-      title={translate('code.open_component_page')}
-    />
-  );
-}
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentLink.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentLink.tsx
new file mode 100644 (file)
index 0000000..3074d6c
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+import * as React from 'react';
+import { Link } from 'react-router';
+import { Component } from '../types';
+import LinkIcon from '../../../components/icons-components/LinkIcon';
+import { translate } from '../../../helpers/l10n';
+import { getProjectUrl } from '../../../helpers/urls';
+
+interface Props {
+  branch?: string;
+  component: Component;
+}
+
+export default function ComponentLink({ component, branch }: Props) {
+  return (
+    <Link
+      className="link-no-underline"
+      title={translate('code.open_component_page')}
+      to={getProjectUrl(component.refKey || component.key, branch)}>
+      <LinkIcon />
+    </Link>
+  );
+}
index 38d25a4828687f088a663ac6bea3427aa0acc6ff..033a8bcf66b70749a162b135b16dda8af413effb 100644 (file)
@@ -19,6 +19,8 @@
  */
 // @flow
 import React from 'react';
+import { Link } from 'react-router';
+import LinkIcon from '../../../components/icons-components/LinkIcon';
 import QualifierIcon from '../../../components/icons-components/QualifierIcon';
 import { splitPath } from '../../../helpers/path';
 import { getPathUrlAsString, getProjectUrl } from '../../../helpers/urls';
@@ -50,8 +52,7 @@ export default class ComponentCell extends React.PureComponent {
 
     if (['DIR', 'FIL', 'UTS'].includes(component.qualifier)) {
       const parts = splitPath(component.path);
-      head = parts.head;
-      tail = parts.tail;
+      ({ head, tail } = parts);
     }
     return (
       <span title={component.refKey || component.key}>
@@ -77,15 +78,15 @@ export default class ComponentCell extends React.PureComponent {
               {this.renderInner()}
             </a>
           ) : (
-            <a
-              id={'component-measures-component-link-' + component.key}
+            <Link
               className="link-no-underline"
-              href={getPathUrlAsString(getProjectUrl(component.refKey, branch))}>
+              id={'component-measures-component-link-' + component.key}
+              to={getProjectUrl(component.refKey, branch)}>
               <span className="big-spacer-right">
-                <i className="icon-detach" />
+                <LinkIcon />
               </span>
               {this.renderInner()}
-            </a>
+            </Link>
           )}
         </div>
       </td>
index 53c2f4c2313e2fca6333e0b6c34889f0c7d26ca9..253f8db02ac0b6c72b566666ca5bf86a99cc7388 100644 (file)
@@ -19,6 +19,7 @@
  */
 // @flow
 import React from 'react';
+import { Link } from 'react-router';
 import QualifierIcon from '../shared/QualifierIcon';
 import FavoriteContainer from '../controls/FavoriteContainer';
 import { getPathUrlAsString, getProjectUrl, getComponentIssuesUrl } from '../../helpers/urls';
@@ -179,19 +180,14 @@ export default class SourceViewerHeader extends React.PureComponent {
 
           <div className="source-viewer-header-measure">
             <span className="source-viewer-header-measure-value">
-              <a
-                href={getPathUrlAsString(
-                  getComponentIssuesUrl(project, {
-                    resolved: 'false',
-                    fileUuids: uuid,
-                    branch: this.props.branch
-                  })
-                )}
-                className="source-viewer-header-external-link"
-                target="_blank">
-                {measures.issues != null ? formatMeasure(measures.issues, 'SHORT_INT') : 0}{' '}
-                <i className="icon-detach" />
-              </a>
+              <Link
+                to={getComponentIssuesUrl(project, {
+                  resolved: 'false',
+                  fileUuids: uuid,
+                  branch: this.props.branch
+                })}>
+                {measures.issues != null ? formatMeasure(measures.issues, 'SHORT_INT') : 0}
+              </Link>
             </span>
             <span className="source-viewer-header-measure-label">
               {translate('metric.violations.name')}
index 1387bb7333c14893ed2abb9f56bb89a3ead6eaa6..2c98827855f18cbcf3700502986822804d2dd59e 100644 (file)
   display: block;
   line-height: 18px;
   color: var(--baseFontColor);
-  font-size: 18px;
-  font-weight: 300;
-}
-
-.source-viewer-header-external-link {
-  border-bottom: none;
-}
-
-.source-viewer-header-external-link i {
-  position: relative;
-  top: -4px;
+  font-size: var(--bigFontSize);
 }
 
 .source-viewer-header-actions {