|
1 | | -import {disablePlugin} from 'sentry/actionCreators/plugins'; |
2 | 1 | import Panel from 'sentry/components/panels/panel'; |
3 | 2 | import PanelItem from 'sentry/components/panels/panelItem'; |
4 | 3 | import PluginConfig from 'sentry/components/pluginConfig'; |
5 | 4 | import {t} from 'sentry/locale'; |
6 | 5 | import type {Plugin} from 'sentry/types/integrations'; |
7 | | -import type {Organization} from 'sentry/types/organization'; |
8 | 6 | import type {Project} from 'sentry/types/project'; |
| 7 | +import {useTogglePluginMutation} from 'sentry/views/settings/projectPlugins/useTogglePluginMutation'; |
9 | 8 |
|
10 | 9 | type Props = { |
11 | | - organization: Organization; |
12 | 10 | pluginList: Plugin[]; |
13 | 11 | project: Project; |
14 | | - onDisablePlugin?: (plugin: Plugin) => void; |
15 | | - onEnablePlugin?: (plugin: Plugin) => void; |
16 | 12 | }; |
17 | 13 |
|
18 | | -function PluginList({ |
19 | | - organization, |
20 | | - project, |
21 | | - pluginList, |
22 | | - onDisablePlugin = () => {}, |
23 | | -}: Props) { |
| 14 | +export default function PluginList({project, pluginList}: Props) { |
| 15 | + const togglePluginMutation = useTogglePluginMutation({ |
| 16 | + projectSlug: project.slug, |
| 17 | + }); |
24 | 18 | const handleDisablePlugin = (plugin: Plugin) => { |
25 | | - disablePlugin({ |
26 | | - projectId: project.slug, |
27 | | - orgId: organization.slug, |
| 19 | + togglePluginMutation.mutate({ |
28 | 20 | pluginId: plugin.slug, |
| 21 | + shouldEnable: false, |
29 | 22 | }); |
30 | | - |
31 | | - onDisablePlugin(plugin); |
32 | 23 | }; |
33 | 24 |
|
34 | 25 | if (!pluginList.length) { |
@@ -56,5 +47,3 @@ function PluginList({ |
56 | 47 | </div> |
57 | 48 | ); |
58 | 49 | } |
59 | | - |
60 | | -export default PluginList; |
0 commit comments