Skip to content

Commit

Permalink
fix name and description to be writable
Browse files Browse the repository at this point in the history
  • Loading branch information
tiina303 committed Dec 15, 2023
1 parent 4d70e47 commit a90c02f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 46 deletions.
7 changes: 0 additions & 7 deletions frontend/src/scenes/pipeline/AppsManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { SceneExport } from 'scenes/sceneTypes'
import { PluginInstallationType, PluginType } from '~/types'

import { appsManagementLogic } from './appsManagementLogic'
import { ExportsUnsubscribeModal, exportsUnsubscribeModalLogic } from './ExportsUnsubscribeModal'
import { RenderApp } from './utils'

export const scene: SceneExport = {
Expand All @@ -31,19 +30,13 @@ export function AppsManagement(): JSX.Element {
localPlugins,
} = useValues(appsManagementLogic)
const { isDev, isCloudOrDev } = useValues(preflightLogic)
const { startUnsubscribe } = useActions(exportsUnsubscribeModalLogic)
const { loading } = useValues(exportsUnsubscribeModalLogic)

if (!canInstallPlugins || !canGloballyManagePlugins) {
return <>You don't have permission to manage apps.</>
}

return (
<div className="pipeline-apps-management-scene">
<ExportsUnsubscribeModal />
<LemonButton loading={loading} onClick={startUnsubscribe}>
Unsubscribe from batch exports
</LemonButton>
{isCloudOrDev &&
(missingGlobalPlugins.length > 0 ||
shouldBeGlobalPlugins.length > 0 ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function ExportsUnsubscribeModal(): JSX.Element {
onClose={closeModal}
isOpen={modalOpen}
width={600}
title="Disable remaining export apps"
title="Disable remaining data pipelines apps"
description="To make sure there's no unexpected impact on your data, you need to explicitly disable the following apps before unsubscribing:"
footer={
<>
Expand Down
12 changes: 5 additions & 7 deletions posthog/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,6 @@ class PluginConfigSerializer(serializers.ModelSerializer):
plugin_info = serializers.SerializerMethodField()
delivery_rate_24h = serializers.SerializerMethodField()
error = serializers.SerializerMethodField()
name = serializers.SerializerMethodField()
description = serializers.SerializerMethodField()

class Meta:
model = PluginConfig
Expand Down Expand Up @@ -607,11 +605,11 @@ def get_config(self, plugin_config: PluginConfig):

return new_plugin_config

def get_name(self, plugin_config: PluginConfig):
return plugin_config.name or plugin_config.plugin.name

def get_description(self, plugin_config: PluginConfig):
return plugin_config.description or plugin_config.plugin.description
def to_representation(self, instance: Any) -> Any:
representation = super().to_representation(instance)
representation["name"] = representation["name"] or instance.plugin.name
representation["description"] = representation["description"] or instance.plugin.description
return representation

def get_plugin_info(self, plugin_config: PluginConfig):
if "view" in self.context and self.context["view"].action == "retrieve":
Expand Down
12 changes: 6 additions & 6 deletions posthog/api/test/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,8 +1356,8 @@ def test_create_plugin_config_with_secrets(self, mock_get, mock_reload):
"delivery_rate_24h": None,
"created_at": mock.ANY,
"updated_at": mock.ANY,
"name": None,
"description": None,
"name": "Hello World",
"description": "Greet the World and Foo a Bar, JS edition!",
"deleted": False,
},
)
Expand Down Expand Up @@ -1385,8 +1385,8 @@ def test_create_plugin_config_with_secrets(self, mock_get, mock_reload):
"delivery_rate_24h": None,
"created_at": mock.ANY,
"updated_at": mock.ANY,
"name": None,
"description": None,
"name": "Hello World",
"description": "Greet the World and Foo a Bar, JS edition!",
"deleted": False,
},
)
Expand Down Expand Up @@ -1416,8 +1416,8 @@ def test_create_plugin_config_with_secrets(self, mock_get, mock_reload):
"delivery_rate_24h": None,
"created_at": mock.ANY,
"updated_at": mock.ANY,
"name": None,
"description": None,
"name": "Hello World",
"description": "Greet the World and Foo a Bar, JS edition!",
"deleted": False,
},
)
Expand Down
25 changes: 0 additions & 25 deletions posthog/batch_exports/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,28 +394,3 @@ def get_queryset(self):
limit=limit,
level_filter=level_filter,
)


# queryset = BatchExport.objects.all()
# serializer_class = BatchExportSerializer
# permission_classes = [
# IsAuthenticated,
# ProjectMembershipNecessaryPermissions,
# OrganizationMemberPermissions,
# ]
# permission_classes = [
# IsAuthenticated,
# ProjectMembershipNecessaryPermissions,
# TeamMemberAccessPermission,
# ]

# def get_queryset(self):
# if not isinstance(self.request.user, User) or self.request.user.current_team is None:
# raise NotAuthenticated()

# return (
# self.queryset.filter(team_id=self.team_id)
# .exclude(deleted=True)
# .order_by("-created_at")
# .prefetch_related("destination")
# )

0 comments on commit a90c02f

Please sign in to comment.