import {Fragment} from 'react'; import styled from '@emotion/styled'; import moment from 'moment'; import {Button} from 'sentry/components/button'; import {IconUpgrade} from 'sentry/icons'; import {t, tct} from 'sentry/locale'; import ConfigStore from 'sentry/stores/configStore'; import {space} from 'sentry/styles/space'; import AsyncView from 'sentry/views/asyncView'; type Data = { config: [key: string, value: string][]; environment: { config: string; start_date: string; }; pythonVersion: string; }; type State = AsyncView['state'] & {data: Data}; export default class AdminEnvironment extends AsyncView<{}, State> { getEndpoints(): ReturnType { return [['data', '/internal/environment/']]; } renderBody() { const {data} = this.state; const {environment, config, pythonVersion} = data; const {version} = ConfigStore.getState(); return (

{t('Environment')}

{environment ? (
{t('Server Version')} {version.upgradeAvailable && ( )}
{version.current}
{t('Python Version')}
{pythonVersion}
{t('Configuration File')}
{environment.config}
{t('Uptime')}
                {moment(environment.start_date).toNow(true)} (since{' '}
                {environment.start_date})
              
) : (

{t('Environment not found (are you using the builtin Sentry webserver?).')}

)}

{tct('Configuration [configPath]', { configPath: environment.config && {environment.config}, })}

{config.map(([key, value]) => (
{key}
{value}
))}
); } } const VersionLabel = styled('dt')` display: inline-grid; grid-auto-flow: column; gap: ${space(1)}; align-items: center; `;