diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/code/components')
11 files changed, 39 insertions, 50 deletions
diff --git a/server/sonar-web/src/main/js/apps/code/components/App.tsx b/server/sonar-web/src/main/js/apps/code/components/App.tsx index e4a25accdc5..9aa8d3a9e97 100644 --- a/server/sonar-web/src/main/js/apps/code/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/App.tsx @@ -26,7 +26,6 @@ import Breadcrumbs from './Breadcrumbs'; import Search from './Search'; import { addComponent, addComponentBreadcrumbs, clearBucket } from '../bucket'; import { retrieveComponentChildren, retrieveComponent, loadMoreChildren } from '../utils'; -import { Breadcrumb, Component, ComponentMeasure, BranchLike, Metric } from '../../../app/types'; import ListFooter from '../../../components/controls/ListFooter'; import SourceViewer from '../../../components/SourceViewer/SourceViewer'; import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; @@ -37,7 +36,7 @@ import { translate } from '../../../helpers/l10n'; import '../code.css'; interface StateToProps { - metrics: { [metric: string]: Metric }; + metrics: { [metric: string]: T.Metric }; } interface DispatchToProps { @@ -45,21 +44,21 @@ interface DispatchToProps { } interface OwnProps { - branchLike?: BranchLike; - component: Component; + branchLike?: T.BranchLike; + component: T.Component; location: { query: { [x: string]: string } }; } type Props = StateToProps & DispatchToProps & OwnProps; interface State { - baseComponent?: ComponentMeasure; - breadcrumbs: Breadcrumb[]; - components?: ComponentMeasure[]; + baseComponent?: T.ComponentMeasure; + breadcrumbs: T.Breadcrumb[]; + components?: T.ComponentMeasure[]; loading: boolean; page: number; - searchResults?: ComponentMeasure[]; - sourceViewer?: ComponentMeasure; + searchResults?: T.ComponentMeasure[]; + sourceViewer?: T.ComponentMeasure; total: number; } diff --git a/server/sonar-web/src/main/js/apps/code/components/Breadcrumbs.tsx b/server/sonar-web/src/main/js/apps/code/components/Breadcrumbs.tsx index c1fca8d200b..5aadebbdb85 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Breadcrumbs.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/Breadcrumbs.tsx @@ -19,12 +19,11 @@ */ import * as React from 'react'; import ComponentName from './ComponentName'; -import { BranchLike, Breadcrumb, ComponentMeasure } from '../../../app/types'; interface Props { - branchLike?: BranchLike; - breadcrumbs: Breadcrumb[]; - rootComponent: ComponentMeasure; + branchLike?: T.BranchLike; + breadcrumbs: T.Breadcrumb[]; + rootComponent: T.ComponentMeasure; } export default function Breadcrumbs({ branchLike, breadcrumbs, rootComponent }: Props) { diff --git a/server/sonar-web/src/main/js/apps/code/components/Component.tsx b/server/sonar-web/src/main/js/apps/code/components/Component.tsx index 81b80ea3591..9352241bd26 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Component.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/Component.tsx @@ -23,19 +23,18 @@ import ComponentName from './ComponentName'; import ComponentMeasure from './ComponentMeasure'; import ComponentLink from './ComponentLink'; import ComponentPin from './ComponentPin'; -import { BranchLike, Metric, ComponentMeasure as IComponentMeasure } from '../../../app/types'; const TOP_OFFSET = 200; const BOTTOM_OFFSET = 10; interface Props { - branchLike?: BranchLike; + branchLike?: T.BranchLike; canBrowse?: boolean; - component: IComponentMeasure; + component: T.ComponentMeasure; isLeak: boolean; - metrics: Metric[]; - previous?: IComponentMeasure; - rootComponent: IComponentMeasure; + metrics: T.Metric[]; + previous?: T.ComponentMeasure; + rootComponent: T.ComponentMeasure; selected?: boolean; } 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 index eb6e931c945..e60a57cc2e9 100644 --- a/server/sonar-web/src/main/js/apps/code/components/ComponentLink.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/ComponentLink.tsx @@ -19,14 +19,13 @@ */ import * as React from 'react'; import { Link } from 'react-router'; -import { BranchLike, ComponentMeasure } from '../../../app/types'; import LinkIcon from '../../../components/icons-components/LinkIcon'; import { translate } from '../../../helpers/l10n'; import { getBranchLikeUrl } from '../../../helpers/urls'; interface Props { - branchLike?: BranchLike; - component: ComponentMeasure; + branchLike?: T.BranchLike; + component: T.ComponentMeasure; } export default function ComponentLink({ component, branchLike }: Props) { diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx index e33ff7e5d68..fdc492f8e1e 100644 --- a/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx @@ -19,13 +19,12 @@ */ import * as React from 'react'; import Measure from '../../../components/measure/Measure'; -import { Metric, ComponentMeasure as IComponentMeasure } from '../../../app/types'; import { isDiffMetric } from '../../../helpers/measures'; import { getLeakValue } from '../../../components/measure/utils'; interface Props { - component: IComponentMeasure; - metric: Metric; + component: T.ComponentMeasure; + metric: T.Metric; } export default function ComponentMeasure({ component, metric }: Props) { diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx index e303cffef93..55a25d0371f 100644 --- a/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx @@ -21,13 +21,12 @@ import * as React from 'react'; import { Link } from 'react-router'; import Truncated from './Truncated'; import * as theme from '../../../app/theme'; -import { BranchLike, ComponentMeasure } from '../../../app/types'; import QualifierIcon from '../../../components/icons-components/QualifierIcon'; import { getBranchLikeQuery } from '../../../helpers/branches'; import LongLivingBranchIcon from '../../../components/icons-components/LongLivingBranchIcon'; import { translate } from '../../../helpers/l10n'; -function getTooltip(component: ComponentMeasure) { +function getTooltip(component: T.ComponentMeasure) { const isFile = component.qualifier === 'FIL' || component.qualifier === 'UTS'; if (isFile && component.path) { return component.path + '\n\n' + component.key; @@ -52,11 +51,11 @@ function mostCommitPrefix(strings: string[]) { } interface Props { - branchLike?: BranchLike; + branchLike?: T.BranchLike; canBrowse?: boolean; - component: ComponentMeasure; - previous?: ComponentMeasure; - rootComponent: ComponentMeasure; + component: T.ComponentMeasure; + previous?: T.ComponentMeasure; + rootComponent: T.ComponentMeasure; } export default function ComponentName(props: Props) { diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx index 24ef4d65621..f486ce21bf3 100644 --- a/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx @@ -19,14 +19,13 @@ */ import * as React from 'react'; import * as PropTypes from 'prop-types'; -import { BranchLike, ComponentMeasure } from '../../../app/types'; import PinIcon from '../../../components/icons-components/PinIcon'; import { WorkspaceContext } from '../../../components/workspace/context'; import { translate } from '../../../helpers/l10n'; interface Props { - branchLike?: BranchLike; - component: ComponentMeasure; + branchLike?: T.BranchLike; + component: T.ComponentMeasure; } export default class ComponentPin extends React.PureComponent<Props> { diff --git a/server/sonar-web/src/main/js/apps/code/components/Components.tsx b/server/sonar-web/src/main/js/apps/code/components/Components.tsx index 2a6bcf6e9f0..c8672d01b7e 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Components.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/Components.tsx @@ -22,16 +22,15 @@ import * as classNames from 'classnames'; import Component from './Component'; import ComponentsEmpty from './ComponentsEmpty'; import ComponentsHeader from './ComponentsHeader'; -import { BranchLike, ComponentMeasure, Metric } from '../../../app/types'; import { getCodeMetrics, showLeakMeasure } from '../utils'; interface Props { - baseComponent?: ComponentMeasure; - branchLike?: BranchLike; - components: ComponentMeasure[]; - metrics: { [metric: string]: Metric }; - rootComponent: ComponentMeasure; - selected?: ComponentMeasure; + baseComponent?: T.ComponentMeasure; + branchLike?: T.BranchLike; + components: T.ComponentMeasure[]; + metrics: { [metric: string]: T.Metric }; + rootComponent: T.ComponentMeasure; + selected?: T.ComponentMeasure; } export default function Components(props: Props) { diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx index 04360721e2d..cf518c06f80 100644 --- a/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx @@ -20,13 +20,12 @@ import * as React from 'react'; import * as classNames from 'classnames'; import { translate } from '../../../helpers/l10n'; -import { ComponentMeasure } from '../../../app/types'; interface Props { - baseComponent?: ComponentMeasure; + baseComponent?: T.ComponentMeasure; isLeak: boolean; metrics: string[]; - rootComponent: ComponentMeasure; + rootComponent: T.ComponentMeasure; } const SHORT_NAME_METRICS = [ diff --git a/server/sonar-web/src/main/js/apps/code/components/Search.tsx b/server/sonar-web/src/main/js/apps/code/components/Search.tsx index 291ff86d533..f8ae8822fd5 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Search.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/Search.tsx @@ -22,22 +22,21 @@ import * as PropTypes from 'prop-types'; import * as classNames from 'classnames'; import Components from './Components'; import { getTree } from '../../../api/components'; -import { BranchLike, ComponentMeasure } from '../../../app/types'; import SearchBox from '../../../components/controls/SearchBox'; import { getBranchLikeQuery } from '../../../helpers/branches'; import { translate } from '../../../helpers/l10n'; import { getProjectUrl } from '../../../helpers/urls'; interface Props { - branchLike?: BranchLike; - component: ComponentMeasure; + branchLike?: T.BranchLike; + component: T.ComponentMeasure; location: {}; } interface State { query: string; loading: boolean; - results?: ComponentMeasure[]; + results?: T.ComponentMeasure[]; selectedIndex?: number; } diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/Components-test.tsx b/server/sonar-web/src/main/js/apps/code/components/__tests__/Components-test.tsx index f2dee8de3cd..c5388d552a7 100644 --- a/server/sonar-web/src/main/js/apps/code/components/__tests__/Components-test.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/__tests__/Components-test.tsx @@ -20,7 +20,6 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import Components from '../Components'; -import { BranchType } from '../../../../app/types'; const COMPONENT = { key: 'foo', name: 'Foo', qualifier: 'TRK' }; const PORTFOLIO = { key: 'bar', name: 'Bar', qualifier: 'VW' }; @@ -29,7 +28,7 @@ const BRANCH = { isMain: false, name: 'feature', mergeBranch: 'master', - type: BranchType.SHORT + type: 'SHORT' }; it('renders correctly', () => { |