123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- /*
- * SonarQube
- * Copyright (C) 2009-2022 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 withAppStateContext from '../../../app/components/app-state/withAppStateContext';
- import { ClipboardButton } from '../../../components/controls/clipboard';
- import { Alert } from '../../../components/ui/Alert';
- import { toShortNotSoISOString } from '../../../helpers/dates';
- import { translate } from '../../../helpers/l10n';
- import { AppState } from '../../../types/appstate';
- import PageActions from './PageActions';
-
- export interface Props {
- isCluster: boolean;
- loading: boolean;
- logLevel: string;
- onLogLevelChange: () => void;
- appState: AppState;
- serverId?: string;
- showActions: boolean;
- version?: string;
- }
-
- export function PageHeader(props: Props) {
- const { isCluster, loading, logLevel, serverId, showActions, version, appState } = props;
- return (
- <header className="page-header">
- <h1 className="page-title">{translate('system_info.page')}</h1>
- {showActions && (
- <PageActions
- canDownloadLogs={!isCluster}
- canRestart={!isCluster}
- cluster={isCluster}
- logLevel={logLevel}
- onLogLevelChange={props.onLogLevelChange}
- serverId={serverId}
- />
- )}
- {loading && (
- <div className="page-actions">
- <i className="spinner" />
- </div>
- )}
- {serverId && version && (
- <div className="system-info-copy-paste-id-info boxed-group ">
- {!appState.productionDatabase && (
- <Alert className="width-100" variant="warning">
- {translate('system.not_production_database_warning')}
- </Alert>
- )}
- <div className="display-flex-center">
- <div className="flex-1">
- <table className="width-100">
- <tbody>
- <tr>
- <th>
- <strong>{translate('system.server_id')}</strong>
- </th>
- <td>
- <code>{serverId}</code>
- </td>
- </tr>
- <tr>
- <th>
- <strong>{translate('system.version')}</strong>
- </th>
- <td>{version}</td>
- </tr>
- </tbody>
- </table>
- </div>
- <ClipboardButton
- className="flex-0"
- copyValue={`SonarQube ID information
- Server ID: ${serverId}
- Version: ${version}
- Date: ${toShortNotSoISOString(Date.now())}
- `}>
- {translate('system.copy_id_info')}
- </ClipboardButton>
- </div>
- </div>
- )}
- </header>
- );
- }
-
- export default withAppStateContext(PageHeader);
|