(core) Adds a UI panel for managing webhooks

Summary:
This adds a UI panel for managing webhooks. Work started by Cyprien Pindat. You can find the UI on a document's settings page. Main changes relative to Cyprien's demo:

  * Changed behavior of virtual table to be more consistent with the rest of Grist, by factoring out part of the implementation of on-demand tables.
  * Cell values that would create an error can now be denied and reverted (as for the rest of Grist).
  * Changes made by other users are integrated in a sane way.
  * Basic undo/redo support is added using the regular undo/redo stack.
  * The table list in the drop-down is now updated if schema changes.
  * Added a notification from back-end when webhook status is updated so constant polling isn't needed to support multi-user operation.
  *  Factored out webhook specific logic from general virtual table support.
  * Made a bunch of fixes to various broken behavior.
  * Added tests.

The code remains somewhat unpolished, and behavior in the presence of errors is imperfect in general but may be adequate for this case.

I assume that we'll soon be lifting the restriction on the set of domains that are supported for webhooks - otherwise we'd want to provide some friendly way to discover that list of supported domains rather than just throwing an error.

I don't actually know a lot about how the front-end works - it looks like tables/columns/fields/sections can be safely added if they have string ids that won't collide with bone fide numeric ids from the back end. Sneaky.

Contains a migration, so needs an extra reviewer for that.

Test Plan: added tests

Reviewers: jarek, dsagal

Reviewed By: jarek, dsagal

Differential Revision: https://phab.getgrist.com/D3856
This commit is contained in:
Paul Fitzpatrick
2023-05-08 18:06:24 -04:00
parent 5e9f2e06ea
commit 603238e966
37 changed files with 1698 additions and 376 deletions

View File

@@ -1189,7 +1189,6 @@ def migration35(tdset):
return tdset.apply_doc_actions(doc_actions)
@migration(schema_version=36)
def migration36(tdset):
"""
@@ -1197,10 +1196,22 @@ def migration36(tdset):
"""
return tdset.apply_doc_actions([add_column('_grist_Tables_column', 'description', 'Text')])
@migration(schema_version=37)
def migration37(tdset):
"""
Add fileExt column to _grist_Attachments.
"""
return tdset.apply_doc_actions([add_column('_grist_Attachments', 'fileExt', 'Text')])
@migration(schema_version=38)
def migration38(tdset):
doc_actions = [add_column('_grist_Triggers', 'memo', 'Text'),
add_column('_grist_Triggers', 'label', 'Text'),
add_column('_grist_Triggers', 'enabled', 'Bool')]
triggers = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Triggers']))
doc_actions.append(actions.BulkUpdateRecord(
'_grist_Triggers',
[t.id for t in triggers],
{'enabled': [True for t in triggers]}
))
return tdset.apply_doc_actions(doc_actions)

View File

@@ -15,7 +15,7 @@ import six
import actions
SCHEMA_VERSION = 37
SCHEMA_VERSION = 38
def make_column(col_id, col_type, formula='', isFormula=False):
return {
@@ -254,6 +254,9 @@ def schema_create_actions():
make_column("eventTypes", "ChoiceList"),
make_column("isReadyColRef", "Ref:_grist_Tables_column"),
make_column("actions", "Text"), # JSON
make_column("label", "Text"),
make_column("memo", "Text"),
make_column("enabled", "Bool"),
]),
# All of the ACL rules.