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/apps/overview | |
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/apps/overview')
33 files changed, 99 insertions, 69 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx b/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx index 163d39c564e..aa70f143472 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx @@ -32,17 +32,18 @@ import { parseDate } from '../../../helpers/dates'; import { translate } from '../../../helpers/l10n'; import { BranchLike } from '../../../types/branch-like'; import { GraphType, MeasureHistory } from '../../../types/project-activity'; +import { Analysis as AnalysisType, Component, Metric } from '../../../types/types'; import Analysis from './Analysis'; export interface ActivityPanelProps { - analyses?: T.Analysis[]; + analyses?: AnalysisType[]; branchLike?: BranchLike; - component: Pick<T.Component, 'key' | 'qualifier'>; + component: Pick<Component, 'key' | 'qualifier'>; graph?: GraphType; leakPeriodDate?: Date; loading?: boolean; measuresHistory: MeasureHistory[]; - metrics: T.Metric[]; + metrics: Metric[]; onGraphChange: (graph: GraphType) => void; } diff --git a/server/sonar-web/src/main/js/apps/overview/branches/Analysis.tsx b/server/sonar-web/src/main/js/apps/overview/branches/Analysis.tsx index 80a7a6274b7..4daeefa495f 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/Analysis.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/Analysis.tsx @@ -22,10 +22,11 @@ import * as React from 'react'; import DateTimeFormatter from '../../../components/intl/DateTimeFormatter'; import { translate } from '../../../helpers/l10n'; import { ComponentQualifier } from '../../../types/component'; +import { Analysis as TypeAnalysis } from '../../../types/types'; import Event from './Event'; export interface AnalysisProps { - analysis: T.Analysis; + analysis: TypeAnalysis; qualifier: string; } diff --git a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverview.tsx b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverview.tsx index 9ab00c04736..ecf8a51dcb5 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverview.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverview.tsx @@ -49,6 +49,7 @@ import { ComponentQualifier } from '../../../types/component'; import { MetricKey } from '../../../types/metrics'; import { GraphType, MeasureHistory } from '../../../types/project-activity'; import { QualityGateStatus, QualityGateStatusCondition } from '../../../types/quality-gates'; +import { Analysis, Component, MeasureEnhanced, Metric, Period } from '../../../types/types'; import '../styles.css'; import { HISTORY_METRICS_LIST, METRICS } from '../utils'; import BranchOverviewRenderer from './BranchOverviewRenderer'; @@ -56,21 +57,21 @@ import BranchOverviewRenderer from './BranchOverviewRenderer'; interface Props { branch?: Branch; branchesEnabled?: boolean; - component: T.Component; + component: Component; projectBinding?: ProjectAlmBindingResponse; } interface State { - analyses?: T.Analysis[]; + analyses?: Analysis[]; appLeak?: ApplicationPeriod; detectedCIOnLastAnalysis?: boolean; graph: GraphType; loadingHistory?: boolean; loadingStatus?: boolean; - measures?: T.MeasureEnhanced[]; + measures?: MeasureEnhanced[]; measuresHistory?: MeasureHistory[]; - metrics?: T.Metric[]; - period?: T.Period; + metrics?: Metric[]; + period?: Period; qgStatuses?: QualityGateStatus[]; } @@ -348,10 +349,7 @@ export default class BranchOverview extends React.PureComponent<Props, State> { ); }; - getFailedConditions = ( - conditions: QualityGateStatusCondition[], - measures: T.MeasureEnhanced[] - ) => { + getFailedConditions = (conditions: QualityGateStatusCondition[], measures: MeasureEnhanced[]) => { return ( conditions .filter(c => c.level !== 'OK') diff --git a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx index d537f7d5d7a..c3be7dbff7e 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx @@ -26,6 +26,7 @@ import { Branch } from '../../../types/branch-like'; import { ComponentQualifier } from '../../../types/component'; import { GraphType, MeasureHistory } from '../../../types/project-activity'; import { QualityGateStatus } from '../../../types/quality-gates'; +import { Analysis, Component, MeasureEnhanced, Metric, Period } from '../../../types/types'; import ActivityPanel from './ActivityPanel'; import FirstAnalysisNextStepsNotif from './FirstAnalysisNextStepsNotif'; import { MeasuresPanel } from './MeasuresPanel'; @@ -33,20 +34,20 @@ import NoCodeWarning from './NoCodeWarning'; import QualityGatePanel from './QualityGatePanel'; export interface BranchOverviewRendererProps { - analyses?: T.Analysis[]; + analyses?: Analysis[]; appLeak?: ApplicationPeriod; branch?: Branch; branchesEnabled?: boolean; - component: T.Component; + component: Component; detectedCIOnLastAnalysis?: boolean; graph?: GraphType; loadingHistory?: boolean; loadingStatus?: boolean; - measures?: T.MeasureEnhanced[]; + measures?: MeasureEnhanced[]; measuresHistory?: MeasureHistory[]; - metrics?: T.Metric[]; + metrics?: Metric[]; onGraphChange: (graph: GraphType) => void; - period?: T.Period; + period?: Period; projectBinding?: ProjectAlmBindingResponse; projectIsEmpty?: boolean; qgStatuses?: QualityGateStatus[]; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/DebtValue.tsx b/server/sonar-web/src/main/js/apps/overview/branches/DebtValue.tsx index abf286bd08f..5a8c51c3a32 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/DebtValue.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/DebtValue.tsx @@ -24,11 +24,12 @@ import { getLocalizedMetricName, translate } from '../../../helpers/l10n'; import { findMeasure, formatMeasure, localizeMetric } from '../../../helpers/measures'; import { BranchLike } from '../../../types/branch-like'; import { MetricKey } from '../../../types/metrics'; +import { Component, MeasureEnhanced } from '../../../types/types'; export interface DebtValueProps { branchLike?: BranchLike; - component: T.Component; - measures: T.MeasureEnhanced[]; + component: Component; + measures: MeasureEnhanced[]; useDiffMetric?: boolean; } diff --git a/server/sonar-web/src/main/js/apps/overview/branches/DrilldownMeasureValue.tsx b/server/sonar-web/src/main/js/apps/overview/branches/DrilldownMeasureValue.tsx index c30a0ca7f04..3a6d201bada 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/DrilldownMeasureValue.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/DrilldownMeasureValue.tsx @@ -23,11 +23,12 @@ import { getLocalizedMetricName } from '../../../helpers/l10n'; import { findMeasure, formatMeasure } from '../../../helpers/measures'; import { BranchLike } from '../../../types/branch-like'; import { MetricKey } from '../../../types/metrics'; +import { Component, MeasureEnhanced } from '../../../types/types'; export interface DrilldownMeasureValueProps { branchLike?: BranchLike; - component: T.Component; - measures: T.MeasureEnhanced[]; + component: Component; + measures: MeasureEnhanced[]; metric: MetricKey; } diff --git a/server/sonar-web/src/main/js/apps/overview/branches/Event.tsx b/server/sonar-web/src/main/js/apps/overview/branches/Event.tsx index ce8440b6d3e..a33b217d70c 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/Event.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/Event.tsx @@ -21,11 +21,12 @@ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import Level from '../../../components/ui/Level'; import { translate } from '../../../helpers/l10n'; +import { AnalysisEvent } from '../../../types/types'; import { isDefinitionChangeEvent } from '../../projectActivity/components/DefinitionChangeEventInner'; import { isRichQualityGateEvent } from '../../projectActivity/components/RichQualityGateEventInner'; interface Props { - event: T.AnalysisEvent; + event: AnalysisEvent; } export function Event({ event }: Props) { diff --git a/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx b/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx index 704d09759bb..5338da91e84 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx @@ -26,12 +26,13 @@ import { translate } from '../../../helpers/l10n'; import { isLoggedIn } from '../../../helpers/users'; import { ProjectAlmBindingResponse } from '../../../types/alm-settings'; import { ComponentQualifier } from '../../../types/component'; +import { Component, CurrentUser } from '../../../types/types'; import { PULL_REQUEST_DECORATION_BINDING_CATEGORY } from '../../settings/components/AdditionalCategoryKeys'; export interface FirstAnalysisNextStepsNotifProps { branchesEnabled?: boolean; - component: T.Component; - currentUser: T.CurrentUser; + component: Component; + currentUser: CurrentUser; detectedCIOnLastAnalysis?: boolean; projectBinding?: ProjectAlmBindingResponse; } diff --git a/server/sonar-web/src/main/js/apps/overview/branches/LeakPeriodInfo.tsx b/server/sonar-web/src/main/js/apps/overview/branches/LeakPeriodInfo.tsx index 53e675c3f67..49b89c3783d 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/LeakPeriodInfo.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/LeakPeriodInfo.tsx @@ -20,11 +20,12 @@ import * as React from 'react'; import { isApplicationPeriod } from '../../../helpers/periods'; import { ApplicationPeriod } from '../../../types/application'; +import { Period } from '../../../types/types'; import ApplicationLeakPeriodInfo from './ApplicationLeakPeriodInfo'; import ProjectLeakPeriodInfo from './ProjectLeakPeriodInfo'; export interface LeakPeriodInfoProps { - leakPeriod: T.Period | ApplicationPeriod; + leakPeriod: Period | ApplicationPeriod; } export function LeakPeriodInfo({ leakPeriod }: LeakPeriodInfoProps) { diff --git a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanel.tsx b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanel.tsx index 4edc3cba36b..dcc39f05b8b 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanel.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanel.tsx @@ -29,6 +29,7 @@ import { Branch } from '../../../types/branch-like'; import { ComponentQualifier } from '../../../types/component'; import { IssueType } from '../../../types/issues'; import { MetricKey } from '../../../types/metrics'; +import { Component, MeasureEnhanced, Period } from '../../../types/types'; import MeasurementLabel from '../components/MeasurementLabel'; import { MeasurementType } from '../utils'; import { DrilldownMeasureValue } from './DrilldownMeasureValue'; @@ -39,10 +40,10 @@ import MeasuresPanelNoNewCode from './MeasuresPanelNoNewCode'; export interface MeasuresPanelProps { appLeak?: ApplicationPeriod; branch?: Branch; - component: T.Component; + component: Component; loading?: boolean; - measures?: T.MeasureEnhanced[]; - period?: T.Period; + measures?: MeasureEnhanced[]; + period?: Period; } export enum MeasuresPanelTabs { diff --git a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelIssueMeasureRow.tsx b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelIssueMeasureRow.tsx index a4abcbd51a2..3f33feb1370 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelIssueMeasureRow.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelIssueMeasureRow.tsx @@ -22,6 +22,7 @@ import { translate } from '../../../helpers/l10n'; import { BranchLike } from '../../../types/branch-like'; import { ComponentQualifier } from '../../../types/component'; import { IssueType } from '../../../types/issues'; +import { Component, MeasureEnhanced } from '../../../types/types'; import IssueLabel from '../components/IssueLabel'; import IssueRating from '../components/IssueRating'; import DebtValue from './DebtValue'; @@ -29,9 +30,9 @@ import SecurityHotspotsReviewed from './SecurityHotspotsReviewed'; export interface MeasuresPanelIssueMeasureRowProps { branchLike?: BranchLike; - component: T.Component; + component: Component; isNewCodeTab: boolean; - measures: T.MeasureEnhanced[]; + measures: MeasureEnhanced[]; type: IssueType; } diff --git a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx index a6eaf3cf941..57532e33143 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx @@ -25,11 +25,12 @@ import { translate } from '../../../helpers/l10n'; import { getBaseUrl } from '../../../helpers/system'; import { Branch } from '../../../types/branch-like'; import { ComponentQualifier } from '../../../types/component'; +import { Component, Period } from '../../../types/types'; export interface MeasuresPanelNoNewCodeProps { branch?: Branch; - component: T.Component; - period?: T.Period; + component: Component; + period?: Period; } export default function MeasuresPanelNoNewCode(props: MeasuresPanelNoNewCodeProps) { diff --git a/server/sonar-web/src/main/js/apps/overview/branches/NoCodeWarning.tsx b/server/sonar-web/src/main/js/apps/overview/branches/NoCodeWarning.tsx index 3c03e6fe6c5..bdf4542e5c5 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/NoCodeWarning.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/NoCodeWarning.tsx @@ -24,11 +24,12 @@ import { translate, translateWithParameters } from '../../../helpers/l10n'; import { BranchLike } from '../../../types/branch-like'; import { ComponentQualifier } from '../../../types/component'; import { MetricKey } from '../../../types/metrics'; +import { Component, MeasureEnhanced } from '../../../types/types'; interface Props { branchLike?: BranchLike; - component: T.Component; - measures?: T.MeasureEnhanced[]; + component: Component; + measures?: MeasureEnhanced[]; } export function NoCodeWarning({ branchLike, component, measures }: Props) { diff --git a/server/sonar-web/src/main/js/apps/overview/branches/ProjectLeakPeriodInfo.tsx b/server/sonar-web/src/main/js/apps/overview/branches/ProjectLeakPeriodInfo.tsx index 1996f07ae95..3e7a6defbd6 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/ProjectLeakPeriodInfo.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/ProjectLeakPeriodInfo.tsx @@ -24,9 +24,10 @@ import DateFromNow from '../../../components/intl/DateFromNow'; import { formatterOption } from '../../../components/intl/DateTimeFormatter'; import { translateWithParameters } from '../../../helpers/l10n'; import { getPeriodDate, getPeriodLabel } from '../../../helpers/periods'; +import { Period } from '../../../types/types'; export interface ProjectLeakPeriodInfoProps extends WrappedComponentProps { - leakPeriod: T.Period; + leakPeriod: Period; } export function ProjectLeakPeriodInfo(props: ProjectLeakPeriodInfoProps) { diff --git a/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx b/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx index 2954827ba40..128d3b0b0fa 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx @@ -25,11 +25,12 @@ import { Alert } from '../../../components/ui/Alert'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { QualityGateStatus } from '../../../types/quality-gates'; +import { Component } from '../../../types/types'; import SonarLintPromotion from '../components/SonarLintPromotion'; import QualityGatePanelSection from './QualityGatePanelSection'; export interface QualityGatePanelProps { - component: Pick<T.Component, 'key' | 'qualifier'>; + component: Pick<Component, 'key' | 'qualifier'>; loading?: boolean; qgStatuses?: QualityGateStatus[]; } diff --git a/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanelSection.tsx b/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanelSection.tsx index 3470d679423..fe441a3bbda 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanelSection.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanelSection.tsx @@ -23,11 +23,12 @@ import { isDiffMetric } from '../../../helpers/measures'; import { BranchLike } from '../../../types/branch-like'; import { ComponentQualifier } from '../../../types/component'; import { QualityGateStatus } from '../../../types/quality-gates'; +import { Component } from '../../../types/types'; import QualityGateConditions from '../components/QualityGateConditions'; export interface QualityGatePanelSectionProps { branchLike?: BranchLike; - component: Pick<T.Component, 'key' | 'qualifier'>; + component: Pick<Component, 'key' | 'qualifier'>; qgStatus: QualityGateStatus; } diff --git a/server/sonar-web/src/main/js/apps/overview/branches/SecurityHotspotsReviewed.tsx b/server/sonar-web/src/main/js/apps/overview/branches/SecurityHotspotsReviewed.tsx index 01840022a22..63ed0c15e5a 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/SecurityHotspotsReviewed.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/SecurityHotspotsReviewed.tsx @@ -23,9 +23,10 @@ import CoverageRating from '../../../components/ui/CoverageRating'; import { translate } from '../../../helpers/l10n'; import { findMeasure, formatMeasure } from '../../../helpers/measures'; import { MetricKey } from '../../../types/metrics'; +import { MeasureEnhanced } from '../../../types/types'; export interface SecurityHotspotsReviewedProps { - measures: T.MeasureEnhanced[]; + measures: MeasureEnhanced[]; useDiffMetric?: boolean; } diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx index 08ef85049dd..bdb0f097d2f 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx @@ -37,6 +37,7 @@ import { waitAndUpdate } from '../../../../helpers/testUtils'; import { ComponentQualifier } from '../../../../types/component'; import { MetricKey } from '../../../../types/metrics'; import { GraphType } from '../../../../types/project-activity'; +import { Measure, Metric } from '../../../../types/types'; import BranchOverview, { BRANCH_OVERVIEW_ACTIVITY_GRAPH, NO_CI_DETECTED } from '../BranchOverview'; import BranchOverviewRenderer from '../BranchOverviewRenderer'; @@ -49,8 +50,8 @@ jest.mock('../../../../api/measures', () => { const { mockMeasure, mockMetric } = jest.requireActual('../../../../helpers/testMocks'); return { getMeasuresWithPeriodAndMetrics: jest.fn((_, metricKeys: string[]) => { - const metrics: T.Metric[] = []; - const measures: T.Measure[] = []; + const metrics: Metric[] = []; + const measures: Measure[] = []; metricKeys.forEach(key => { if (key === 'unknown_metric') { return; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/Event-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/Event-test.tsx index 4a67a46209e..10d651996e7 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/Event-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/Event-test.tsx @@ -19,6 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; +import { AnalysisEvent } from '../../../../types/types'; import { Event } from '../Event'; it('should render an event correctly', () => { @@ -34,7 +35,7 @@ it('should render a version correctly', () => { }); it('should render rich quality gate event', () => { - const event: T.AnalysisEvent = { + const event: AnalysisEvent = { category: 'QUALITY_GATE', key: 'foo1234', name: '', diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ProjectLeakPeriodInfo-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ProjectLeakPeriodInfo-test.tsx index efe108afacd..4f6b86d484c 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ProjectLeakPeriodInfo-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ProjectLeakPeriodInfo-test.tsx @@ -22,6 +22,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { IntlShape } from 'react-intl'; import { mockPeriod } from '../../../../helpers/testMocks'; +import { Period } from '../../../../types/types'; import { ProjectLeakPeriodInfo } from '../ProjectLeakPeriodInfo'; jest.mock('date-fns', () => { @@ -61,7 +62,7 @@ it('should render a more precise date', () => { ).toMatchSnapshot(); }); -function shallowRender(period: Partial<T.Period> = {}) { +function shallowRender(period: Partial<Period> = {}) { return shallow( <ProjectLeakPeriodInfo intl={ diff --git a/server/sonar-web/src/main/js/apps/overview/components/App.tsx b/server/sonar-web/src/main/js/apps/overview/components/App.tsx index e16b7599eb3..d95d2cfff8c 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/App.tsx @@ -26,16 +26,17 @@ import { isPullRequest } from '../../../helpers/branch-like'; import { ProjectAlmBindingResponse } from '../../../types/alm-settings'; import { BranchLike } from '../../../types/branch-like'; import { isPortfolioLike } from '../../../types/component'; +import { AppState, Component } from '../../../types/types'; import BranchOverview from '../branches/BranchOverview'; const EmptyOverview = lazyLoadComponent(() => import('./EmptyOverview')); const PullRequestOverview = lazyLoadComponent(() => import('../pullRequests/PullRequestOverview')); interface Props { - appState: Pick<T.AppState, 'branchesEnabled'>; + appState: Pick<AppState, 'branchesEnabled'>; branchLike?: BranchLike; branchLikes: BranchLike[]; - component: T.Component; + component: Component; isInProgress?: boolean; isPending?: boolean; projectBinding?: ProjectAlmBindingResponse; diff --git a/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx b/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx index 0008d78886f..ac6038393d8 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx @@ -29,12 +29,13 @@ import { getCurrentUser, Store } from '../../../store/rootReducer'; import { ProjectAlmBindingResponse } from '../../../types/alm-settings'; import { BranchLike } from '../../../types/branch-like'; import { ComponentQualifier } from '../../../types/component'; +import { Component, CurrentUser } from '../../../types/types'; export interface EmptyOverviewProps { branchLike?: BranchLike; branchLikes: BranchLike[]; - component: T.Component; - currentUser: T.CurrentUser; + component: Component; + currentUser: CurrentUser; hasAnalyses?: boolean; projectBinding?: ProjectAlmBindingResponse; } diff --git a/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx b/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx index 8a9db10118b..b0a2068eaa9 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx @@ -27,13 +27,14 @@ import { findMeasure, formatMeasure, localizeMetric } from '../../../helpers/mea import { getComponentIssuesUrl, getComponentSecurityHotspotsUrl } from '../../../helpers/urls'; import { BranchLike } from '../../../types/branch-like'; import { IssueType } from '../../../types/issues'; +import { Component, MeasureEnhanced } from '../../../types/types'; import { getIssueIconClass, getIssueMetricKey } from '../utils'; export interface IssueLabelProps { branchLike?: BranchLike; - component: T.Component; + component: Component; helpTooltip?: string; - measures: T.MeasureEnhanced[]; + measures: MeasureEnhanced[]; type: IssueType; useDiffMetric?: boolean; } diff --git a/server/sonar-web/src/main/js/apps/overview/components/IssueRating.tsx b/server/sonar-web/src/main/js/apps/overview/components/IssueRating.tsx index ec85ad822ee..d3238fcbaf8 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/IssueRating.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/IssueRating.tsx @@ -25,12 +25,13 @@ import Rating from '../../../components/ui/Rating'; import { findMeasure } from '../../../helpers/measures'; import { BranchLike } from '../../../types/branch-like'; import { IssueType } from '../../../types/issues'; +import { Component, MeasureEnhanced } from '../../../types/types'; import { getIssueRatingMetricKey, getIssueRatingName } from '../utils'; export interface IssueRatingProps { branchLike?: BranchLike; - component: T.Component; - measures: T.MeasureEnhanced[]; + component: Component; + measures: MeasureEnhanced[]; type: IssueType; useDiffMetric?: boolean; } diff --git a/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.tsx b/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.tsx index c07984784aa..57759228ef1 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.tsx @@ -26,12 +26,13 @@ import DateFromNow from '../../../components/intl/DateFromNow'; import DateTimeFormatter, { formatterOption } from '../../../components/intl/DateTimeFormatter'; import { translateWithParameters } from '../../../helpers/l10n'; import { getPeriodDate, getPeriodLabel } from '../../../helpers/periods'; +import { Dict, Period } from '../../../types/types'; interface Props { - period: T.Period; + period: Period; } -const MODE_INCLUDES_TIME: T.Dict<boolean> = { +const MODE_INCLUDES_TIME: Dict<boolean> = { manual_baseline: true, SPECIFIC_ANALYSIS: true }; diff --git a/server/sonar-web/src/main/js/apps/overview/components/MeasurementLabel.tsx b/server/sonar-web/src/main/js/apps/overview/components/MeasurementLabel.tsx index 5e968b8b893..3ac5219934a 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/MeasurementLabel.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/MeasurementLabel.tsx @@ -24,6 +24,7 @@ import DrilldownLink from '../../../components/shared/DrilldownLink'; import { translate } from '../../../helpers/l10n'; import { findMeasure, formatMeasure } from '../../../helpers/measures'; import { BranchLike } from '../../../types/branch-like'; +import { Component, MeasureEnhanced } from '../../../types/types'; import { getMeasurementIconClass, getMeasurementLabelKeys, @@ -35,8 +36,8 @@ import { interface Props { branchLike?: BranchLike; centered?: boolean; - component: T.Component; - measures: T.MeasureEnhanced[]; + component: Component; + measures: MeasureEnhanced[]; type: MeasurementType; useDiffMetric?: boolean; } diff --git a/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx b/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx index a3a191f3ac4..cecbbdac1f9 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx @@ -35,16 +35,17 @@ import { BranchLike } from '../../../types/branch-like'; import { IssueType } from '../../../types/issues'; import { MetricKey } from '../../../types/metrics'; import { QualityGateStatusConditionEnhanced } from '../../../types/quality-gates'; +import { Component, Dict } from '../../../types/types'; interface Props { branchLike?: BranchLike; - component: Pick<T.Component, 'key'>; + component: Pick<Component, 'key'>; condition: QualityGateStatusConditionEnhanced; } export default class QualityGateCondition extends React.PureComponent<Props> { - getIssuesUrl = (sinceLeakPeriod: boolean, customQuery: T.Dict<string>) => { - const query: T.Dict<string | undefined> = { + getIssuesUrl = (sinceLeakPeriod: boolean, customQuery: Dict<string>) => { + const query: Dict<string | undefined> = { resolved: 'false', ...getBranchLikeQuery(this.props.branchLike), ...customQuery @@ -56,7 +57,7 @@ export default class QualityGateCondition extends React.PureComponent<Props> { }; getUrlForSecurityHotspot(sinceLeakPeriod: boolean) { - const query: T.Dict<string | undefined> = { + const query: Dict<string | undefined> = { ...getBranchLikeQuery(this.props.branchLike) }; if (sinceLeakPeriod) { @@ -96,7 +97,7 @@ export default class QualityGateCondition extends React.PureComponent<Props> { const metricKey = condition.measure.metric.key; - const METRICS_TO_URL_MAPPING: T.Dict<() => Location> = { + const METRICS_TO_URL_MAPPING: Dict<() => Location> = { [MetricKey.reliability_rating]: () => this.getUrlForBugsOrVulnerabilities(IssueType.Bug, false), [MetricKey.new_reliability_rating]: () => diff --git a/server/sonar-web/src/main/js/apps/overview/components/QualityGateConditions.tsx b/server/sonar-web/src/main/js/apps/overview/components/QualityGateConditions.tsx index 77e6323bb87..5cd2452c863 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/QualityGateConditions.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/QualityGateConditions.tsx @@ -24,13 +24,14 @@ import ChevronDownIcon from '../../../components/icons/ChevronDownIcon'; import { translateWithParameters } from '../../../helpers/l10n'; import { BranchLike } from '../../../types/branch-like'; import { QualityGateStatusConditionEnhanced } from '../../../types/quality-gates'; +import { Component } from '../../../types/types'; import QualityGateCondition from './QualityGateCondition'; const LEVEL_ORDER = ['ERROR', 'WARN']; export interface QualityGateConditionsProps { branchLike?: BranchLike; - component: Pick<T.Component, 'key'>; + component: Pick<Component, 'key'>; collapsible?: boolean; failedConditions: QualityGateStatusConditionEnhanced[]; } diff --git a/server/sonar-web/src/main/js/apps/overview/components/SonarLintPromotion.tsx b/server/sonar-web/src/main/js/apps/overview/components/SonarLintPromotion.tsx index 32a6ce2a627..7796778e690 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/SonarLintPromotion.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/SonarLintPromotion.tsx @@ -24,9 +24,10 @@ import SonarLintIcon from '../../../components/icons/SonarLintIcon'; import { translate } from '../../../helpers/l10n'; import { MetricKey } from '../../../types/metrics'; import { QualityGateStatusCondition } from '../../../types/quality-gates'; +import { CurrentUser } from '../../../types/types'; export interface SonarLintPromotionProps { - currentUser: T.CurrentUser; + currentUser: CurrentUser; qgConditions?: QualityGateStatusCondition[]; } diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/LeakPeriodLegend-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/LeakPeriodLegend-test.tsx index 76929c951e9..44a2e8eac02 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/LeakPeriodLegend-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/LeakPeriodLegend-test.tsx @@ -21,6 +21,7 @@ import { differenceInDays } from 'date-fns'; import { shallow } from 'enzyme'; import * as React from 'react'; import { IntlShape } from 'react-intl'; +import { Period } from '../../../../types/types'; import { LeakPeriodLegend } from '../LeakPeriodLegend'; jest.mock('date-fns', () => { @@ -60,7 +61,7 @@ it('should render a more precise date', () => { ).toMatchSnapshot(); }); -function getWrapper(period: Partial<T.Period> = {}) { +function getWrapper(period: Partial<Period> = {}) { return shallow( <LeakPeriodLegend intl={ diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/AfterMergeEstimate.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/AfterMergeEstimate.tsx index 333f4947b1e..437a0499532 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/AfterMergeEstimate.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/AfterMergeEstimate.tsx @@ -21,11 +21,12 @@ import classNames from 'classnames'; import * as React from 'react'; import { translate } from '../../../helpers/l10n'; import { findMeasure, formatMeasure } from '../../../helpers/measures'; +import { MeasureEnhanced } from '../../../types/types'; import { getMeasurementAfterMergeMetricKey, MeasurementType } from '../utils'; export interface AfterMergeEstimateProps { className?: string; - measures: T.MeasureEnhanced[]; + measures: MeasureEnhanced[]; type: MeasurementType; } diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/LargeQualityGateBadge.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/LargeQualityGateBadge.tsx index 307c163b893..e9cc50fa1b1 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/LargeQualityGateBadge.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/LargeQualityGateBadge.tsx @@ -26,10 +26,11 @@ import HelpTooltip from '../../../components/controls/HelpTooltip'; import HelpIcon from '../../../components/icons/HelpIcon'; import { translate } from '../../../helpers/l10n'; import { getQualityGatesUrl, getQualityGateUrl } from '../../../helpers/urls'; +import { Component, Status } from '../../../types/types'; interface Props { - component: T.Component; - level?: T.Status; + component: Component; + level?: Status; } export function LargeQualityGateBadge({ component, level }: Props) { diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestOverview.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestOverview.tsx index d6a0cdcb7ef..270f52aea34 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestOverview.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestOverview.tsx @@ -33,6 +33,7 @@ import { getBranchStatusByBranchLike, Store } from '../../../store/rootReducer'; import { BranchLike, PullRequest } from '../../../types/branch-like'; import { IssueType } from '../../../types/issues'; import { QualityGateStatusCondition } from '../../../types/quality-gates'; +import { Component, MeasureEnhanced, Status } from '../../../types/types'; import IssueLabel from '../components/IssueLabel'; import IssueRating from '../components/IssueRating'; import MeasurementLabel from '../components/MeasurementLabel'; @@ -46,7 +47,7 @@ import LargeQualityGateBadge from './LargeQualityGateBadge'; interface StateProps { conditions?: QualityGateStatusCondition[]; ignoredConditions?: boolean; - status?: T.Status; + status?: Status; } interface DispatchProps { @@ -55,14 +56,14 @@ interface DispatchProps { interface OwnProps { branchLike: PullRequest; - component: T.Component; + component: Component; } type Props = StateProps & DispatchProps & OwnProps; interface State { loading: boolean; - measures: T.MeasureEnhanced[]; + measures: MeasureEnhanced[]; } export class PullRequestOverview extends React.PureComponent<Props, State> { |