From a0a53f7a1273a1aeed8f68817ac57631bcaf5231 Mon Sep 17 00:00:00 2001 From: Tiina Turban Date: Fri, 3 Nov 2023 13:47:45 +0100 Subject: [PATCH] feat: Add pipeline ui fields to plugin config --- latest_migrations.manifest | 2 +- posthog/api/plugin.py | 4 +++ posthog/api/test/test_plugin.py | 8 ++++++ .../0360_add_plugin_config_ui_fields.py | 27 +++++++++++++++++++ posthog/models/plugin.py | 5 ++++ 5 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 posthog/migrations/0360_add_plugin_config_ui_fields.py diff --git a/latest_migrations.manifest b/latest_migrations.manifest index 5d996c9f43b482..5d80d4a66f329b 100644 --- a/latest_migrations.manifest +++ b/latest_migrations.manifest @@ -5,7 +5,7 @@ contenttypes: 0002_remove_content_type_name ee: 0015_add_verified_properties otp_static: 0002_throttling otp_totp: 0002_auto_20190420_0723 -posthog: 0359_team_external_data_workspace_id +posthog: 0360_auto_20231103_1229 sessions: 0001_initial social_django: 0010_uid_db_index two_factor: 0007_auto_20201201_1019 diff --git a/posthog/api/plugin.py b/posthog/api/plugin.py index b39c18a67346aa..dc08147c430160 100644 --- a/posthog/api/plugin.py +++ b/posthog/api/plugin.py @@ -503,6 +503,10 @@ class Meta: "plugin_info", "delivery_rate_24h", "created_at", + "updated_at", + "name", + "description", + "deleted", ] read_only_fields = [ "id", diff --git a/posthog/api/test/test_plugin.py b/posthog/api/test/test_plugin.py index ea8021975daa80..6d1bad88141559 100644 --- a/posthog/api/test/test_plugin.py +++ b/posthog/api/test/test_plugin.py @@ -935,6 +935,8 @@ def test_create_plugin_config(self, mock_get, mock_reload): "enabled": True, "order": 0, "config": json.dumps({"bar": "moop"}), + "name": "name in ui", + "description": "description in ui", }, format="multipart", ) @@ -955,6 +957,9 @@ def test_create_plugin_config(self, mock_get, mock_reload): "plugin_info": None, "delivery_rate_24h": None, "created_at": mock.ANY, + "name": "name in ui", + "description": "description in ui", + "deleted": False, }, ) plugin_config = PluginConfig.objects.first() @@ -993,6 +998,9 @@ def test_create_plugin_config(self, mock_get, mock_reload): "plugin_info": None, "delivery_rate_24h": None, "created_at": mock.ANY, + "name": "name in ui", + "description": "description in ui", + "deleted": False, }, ) self.client.delete(f"/api/plugin_config/{plugin_config_id}") diff --git a/posthog/migrations/0360_add_plugin_config_ui_fields.py b/posthog/migrations/0360_add_plugin_config_ui_fields.py new file mode 100644 index 00000000000000..8f8fcf981b3590 --- /dev/null +++ b/posthog/migrations/0360_add_plugin_config_ui_fields.py @@ -0,0 +1,27 @@ +# Generated by Django 3.2.19 on 2023-11-03 12:29 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("posthog", "0359_team_external_data_workspace_id"), + ] + + operations = [ + migrations.AddField( + model_name="pluginconfig", + name="deleted", + field=models.BooleanField(blank=True, default=False, null=True), + ), + migrations.AddField( + model_name="pluginconfig", + name="description", + field=models.CharField(blank=True, max_length=400, null=True), + ), + migrations.AddField( + model_name="pluginconfig", + name="name", + field=models.CharField(blank=True, max_length=400, null=True), + ), + ] diff --git a/posthog/models/plugin.py b/posthog/models/plugin.py index b8787dd3df3447..1a07355ee487cd 100644 --- a/posthog/models/plugin.py +++ b/posthog/models/plugin.py @@ -237,6 +237,11 @@ class Meta: created_at: models.DateTimeField = models.DateTimeField(auto_now_add=True) updated_at: models.DateTimeField = models.DateTimeField(auto_now=True) + # Used in the frontend + name: models.CharField = models.CharField(max_length=400, null=True, blank=True) + description: models.CharField = models.CharField(max_length=400, null=True, blank=True) + # Used in the frontend to hide pluginConfgis that user deleted + deleted: models.BooleanField = models.BooleanField(default=False, null=True, blank=True) class PluginAttachment(models.Model):