]> source.dussan.org Git - sonarqube.git/commitdiff
better rendering of long versions
authorStas Vilchik <stas.vilchik@sonarsource.com>
Wed, 25 Oct 2017 12:26:57 +0000 (14:26 +0200)
committerStas Vilchik <stas.vilchik@sonarsource.com>
Wed, 25 Oct 2017 15:33:29 +0000 (17:33 +0200)
server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.tsx
server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMeta-test.tsx.snap
server/sonar-web/src/main/js/apps/overview/events/Event.js
server/sonar-web/src/main/js/apps/overview/events/__tests__/__snapshots__/Event-test.js.snap
server/sonar-web/src/main/js/apps/overview/styles.css
server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityAnalysesList-test.js.snap
server/sonar-web/src/main/js/apps/projectActivity/components/projectActivity.css

index 43540593843ed036ff3a9ce02c805b1c483d390d..1a2b4bd1cd85b021e11798cb706a338dc6a1e8c9 100644 (file)
@@ -21,7 +21,9 @@ import * as React from 'react';
 import BranchStatus from '../../../../components/common/BranchStatus';
 import { Branch, Component } from '../../../types';
 import DateTimeFormatter from '../../../../components/intl/DateTimeFormatter';
+import Tooltip from '../../../../components/controls/Tooltip';
 import { isShortLivingBranch } from '../../../../helpers/branches';
+import { translate } from '../../../../helpers/l10n';
 
 interface Props {
   branch?: Branch;
@@ -41,7 +43,17 @@ export default function ComponentNavMeta(props: Props) {
   }
 
   if (props.component.version && !shortBranch) {
-    metaList.push(<li key="version">Version {props.component.version}</li>);
+    metaList.push(
+      <li key="version">
+        <Tooltip
+          overlay={`${translate('version')} ${props.component.version}`}
+          mouseEnterDelay={0.5}>
+          <span className="text-limited">
+            {translate('version')} {props.component.version}
+          </span>
+        </Tooltip>
+      </li>
+    );
   }
 
   return (
index 905f83959b16bfa57bce63aa95fa1f32f5895c92..a1dd339dfce14c0256dc20b675311057231e92b7 100644 (file)
@@ -13,8 +13,19 @@ exports[`renders meta for long-living branch 1`] = `
       />
     </li>
     <li>
-      Version 
-      0.0.1
+      <Tooltip
+        mouseEnterDelay={0.5}
+        overlay="version 0.0.1"
+        placement="bottom"
+      >
+        <span
+          className="text-limited"
+        >
+          version
+           
+          0.0.1
+        </span>
+      </Tooltip>
     </li>
   </ul>
 </div>
index becf8b33e5693916729c04edfbe703baf3e9ea41..fa1b09e0af3c379646a54d6801fa35b3e143a930 100644 (file)
@@ -27,7 +27,11 @@ export default function Event(props /*: { event: EventType } */) {
   const { event } = props;
 
   if (event.category === 'VERSION') {
-    return <span className="overview-analysis-event badge">{props.event.name}</span>;
+    return (
+      <Tooltip overlay={`${translate('version')} ${props.event.name}`} mouseEnterDelay={0.5}>
+        <span className="overview-analysis-event badge">{props.event.name}</span>
+      </Tooltip>
+    );
   }
 
   return (
index b14322d6f2ad7706271b3778c0bc273b56920365..f6b5bdfc0e60634d966b01353f5a5d6f00b565d0 100644 (file)
@@ -1,11 +1,17 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
 exports[`should render a version correctly 1`] = `
-<span
-  className="overview-analysis-event badge"
+<Tooltip
+  mouseEnterDelay={0.5}
+  overlay="version 6.5-SNAPSHOT"
+  placement="bottom"
 >
-  6.5-SNAPSHOT
-</span>
+  <span
+    className="overview-analysis-event badge"
+  >
+    6.5-SNAPSHOT
+  </span>
+</Tooltip>
 `;
 
 exports[`should render an event correctly 1`] = `
index 10ee754e0118c1fe789965f67d774a16e3e572f6..8dfefbd5d3c1f0d0bac61b16bf717ca769c7fca9 100644 (file)
 
 .overview-analysis-event.badge {
   vertical-align: middle;
+  /* 260px to match the sidebar width on project dashboard */
+  max-width: 260px;
   padding: 4px 14px;
+  box-sizing: border-box;
   border-radius: 2px;
   font-weight: bold;
   font-size: 12px;
   letter-spacing: 0;
+  overflow: hidden;
+  text-overflow: ellipsis;
 }
 
 .overview-analysis-event + .overview-analysis-event {
index 2b740b2004b12a81e993a61ac41112d28e627cbc..451abec900836bafa7bb1fd6605ddc295471eebe 100644 (file)
@@ -23,6 +23,7 @@ import classNames from 'classnames';
 import { throttle } from 'lodash';
 import ProjectActivityAnalysis from './ProjectActivityAnalysis';
 import DateFormatter from '../../../components/intl/DateFormatter';
+import Tooltip from '../../../components/controls/Tooltip';
 import { translate } from '../../../helpers/l10n';
 import { toShortNotSoISOString } from '../../../helpers/dates';
 import {
@@ -187,7 +188,11 @@ export default class ProjectActivityAnalysesList extends React.PureComponent {
             <li key={version.key || 'noversion'}>
               {version.version && (
                 <div className={classNames('project-activity-version-badge', { first: idx === 0 })}>
-                  <span className="badge">{version.version}</span>
+                  <Tooltip
+                    overlay={`${translate('version')} ${version.version}`}
+                    mouseEnterDelay={0.5}>
+                    <span className="badge">{version.version}</span>
+                  </Tooltip>
                 </div>
               )}
               <ul className="project-activity-days-list">
index 904f0c3a49d48241063c079f6a73c30328099a38..f2a64234ead24b23331153b469567c7439779a24 100644 (file)
@@ -14,11 +14,17 @@ exports[`should correctly filter analyses by category 1`] = `
     <div
       className="project-activity-version-badge first"
     >
-      <span
-        className="badge"
+      <Tooltip
+        mouseEnterDelay={0.5}
+        overlay="version 6.4"
+        placement="bottom"
       >
-        6.4
-      </span>
+        <span
+          className="badge"
+        >
+          6.4
+        </span>
+      </Tooltip>
     </div>
     <ul
       className="project-activity-days-list"
@@ -84,11 +90,17 @@ exports[`should correctly filter analyses by date range 1`] = `
     <div
       className="project-activity-version-badge first"
     >
-      <span
-        className="badge"
+      <Tooltip
+        mouseEnterDelay={0.5}
+        overlay="version 6.5-SNAPSHOT"
+        placement="bottom"
       >
-        6.5-SNAPSHOT
-      </span>
+        <span
+          className="badge"
+        >
+          6.5-SNAPSHOT
+        </span>
+      </Tooltip>
     </div>
     <ul
       className="project-activity-days-list"
@@ -154,11 +166,17 @@ exports[`should render correctly 1`] = `
     <div
       className="project-activity-version-badge first"
     >
-      <span
-        className="badge"
+      <Tooltip
+        mouseEnterDelay={0.5}
+        overlay="version 6.5-SNAPSHOT"
+        placement="bottom"
       >
-        6.5-SNAPSHOT
-      </span>
+        <span
+          className="badge"
+        >
+          6.5-SNAPSHOT
+        </span>
+      </Tooltip>
     </div>
     <ul
       className="project-activity-days-list"
@@ -230,11 +248,17 @@ exports[`should render correctly 1`] = `
     <div
       className="project-activity-version-badge"
     >
-      <span
-        className="badge"
+      <Tooltip
+        mouseEnterDelay={0.5}
+        overlay="version 6.4"
+        placement="bottom"
       >
-        6.4
-      </span>
+        <span
+          className="badge"
+        >
+          6.4
+        </span>
+      </Tooltip>
     </div>
     <ul
       className="project-activity-days-list"
index a2327b5fb26eb36326dc19b76e7d1367753187aa..0df971b5158ce46a99b126ee7e27f97af0868ad7 100644 (file)
 }
 
 .project-activity-version-badge .badge {
+  max-width: 385px;
   vertical-align: middle;
   padding: 4px 14px 4px 14px;
+  box-sizing: border-box;
   border-radius: 0 2px 2px 0;
   font-weight: bold;
   font-size: 12px;
   letter-spacing: 0;
+  overflow: hidden;
+  text-overflow: ellipsis;
 }