diff options
author | philippe-perrin-sonarsource <philippe.perrin@sonarsource.com> | 2022-01-27 11:06:59 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-01-27 20:03:05 +0000 |
commit | dca8354af94e9feb46ea2312857e000aaa232372 (patch) | |
tree | 336b645749ab1fb1b1abdac19a69c70257e98b68 /server/sonar-web/src/main/js/components/activity-graph | |
parent | 85f744be340d8f404978341186dd77cc05584f31 (diff) | |
download | sonarqube-dca8354af94e9feb46ea2312857e000aaa232372.tar.gz sonarqube-dca8354af94e9feb46ea2312857e000aaa232372.zip |
SONAR-15945 Get rid of T namespace in sonar-web
Diffstat (limited to 'server/sonar-web/src/main/js/components/activity-graph')
8 files changed, 20 insertions, 12 deletions
diff --git a/server/sonar-web/src/main/js/components/activity-graph/AddGraphMetric.tsx b/server/sonar-web/src/main/js/components/activity-graph/AddGraphMetric.tsx index 6f50f63de03..7e313936705 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/AddGraphMetric.tsx +++ b/server/sonar-web/src/main/js/components/activity-graph/AddGraphMetric.tsx @@ -24,12 +24,13 @@ import Dropdown from '../../components/controls/Dropdown'; import DropdownIcon from '../../components/icons/DropdownIcon'; import { getLocalizedMetricName, translate } from '../../helpers/l10n'; import { isDiffMetric } from '../../helpers/measures'; +import { Metric } from '../../types/types'; import AddGraphMetricPopup from './AddGraphMetricPopup'; interface Props { addMetric: (metric: string) => void; className?: string; - metrics: T.Metric[]; + metrics: Metric[]; metricsTypeFilter?: string[]; removeMetric: (metric: string) => void; selectedMetrics: string[]; @@ -81,7 +82,7 @@ export default class AddGraphMetric extends React.PureComponent<Props, State> { .map(metric => metric.key); }; - getSelectedMetricsElements = (metrics: T.Metric[], selectedMetrics?: string[]) => { + getSelectedMetricsElements = (metrics: Metric[], selectedMetrics?: string[]) => { const selected = selectedMetrics || this.props.selectedMetrics; return metrics.filter(metric => selected.includes(metric.key)).map(metric => metric.key); }; diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphHistory.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphHistory.tsx index af55a9814a6..ce93bbc2c4d 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/GraphHistory.tsx +++ b/server/sonar-web/src/main/js/components/activity-graph/GraphHistory.tsx @@ -22,12 +22,13 @@ import { AutoSizer } from 'react-virtualized/dist/commonjs/AutoSizer'; import AdvancedTimeline from '../../components/charts/AdvancedTimeline'; import { formatMeasure, getShortType } from '../../helpers/measures'; import { MeasureHistory, Serie } from '../../types/project-activity'; +import { AnalysisEvent } from '../../types/types'; import GraphsLegendCustom from './GraphsLegendCustom'; import GraphsLegendStatic from './GraphsLegendStatic'; import GraphsTooltips from './GraphsTooltips'; interface Props { - events: T.AnalysisEvent[]; + events: AnalysisEvent[]; graph: string; graphEndDate?: Date; graphStartDate?: Date; diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsHeader.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsHeader.tsx index e783b394cef..a2ad51be507 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/GraphsHeader.tsx +++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsHeader.tsx @@ -21,6 +21,7 @@ import classNames from 'classnames'; import * as React from 'react'; import { translate } from '../../helpers/l10n'; import { GraphType } from '../../types/project-activity'; +import { Metric } from '../../types/types'; import SelectLegacy from '../controls/SelectLegacy'; import AddGraphMetric from './AddGraphMetric'; import './styles.css'; @@ -31,7 +32,7 @@ interface Props { className?: string; removeCustomMetric?: (metric: string) => void; graph: GraphType; - metrics: T.Metric[]; + metrics: Metric[]; metricsTypeFilter?: string[]; selectedMetrics?: string[]; updateGraph: (graphType: string) => void; diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsHistory.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsHistory.tsx index 29d351983c5..e4f4894ebd6 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/GraphsHistory.tsx +++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsHistory.tsx @@ -23,12 +23,13 @@ import DeferredSpinner from '../../components/ui/DeferredSpinner'; import { translate } from '../../helpers/l10n'; import { getBaseUrl } from '../../helpers/system'; import { GraphType, MeasureHistory, Serie } from '../../types/project-activity'; +import { ParsedAnalysis } from '../../types/types'; import GraphHistory from './GraphHistory'; import './styles.css'; import { getSeriesMetricType, hasHistoryData, isCustomGraph } from './utils'; interface Props { - analyses: T.ParsedAnalysis[]; + analyses: ParsedAnalysis[]; graph: GraphType; graphs: Serie[][]; graphEndDate?: Date; diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltips.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltips.tsx index 5fefe862278..4e175e2de88 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltips.tsx +++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltips.tsx @@ -21,6 +21,7 @@ import * as React from 'react'; import { Popup, PopupPlacement } from '../../components/ui/popups'; import { isDefined } from '../../helpers/types'; import { MeasureHistory, Serie } from '../../types/project-activity'; +import { AnalysisEvent } from '../../types/types'; import DateTimeFormatter from '../intl/DateTimeFormatter'; import GraphsTooltipsContent from './GraphsTooltipsContent'; import GraphsTooltipsContentCoverage from './GraphsTooltipsContentCoverage'; @@ -30,7 +31,7 @@ import GraphsTooltipsContentIssues from './GraphsTooltipsContentIssues'; import { DEFAULT_GRAPH } from './utils'; interface Props { - events: T.AnalysisEvent[]; + events: AnalysisEvent[]; formatValue: (tick: number | string) => string; graph: string; graphWidth: number; diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentEvents.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentEvents.tsx index 98c07f2dc2c..b905ed858df 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentEvents.tsx +++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentEvents.tsx @@ -19,10 +19,11 @@ */ import * as React from 'react'; import EventInner from '../../apps/projectActivity/components/EventInner'; +import { AnalysisEvent } from '../../types/types'; interface Props { addSeparator: boolean; - events: T.AnalysisEvent[]; + events: AnalysisEvent[]; } export default function GraphsTooltipsContentEvents({ addSeparator, events }: Props) { diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentIssues.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentIssues.tsx index 14bb68e56b9..7b5b4c6dc71 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentIssues.tsx +++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentIssues.tsx @@ -21,6 +21,7 @@ import * as React from 'react'; import ChartLegendIcon from '../../components/icons/ChartLegendIcon'; import Rating from '../../components/ui/Rating'; import { MeasureHistory } from '../../types/project-activity'; +import { Dict } from '../../types/types'; export interface GraphsTooltipsContentIssuesProps { index: number; @@ -31,7 +32,7 @@ export interface GraphsTooltipsContentIssuesProps { value: string; } -const METRIC_RATING: T.Dict<string> = { +const METRIC_RATING: Dict<string> = { bugs: 'reliability_rating', vulnerabilities: 'security_rating', code_smells: 'sqale_rating' diff --git a/server/sonar-web/src/main/js/components/activity-graph/utils.ts b/server/sonar-web/src/main/js/components/activity-graph/utils.ts index c0d44ce9c41..e79c9e4e82f 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/utils.ts +++ b/server/sonar-web/src/main/js/components/activity-graph/utils.ts @@ -23,16 +23,17 @@ import { localizeMetric } from '../../helpers/measures'; import { get, save } from '../../helpers/storage'; import { MetricKey } from '../../types/metrics'; import { GraphType, MeasureHistory, Serie } from '../../types/project-activity'; +import { Dict, Metric } from '../../types/types'; export const DEFAULT_GRAPH = GraphType.issues; -const GRAPHS_METRICS_DISPLAYED: T.Dict<string[]> = { +const GRAPHS_METRICS_DISPLAYED: Dict<string[]> = { [GraphType.issues]: [MetricKey.bugs, MetricKey.code_smells, MetricKey.vulnerabilities], [GraphType.coverage]: [MetricKey.lines_to_cover, MetricKey.uncovered_lines], [GraphType.duplications]: [MetricKey.ncloc, MetricKey.duplicated_lines] }; -const GRAPHS_METRICS: T.Dict<string[]> = { +const GRAPHS_METRICS: Dict<string[]> = { [GraphType.issues]: GRAPHS_METRICS_DISPLAYED[GraphType.issues].concat([ MetricKey.reliability_rating, MetricKey.security_rating, @@ -106,7 +107,7 @@ export function generateCoveredLinesMetric( export function generateSeries( measuresHistory: MeasureHistory[], graph: GraphType, - metrics: T.Metric[] | T.Dict<T.Metric>, + metrics: Metric[] | Dict<Metric>, displayedMetrics: string[] ): Serie[] { if (displayedMetrics.length <= 0 || measuresHistory === undefined) { @@ -158,7 +159,7 @@ export function getActivityGraph( }; } -function findMetric(key: string, metrics: T.Metric[] | T.Dict<T.Metric>) { +function findMetric(key: string, metrics: Metric[] | Dict<Metric>) { if (Array.isArray(metrics)) { return metrics.find(metric => metric.key === key); } |