Skip to content

feat(aci): set up sentry app action settings button #93456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 53 additions & 9 deletions static/app/views/automations/components/actions/sentryApp.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,65 @@
import {Fragment} from 'react';

import {openModal} from 'sentry/actionCreators/modal';
import {Button} from 'sentry/components/core/button';
import {IconSettings} from 'sentry/icons';
import {t, tct} from 'sentry/locale';
import type {ActionHandler} from 'sentry/types/workflowEngine/actions';
import SentryAppRuleModal from 'sentry/views/alerts/rules/issue/sentryAppRuleModal';
import {useActionNodeContext} from 'sentry/views/automations/components/actionNodes';
import {SentryAppActionSettingsButton} from 'sentry/views/automations/components/actions/sentryAppSettingsButton';
import type {SchemaFormConfig} from 'sentry/views/settings/organizationIntegrations/sentryAppExternalForm';

export function SentryAppDetails({handler}: {handler: ActionHandler}) {
const name = handler?.sentryApp?.name;
const name = handler?.sentryApp?.name || t('unknown SentryApp');
const title = handler?.sentryApp?.title;

return title || name || t('Unknown SentryApp action');
return title || tct('Notify [name]', {name});
}

export function SentryAppNode() {
const {handler} = useActionNodeContext();
const name = handler?.sentryApp?.name;
const title = handler?.sentryApp?.title;
return tct('[label] with these [settings]', {
label: title || name || t('Unknown SentryApp'),
settings: <SentryAppActionSettingsButton />,
});

return (
<Fragment>
<SentryAppDetails handler={handler} />
{handler?.sentryApp?.settings
? tct(' with these [settings]', {settings: <SentryAppActionSettingsButton />})
: null}
</Fragment>
);
}

function SentryAppActionSettingsButton() {
const {action, handler, onUpdate} = useActionNodeContext();
const sentryApp = handler.sentryApp;

if (!sentryApp?.settings) {
return null;
}

return (
<Button
size="sm"
icon={<IconSettings />}
onClick={() => {
openModal(
deps => (
<SentryAppRuleModal
{...deps}
sentryAppInstallationUuid={sentryApp.installationUuid}
config={sentryApp.settings as SchemaFormConfig}
appName={sentryApp.title ?? sentryApp.name}
onSubmitSuccess={(formData: Record<string, string>) =>
onUpdate({data: formData})
}
resetValues={action.data}
/>
),
{closeEvents: 'escape-key'}
);
}}
>
{t('Action Settings')}
</Button>
);
}

This file was deleted.

Loading