]> source.dussan.org Git - sonarqube.git/commitdiff
remove graphics.css
authorStas Vilchik <stas.vilchik@sonarsource.com>
Wed, 2 Jan 2019 11:05:55 +0000 (12:05 +0100)
committerSonarTech <sonartech@sonarsource.com>
Mon, 7 Jan 2019 19:21:00 +0000 (20:21 +0100)
23 files changed:
server/sonar-web/src/main/js/app/styles/components/graphics.css [deleted file]
server/sonar-web/src/main/js/app/styles/sonar.css
server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendCustom.tsx
server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendItem.tsx
server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendStatic.tsx
server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltips.tsx
server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContent.tsx
server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentIssues.tsx
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/GraphsLegendItem-test.tsx
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/GraphsTooltipsContent-test.tsx
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/GraphsTooltipsContentIssues-test.tsx
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsLegendCustom-test.tsx.snap
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsLegendItem-test.tsx.snap
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsLegendStatic-test.tsx.snap
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltips-test.tsx.snap
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContent-test.tsx.snap
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContentIssues-test.tsx.snap
server/sonar-web/src/main/js/components/icons-components/ChartLegendIcon.tsx
server/sonar-web/src/main/js/components/preview-graph/PreviewGraphTooltips.tsx
server/sonar-web/src/main/js/components/preview-graph/PreviewGraphTooltipsContent.tsx
server/sonar-web/src/main/js/components/preview-graph/__tests__/PreviewGraphTooltipsContent-test.tsx
server/sonar-web/src/main/js/components/preview-graph/__tests__/__snapshots__/PreviewGraphTooltips-test.tsx.snap
server/sonar-web/src/main/js/components/preview-graph/__tests__/__snapshots__/PreviewGraphTooltipsContent-test.tsx.snap

diff --git a/server/sonar-web/src/main/js/app/styles/components/graphics.css b/server/sonar-web/src/main/js/app/styles/components/graphics.css
deleted file mode 100644 (file)
index 966a781..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.
- */
-/* TODO remove this file */
-
-.line-chart-legend {
-  color: var(--blue);
-}
-
-.line-chart-legend.line-chart-legend-1 {
-  color: var(--darkBlue);
-}
-
-.line-chart-legend.line-chart-legend-2 {
-  color: #24c6e0;
-}
index 053d384ab3e8be6830e84458dd89d749243ab262..a8676e85ebc9c5acac303f1d67ddce08dda63c1b 100644 (file)
@@ -36,7 +36,6 @@
 @import './components/menu.css';
 @import './components/page.css';
 @import './components/component-name.css';
-@import './components/graphics.css';
 @import './components/list-groups.css';
 @import './components/panels.css';
 @import './components/badges.css';
index b57dca8eb547578c108dc7229f3af818167f438a..4c7524794e482deb3cbf191b649830c20ed29c7c 100644 (file)
@@ -35,11 +35,11 @@ export default function GraphsLegendCustom({ removeMetric, series }: Props) {
         const hasData = hasDataValues(serie);
         const legendItem = (
           <GraphsLegendItem
+            index={idx}
             metric={serie.name}
             name={serie.translatedName}
             removeMetric={removeMetric}
             showWarning={!hasData}
-            style={idx.toString()}
           />
         );
         if (!hasData) {
index d0b9ac2603f51f1c2a0a4b10f649cb476e25b597..7fd415ce9e5a13284bd9da1f2a9f5547b398a1a3 100644 (file)
@@ -27,10 +27,10 @@ import ClearIcon from '../../../components/icons-components/ClearIcon';
 
 interface Props {
   className?: string;
+  index: number;
   metric: string;
   name: string;
   showWarning?: boolean;
-  style: string;
   removeMetric?: (metric: string) => void;
 }
 
@@ -52,12 +52,7 @@ export default class GraphsLegendItem extends React.PureComponent<Props> {
         {this.props.showWarning ? (
           <AlertWarnIcon className="spacer-right" />
         ) : (
-          <ChartLegendIcon
-            className={classNames(
-              'text-middle spacer-right line-chart-legend',
-              'line-chart-legend-' + this.props.style
-            )}
-          />
+          <ChartLegendIcon className="text-middle spacer-right" index={this.props.index} />
         )}
         <span className="text-middle">{this.props.name}</span>
         {isActionable && (
index aa74f13ab4b2c4583cffc4a0aa4515bc7f09482e..f5f3d13f8d350b9160bea5f1e5e52c31da1ccb29 100644 (file)
@@ -31,10 +31,10 @@ export default function GraphsLegendStatic({ series }: Props) {
       {series.map((serie, idx) => (
         <GraphsLegendItem
           className="big-spacer-left big-spacer-right"
+          index={idx}
           key={serie.name}
           metric={serie.name}
           name={serie.translatedName}
-          style={idx.toString()}
         />
       ))}
     </div>
index 903ff4ad639cf855eb6c7ed3420f7c61a5401ac3..31fbc3e5b152b08d9df8293f3b13434d2a135a54 100644 (file)
@@ -54,10 +54,10 @@ export default class GraphsTooltips extends React.PureComponent<Props> {
       if (this.props.graph === DEFAULT_GRAPH) {
         return (
           <GraphsTooltipsContentIssues
+            index={idx}
             key={serie.name}
             measuresHistory={this.props.measuresHistory}
             name={serie.name}
-            style={idx.toString()}
             tooltipIdx={tooltipIdx}
             translatedName={serie.translatedName}
             value={this.props.formatValue(point.y)}
@@ -66,9 +66,9 @@ export default class GraphsTooltips extends React.PureComponent<Props> {
       } else {
         return (
           <GraphsTooltipsContent
+            index={idx}
             key={serie.name}
             name={serie.name}
-            style={idx.toString()}
             translatedName={serie.translatedName}
             value={this.props.formatValue(point.y)}
           />
index e306fdfcc7ac43f4ee118eb908e58420df1da7da..57a62e9229ef05661a3a6ceedd9761a021939cf3 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import * as React from 'react';
-import * as classNames from 'classnames';
 import ChartLegendIcon from '../../../components/icons-components/ChartLegendIcon';
 
 interface Props {
   name: string;
-  style: string;
+  index: number;
   translatedName: string;
   value: string;
 }
 
-export default function GraphsTooltipsContent({ name, style, translatedName, value }: Props) {
+export default function GraphsTooltipsContent({ name, index, translatedName, value }: Props) {
   return (
     <tr className="project-activity-graph-tooltip-line" key={name}>
       <td className="thin">
-        <ChartLegendIcon
-          className={classNames('spacer-right line-chart-legend', 'line-chart-legend-' + style)}
-        />
+        <ChartLegendIcon className="spacer-right" index={index} />
       </td>
       <td className="project-activity-graph-tooltip-value text-right spacer-right thin">{value}</td>
       <td>{translatedName}</td>
index f92dd2494e0bfc500c86ee99e88fc303440b79f7..07a28ff5f70201559bcd7d59e0ed89fe19da3011 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import * as React from 'react';
-import * as classNames from 'classnames';
 import ChartLegendIcon from '../../../components/icons-components/ChartLegendIcon';
 import Rating from '../../../components/ui/Rating';
 import { MeasureHistory } from '../utils';
 
 interface Props {
+  index: number;
   measuresHistory: MeasureHistory[];
   name: string;
-  style: string;
   tooltipIdx: number;
   translatedName: string;
   value: string;
@@ -49,12 +48,7 @@ export default function GraphsTooltipsContentIssues(props: Props) {
   return (
     <tr className="project-activity-graph-tooltip-issues-line" key={props.name}>
       <td className="thin">
-        <ChartLegendIcon
-          className={classNames(
-            'spacer-right line-chart-legend',
-            'line-chart-legend-' + props.style
-          )}
-        />
+        <ChartLegendIcon className="spacer-right" index={props.index} />
       </td>
       <td className="text-right spacer-right">
         <span className="project-activity-graph-tooltip-value">{props.value}</span>
index 5b0f66f360b92c5bb26b21670cba309360150388..ec7433efaf60f630978ca04e06fd385cdf45558d 100644 (file)
@@ -22,7 +22,7 @@ import { shallow } from 'enzyme';
 import GraphsLegendItem from '../GraphsLegendItem';
 
 it('should render correctly a legend', () => {
-  expect(shallow(<GraphsLegendItem metric="bugs" name="Bugs" style="2" />)).toMatchSnapshot();
+  expect(shallow(<GraphsLegendItem index={2} metric="bugs" name="Bugs" />)).toMatchSnapshot();
 });
 
 it('should render correctly an actionable legend', () => {
@@ -30,10 +30,10 @@ it('should render correctly an actionable legend', () => {
     shallow(
       <GraphsLegendItem
         className="myclass"
+        index={1}
         metric="foo"
         name="Foo"
         removeMetric={() => {}}
-        style="1"
       />
     )
   ).toMatchSnapshot();
@@ -42,7 +42,7 @@ it('should render correctly an actionable legend', () => {
 it('should render correctly legends with warning', () => {
   expect(
     shallow(
-      <GraphsLegendItem className="myclass" metric="foo" name="Foo" showWarning={true} style="1" />
+      <GraphsLegendItem className="myclass" index={1} metric="foo" name="Foo" showWarning={true} />
     )
   ).toMatchSnapshot();
 });
index f201d77f389757b2ac89dbb6ba20f491f60d48ab..41c2e49bb3fe8051f3f305a3908adb1e67730b45 100644 (file)
@@ -22,8 +22,8 @@ import { shallow } from 'enzyme';
 import GraphsTooltipsContent from '../GraphsTooltipsContent';
 
 const DEFAULT_PROPS = {
+  index: 1,
   name: 'code_smells',
-  style: '1',
   translatedName: 'Code Smells',
   value: '1.2k'
 };
index f2eab0d58fe4c01cc451b5326b8e85c5f0dff599..8adfb4e854a4e92be68e108131624273bd8ef77f 100644 (file)
@@ -40,9 +40,9 @@ const MEASURES_ISSUES = [
 ];
 
 const DEFAULT_PROPS = {
+  index: 2,
   measuresHistory: MEASURES_ISSUES,
   name: 'bugs',
-  style: '2',
   tooltipIdx: 1,
   translatedName: 'Bugs',
   value: '1.2k'
index 755cda6620b8f9d7a6b01d18ef03f30e05929e9c..230b69d63ac929c41e8c580a5348836a86f0f354 100644 (file)
@@ -9,11 +9,11 @@ exports[`should render correctly the list of series 1`] = `
     key="bugs"
   >
     <GraphsLegendItem
+      index={0}
       metric="bugs"
       name="Bugs"
       removeMetric={[Function]}
       showWarning={false}
-      style="0"
     />
   </span>
   <span
@@ -21,11 +21,11 @@ exports[`should render correctly the list of series 1`] = `
     key="my_metric"
   >
     <GraphsLegendItem
+      index={1}
       metric="my_metric"
       name="My Metric"
       removeMetric={[Function]}
       showWarning={false}
-      style="1"
     />
   </span>
   <Tooltip
@@ -36,11 +36,11 @@ exports[`should render correctly the list of series 1`] = `
       className="spacer-left spacer-right"
     >
       <GraphsLegendItem
+        index={2}
         metric="foo"
         name="Foo"
         removeMetric={[Function]}
         showWarning={true}
-        style="2"
       />
     </span>
   </Tooltip>
index 395dde84e79ad1ed6e58d4bd4cd04726d8f82e15..19d9bb6c1d8962a648809571b8c030127246b273 100644 (file)
@@ -5,7 +5,8 @@ exports[`should render correctly a legend 1`] = `
   className=""
 >
   <ChartLegendIcon
-    className="text-middle spacer-right line-chart-legend line-chart-legend-2"
+    className="text-middle spacer-right"
+    index={2}
   />
   <span
     className="text-middle"
@@ -20,7 +21,8 @@ exports[`should render correctly an actionable legend 1`] = `
   className="project-activity-graph-legend-actionable myclass"
 >
   <ChartLegendIcon
-    className="text-middle spacer-right line-chart-legend line-chart-legend-1"
+    className="text-middle spacer-right"
+    index={1}
   />
   <span
     className="text-middle"
index c8d7df8f28acc96ca1f3901cfc748d66b0b0fbcb..da1d0b847ee343eef79a8415f581ea0dca3171e5 100644 (file)
@@ -6,17 +6,17 @@ exports[`should render correctly the list of series 1`] = `
 >
   <GraphsLegendItem
     className="big-spacer-left big-spacer-right"
+    index={0}
     key="bugs"
     metric="bugs"
     name="Bugs"
-    style="0"
   />
   <GraphsLegendItem
     className="big-spacer-left big-spacer-right"
+    index={1}
     key="code_smells"
     metric="code_smells"
     name="Code Smells"
-    style="1"
   />
 </div>
 `;
index 3089427f9acea67c492b54b8cc405c0752d33f02..65dedadf6b93c9cee89acd618bb51e7a767d6cc3 100644 (file)
@@ -63,28 +63,28 @@ exports[`should render correctly for issues graphs 1`] = `
     >
       <tbody>
         <GraphsTooltipsContentIssues
+          index={0}
           key="bugs"
           measuresHistory={Array []}
           name="bugs"
-          style="0"
           tooltipIdx={0}
           translatedName="Bugs"
           value="Formated.3"
         />
         <GraphsTooltipsContentIssues
+          index={1}
           key="code_smells"
           measuresHistory={Array []}
           name="code_smells"
-          style="1"
           tooltipIdx={0}
           translatedName="Code Smells"
           value="Formated.18"
         />
         <GraphsTooltipsContentIssues
+          index={2}
           key="vulnerabilities"
           measuresHistory={Array []}
           name="vulnerabilities"
-          style="2"
           tooltipIdx={0}
           translatedName="Vulnerabilities"
           value="Formated.0"
@@ -122,23 +122,23 @@ exports[`should render correctly for random graphs 1`] = `
     >
       <tbody>
         <GraphsTooltipsContent
+          index={0}
           key="bugs"
           name="bugs"
-          style="0"
           translatedName="Bugs"
           value="Formated.0"
         />
         <GraphsTooltipsContent
+          index={1}
           key="code_smells"
           name="code_smells"
-          style="1"
           translatedName="Code Smells"
           value="Formated.15"
         />
         <GraphsTooltipsContent
+          index={2}
           key="vulnerabilities"
           name="vulnerabilities"
-          style="2"
           translatedName="Vulnerabilities"
           value="Formated.1"
         />
index 7f818adb4c65401a4281fb2e14a2a73edab3f33f..d7ad675e304576f2044d7c2ed87ef395b31f4a59 100644 (file)
@@ -9,7 +9,8 @@ exports[`should render correctly 1`] = `
     className="thin"
   >
     <ChartLegendIcon
-      className="spacer-right line-chart-legend line-chart-legend-1"
+      className="spacer-right"
+      index={1}
     />
   </td>
   <td
index f5712ca5b762ab2af43f0acf424d7316dd4e68c9..2cb9fd48c09d4b31fb1ff5e137ffbcc51a87cc56 100644 (file)
@@ -9,7 +9,8 @@ exports[`should render correctly 1`] = `
     className="thin"
   >
     <ChartLegendIcon
-      className="spacer-right line-chart-legend line-chart-legend-2"
+      className="spacer-right"
+      index={2}
     />
   </td>
   <td
@@ -41,7 +42,8 @@ exports[`should render correctly when rating data is missing 1`] = `
     className="thin"
   >
     <ChartLegendIcon
-      className="spacer-right line-chart-legend line-chart-legend-2"
+      className="spacer-right"
+      index={2}
     />
   </td>
   <td
index 20023372860d22e69cfc6c9edb81976501d7f132..318715beb6f74f251369f9a1dbbeb986acc614c1 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import * as React from 'react';
-import Icon, { IconProps } from './Icon';
+import Icon from './Icon';
+import * as theme from '../../app/theme';
 
-export default function ChartLegendIcon({ className, fill = 'currentColor', size }: IconProps) {
+interface Props {
+  className?: string;
+  index: number;
+  size?: number;
+}
+
+const COLORS = [theme.blue, theme.darkBlue, '#24c6e0'];
+
+export default function ChartLegendIcon({ className, index, size }: Props) {
+  const fill = COLORS[index] || COLORS[0];
   return (
     <Icon className={className} size={size}>
       <path
index 46c296ed25361d97378c9963ee3f98e54bc32a7c..715eaa29969c0060a419b09bc6cdf36f3bddd4c1 100644 (file)
@@ -64,8 +64,8 @@ export default class PreviewGraphTooltips extends React.PureComponent<Props> {
                 }
                 return (
                   <PreviewGraphTooltipsContent
+                    index={idx}
                     key={serie.name}
-                    style={idx.toString()}
                     translatedName={serie.translatedName}
                     value={this.props.formatValue(point.y)}
                   />
index 75c8498b3564910eff224010f17e815d6d376dc4..987d6375e36d443a6181a0e696b23680a94c2e30 100644 (file)
@@ -21,18 +21,16 @@ import * as React from 'react';
 import ChartLegendIcon from '../icons-components/ChartLegendIcon';
 
 interface Props {
-  style: string;
+  index: number;
   translatedName: string;
   value: string;
 }
 
-export default function PreviewGraphTooltipsContent({ style, translatedName, value }: Props) {
+export default function PreviewGraphTooltipsContent({ index, translatedName, value }: Props) {
   return (
     <tr className="overview-analysis-graph-tooltip-line">
       <td className="thin">
-        <ChartLegendIcon
-          className={'little-spacer-right line-chart-legend line-chart-legend-' + style}
-        />
+        <ChartLegendIcon className="little-spacer-right" index={index} />
       </td>
       <td className="overview-analysis-graph-tooltip-value text-right little-spacer-right thin">
         {value}
index 250655af0ac7d8bdac9ab1fa41147eb952196053..031075f24cf7254e3d59412df874968060e42d3e 100644 (file)
@@ -22,7 +22,7 @@ import { shallow } from 'enzyme';
 import PreviewGraphTooltipsContent from '../PreviewGraphTooltipsContent';
 
 const DEFAULT_PROPS = {
-  style: '1',
+  index: 1,
   translatedName: 'Code Smells',
   value: '1.2k'
 };
index dc7782ee68bced1289a00de73c9a3caa33e37953..3f3e69c14bcb800afc318edb7ab46e86130f3a21 100644 (file)
@@ -28,20 +28,20 @@ exports[`should render correctly 1`] = `
     >
       <tbody>
         <PreviewGraphTooltipsContent
+          index={0}
           key="code_smells"
-          style="0"
           translatedName="Code Smells"
           value="Formated.15"
         />
         <PreviewGraphTooltipsContent
+          index={1}
           key="bugs"
-          style="1"
           translatedName="Bugs"
           value="Formated.0"
         />
         <PreviewGraphTooltipsContent
+          index={2}
           key="vulnerabilities"
-          style="2"
           translatedName="Vulnerabilities"
           value="Formated.1"
         />
index c9c0609799c751bdd9653337cd31bb9402ee08ab..9d4cbadfb976a6316fb7b4ca3e3f97c13d47867b 100644 (file)
@@ -8,7 +8,8 @@ exports[`should render correctly 1`] = `
     className="thin"
   >
     <ChartLegendIcon
-      className="little-spacer-right line-chart-legend line-chart-legend-1"
+      className="little-spacer-right"
+      index={1}
     />
   </td>
   <td