diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2018-12-05 17:32:18 +0100 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-12-05 20:20:59 +0100 |
commit | 41c98779d38bda9fdfdca182a5f20c73fcff9a84 (patch) | |
tree | d895a9f8bfd0276aee5ffacf7bb33a0109436cbd /server/sonar-web/src/main/js/apps/about | |
parent | a9c22c1185c5fd8c8dc4c9388f4a3b967e3f463d (diff) | |
download | sonarqube-41c98779d38bda9fdfdca182a5f20c73fcff9a84.tar.gz sonarqube-41c98779d38bda9fdfdca182a5f20c73fcff9a84.zip |
create global type definitions (#1017)
Diffstat (limited to 'server/sonar-web/src/main/js/apps/about')
5 files changed, 12 insertions, 26 deletions
diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutApp.tsx b/server/sonar-web/src/main/js/apps/about/components/AboutApp.tsx index 752000d6e13..eb452a2ff8b 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutApp.tsx +++ b/server/sonar-web/src/main/js/apps/about/components/AboutApp.tsx @@ -42,12 +42,11 @@ import { } from '../../../store/rootReducer'; import { translate } from '../../../helpers/l10n'; import { fetchAboutPageSettings } from '../actions'; -import { IssueType, AppState, CurrentUser } from '../../../app/types'; import '../styles.css'; interface Props { - appState: Pick<AppState, 'defaultOrganization' | 'organizationsEnabled'>; - currentUser: CurrentUser; + appState: Pick<T.AppState, 'defaultOrganization' | 'organizationsEnabled'>; + currentUser: T.CurrentUser; customText?: string; fetchAboutPageSettings: () => Promise<void>; location: Location; @@ -121,10 +120,9 @@ class AboutApp extends React.PureComponent<Props, State> { let vulnerabilities; let codeSmells; if (!loading && issueTypes) { - bugs = issueTypes[IssueType.Bug] && issueTypes[IssueType.Bug].count; - vulnerabilities = - issueTypes[IssueType.Vulnerability] && issueTypes[IssueType.Vulnerability].count; - codeSmells = issueTypes[IssueType.CodeSmell] && issueTypes[IssueType.CodeSmell].count; + bugs = issueTypes['BUG'] && issueTypes['BUG'].count; + vulnerabilities = issueTypes['VULNERABILITY'] && issueTypes['VULNERABILITY'].count; + codeSmells = issueTypes['CODE_SMELL'] && issueTypes['CODE_SMELL'].count; } return ( diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutStandards.tsx b/server/sonar-web/src/main/js/apps/about/components/AboutStandards.tsx index 07d58182fdb..c0e840db867 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutStandards.tsx +++ b/server/sonar-web/src/main/js/apps/about/components/AboutStandards.tsx @@ -23,7 +23,6 @@ import ReadMore from './ReadMore'; import TagsIcon from '../../../components/icons-components/TagsIcon'; import { translate } from '../../../helpers/l10n'; import { getRulesUrl } from '../../../helpers/urls'; -import { AppState } from '../../../app/types'; const link = 'https://redirect.sonarsource.com/doc/rules.html'; @@ -32,7 +31,7 @@ const owaspTags = const sans25Tags = 'sans-top25-porous,sans-top25-risky,sans-top25-insecure'; interface Props { - appState: Pick<AppState, 'defaultOrganization' | 'organizationsEnabled'>; + appState: Pick<T.AppState, 'defaultOrganization' | 'organizationsEnabled'>; } export default function AboutStandards({ appState }: Props) { diff --git a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.tsx b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.tsx index 5361e0ef438..7010f1ff027 100644 --- a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.tsx +++ b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.tsx @@ -25,7 +25,6 @@ import { getIssuesUrl } from '../../../helpers/urls'; import BugIcon from '../../../components/icons-components/BugIcon'; import VulnerabilityIcon from '../../../components/icons-components/VulnerabilityIcon'; import CodeSmellIcon from '../../../components/icons-components/CodeSmellIcon'; -import { IssueType } from '../../../app/types'; interface Props { bugs?: number; @@ -46,11 +45,7 @@ export default function EntryIssueTypes({ bugs, codeSmells, loading, vulnerabili <td className="about-page-issue-type-number"> <Link className="about-page-issue-type-link" - to={getIssuesUrl({ - resolved: 'false', - types: IssueType.Bug, - s: 'CREATION_DATE' - })}> + to={getIssuesUrl({ resolved: 'false', types: 'BUG', s: 'CREATION_DATE' })}> {formatMeasure(bugs, 'SHORT_INT')} </Link> </td> @@ -67,7 +62,7 @@ export default function EntryIssueTypes({ bugs, codeSmells, loading, vulnerabili className="about-page-issue-type-link" to={getIssuesUrl({ resolved: 'false', - types: IssueType.Vulnerability, + types: 'VULNERABILITY', s: 'CREATION_DATE' })}> {formatMeasure(vulnerabilities, 'SHORT_INT')} @@ -84,11 +79,7 @@ export default function EntryIssueTypes({ bugs, codeSmells, loading, vulnerabili <td className="about-page-issue-type-number"> <Link className="about-page-issue-type-link" - to={getIssuesUrl({ - resolved: 'false', - types: IssueType.CodeSmell, - s: 'CREATION_DATE' - })}> + to={getIssuesUrl({ resolved: 'false', types: 'CODE_SMELL', s: 'CREATION_DATE' })}> {formatMeasure(codeSmells, 'SHORT_INT')} </Link> </td> diff --git a/server/sonar-web/src/main/js/apps/about/sonarcloud/Contact.tsx b/server/sonar-web/src/main/js/apps/about/sonarcloud/Contact.tsx index 9153e103b18..1b9ef436568 100644 --- a/server/sonar-web/src/main/js/apps/about/sonarcloud/Contact.tsx +++ b/server/sonar-web/src/main/js/apps/about/sonarcloud/Contact.tsx @@ -24,7 +24,6 @@ import { Location } from 'history'; import SQPageContainer from './components/SQPageContainer'; import Select from '../../../components/controls/Select'; import { Alert } from '../../../components/ui/Alert'; -import { Organization } from '../../../app/types'; import { isLoggedIn } from '../../../helpers/users'; import './style.css'; @@ -57,7 +56,7 @@ export default class Contact extends React.PureComponent<Props, State> { }; } - getOrganizations = (organizations?: Organization[]) => { + getOrganizations = (organizations?: T.Organization[]) => { return (organizations || []).map(org => ({ label: org.name, value: org.key diff --git a/server/sonar-web/src/main/js/apps/about/sonarcloud/components/SQPageContainer.tsx b/server/sonar-web/src/main/js/apps/about/sonarcloud/components/SQPageContainer.tsx index 97030a220ae..dee101afa87 100644 --- a/server/sonar-web/src/main/js/apps/about/sonarcloud/components/SQPageContainer.tsx +++ b/server/sonar-web/src/main/js/apps/about/sonarcloud/components/SQPageContainer.tsx @@ -22,12 +22,11 @@ import { connect } from 'react-redux'; import { withRouter, WithRouterProps } from 'react-router'; import Footer from './Footer'; import { getCurrentUser, getMyOrganizations, Store } from '../../../../store/rootReducer'; -import { CurrentUser, Organization } from '../../../../app/types'; import GlobalContainer from '../../../../app/components/GlobalContainer'; interface StateProps { - currentUser: CurrentUser; - userOrganizations?: Organization[]; + currentUser: T.CurrentUser; + userOrganizations?: T.Organization[]; } interface OwnProps { |