From a9e4c05ba0af80a7c8c7c46b1e7a3d4b8574e034 Mon Sep 17 00:00:00 2001 From: Ambroise C Date: Thu, 4 Jan 2024 18:56:00 +0100 Subject: SONAR-21398 Migrate maintenance and setup pages to MIUI --- .../main/js/apps/maintenance/components/App.tsx | 166 +++++++++++---------- .../src/main/js/apps/maintenance/styles.css | 38 ----- 2 files changed, 89 insertions(+), 115 deletions(-) delete mode 100644 server/sonar-web/src/main/js/apps/maintenance/styles.css (limited to 'server/sonar-web/src/main/js/apps/maintenance') diff --git a/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx b/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx index 77afea7e4bd..dac43387268 100644 --- a/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx @@ -17,21 +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 classNames from 'classnames'; +import styled from '@emotion/styled'; +import { ButtonPrimary, Link, Title, themeBorder } from 'design-system'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { FormattedMessage } from 'react-intl'; import { getMigrationStatus, getSystemStatus, migrateDatabase } from '../../../api/system'; -import DocLink from '../../../components/common/DocLink'; +import DocumentationLink from '../../../components/common/DocumentationLink'; import InstanceMessage from '../../../components/common/InstanceMessage'; -import Link from '../../../components/common/Link'; -import { Button } from '../../../components/controls/buttons'; import DateFromNow from '../../../components/intl/DateFromNow'; import TimeFormatter from '../../../components/intl/TimeFormatter'; import { translate } from '../../../helpers/l10n'; import { getBaseUrl } from '../../../helpers/system'; import { getReturnUrl } from '../../../helpers/urls'; -import '../styles.css'; interface Props { location: { query?: { return_to?: string } }; @@ -61,7 +59,7 @@ export default class App extends React.PureComponent { componentWillUnmount() { this.mounted = false; - if (this.interval) { + if (this.interval !== undefined) { window.clearInterval(this.interval); } } @@ -140,73 +138,68 @@ export default class App extends React.PureComponent { <>
-
+ {status === 'OFFLINE' && ( <> -

+ -

-

+ + {translate('maintenance.sonarqube_is_offline.text')} -

-

- {/* We don't use here, as we want to fully refresh the page. */} - {translate('maintenance.try_again')} -

+ +
+ + {translate('maintenance.try_again')} + +
)} {status === 'UP' && ( <> -

+ -

-

+ + {translate('maintenance.all_systems_opetational')} -

-

+ +

{translate('layout.home')} -

+
)} {status === 'STARTING' && ( <> -

+ -

-

+ + -

+ )} {status === 'DOWN' && ( <> -

+ -

-

- {translate('maintenance.sonarqube_is_down.text')} -

-

- {/* We don't use here, as we want to fully refresh the page. */} - {translate('maintenance.try_again')} -

+ + {translate('maintenance.sonarqube_is_down.text')} + + + {translate('maintenance.try_again')} + + )} {(status === 'DB_MIGRATION_NEEDED' || status === 'DB_MIGRATION_RUNNING') && ( <> -

+ -

-

+ + { ), }} /> -

-

+ + + {translate('maintenance.sonarqube_is_under_maintenance_link.2')} - + ), }} /> -

+ )} {state === 'NO_MIGRATION' && ( <> -

+ {translate('maintenance.database_is_up_to_date')} -

-

+ +

{translate('layout.home')} -

+
)} {state === 'MIGRATION_REQUIRED' && ( <> -

{translate('maintenance.upgrade_database')}

-

{translate('maintenance.upgrade_database.1')}

-

{translate('maintenance.upgrade_database.2')}

-

{translate('maintenance.upgrade_database.3')}

-
- -
+ + )} {state === 'NOT_SUPPORTED' && ( <> -

+ {translate('maintenance.migration_not_supported')} -

+

{translate('maintenance.migration_not_supported.text')}

)} {state === 'MIGRATION_RUNNING' && ( <> -

{translate('maintenance.database_migration')}

- {this.state.message && ( -

{this.state.message}

+ {translate('maintenance.database_migration')} + {this.state.message !== undefined && ( + {this.state.message} )} - {this.state.startedAt && ( -

+ {this.state.startedAt !== undefined && ( + {translate('background_tasks.table.started')}{' '}
-

+ )} -

+ -

+ )} {state === 'MIGRATION_SUCCEEDED' && ( <> -

+ {translate('maintenance.database_is_up_to_date')} -

-

+ +

{translate('layout.home')} -

+
)} {state === 'MIGRATION_FAILED' && ( <> -

+ {translate('maintenance.upgrade_failed')} -

-

{translate('maintenance.upgrade_failed.text')}

+ + {translate('maintenance.upgrade_failed.text')} )} -
+
); } } + +const MaintenanceContainer = styled.div` + border: ${themeBorder('default')}; + width: 400px; +`; + +const MaintenanceTitle = styled(Title)` + text-align: center; + margin-bottom: 2.5rem; +`; + +const MaintenanceText = styled.p` + margin-bottom: 1rem; +`; + +const MaintenanceSpinner = styled.div` + margin-top: 2.5rem; + text-align: center; +`; diff --git a/server/sonar-web/src/main/js/apps/maintenance/styles.css b/server/sonar-web/src/main/js/apps/maintenance/styles.css deleted file mode 100644 index 65754981e7a..00000000000 --- a/server/sonar-web/src/main/js/apps/maintenance/styles.css +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2024 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. - */ -.maintenance-title { - margin-bottom: 40px; - line-height: 1.5; - font-size: 24px; - font-weight: 300; - text-align: center; -} - -.maintenance-text { - margin-bottom: 16px; - line-height: 1.5; - font-size: var(--bigFontSize); - font-weight: 300; -} - -.maintenance-spinner { - margin-top: 40px; - text-align: center; -} -- cgit v1.2.3