import {Fragment} from 'react'; import type {RouteComponentProps} from 'react-router'; import styled from '@emotion/styled'; import { addErrorMessage, addLoadingMessage, addSuccessMessage, } from 'sentry/actionCreators/indicator'; import {openRemoteConfigCreateFeatureModal} from 'sentry/actionCreators/modal'; import Feature from 'sentry/components/acl/feature'; import Alert from 'sentry/components/alert'; import {Button} from 'sentry/components/button'; import {openConfirmModal} from 'sentry/components/confirm'; import {Flex} from 'sentry/components/container/flex'; import EmptyMessage from 'sentry/components/emptyMessage'; import TextArea from 'sentry/components/forms/controls/textarea'; import FieldGroup from 'sentry/components/forms/fieldGroup'; import FieldControl from 'sentry/components/forms/fieldGroup/fieldControl'; import * as Layout from 'sentry/components/layouts/thirds'; import NoProjectMessage from 'sentry/components/noProjectMessage'; import Panel from 'sentry/components/panels/panel'; import PanelBody from 'sentry/components/panels/panelBody'; import PanelHeader from 'sentry/components/panels/panelHeader'; import {PanelTable} from 'sentry/components/panels/panelTable'; import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle'; import {Slider} from 'sentry/components/slider'; import SplitDiff from 'sentry/components/splitDiff'; import TextCopyInput from 'sentry/components/textCopyInput'; import {IconSubtract} from 'sentry/icons'; import {t, tct} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import type {Organization} from 'sentry/types/organization'; import type {Project} from 'sentry/types/project'; import type {RemoteConfigFeature, RemoteConfigOptions} from 'sentry/types/remoteConfig'; import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader'; import useRemoteConfigSettings from 'sentry/views/settings/project/remoteConfig/useRemoteConfigSettings'; type RouteParams = { projectId: string; }; type Props = RouteComponentProps & { organization: Organization; project: Project; }; export default function RemoteConfigContainer(props: Props) { return ( ); } function NoAccess() { return ( {t("You don't have access to this feature")} ); } function ProjectRemoteConfig({organization, project, params: {projectId}}: Props) { const {result, staged, dispatch, handleSave, handleDelete} = useRemoteConfigSettings({ organization, projectId, }); const disabled = result.isLoading || result.isFetching; const addFeatureButton = ( ); return ( {t('Settings')} {t('Danger Zone')} ); } function OptionsPanelContent({ disabled, dispatch, options, }: { disabled: boolean; dispatch: ReturnType['dispatch']; options: RemoteConfigOptions; }) { return ( { dispatch({ type: 'updateOption', key: 'sample_rate', value: value as number, }); }} showThumbLabels min={0} max={1} step={0.01} value={options.sample_rate} /> { dispatch({ type: 'updateOption', key: 'traces_sample_rate', value: value as number, }); }} showThumbLabels min={0} max={1} step={0.01} value={options.traces_sample_rate} /> ); } function FeaturesPanelContent({ disabled, dispatch, features, }: { disabled: boolean; dispatch: ReturnType['dispatch']; features: RemoteConfigFeature[]; }) { if (!features.length) { return ( {t('No features defined')}
); } return features.map(feature => { return [
{feature.key}
,