import {Fragment} from 'react'; import styled from '@emotion/styled'; import moment from 'moment'; import {Button} from 'sentry/components/button'; import LoadingError from 'sentry/components/loadingError'; import LoadingIndicator from 'sentry/components/loadingIndicator'; import {IconUpgrade} from 'sentry/icons'; import {t, tct} from 'sentry/locale'; import ConfigStore from 'sentry/stores/configStore'; import {space} from 'sentry/styles/space'; import {useApiQuery} from 'sentry/utils/queryClient'; type Data = { config: [key: string, value: string][]; environment: { config: string; start_date: string; }; pythonVersion: string; }; export default function AdminEnvironment() { const {data, isLoading, isError} = useApiQuery(['/internal/environment/'], { staleTime: 0, }); if (isError) { return ; } if (isLoading) { return ; } const {version} = ConfigStore.getState(); return (

{t('Environment')}

{data?.environment ? (
{t('Server Version')} {version.upgradeAvailable && ( )}
{version.current}
{t('Python Version')}
{data?.pythonVersion}
{t('Configuration File')}
{data.environment.config}
{t('Uptime')}
              {tct('[now] (since [start])', {
                now: moment(data.environment.start_date).toNow(true),
                start: data.environment.start_date,
              })}
            
) : (

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

)}

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

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