aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/app/components
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/app/components')
-rw-r--r--server/sonar-web/src/main/js/app/components/AdminContainer.tsx15
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/SettingsEditionsNotif.tsx60
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx14
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsEditionsNotif-test.tsx43
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx19
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsEditionsNotif-test.tsx.snap39
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap15
7 files changed, 8 insertions, 197 deletions
diff --git a/server/sonar-web/src/main/js/app/components/AdminContainer.tsx b/server/sonar-web/src/main/js/app/components/AdminContainer.tsx
index fec085b91f2..ea9c6f1301b 100644
--- a/server/sonar-web/src/main/js/app/components/AdminContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/AdminContainer.tsx
@@ -24,20 +24,17 @@ import { connect } from 'react-redux';
import SettingsNav from './nav/settings/SettingsNav';
import { getAppState } from '../../store/rootReducer';
import { getSettingsNavigation } from '../../api/nav';
-import { EditionStatus, getEditionStatus } from '../../api/marketplace';
-import { setAdminPages, setEditionStatus } from '../../store/appState/duck';
+import { setAdminPages } from '../../store/appState/duck';
import { translate } from '../../helpers/l10n';
import { Extension } from '../types';
interface Props {
appState: {
adminPages: Extension[];
- editionStatus?: EditionStatus;
organizationsEnabled: boolean;
};
location: {};
setAdminPages: (adminPages: Extension[]) => void;
- setEditionStatus: (editionStatus: EditionStatus) => void;
}
class AdminContainer extends React.PureComponent<Props> {
@@ -56,17 +53,16 @@ class AdminContainer extends React.PureComponent<Props> {
}
loadData() {
- Promise.all([getSettingsNavigation(), getEditionStatus()]).then(
- ([r, editionStatus]) => {
+ getSettingsNavigation().then(
+ r => {
this.props.setAdminPages(r.extensions);
- this.props.setEditionStatus(editionStatus);
},
() => {}
);
}
render() {
- const { adminPages, editionStatus, organizationsEnabled } = this.props.appState;
+ const { adminPages, organizationsEnabled } = this.props.appState;
// Check that the adminPages are loaded
if (!adminPages) {
@@ -80,7 +76,6 @@ class AdminContainer extends React.PureComponent<Props> {
<Helmet defaultTitle={defaultTitle} titleTemplate={'%s - ' + defaultTitle} />
<SettingsNav
customOrganizations={organizationsEnabled}
- editionStatus={editionStatus}
extensions={adminPages}
location={this.props.location}
/>
@@ -94,6 +89,6 @@ const mapStateToProps = (state: any) => ({
appState: getAppState(state)
});
-const mapDispatchToProps = { setAdminPages, setEditionStatus };
+const mapDispatchToProps = { setAdminPages };
export default connect(mapStateToProps, mapDispatchToProps)(AdminContainer as any);
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsEditionsNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsEditionsNotif.tsx
deleted file mode 100644
index 5df886e38b2..00000000000
--- a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsEditionsNotif.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 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 NavBarNotif from '../../../../components/nav/NavBarNotif';
-import { EditionStatus } from '../../../../api/marketplace';
-import { translate } from '../../../../helpers/l10n';
-
-interface Props {
- editionStatus: EditionStatus;
-}
-
-export default class SettingsEditionsNotif extends React.PureComponent<Props> {
- render() {
- const { editionStatus } = this.props;
-
- if (editionStatus.installationStatus === 'AUTOMATIC_IN_PROGRESS') {
- return (
- <NavBarNotif className="alert alert-info">
- <i className="spinner spacer-right text-bottom" />
- <span>{translate('marketplace.status.AUTOMATIC_IN_PROGRESS')}</span>
- </NavBarNotif>
- );
- } else if (editionStatus.installationStatus === 'AUTOMATIC_READY') {
- return (
- <NavBarNotif className="alert alert-success">
- <span>{translate('marketplace.status.AUTOMATIC_READY')}</span>
- </NavBarNotif>
- );
- } else if (
- ['MANUAL_IN_PROGRESS', 'AUTOMATIC_FAILURE'].includes(editionStatus.installationStatus)
- ) {
- return (
- <NavBarNotif className="alert alert-danger">
- {translate('marketplace.status', editionStatus.installationStatus)}
- <a className="little-spacer-left" href="https://www.sonarsource.com" target="_blank">
- {translate('marketplace.how_to_install')}
- </a>
- </NavBarNotif>
- );
- }
- return null;
- }
-}
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx
index b677146a392..7f7632d6630 100644
--- a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx
@@ -21,14 +21,11 @@ import * as React from 'react';
import * as classNames from 'classnames';
import { IndexLink, Link } from 'react-router';
import ContextNavBar from '../../../../components/nav/ContextNavBar';
-import SettingsEditionsNotif from './SettingsEditionsNotif';
import NavBarTabs from '../../../../components/nav/NavBarTabs';
-import { EditionStatus } from '../../../../api/marketplace';
import { Extension } from '../../../types';
import { translate } from '../../../../helpers/l10n';
interface Props {
- editionStatus?: EditionStatus;
extensions: Extension[];
customOrganizations: boolean;
location: {};
@@ -75,7 +72,7 @@ export default class SettingsNav extends React.PureComponent<Props> {
};
render() {
- const { customOrganizations, editionStatus, extensions } = this.props;
+ const { customOrganizations, extensions } = this.props;
const isSecurity = this.isSecurityActive();
const isProjects = this.isProjectsActive();
const isSystem = this.isSystemActive();
@@ -94,15 +91,8 @@ export default class SettingsNav extends React.PureComponent<Props> {
const hasSupportExtension = extensionsWithoutSupport.length < extensions.length;
- let notifComponent;
- if (editionStatus && editionStatus.installationStatus !== 'NONE') {
- notifComponent = <SettingsEditionsNotif editionStatus={editionStatus} />;
- }
return (
- <ContextNavBar
- id="context-navigation"
- height={notifComponent ? 95 : 65}
- notif={notifComponent}>
+ <ContextNavBar id="context-navigation" height={65}>
<h1 className="navbar-context-header">
<strong>{translate('layout.settings')}</strong>
</h1>
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsEditionsNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsEditionsNotif-test.tsx
deleted file mode 100644
index 55612c06b34..00000000000
--- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsEditionsNotif-test.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 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 { shallow } from 'enzyme';
-import SettingsEditionsNotif from '../SettingsEditionsNotif';
-
-it('should display an in progress notif', () => {
- const wrapper = shallow(
- <SettingsEditionsNotif editionStatus={{ installationStatus: 'AUTOMATIC_IN_PROGRESS' }} />
- );
- expect(wrapper).toMatchSnapshot();
-});
-
-it('should display an error notification', () => {
- const wrapper = shallow(
- <SettingsEditionsNotif editionStatus={{ installationStatus: 'AUTOMATIC_FAILURE' }} />
- );
- expect(wrapper).toMatchSnapshot();
-});
-
-it('should display a ready notification', () => {
- const wrapper = shallow(
- <SettingsEditionsNotif editionStatus={{ installationStatus: 'AUTOMATIC_READY' }} />
- );
- expect(wrapper).toMatchSnapshot();
-});
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx
index f819af90c49..9650ec9f4a9 100644
--- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx
@@ -24,24 +24,7 @@ import SettingsNav from '../SettingsNav';
it('should work with extensions', () => {
const extensions = [{ key: 'foo', name: 'Foo' }];
const wrapper = shallow(
- <SettingsNav
- customOrganizations={false}
- editionStatus={{ installationStatus: 'NONE' }}
- extensions={extensions}
- location={{}}
- />
+ <SettingsNav customOrganizations={false} extensions={extensions} location={{}} />
);
expect(wrapper).toMatchSnapshot();
});
-
-it('should display an edition notification', () => {
- const wrapper = shallow(
- <SettingsNav
- customOrganizations={false}
- editionStatus={{ installationStatus: 'AUTOMATIC_IN_PROGRESS' }}
- extensions={[]}
- location={{}}
- />
- );
- expect({ ...wrapper.find('ContextNavBar').props(), children: [] }).toMatchSnapshot();
-});
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsEditionsNotif-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsEditionsNotif-test.tsx.snap
deleted file mode 100644
index 030ff105e6a..00000000000
--- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsEditionsNotif-test.tsx.snap
+++ /dev/null
@@ -1,39 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should display a ready notification 1`] = `
-<NavBarNotif
- className="alert alert-success"
->
- <span>
- marketplace.status.AUTOMATIC_READY
- </span>
-</NavBarNotif>
-`;
-
-exports[`should display an error notification 1`] = `
-<NavBarNotif
- className="alert alert-danger"
->
- marketplace.status.AUTOMATIC_FAILURE
- <a
- className="little-spacer-left"
- href="https://www.sonarsource.com"
- target="_blank"
- >
- marketplace.how_to_install
- </a>
-</NavBarNotif>
-`;
-
-exports[`should display an in progress notif 1`] = `
-<NavBarNotif
- className="alert alert-info"
->
- <i
- className="spinner spacer-right text-bottom"
- />
- <span>
- marketplace.status.AUTOMATIC_IN_PROGRESS
- </span>
-</NavBarNotif>
-`;
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap
index 9dd9e567752..62c113f24bb 100644
--- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap
+++ b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.tsx.snap
@@ -1,20 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`should display an edition notification 1`] = `
-Object {
- "children": Array [],
- "height": 95,
- "id": "context-navigation",
- "notif": <SettingsEditionsNotif
- editionStatus={
- Object {
- "installationStatus": "AUTOMATIC_IN_PROGRESS",
- }
- }
-/>,
-}
-`;
-
exports[`should work with extensions 1`] = `
<ContextNavBar
height={65}