From: Stas Vilchik Date: Thu, 20 Sep 2018 09:44:42 +0000 (+0200) Subject: rewrite about app in ts X-Git-Tag: 7.5~450 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d5fbab940ffbdc45df0c5a078a340caaf9fea956;p=sonarqube.git rewrite about app in ts --- diff --git a/server/sonar-web/src/main/js/apps/about/actions.js b/server/sonar-web/src/main/js/apps/about/actions.js deleted file mode 100644 index a60d730c30a..00000000000 --- a/server/sonar-web/src/main/js/apps/about/actions.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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. - */ -import { getValues } from '../../api/settings'; -import { receiveValues } from '../settings/store/values/actions'; - -export const fetchAboutPageSettings = () => dispatch => { - const keys = ['sonar.lf.aboutText']; - - return getValues({ keys: keys.join() }).then(values => { - dispatch(receiveValues(values)); - }); -}; diff --git a/server/sonar-web/src/main/js/apps/about/actions.ts b/server/sonar-web/src/main/js/apps/about/actions.ts new file mode 100644 index 00000000000..515d95128db --- /dev/null +++ b/server/sonar-web/src/main/js/apps/about/actions.ts @@ -0,0 +1,31 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 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. + */ +import { Dispatch } from 'redux'; +import { getValues } from '../../api/settings'; +import { receiveValues } from '../settings/store/values/actions'; +import { Store } from '../../store/rootReducer'; + +export const fetchAboutPageSettings = () => (dispatch: Dispatch) => { + const keys = ['sonar.lf.aboutText']; + + return getValues({ keys: keys.join() }).then(values => { + dispatch(receiveValues(values)); + }); +}; diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js b/server/sonar-web/src/main/js/apps/about/components/AboutApp.js deleted file mode 100644 index 941db10c50b..00000000000 --- a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js +++ /dev/null @@ -1,227 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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. - */ -// @flow -import React from 'react'; -import { connect } from 'react-redux'; -import { keyBy } from 'lodash'; -import { Link } from 'react-router'; -import AboutProjects from './AboutProjects'; -import EntryIssueTypes from './EntryIssueTypes'; -import AboutLanguages from './AboutLanguages'; -import AboutCleanCode from './AboutCleanCode'; -import AboutQualityModel from './AboutQualityModel'; -import AboutQualityGates from './AboutQualityGates'; -import AboutLeakPeriod from './AboutLeakPeriod'; -import AboutStandards from './AboutStandards'; -import AboutScanners from './AboutScanners'; -import { searchProjects } from '../../../api/components'; -import { getFacet } from '../../../api/issues'; -import GlobalContainer from '../../../app/components/GlobalContainer'; -import { getAppState, getCurrentUser, getGlobalSettingValue } from '../../../store/rootReducer'; -import { translate } from '../../../helpers/l10n'; -import { fetchAboutPageSettings } from '../actions'; -import { isSonarCloud } from '../../../helpers/system'; -import { IssueType } from '../../../app/types'; -import '../styles.css'; - -/*:: -type State = { - loading: boolean, - projectsCount: number, - issueTypes?: { - [key: string]: ?{ - count: number - } - } -}; -*/ - -class AboutApp extends React.PureComponent { - /*:: mounted: boolean; */ - - /*:: props: { - appState: { - defaultOrganization: string, - organizationsEnabled: boolean - }, - currentUser: { isLoggedIn: boolean }, - customText?: string, - fetchAboutPageSettings: () => Promise<*>, - location: { pathname: string } - }; -*/ - - state /*: State */ = { - loading: true, - projectsCount: 0 - }; - - componentDidMount() { - this.mounted = true; - if (isSonarCloud()) { - window.location = 'https://about.sonarcloud.io'; - } else { - this.loadData(); - // $FlowFixMe - document.body.classList.add('white-page'); - // $FlowFixMe - document.documentElement.classList.add('white-page'); - } - } - - componentWillUnmount() { - this.mounted = false; - // $FlowFixMe - document.body.classList.remove('white-page'); - // $FlowFixMe - document.documentElement.classList.remove('white-page'); - } - - loadProjects() { - return searchProjects({ ps: 1 }).then(r => r.paging.total); - } - - loadIssues() { - return getFacet({ resolved: false }, 'types'); - } - - loadCustomText() { - return this.props.fetchAboutPageSettings(); - } - - loadData() { - Promise.all([this.loadProjects(), this.loadIssues(), this.loadCustomText()]).then( - responses => { - if (this.mounted) { - const [projectsCount, issues] = responses; - const issueTypes = keyBy(issues.facet, 'val'); - this.setState({ - projectsCount, - issueTypes, - loading: false - }); - } - }, - () => { - if (this.mounted) { - this.setState({ loading: false }); - } - } - ); - } - - render() { - const { customText } = this.props; - const { loading, issueTypes, projectsCount } = this.state; - - if (isSonarCloud()) { - return null; - } - - let bugs; - 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; - } - - return ( - -
-
-
-

{translate('layout.sonar.slogan')}

- {!this.props.currentUser.isLoggedIn && ( - - {translate('layout.login')} - - )} - - {translate('about_page.read_documentation')} - -
- -
- - -
-
- - {customText != null && - customText.value && ( -
- )} - - - - - -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- - -
- - ); - } -} - -const mapStateToProps = state => ({ - appState: getAppState(state), - currentUser: getCurrentUser(state), - customText: getGlobalSettingValue(state, 'sonar.lf.aboutText') -}); - -const mapDispatchToProps = { fetchAboutPageSettings }; - -export default connect( - mapStateToProps, - mapDispatchToProps -)(AboutApp); 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 new file mode 100644 index 00000000000..40737d5408e --- /dev/null +++ b/server/sonar-web/src/main/js/apps/about/components/AboutApp.tsx @@ -0,0 +1,205 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 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. + */ +import * as React from 'react'; +import { connect } from 'react-redux'; +import { keyBy } from 'lodash'; +import { Link } from 'react-router'; +import { Location } from 'history'; +import AboutProjects from './AboutProjects'; +import EntryIssueTypes from './EntryIssueTypes'; +import AboutLanguages from './AboutLanguages'; +import AboutCleanCode from './AboutCleanCode'; +import AboutQualityModel from './AboutQualityModel'; +import AboutQualityGates from './AboutQualityGates'; +import AboutLeakPeriod from './AboutLeakPeriod'; +import AboutStandards from './AboutStandards'; +import AboutScanners from './AboutScanners'; +import { searchProjects } from '../../../api/components'; +import { getFacet } from '../../../api/issues'; +import GlobalContainer from '../../../app/components/GlobalContainer'; +import { + getAppState, + getCurrentUser, + getGlobalSettingValue, + Store +} 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; + currentUser: CurrentUser; + customText?: { value: string }; + fetchAboutPageSettings: () => Promise; + location: Location; +} + +interface State { + issueTypes?: { [key: string]: { count: number } }; + loading: boolean; + projectsCount: number; +} + +class AboutApp extends React.PureComponent { + mounted = false; + + state: State = { + loading: true, + projectsCount: 0 + }; + + componentDidMount() { + this.mounted = true; + this.loadData(); + document.body.classList.add('white-page'); + document.documentElement.classList.add('white-page'); + } + + componentWillUnmount() { + this.mounted = false; + document.body.classList.remove('white-page'); + document.documentElement.classList.remove('white-page'); + } + + loadProjects() { + return searchProjects({ ps: 1 }).then(r => r.paging.total); + } + + loadIssues() { + return getFacet({ resolved: false }, 'types'); + } + + loadCustomText() { + return this.props.fetchAboutPageSettings(); + } + + loadData() { + Promise.all([this.loadProjects(), this.loadIssues(), this.loadCustomText()]).then( + responses => { + if (this.mounted) { + const [projectsCount, issues] = responses; + const issueTypes = keyBy(issues.facet, 'val'); + this.setState({ projectsCount, issueTypes, loading: false }); + } + }, + () => { + if (this.mounted) { + this.setState({ loading: false }); + } + } + ); + } + + render() { + const { customText } = this.props; + const { loading, issueTypes, projectsCount } = this.state; + + let bugs; + 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; + } + + return ( + +
+
+
+

{translate('layout.sonar.slogan')}

+ {!this.props.currentUser.isLoggedIn && ( + + {translate('layout.login')} + + )} + + {translate('about_page.read_documentation')} + +
+ +
+ + +
+
+ + {customText != null && + customText.value && ( +
+ )} + + + + + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + +
+ + ); + } +} + +const mapStateToProps = (state: Store) => ({ + appState: getAppState(state), + currentUser: getCurrentUser(state), + customText: getGlobalSettingValue(state, 'sonar.lf.aboutText') +}); + +const mapDispatchToProps = { fetchAboutPageSettings } as any; + +export default connect( + mapStateToProps, + mapDispatchToProps +)(AboutApp); diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutCleanCode.js b/server/sonar-web/src/main/js/apps/about/components/AboutCleanCode.js deleted file mode 100644 index c98cd4e9d07..00000000000 --- a/server/sonar-web/src/main/js/apps/about/components/AboutCleanCode.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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. - */ -import React from 'react'; -import ReadMore from './ReadMore'; -import { translate } from '../../../helpers/l10n'; - -const link = 'https://redirect.sonarsource.com/doc/issues.html'; - -export default function AboutCleanCode() { - return ( -
-

{translate('about_page.clean_code')}

-
-

{translate('about_page.clean_code.text')}

- -
-
- ); -} diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutCleanCode.tsx b/server/sonar-web/src/main/js/apps/about/components/AboutCleanCode.tsx new file mode 100644 index 00000000000..29ad172144b --- /dev/null +++ b/server/sonar-web/src/main/js/apps/about/components/AboutCleanCode.tsx @@ -0,0 +1,36 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 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. + */ +import * as React from 'react'; +import ReadMore from './ReadMore'; +import { translate } from '../../../helpers/l10n'; + +const link = 'https://redirect.sonarsource.com/doc/issues.html'; + +export default function AboutCleanCode() { + return ( +
+

{translate('about_page.clean_code')}

+
+

{translate('about_page.clean_code.text')}

+ +
+
+ ); +} diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutLanguages.js b/server/sonar-web/src/main/js/apps/about/components/AboutLanguages.js deleted file mode 100644 index 1fecd6de905..00000000000 --- a/server/sonar-web/src/main/js/apps/about/components/AboutLanguages.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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. - */ -// @flow -import React from 'react'; -import { translate } from '../../../helpers/l10n'; - -const languages = [ - { name: 'Java', url: 'https://redirect.sonarsource.com/plugins/java.html' }, - { name: 'C/C++', url: 'https://redirect.sonarsource.com/plugins/cpp.html' }, - { name: 'C#', url: 'https://redirect.sonarsource.com/plugins/csharp.html' }, - { name: 'COBOL', url: 'https://redirect.sonarsource.com/plugins/cobol.html' }, - { name: 'ABAP', url: 'https://redirect.sonarsource.com/plugins/abap.html' }, - { name: 'HTML', url: 'https://redirect.sonarsource.com/plugins/web.html' }, - { name: 'RPG', url: 'https://redirect.sonarsource.com/plugins/rpg.html' }, - { name: 'JavaScript', url: 'https://redirect.sonarsource.com/plugins/javascript.html' }, - { name: 'TypeScript', url: 'https://redirect.sonarsource.com/plugins/typescript.html' }, - { name: 'Objective C', url: 'https://redirect.sonarsource.com/plugins/objectivec.html' }, - { name: 'XML', url: 'https://redirect.sonarsource.com/plugins/xml.html' }, - { name: 'VB.NET', url: 'https://redirect.sonarsource.com/plugins/vbnet.html' }, - { name: 'PL/SQL', url: 'https://redirect.sonarsource.com/plugins/plsql.html' }, - { name: 'T-SQL', url: 'https://redirect.sonarsource.com/plugins/tsql.html' }, - { name: 'Flex', url: 'https://redirect.sonarsource.com/plugins/flex.html' }, - { name: 'Python', url: 'https://redirect.sonarsource.com/plugins/python.html' }, - { name: 'Groovy', url: 'https://redirect.sonarsource.com/plugins/groovy.html' }, - { name: 'PHP', url: 'https://redirect.sonarsource.com/plugins/php.html' }, - { name: 'Swift', url: 'https://redirect.sonarsource.com/plugins/swift.html' }, - { name: 'Visual Basic', url: 'https://redirect.sonarsource.com/plugins/vb.html' }, - { name: 'PL/I', url: 'https://redirect.sonarsource.com/plugins/pli.html' } -]; - -const half = (languages.length + 1) / 2; - -export default function AboutLanguages() { - return ( -
-

{translate('about_page.languages')}

-
-

{translate('about_page.languages.text')}

- -
-
- ); -} diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutLanguages.tsx b/server/sonar-web/src/main/js/apps/about/components/AboutLanguages.tsx new file mode 100644 index 00000000000..d770ba01b18 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/about/components/AboutLanguages.tsx @@ -0,0 +1,69 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 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. + */ +import * as React from 'react'; +import { translate } from '../../../helpers/l10n'; + +const languages = [ + { name: 'Java', url: 'https://redirect.sonarsource.com/plugins/java.html' }, + { name: 'C/C++', url: 'https://redirect.sonarsource.com/plugins/cpp.html' }, + { name: 'C#', url: 'https://redirect.sonarsource.com/plugins/csharp.html' }, + { name: 'COBOL', url: 'https://redirect.sonarsource.com/plugins/cobol.html' }, + { name: 'ABAP', url: 'https://redirect.sonarsource.com/plugins/abap.html' }, + { name: 'HTML', url: 'https://redirect.sonarsource.com/plugins/web.html' }, + { name: 'RPG', url: 'https://redirect.sonarsource.com/plugins/rpg.html' }, + { name: 'JavaScript', url: 'https://redirect.sonarsource.com/plugins/javascript.html' }, + { name: 'TypeScript', url: 'https://redirect.sonarsource.com/plugins/typescript.html' }, + { name: 'Objective C', url: 'https://redirect.sonarsource.com/plugins/objectivec.html' }, + { name: 'XML', url: 'https://redirect.sonarsource.com/plugins/xml.html' }, + { name: 'VB.NET', url: 'https://redirect.sonarsource.com/plugins/vbnet.html' }, + { name: 'PL/SQL', url: 'https://redirect.sonarsource.com/plugins/plsql.html' }, + { name: 'T-SQL', url: 'https://redirect.sonarsource.com/plugins/tsql.html' }, + { name: 'Flex', url: 'https://redirect.sonarsource.com/plugins/flex.html' }, + { name: 'Python', url: 'https://redirect.sonarsource.com/plugins/python.html' }, + { name: 'Groovy', url: 'https://redirect.sonarsource.com/plugins/groovy.html' }, + { name: 'PHP', url: 'https://redirect.sonarsource.com/plugins/php.html' }, + { name: 'Swift', url: 'https://redirect.sonarsource.com/plugins/swift.html' }, + { name: 'Visual Basic', url: 'https://redirect.sonarsource.com/plugins/vb.html' }, + { name: 'PL/I', url: 'https://redirect.sonarsource.com/plugins/pli.html' } +]; + +const half = (languages.length + 1) / 2; + +export default function AboutLanguages() { + return ( +
+

{translate('about_page.languages')}

+
+

{translate('about_page.languages.text')}

+ +
+
+ ); +} diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutLeakPeriod.js b/server/sonar-web/src/main/js/apps/about/components/AboutLeakPeriod.js deleted file mode 100644 index 203a2855936..00000000000 --- a/server/sonar-web/src/main/js/apps/about/components/AboutLeakPeriod.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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. - */ -import React from 'react'; -import ReadMore from './ReadMore'; -import { translate } from '../../../helpers/l10n'; - -const link = 'https://redirect.sonarsource.com/doc/fix-the-leak.html'; - -export default function AboutLeakPeriod() { - return ( -
-

{translate('about_page.fix_the_leak')}

-
-

{translate('about_page.fix_the_leak_on_new_code.text')}

- -
-
- ); -} diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutLeakPeriod.tsx b/server/sonar-web/src/main/js/apps/about/components/AboutLeakPeriod.tsx new file mode 100644 index 00000000000..78c3aaa89c2 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/about/components/AboutLeakPeriod.tsx @@ -0,0 +1,36 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 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. + */ +import * as React from 'react'; +import ReadMore from './ReadMore'; +import { translate } from '../../../helpers/l10n'; + +const link = 'https://redirect.sonarsource.com/doc/fix-the-leak.html'; + +export default function AboutLeakPeriod() { + return ( +
+

{translate('about_page.fix_the_leak')}

+
+

{translate('about_page.fix_the_leak_on_new_code.text')}

+ +
+
+ ); +} diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutProjects.js b/server/sonar-web/src/main/js/apps/about/components/AboutProjects.js deleted file mode 100644 index ded5a77736f..00000000000 --- a/server/sonar-web/src/main/js/apps/about/components/AboutProjects.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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. - */ -//@flow -import React from 'react'; -import { Link } from 'react-router'; -import { formatMeasure } from '../../../helpers/measures'; -import { translate } from '../../../helpers/l10n'; - -/*:: -type Props = { - count: number, - loading: boolean -}; -*/ - -export default function AboutProjects({ count, loading } /*: Props */) { - return ( -
- {loading && } - {!loading && ( -
-
- - {formatMeasure(count, 'INT')} - -
-
{translate('about_page.projects_analyzed')}
-
- )} -
- ); -} diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutProjects.tsx b/server/sonar-web/src/main/js/apps/about/components/AboutProjects.tsx new file mode 100644 index 00000000000..81e8065bda8 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/about/components/AboutProjects.tsx @@ -0,0 +1,47 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 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. + */ +import * as React from 'react'; +import { Link } from 'react-router'; +import { formatMeasure } from '../../../helpers/measures'; +import { translate } from '../../../helpers/l10n'; + +interface Props { + count: number; + loading: boolean; +} + +export default function AboutProjects({ count, loading }: Props) { + return ( +
+ {loading ? ( + + ) : ( +
+
+ + {formatMeasure(count, 'INT')} + +
+
{translate('about_page.projects_analyzed')}
+
+ )} +
+ ); +} diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutQualityGates.js b/server/sonar-web/src/main/js/apps/about/components/AboutQualityGates.js deleted file mode 100644 index 2af98417ba5..00000000000 --- a/server/sonar-web/src/main/js/apps/about/components/AboutQualityGates.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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. - */ -import React from 'react'; -import ReadMore from './ReadMore'; -import { translate } from '../../../helpers/l10n'; - -const link = 'https://redirect.sonarsource.com/doc/quality-gates.html'; - -export default function AboutQualityGates() { - return ( -
-

{translate('about_page.quality_gates')}

-
-

{translate('about_page.quality_gates.text')}

- -
-
- ); -} diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutQualityGates.tsx b/server/sonar-web/src/main/js/apps/about/components/AboutQualityGates.tsx new file mode 100644 index 00000000000..d89d581114c --- /dev/null +++ b/server/sonar-web/src/main/js/apps/about/components/AboutQualityGates.tsx @@ -0,0 +1,36 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 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. + */ +import * as React from 'react'; +import ReadMore from './ReadMore'; +import { translate } from '../../../helpers/l10n'; + +const link = 'https://redirect.sonarsource.com/doc/quality-gates.html'; + +export default function AboutQualityGates() { + return ( +
+

{translate('about_page.quality_gates')}

+
+

{translate('about_page.quality_gates.text')}

+ +
+
+ ); +} diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutQualityModel.js b/server/sonar-web/src/main/js/apps/about/components/AboutQualityModel.js deleted file mode 100644 index a1fa080202d..00000000000 --- a/server/sonar-web/src/main/js/apps/about/components/AboutQualityModel.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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. - */ -import React from 'react'; -import { translate } from '../../../helpers/l10n'; -import BugIcon from '../../../components/icons-components/BugIcon'; -import VulnerabilityIcon from '../../../components/icons-components/VulnerabilityIcon'; -import CodeSmellIcon from '../../../components/icons-components/CodeSmellIcon'; - -export default function AboutQualityModel() { - return ( -
-

{translate('about_page.quality_model')}

- -
-
-
-
- -
-

- {translate('issue.type.BUG.plural')}{' '} - {translate('about_page.quality_model.bugs')} -

-
- -
-
- -
-

- {translate('issue.type.VULNERABILITY.plural')}{' '} - {translate('about_page.quality_model.vulnerabilities')} -

-
- -
-
- -
-

- {translate('issue.type.CODE_SMELL.plural')}{' '} - {translate('about_page.quality_model.code_smells')} -

-
-
-
-
- ); -} diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutQualityModel.tsx b/server/sonar-web/src/main/js/apps/about/components/AboutQualityModel.tsx new file mode 100644 index 00000000000..322ae44abcc --- /dev/null +++ b/server/sonar-web/src/main/js/apps/about/components/AboutQualityModel.tsx @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 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. + */ +import * as React from 'react'; +import { translate } from '../../../helpers/l10n'; +import BugIcon from '../../../components/icons-components/BugIcon'; +import VulnerabilityIcon from '../../../components/icons-components/VulnerabilityIcon'; +import CodeSmellIcon from '../../../components/icons-components/CodeSmellIcon'; + +export default function AboutQualityModel() { + return ( +
+

{translate('about_page.quality_model')}

+ +
+
+
+
+ +
+

+ {translate('issue.type.BUG.plural')}{' '} + {translate('about_page.quality_model.bugs')} +

+
+ +
+
+ +
+

+ {translate('issue.type.VULNERABILITY.plural')}{' '} + {translate('about_page.quality_model.vulnerabilities')} +

+
+ +
+
+ +
+

+ {translate('issue.type.CODE_SMELL.plural')}{' '} + {translate('about_page.quality_model.code_smells')} +

+
+
+
+
+ ); +} diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutScanners.js b/server/sonar-web/src/main/js/apps/about/components/AboutScanners.js deleted file mode 100644 index 42ad663a7ad..00000000000 --- a/server/sonar-web/src/main/js/apps/about/components/AboutScanners.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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. - */ -import React from 'react'; -import { translate } from '../../../helpers/l10n'; - -const scanners = [ - { - key: 'sonarqube', - link: 'https://redirect.sonarsource.com/doc/install-configure-scanner.html' - }, - { - key: 'msbuild', - link: 'https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html' - }, - { - key: 'maven', - link: 'https://redirect.sonarsource.com/doc/install-configure-scanner-maven.html' - }, - { - key: 'gradle', - link: 'https://redirect.sonarsource.com/doc/gradle.html' - }, - { - key: 'jenkins', - link: 'https://redirect.sonarsource.com/plugins/jenkins.html' - }, - { - key: 'ant', - link: 'https://redirect.sonarsource.com/doc/install-configure-scanner-ant.html' - } -]; - -export default function AboutScanners() { - return ( -
-

{translate('about_page.scanners')}

-
-

{translate('about_page.scanners.text')}

-
- {scanners.map(scanner => ( - - {translate('about_page.scanners', - - ))} -
-
-
- ); -} diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutScanners.tsx b/server/sonar-web/src/main/js/apps/about/components/AboutScanners.tsx new file mode 100644 index 00000000000..b6f500b669e --- /dev/null +++ b/server/sonar-web/src/main/js/apps/about/components/AboutScanners.tsx @@ -0,0 +1,71 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 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. + */ +import * as React from 'react'; +import { translate } from '../../../helpers/l10n'; +import { getBaseUrl } from '../../../helpers/urls'; + +const scanners = [ + { + key: 'sonarqube', + link: 'https://redirect.sonarsource.com/doc/install-configure-scanner.html' + }, + { + key: 'msbuild', + link: 'https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html' + }, + { + key: 'maven', + link: 'https://redirect.sonarsource.com/doc/install-configure-scanner-maven.html' + }, + { + key: 'gradle', + link: 'https://redirect.sonarsource.com/doc/gradle.html' + }, + { + key: 'jenkins', + link: 'https://redirect.sonarsource.com/plugins/jenkins.html' + }, + { + key: 'ant', + link: 'https://redirect.sonarsource.com/doc/install-configure-scanner-ant.html' + } +]; + +export default function AboutScanners() { + return ( +
+

{translate('about_page.scanners')}

+
+

{translate('about_page.scanners.text')}

+
+ {scanners.map(scanner => ( + + {translate('about_page.scanners', + + ))} +
+
+
+ ); +} diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutStandards.js b/server/sonar-web/src/main/js/apps/about/components/AboutStandards.js deleted file mode 100644 index b4624dc821e..00000000000 --- a/server/sonar-web/src/main/js/apps/about/components/AboutStandards.js +++ /dev/null @@ -1,92 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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. - */ -import React from 'react'; -import { Link } from 'react-router'; -import ReadMore from './ReadMore'; -import TagsIcon from '../../../components/icons-components/TagsIcon'; -import { translate } from '../../../helpers/l10n'; -import { getRulesUrl } from '../../../helpers/urls'; - -const link = 'https://redirect.sonarsource.com/doc/rules.html'; - -const owaspTags = - 'owasp-a1,owasp-a2,owasp-a3,owasp-a4,owasp-a5,owasp-a6,owasp-a7,owasp-a8,owasp-a9,owasp-a10'; -const sans25Tags = 'sans-top25-porous,sans-top25-risky,sans-top25-insecure'; - -/*:: -type Props = { - appState: { - defaultOrganization: string, - organizationsEnabled: boolean - } -}; -*/ - -export default function AboutStandards(props /*: Props */) { - const organization = props.appState.organizationsEnabled - ? props.appState.defaultOrganization - : undefined; - - return ( -
-

{translate('about_page.standards')}

-
-

{translate('about_page.standards.text')}

- -
-
    -
  • - - - MISRA - -
  • -
  • - - - CERT - -
  • -
  • - - - CWE - -
  • -
  • - - - OWASP Top 10 - -
  • -
  • - - - SANS Top 25 - -
  • -
-
- - -
-
- ); -} 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 new file mode 100644 index 00000000000..07d58182fdb --- /dev/null +++ b/server/sonar-web/src/main/js/apps/about/components/AboutStandards.tsx @@ -0,0 +1,86 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 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. + */ +import * as React from 'react'; +import { Link } from 'react-router'; +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'; + +const owaspTags = + 'owasp-a1,owasp-a2,owasp-a3,owasp-a4,owasp-a5,owasp-a6,owasp-a7,owasp-a8,owasp-a9,owasp-a10'; +const sans25Tags = 'sans-top25-porous,sans-top25-risky,sans-top25-insecure'; + +interface Props { + appState: Pick; +} + +export default function AboutStandards({ appState }: Props) { + const organization = appState.organizationsEnabled ? appState.defaultOrganization : undefined; + + return ( +
+

{translate('about_page.standards')}

+
+

{translate('about_page.standards.text')}

+ +
+
    +
  • + + + MISRA + +
  • +
  • + + + CERT + +
  • +
  • + + + CWE + +
  • +
  • + + + OWASP Top 10 + +
  • +
  • + + + SANS Top 25 + +
  • +
+
+ + +
+
+ ); +} diff --git a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js deleted file mode 100644 index b6584777311..00000000000 --- a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js +++ /dev/null @@ -1,111 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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. - */ -//@flow -import React from 'react'; -import { Link } from 'react-router'; -import { formatMeasure } from '../../../helpers/measures'; -import { translate } from '../../../helpers/l10n'; -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'; - -/*:: -type Props = { - bugs: ?number, - codeSmells: ?number, - loading: boolean, - vulnerabilities: ?number -}; -*/ - -export default function EntryIssueTypes( - { bugs, codeSmells, loading, vulnerabilities } /*: Props */ -) { - return ( -
- {loading && } - {!loading && ( - - - - - - - - - - - - - - - -
- - {formatMeasure(bugs, 'SHORT_INT')} - - - - - - {translate('issue.type.BUG.plural')} -
- - {formatMeasure(vulnerabilities, 'SHORT_INT')} - - - - - - {translate('issue.type.VULNERABILITY.plural')} -
- - {formatMeasure(codeSmells, 'SHORT_INT')} - - - - - - {translate('issue.type.CODE_SMELL.plural')} -
- )} -
- ); -} 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 new file mode 100644 index 00000000000..5361e0ef438 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.tsx @@ -0,0 +1,107 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 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. + */ +import * as React from 'react'; +import { Link } from 'react-router'; +import { formatMeasure } from '../../../helpers/measures'; +import { translate } from '../../../helpers/l10n'; +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; + codeSmells?: number; + loading: boolean; + vulnerabilities?: number; +} + +export default function EntryIssueTypes({ bugs, codeSmells, loading, vulnerabilities }: Props) { + return ( +
+ {loading ? ( + + ) : ( + + + + + + + + + + + + + + + +
+ + {formatMeasure(bugs, 'SHORT_INT')} + + + + + + {translate('issue.type.BUG.plural')} +
+ + {formatMeasure(vulnerabilities, 'SHORT_INT')} + + + + + + {translate('issue.type.VULNERABILITY.plural')} +
+ + {formatMeasure(codeSmells, 'SHORT_INT')} + + + + + + {translate('issue.type.CODE_SMELL.plural')} +
+ )} +
+ ); +} diff --git a/server/sonar-web/src/main/js/apps/about/components/ReadMore.js b/server/sonar-web/src/main/js/apps/about/components/ReadMore.js deleted file mode 100644 index 1024c4407ed..00000000000 --- a/server/sonar-web/src/main/js/apps/about/components/ReadMore.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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. - */ -import React from 'react'; -import PropTypes from 'prop-types'; -import { translate } from '../../../helpers/l10n'; - -export default class ReadMore extends React.PureComponent { - static propTypes = { - link: PropTypes.string.isRequired - }; - - render() { - return ( - - ); - } -} diff --git a/server/sonar-web/src/main/js/apps/about/components/ReadMore.tsx b/server/sonar-web/src/main/js/apps/about/components/ReadMore.tsx new file mode 100644 index 00000000000..2abbff21e6b --- /dev/null +++ b/server/sonar-web/src/main/js/apps/about/components/ReadMore.tsx @@ -0,0 +1,35 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 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. + */ +import * as React from 'react'; +import { translate } from '../../../helpers/l10n'; + +interface Props { + link: string; +} + +export default function ReadMore({ link }: Props) { + return ( + + ); +} diff --git a/server/sonar-web/src/main/js/apps/settings/store/values/actions.js b/server/sonar-web/src/main/js/apps/settings/store/values/actions.js deleted file mode 100644 index 0da9d1b6bff..00000000000 --- a/server/sonar-web/src/main/js/apps/settings/store/values/actions.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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. - */ -// @flow -/*:: import type { SettingValue } from '../../types'; */ - -export const RECEIVE_VALUES /*: string */ = 'RECEIVE_VALUES'; - -/** - * Receive settings action creator - * @param {Array} settings - * @returns {Object} - */ -export const receiveValues = (settings /*: SettingValue[] */, componentKey /*: ?string */) => ({ - type: RECEIVE_VALUES, - settings, - componentKey -}); diff --git a/server/sonar-web/src/main/js/apps/settings/store/values/actions.ts b/server/sonar-web/src/main/js/apps/settings/store/values/actions.ts new file mode 100644 index 00000000000..a7d6f8f30a8 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/settings/store/values/actions.ts @@ -0,0 +1,29 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 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. + */ +interface SettingValue { + key: string; + value?: string; +} + +export const RECEIVE_VALUES = 'RECEIVE_VALUES'; + +export function receiveValues(settings: SettingValue[], componentKey?: string) { + return { type: RECEIVE_VALUES, settings, componentKey }; +}