aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/about/components
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/apps/about/components')
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/AboutApp.tsx (renamed from server/sonar-web/src/main/js/apps/about/components/AboutApp.js)86
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/AboutCleanCode.tsx (renamed from server/sonar-web/src/main/js/apps/about/components/AboutCleanCode.js)2
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/AboutLanguages.tsx (renamed from server/sonar-web/src/main/js/apps/about/components/AboutLanguages.js)5
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/AboutLeakPeriod.tsx (renamed from server/sonar-web/src/main/js/apps/about/components/AboutLeakPeriod.js)2
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/AboutProjects.tsx (renamed from server/sonar-web/src/main/js/apps/about/components/AboutProjects.js)20
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/AboutQualityGates.tsx (renamed from server/sonar-web/src/main/js/apps/about/components/AboutQualityGates.js)2
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/AboutQualityModel.tsx (renamed from server/sonar-web/src/main/js/apps/about/components/AboutQualityModel.js)2
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/AboutScanners.tsx (renamed from server/sonar-web/src/main/js/apps/about/components/AboutScanners.js)5
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/AboutStandards.tsx (renamed from server/sonar-web/src/main/js/apps/about/components/AboutStandards.js)20
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.tsx (renamed from server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js)26
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/ReadMore.tsx (renamed from server/sonar-web/src/main/js/apps/about/components/ReadMore.js)27
11 files changed, 80 insertions, 117 deletions
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.tsx
index 941db10c50b..40737d5408e 100644
--- a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js
+++ b/server/sonar-web/src/main/js/apps/about/components/AboutApp.tsx
@@ -17,11 +17,11 @@
* 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 * 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';
@@ -34,63 +34,49 @@ 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 {
+ getAppState,
+ getCurrentUser,
+ getGlobalSettingValue,
+ Store
+} from '../../../store/rootReducer';
import { translate } from '../../../helpers/l10n';
import { fetchAboutPageSettings } from '../actions';
-import { isSonarCloud } from '../../../helpers/system';
-import { IssueType } from '../../../app/types';
+import { IssueType, AppState, CurrentUser } 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 }
- };
-*/
+interface Props {
+ appState: Pick<AppState, 'defaultOrganization' | 'organizationsEnabled'>;
+ currentUser: CurrentUser;
+ customText?: { value: string };
+ fetchAboutPageSettings: () => Promise<void>;
+ location: Location;
+}
+
+interface State {
+ issueTypes?: { [key: string]: { count: number } };
+ loading: boolean;
+ projectsCount: number;
+}
+
+class AboutApp extends React.PureComponent<Props, State> {
+ mounted = false;
- state /*: State */ = {
+ 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');
- }
+ this.loadData();
+ document.body.classList.add('white-page');
+ document.documentElement.classList.add('white-page');
}
componentWillUnmount() {
this.mounted = false;
- // $FlowFixMe
document.body.classList.remove('white-page');
- // $FlowFixMe
document.documentElement.classList.remove('white-page');
}
@@ -112,11 +98,7 @@ class AboutApp extends React.PureComponent {
if (this.mounted) {
const [projectsCount, issues] = responses;
const issueTypes = keyBy(issues.facet, 'val');
- this.setState({
- projectsCount,
- issueTypes,
- loading: false
- });
+ this.setState({ projectsCount, issueTypes, loading: false });
}
},
() => {
@@ -131,10 +113,6 @@ class AboutApp extends React.PureComponent {
const { customText } = this.props;
const { loading, issueTypes, projectsCount } = this.state;
- if (isSonarCloud()) {
- return null;
- }
-
let bugs;
let vulnerabilities;
let codeSmells;
@@ -213,13 +191,13 @@ class AboutApp extends React.PureComponent {
}
}
-const mapStateToProps = state => ({
+const mapStateToProps = (state: Store) => ({
appState: getAppState(state),
currentUser: getCurrentUser(state),
customText: getGlobalSettingValue(state, 'sonar.lf.aboutText')
});
-const mapDispatchToProps = { fetchAboutPageSettings };
+const mapDispatchToProps = { fetchAboutPageSettings } as any;
export default connect(
mapStateToProps,
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.tsx
index c98cd4e9d07..29ad172144b 100644
--- a/server/sonar-web/src/main/js/apps/about/components/AboutCleanCode.js
+++ b/server/sonar-web/src/main/js/apps/about/components/AboutCleanCode.tsx
@@ -17,7 +17,7 @@
* 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 * as React from 'react';
import ReadMore from './ReadMore';
import { translate } from '../../../helpers/l10n';
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.tsx
index 1fecd6de905..d770ba01b18 100644
--- a/server/sonar-web/src/main/js/apps/about/components/AboutLanguages.js
+++ b/server/sonar-web/src/main/js/apps/about/components/AboutLanguages.tsx
@@ -17,8 +17,7 @@
* 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 * as React from 'react';
import { translate } from '../../../helpers/l10n';
const languages = [
@@ -56,7 +55,7 @@ export default function AboutLanguages() {
<ul className="about-page-languages">
{languages.slice(0, half).map((language, index) => (
<li key={index}>
- <a href={languages[index].url}>{languages[index].name}</a>
+ <a href={language.url}>{language.name}</a>
<br />
{index + half < languages.length && (
<a href={languages[index + half].url}>{languages[index + half].name}</a>
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.tsx
index 203a2855936..78c3aaa89c2 100644
--- a/server/sonar-web/src/main/js/apps/about/components/AboutLeakPeriod.js
+++ b/server/sonar-web/src/main/js/apps/about/components/AboutLeakPeriod.tsx
@@ -17,7 +17,7 @@
* 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 * as React from 'react';
import ReadMore from './ReadMore';
import { translate } from '../../../helpers/l10n';
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.tsx
index ded5a77736f..81e8065bda8 100644
--- a/server/sonar-web/src/main/js/apps/about/components/AboutProjects.js
+++ b/server/sonar-web/src/main/js/apps/about/components/AboutProjects.tsx
@@ -17,24 +17,22 @@
* 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 * as React from 'react';
import { Link } from 'react-router';
import { formatMeasure } from '../../../helpers/measures';
import { translate } from '../../../helpers/l10n';
-/*::
-type Props = {
- count: number,
- loading: boolean
-};
-*/
+interface Props {
+ count: number;
+ loading: boolean;
+}
-export default function AboutProjects({ count, loading } /*: Props */) {
+export default function AboutProjects({ count, loading }: Props) {
return (
<div className="about-page-projects">
- {loading && <i className="spinner" />}
- {!loading && (
+ {loading ? (
+ <i className="spinner" />
+ ) : (
<div>
<div>
<Link className="about-page-projects-link" to="/projects">
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.tsx
index 2af98417ba5..d89d581114c 100644
--- a/server/sonar-web/src/main/js/apps/about/components/AboutQualityGates.js
+++ b/server/sonar-web/src/main/js/apps/about/components/AboutQualityGates.tsx
@@ -17,7 +17,7 @@
* 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 * as React from 'react';
import ReadMore from './ReadMore';
import { translate } from '../../../helpers/l10n';
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.tsx
index a1fa080202d..322ae44abcc 100644
--- a/server/sonar-web/src/main/js/apps/about/components/AboutQualityModel.js
+++ b/server/sonar-web/src/main/js/apps/about/components/AboutQualityModel.tsx
@@ -17,7 +17,7 @@
* 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 * as React from 'react';
import { translate } from '../../../helpers/l10n';
import BugIcon from '../../../components/icons-components/BugIcon';
import VulnerabilityIcon from '../../../components/icons-components/VulnerabilityIcon';
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.tsx
index 42ad663a7ad..b6f500b669e 100644
--- a/server/sonar-web/src/main/js/apps/about/components/AboutScanners.js
+++ b/server/sonar-web/src/main/js/apps/about/components/AboutScanners.tsx
@@ -17,8 +17,9 @@
* 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 * as React from 'react';
import { translate } from '../../../helpers/l10n';
+import { getBaseUrl } from '../../../helpers/urls';
const scanners = [
{
@@ -59,7 +60,7 @@ export default function AboutScanners() {
<img
alt={translate('about_page.scanners', scanner.key)}
height={60}
- src={`${window.baseUrl}/images/scanner-logos/${scanner.key}.svg`}
+ src={`${getBaseUrl()}/images/scanner-logos/${scanner.key}.svg`}
/>
</a>
))}
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.tsx
index b4624dc821e..07d58182fdb 100644
--- a/server/sonar-web/src/main/js/apps/about/components/AboutStandards.js
+++ b/server/sonar-web/src/main/js/apps/about/components/AboutStandards.tsx
@@ -17,12 +17,13 @@
* 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 * 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';
@@ -30,19 +31,12 @@ 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
- }
-};
-*/
+interface Props {
+ appState: Pick<AppState, 'defaultOrganization' | 'organizationsEnabled'>;
+}
-export default function AboutStandards(props /*: Props */) {
- const organization = props.appState.organizationsEnabled
- ? props.appState.defaultOrganization
- : undefined;
+export default function AboutStandards({ appState }: Props) {
+ const organization = appState.organizationsEnabled ? appState.defaultOrganization : undefined;
return (
<div className="boxed-group">
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.tsx
index b6584777311..5361e0ef438 100644
--- a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js
+++ b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.tsx
@@ -17,8 +17,7 @@
* 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 * as React from 'react';
import { Link } from 'react-router';
import { formatMeasure } from '../../../helpers/measures';
import { translate } from '../../../helpers/l10n';
@@ -28,22 +27,19 @@ import VulnerabilityIcon from '../../../components/icons-components/Vulnerabilit
import CodeSmellIcon from '../../../components/icons-components/CodeSmellIcon';
import { IssueType } from '../../../app/types';
-/*::
-type Props = {
- bugs: ?number,
- codeSmells: ?number,
- loading: boolean,
- vulnerabilities: ?number
-};
-*/
+interface Props {
+ bugs?: number;
+ codeSmells?: number;
+ loading: boolean;
+ vulnerabilities?: number;
+}
-export default function EntryIssueTypes(
- { bugs, codeSmells, loading, vulnerabilities } /*: Props */
-) {
+export default function EntryIssueTypes({ bugs, codeSmells, loading, vulnerabilities }: Props) {
return (
<div className="about-page-projects">
- {loading && <i className="spinner" />}
- {!loading && (
+ {loading ? (
+ <i className="spinner" />
+ ) : (
<table className="about-page-issue-types">
<tbody>
<tr>
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.tsx
index 1024c4407ed..2abbff21e6b 100644
--- a/server/sonar-web/src/main/js/apps/about/components/ReadMore.js
+++ b/server/sonar-web/src/main/js/apps/about/components/ReadMore.tsx
@@ -17,22 +17,19 @@
* 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 * as React from 'react';
import { translate } from '../../../helpers/l10n';
-export default class ReadMore extends React.PureComponent {
- static propTypes = {
- link: PropTypes.string.isRequired
- };
+interface Props {
+ link: string;
+}
- render() {
- return (
- <div className="big-spacer-top">
- <a className="about-page-link-more" href={this.props.link} target="_blank">
- <span>{translate('about_page.read_more')}</span>
- </a>
- </div>
- );
- }
+export default function ReadMore({ link }: Props) {
+ return (
+ <div className="big-spacer-top">
+ <a className="about-page-link-more" href={link} rel="noopener noreferrer" target="_blank">
+ <span>{translate('about_page.read_more')}</span>
+ </a>
+ </div>
+ );
}