mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 16:28:31 +00:00
Preparing for WA beta. (#4189)
* Preparing for WA beta. * Reintroducing Instance.compat_type to ensure that we still support our old node types for compat reasons. * Revert the periodic type name. * Post rebase linting * Show the automation settings modal, but only show the General sidepanel in development. * Fix e2e test
This commit is contained in:
1 parent
86cc8e652f
commit
fffdb8d2da
30 files changed
+395
-289
No files matched your search
@@ -4,6 +4,8 @@ from typing import Any, Dict, Iterable, List, Optional, Type, Union
|
||||
from django.core.files.storage import Storage
|
||||
from django.db.models import QuerySet
|
||||
|
||||
from opentelemetry import trace
|
||||
|
||||
from baserow.contrib.automation.automation_dispatch_context import (
|
||||
AutomationDispatchContext,
|
||||
)
|
||||
@@ -30,10 +32,13 @@ from baserow.core.services.exceptions import (
|
||||
from baserow.core.services.handler import ServiceHandler
|
||||
from baserow.core.services.models import Service
|
||||
from baserow.core.storage import ExportZipFile
|
||||
from baserow.core.telemetry.utils import baserow_trace_methods
|
||||
from baserow.core.utils import ChildProgressBuilder, MirrorDict, extract_allowed
|
||||
|
||||
tracer = trace.get_tracer(__name__)
|
||||
|
||||
class AutomationNodeHandler:
|
||||
|
||||
class AutomationNodeHandler(metaclass=baserow_trace_methods(tracer)):
|
||||
allowed_fields = [
|
||||
"label",
|
||||
"service",
|
||||
@@ -107,11 +112,12 @@ class AutomationNodeHandler:
|
||||
local_cache.delete(self._get_node_cache_key(workflow, True))
|
||||
local_cache.delete(self._get_node_cache_key(workflow, False))
|
||||
|
||||
def get_children(self, node, specific=True):
|
||||
def get_children(self, node: AutomationNode) -> List[AutomationNode]:
|
||||
"""
|
||||
Returns the direct children of the given node.
|
||||
|
||||
:param specific: Whether to return specific node instances.
|
||||
:param node: The parent node.
|
||||
:return: A list of node instances that are the children of the given node.
|
||||
"""
|
||||
|
||||
return node.workflow.get_graph().get_children(node)
|
||||
@@ -250,7 +256,7 @@ class AutomationNodeHandler:
|
||||
) -> AutomationNode:
|
||||
"""
|
||||
Creates an instance of AutomationNode using the serialized version
|
||||
previously exported with `.export_node'.
|
||||
previously exported with '.export_node'.
|
||||
|
||||
:param workflow: The workflow instance the new node should
|
||||
belong to.
|
||||
|
||||
@@ -146,14 +146,14 @@ class AutomationNode(
|
||||
|
||||
return self.workflow.get_graph().get_next_nodes(self, output_uid)
|
||||
|
||||
def get_children(self, specific=True):
|
||||
def get_children(self):
|
||||
"""
|
||||
Returns the direct children of this node if any.
|
||||
"""
|
||||
|
||||
from baserow.contrib.automation.nodes.handler import AutomationNodeHandler
|
||||
|
||||
return AutomationNodeHandler().get_children(self, specific=specific)
|
||||
return AutomationNodeHandler().get_children(self)
|
||||
|
||||
|
||||
class AutomationActionNode(AutomationNode):
|
||||
|
||||
@@ -102,7 +102,7 @@ class ContainerNodeTypeMixin:
|
||||
output: str,
|
||||
):
|
||||
"""
|
||||
Check the container node is not moved inside it self.
|
||||
Check the container node is not moved inside itself.
|
||||
"""
|
||||
|
||||
if node in reference_node.get_parent_nodes():
|
||||
@@ -114,7 +114,8 @@ class ContainerNodeTypeMixin:
|
||||
|
||||
|
||||
class LocalBaserowUpsertRowNodeType(AutomationNodeActionNodeType):
|
||||
type = "upsert_row"
|
||||
type = "local_baserow_upsert_row"
|
||||
compat_type = "upsert_row"
|
||||
service_type = LocalBaserowUpsertRowServiceType.type
|
||||
|
||||
def get_pytest_params(self, pytest_data_fixture) -> Dict[str, int]:
|
||||
@@ -123,35 +124,41 @@ class LocalBaserowUpsertRowNodeType(AutomationNodeActionNodeType):
|
||||
|
||||
|
||||
class LocalBaserowCreateRowNodeType(LocalBaserowUpsertRowNodeType):
|
||||
type = "create_row"
|
||||
type = "local_baserow_create_row"
|
||||
compat_type = "create_row"
|
||||
model_class = LocalBaserowCreateRowActionNode
|
||||
|
||||
|
||||
class LocalBaserowUpdateRowNodeType(LocalBaserowUpsertRowNodeType):
|
||||
type = "update_row"
|
||||
type = "local_baserow_update_row"
|
||||
compat_type = "update_row"
|
||||
model_class = LocalBaserowUpdateRowActionNode
|
||||
|
||||
|
||||
class LocalBaserowDeleteRowNodeType(AutomationNodeActionNodeType):
|
||||
type = "delete_row"
|
||||
type = "local_baserow_delete_row"
|
||||
compat_type = "delete_row"
|
||||
model_class = LocalBaserowDeleteRowActionNode
|
||||
service_type = LocalBaserowDeleteRowServiceType.type
|
||||
|
||||
|
||||
class LocalBaserowGetRowNodeType(AutomationNodeActionNodeType):
|
||||
type = "get_row"
|
||||
type = "local_baserow_get_row"
|
||||
compat_type = "get_row"
|
||||
model_class = LocalBaserowGetRowActionNode
|
||||
service_type = LocalBaserowGetRowUserServiceType.type
|
||||
|
||||
|
||||
class LocalBaserowListRowsNodeType(AutomationNodeActionNodeType):
|
||||
type = "list_rows"
|
||||
type = "local_baserow_list_rows"
|
||||
compat_type = "list_rows"
|
||||
model_class = LocalBaserowListRowsActionNode
|
||||
service_type = LocalBaserowListRowsUserServiceType.type
|
||||
|
||||
|
||||
class LocalBaserowAggregateRowsNodeType(AutomationNodeActionNodeType):
|
||||
type = "aggregate_rows"
|
||||
type = "local_baserow_aggregate_rows"
|
||||
compat_type = "aggregate_rows"
|
||||
model_class = LocalBaserowAggregateRowsActionNode
|
||||
service_type = LocalBaserowAggregateRowsUserServiceType.type
|
||||
|
||||
@@ -365,19 +372,22 @@ class AutomationNodeTriggerType(AutomationNodeType):
|
||||
|
||||
|
||||
class LocalBaserowRowsCreatedNodeTriggerType(AutomationNodeTriggerType):
|
||||
type = "rows_created"
|
||||
type = "local_baserow_rows_created"
|
||||
compat_type = "rows_created"
|
||||
model_class = LocalBaserowRowsCreatedTriggerNode
|
||||
service_type = LocalBaserowRowsCreatedServiceType.type
|
||||
|
||||
|
||||
class LocalBaserowRowsUpdatedNodeTriggerType(AutomationNodeTriggerType):
|
||||
type = "rows_updated"
|
||||
type = "local_baserow_rows_updated"
|
||||
compat_type = "rows_updated"
|
||||
model_class = LocalBaserowRowsUpdatedTriggerNode
|
||||
service_type = LocalBaserowRowsUpdatedServiceType.type
|
||||
|
||||
|
||||
class LocalBaserowRowsDeletedNodeTriggerType(AutomationNodeTriggerType):
|
||||
type = "rows_deleted"
|
||||
type = "local_baserow_rows_deleted"
|
||||
compat_type = "rows_deleted"
|
||||
model_class = LocalBaserowRowsDeletedTriggerNode
|
||||
service_type = LocalBaserowRowsDeletedServiceType.type
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ class NodeGraphHandler:
|
||||
if output is None or uid == output
|
||||
]
|
||||
|
||||
def get_children(self, node) -> List[AutomationNode]:
|
||||
def get_children(self, node: AutomationNode) -> List[AutomationNode]:
|
||||
"""
|
||||
Returns the node children.
|
||||
"""
|
||||
|
||||
@@ -11,6 +11,7 @@ from django.db.models import QuerySet
|
||||
from django.utils import timezone
|
||||
|
||||
from loguru import logger
|
||||
from opentelemetry import trace
|
||||
|
||||
from baserow.contrib.automation.automation_dispatch_context import (
|
||||
AutomationDispatchContext,
|
||||
@@ -48,6 +49,7 @@ from baserow.core.exceptions import IdDoesNotExist
|
||||
from baserow.core.registries import ImportExportConfig
|
||||
from baserow.core.services.exceptions import DispatchException
|
||||
from baserow.core.storage import ExportZipFile, get_default_storage
|
||||
from baserow.core.telemetry.utils import baserow_trace_methods
|
||||
from baserow.core.trash.handler import TrashHandler
|
||||
from baserow.core.utils import (
|
||||
ChildProgressBuilder,
|
||||
@@ -60,8 +62,10 @@ from baserow.core.utils import (
|
||||
WORKFLOW_RATE_LIMIT_CACHE_PREFIX = "automation_workflow_{}"
|
||||
AUTOMATION_WORKFLOW_CACHE_LOCK_SECONDS = 5
|
||||
|
||||
tracer = trace.get_tracer(__name__)
|
||||
|
||||
class AutomationWorkflowHandler:
|
||||
|
||||
class AutomationWorkflowHandler(metaclass=baserow_trace_methods(tracer)):
|
||||
allowed_fields = ["name", "allow_test_run_until", "state"]
|
||||
|
||||
def get_workflow(
|
||||
|
||||
@@ -52,6 +52,10 @@ class Instance(object):
|
||||
type: str
|
||||
"""A unique string that identifies the instance."""
|
||||
|
||||
compat_type: str = ""
|
||||
""" If this instance has been renamed, and we want to support
|
||||
compatibility of the original `type`, implement it with `compat_type`. """
|
||||
|
||||
def __init__(self):
|
||||
if not self.type:
|
||||
raise ImproperlyConfigured("The type of an instance must be set.")
|
||||
@@ -758,13 +762,29 @@ class Registry(Generic[InstanceSubClass]):
|
||||
:rtype: InstanceModelInstance
|
||||
"""
|
||||
|
||||
# If the `type_name` isn't in the registry, we may raise DoesNotExist.
|
||||
if type_name not in self.registry:
|
||||
raise self.does_not_exist_exception_class(
|
||||
type_name, f"The {self.name} type {type_name} does not exist."
|
||||
)
|
||||
# But first, we'll test to see if it matches an Instance's
|
||||
# `compat_name`. If it does, we'll use that Instance's `type`.
|
||||
type_name_via_compat = self.get_by_type_name_by_compat(type_name)
|
||||
if type_name_via_compat:
|
||||
type_name = type_name_via_compat
|
||||
else:
|
||||
raise self.does_not_exist_exception_class(
|
||||
type_name, f"The {self.name} type {type_name} does not exist."
|
||||
)
|
||||
|
||||
return self.registry[type_name]
|
||||
|
||||
def get_by_type_name_by_compat(self, compat_name: str) -> Optional[str]:
|
||||
"""
|
||||
Returns a registered instance's `type` by using the compatibility name.
|
||||
"""
|
||||
|
||||
for instance in self.get_all():
|
||||
if instance.compat_type == compat_name:
|
||||
return instance.type
|
||||
|
||||
def get_by_type(self, instance_type: Type[InstanceSubClass]) -> InstanceSubClass:
|
||||
return self.get(instance_type.type)
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ def test_create_node(api_client, data_fixture):
|
||||
response = api_client.post(
|
||||
url,
|
||||
{
|
||||
"type": "update_row",
|
||||
"type": "local_baserow_update_row",
|
||||
"reference_node_id": trigger.id,
|
||||
"position": "south",
|
||||
"output": "",
|
||||
@@ -57,7 +57,7 @@ def test_create_node(api_client, data_fixture):
|
||||
"id": AnyInt(),
|
||||
"label": "",
|
||||
"service": AnyDict(),
|
||||
"type": "update_row",
|
||||
"type": "local_baserow_update_row",
|
||||
"workflow": workflow.id,
|
||||
}
|
||||
|
||||
@@ -66,10 +66,10 @@ def test_create_node(api_client, data_fixture):
|
||||
workflow.refresh_from_db()
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"create_row": {},
|
||||
"rows_created": {"next": {"": ["update_row"]}},
|
||||
"update_row": {"next": {"": ["create_row"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_create_row": {},
|
||||
"local_baserow_rows_created": {"next": {"": ["local_baserow_update_row"]}},
|
||||
"local_baserow_update_row": {"next": {"": ["local_baserow_create_row"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -89,7 +89,7 @@ def test_create_node_reference_node_invalid(api_client, data_fixture):
|
||||
response = api_client.post(
|
||||
url,
|
||||
{
|
||||
"type": "create_row",
|
||||
"type": "local_baserow_create_row",
|
||||
"reference_node_id": 99999999999,
|
||||
"position": "south",
|
||||
"output": "",
|
||||
@@ -105,7 +105,7 @@ def test_create_node_reference_node_invalid(api_client, data_fixture):
|
||||
response = api_client.post(
|
||||
url,
|
||||
{
|
||||
"type": "create_row",
|
||||
"type": "local_baserow_create_row",
|
||||
"reference_node_id": node2_b.id,
|
||||
"position": "south",
|
||||
"output": "",
|
||||
@@ -152,7 +152,7 @@ def test_create_node_invalid_workflow(api_client, data_fixture):
|
||||
response = api_client.post(
|
||||
url,
|
||||
{
|
||||
"type": "create_row",
|
||||
"type": "local_baserow_create_row",
|
||||
"reference_node_id": 0,
|
||||
"position": "south",
|
||||
"output": "",
|
||||
@@ -179,7 +179,7 @@ def test_create_node_undo_redo(api_client, data_fixture):
|
||||
response = api_client.post(
|
||||
url,
|
||||
{
|
||||
"type": "create_row",
|
||||
"type": "local_baserow_create_row",
|
||||
"reference_node_id": workflow.get_trigger().id,
|
||||
"position": "south",
|
||||
"output": "",
|
||||
@@ -224,14 +224,14 @@ def test_get_nodes(api_client, data_fixture):
|
||||
"id": trigger.id,
|
||||
"label": trigger.label,
|
||||
"service": AnyDict(),
|
||||
"type": "rows_created",
|
||||
"type": "local_baserow_rows_created",
|
||||
"workflow": workflow.id,
|
||||
},
|
||||
{
|
||||
"id": node.id,
|
||||
"label": node.label,
|
||||
"service": AnyDict(),
|
||||
"type": "create_row",
|
||||
"type": "local_baserow_create_row",
|
||||
"workflow": node.workflow.id,
|
||||
},
|
||||
]
|
||||
@@ -332,8 +332,8 @@ def test_duplicate_node(api_client, data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["To duplicate"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["To duplicate"]}},
|
||||
"To duplicate": {"next": {"": ["To duplicate-"]}},
|
||||
"To duplicate-": {},
|
||||
}
|
||||
@@ -400,7 +400,7 @@ def test_update_node_invalid_node(api_client, data_fixture):
|
||||
|
||||
api_kwargs = get_api_kwargs(token)
|
||||
update_url = reverse(API_URL_ITEM, kwargs={"node_id": 100})
|
||||
payload = {"type": "update_row"}
|
||||
payload = {"type": "local_baserow_update_row"}
|
||||
response = api_client.patch(update_url, payload, **api_kwargs)
|
||||
|
||||
assert response.status_code == HTTP_404_NOT_FOUND
|
||||
@@ -448,7 +448,10 @@ def test_replace_node_type_with_irreplaceable_type(
|
||||
api_client,
|
||||
data_fixture,
|
||||
):
|
||||
original_type, irreplaceable_type = ["create_row", "rows_created"]
|
||||
original_type, irreplaceable_type = [
|
||||
"local_baserow_create_row",
|
||||
"local_baserow_rows_created",
|
||||
]
|
||||
user, token = data_fixture.create_user_and_token()
|
||||
workflow = data_fixture.create_automation_workflow(user)
|
||||
node = data_fixture.create_automation_node(
|
||||
@@ -472,7 +475,10 @@ def test_replace_node_type_with_replaceable_type_trigger(
|
||||
api_client,
|
||||
data_fixture,
|
||||
):
|
||||
original_type, replaceable_type = ["rows_created", "rows_updated"]
|
||||
original_type, replaceable_type = [
|
||||
"local_baserow_rows_created",
|
||||
"local_baserow_rows_updated",
|
||||
]
|
||||
user, token = data_fixture.create_user_and_token()
|
||||
workflow = data_fixture.create_automation_workflow(user, trigger_type=original_type)
|
||||
trigger = workflow.get_trigger()
|
||||
@@ -498,7 +504,10 @@ def test_replace_node_type_with_replaceable_type(
|
||||
api_client,
|
||||
data_fixture,
|
||||
):
|
||||
original_type, replaceable_type = ["update_row", "delete_row"]
|
||||
original_type, replaceable_type = [
|
||||
"local_baserow_update_row",
|
||||
"local_baserow_delete_row",
|
||||
]
|
||||
user, token = data_fixture.create_user_and_token()
|
||||
workflow = data_fixture.create_automation_workflow(user)
|
||||
trigger = workflow.get_trigger()
|
||||
@@ -715,7 +724,7 @@ def test_replacing_router_node_with_output_nodes_disallowed(api_client, data_fix
|
||||
|
||||
response = api_client.post(
|
||||
reverse(API_URL_REPLACE, kwargs={"node_id": router.id}),
|
||||
{"new_type": "create_row"},
|
||||
{"new_type": "local_baserow_create_row"},
|
||||
**get_api_kwargs(token),
|
||||
)
|
||||
assert response.status_code == HTTP_400_BAD_REQUEST
|
||||
@@ -900,7 +909,7 @@ def test_simulate_dispatch_action_node(
|
||||
action_node = data_fixture.create_automation_node(
|
||||
user=user,
|
||||
workflow=workflow,
|
||||
type="create_row",
|
||||
type="local_baserow_create_row",
|
||||
service=action_service,
|
||||
)
|
||||
|
||||
@@ -956,7 +965,7 @@ def test_simulate_dispatch_action_node_with_sample_data(
|
||||
action_node = data_fixture.create_automation_node(
|
||||
user=user,
|
||||
workflow=workflow,
|
||||
type="create_row",
|
||||
type="local_baserow_create_row",
|
||||
service=action_service,
|
||||
)
|
||||
|
||||
|
||||
@@ -432,7 +432,10 @@ def test_run_workflow_in_test_mode(api_client, data_fixture):
|
||||
integration=data_fixture.create_local_baserow_integration(user=user),
|
||||
)
|
||||
trigger_node = data_fixture.create_automation_node(
|
||||
user=user, workflow=workflow, type="rows_created", service=trigger_service
|
||||
user=user,
|
||||
workflow=workflow,
|
||||
type="local_baserow_rows_created",
|
||||
service=trigger_service,
|
||||
)
|
||||
|
||||
# Next create an action node
|
||||
@@ -452,7 +455,7 @@ def test_run_workflow_in_test_mode(api_client, data_fixture):
|
||||
action_node = data_fixture.create_automation_node(
|
||||
user=user,
|
||||
workflow=workflow,
|
||||
type="create_row",
|
||||
type="local_baserow_create_row",
|
||||
service=action_service,
|
||||
)
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ def test_create_node_action(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["Node before"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["Node before"]}},
|
||||
"Node before": {"next": {"": ["Node after"]}},
|
||||
"Node after": {},
|
||||
}
|
||||
@@ -58,10 +58,10 @@ def test_create_node_action(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["Node before"]}},
|
||||
"Node before": {"next": {"": ["create_row"]}},
|
||||
"create_row": {"next": {"": ["Node after"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["Node before"]}},
|
||||
"Node before": {"next": {"": ["local_baserow_create_row"]}},
|
||||
"local_baserow_create_row": {"next": {"": ["Node after"]}},
|
||||
"Node after": {},
|
||||
}
|
||||
)
|
||||
@@ -70,10 +70,10 @@ def test_create_node_action(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"Node after": {},
|
||||
"Node before": {"next": {"": ["Node after"]}},
|
||||
"rows_created": {"next": {"": ["Node before"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["Node before"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -89,10 +89,10 @@ def test_create_node_action(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["Node before"]}},
|
||||
"Node before": {"next": {"": ["create_row"]}},
|
||||
"create_row": {"next": {"": ["Node after"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["Node before"]}},
|
||||
"Node before": {"next": {"": ["local_baserow_create_row"]}},
|
||||
"local_baserow_create_row": {"next": {"": ["Node after"]}},
|
||||
"Node after": {},
|
||||
}
|
||||
)
|
||||
@@ -115,10 +115,10 @@ def test_replace_automation_action_node_type(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"After": {},
|
||||
"To replace": {"next": {"": ["After"]}},
|
||||
"rows_created": {"next": {"": ["To replace"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["To replace"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -128,10 +128,10 @@ def test_replace_automation_action_node_type(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"After": {},
|
||||
"rows_created": {"next": {"": ["update_row"]}},
|
||||
"update_row": {"next": {"": ["After"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["local_baserow_update_row"]}},
|
||||
"local_baserow_update_row": {"next": {"": ["After"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -152,10 +152,10 @@ def test_replace_automation_action_node_type(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"After": {},
|
||||
"To replace": {"next": {"": ["After"]}},
|
||||
"rows_created": {"next": {"": ["To replace"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["To replace"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -178,10 +178,10 @@ def test_replace_automation_action_node_type(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"After": {},
|
||||
"rows_created": {"next": {"": ["update_row"]}},
|
||||
"update_row": {"next": {"": ["After"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["local_baserow_update_row"]}},
|
||||
"local_baserow_update_row": {"next": {"": ["After"]}},
|
||||
}
|
||||
)
|
||||
# The original node is trashed again, the new node is restored.
|
||||
@@ -216,9 +216,9 @@ def test_replace_automation_trigger_node_type(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["create_row"]}},
|
||||
"create_row": {},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["local_baserow_create_row"]}},
|
||||
"local_baserow_create_row": {},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -228,9 +228,9 @@ def test_replace_automation_trigger_node_type(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_updated",
|
||||
"rows_updated": {"next": {"": ["create_row"]}},
|
||||
"create_row": {},
|
||||
"0": "local_baserow_rows_updated",
|
||||
"local_baserow_rows_updated": {"next": {"": ["local_baserow_create_row"]}},
|
||||
"local_baserow_create_row": {},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -254,9 +254,9 @@ def test_replace_automation_trigger_node_type(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["create_row"]}},
|
||||
"create_row": {},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["local_baserow_create_row"]}},
|
||||
"local_baserow_create_row": {},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -279,9 +279,9 @@ def test_replace_automation_trigger_node_type(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_updated",
|
||||
"rows_updated": {"next": {"": ["create_row"]}},
|
||||
"create_row": {},
|
||||
"0": "local_baserow_rows_updated",
|
||||
"local_baserow_rows_updated": {"next": {"": ["local_baserow_create_row"]}},
|
||||
"local_baserow_create_row": {},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -321,11 +321,11 @@ def test_delete_node_action(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"After": {},
|
||||
"Before": {"next": {"": ["To delete"]}},
|
||||
"To delete": {"next": {"": ["After"]}},
|
||||
"rows_created": {"next": {"": ["Before"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["Before"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -333,10 +333,10 @@ def test_delete_node_action(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"After": {},
|
||||
"Before": {"next": {"": ["After"]}},
|
||||
"rows_created": {"next": {"": ["Before"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["Before"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -348,11 +348,11 @@ def test_delete_node_action(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"After": {},
|
||||
"Before": {"next": {"": ["To delete"]}},
|
||||
"To delete": {"next": {"": ["After"]}},
|
||||
"rows_created": {"next": {"": ["Before"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["Before"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -363,10 +363,10 @@ def test_delete_node_action(data_fixture):
|
||||
ActionHandler.redo(user, [WorkflowActionScopeType.value(workflow.id)], session_id)
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"After": {},
|
||||
"Before": {"next": {"": ["After"]}},
|
||||
"rows_created": {"next": {"": ["Before"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["Before"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -394,10 +394,10 @@ def test_delete_node_action_after_nothing(data_fixture):
|
||||
)
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"Before": {"next": {"": ["To delete"]}},
|
||||
"To delete": {},
|
||||
"rows_created": {"next": {"": ["Before"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["Before"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -405,9 +405,9 @@ def test_delete_node_action_after_nothing(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"Before": {},
|
||||
"rows_created": {"next": {"": ["Before"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["Before"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -419,10 +419,10 @@ def test_delete_node_action_after_nothing(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"Before": {"next": {"": ["To delete"]}},
|
||||
"To delete": {},
|
||||
"rows_created": {"next": {"": ["Before"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["Before"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -434,9 +434,9 @@ def test_delete_node_action_after_nothing(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"Before": {},
|
||||
"rows_created": {"next": {"": ["Before"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["Before"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -461,8 +461,8 @@ def test_duplicate_node_action(data_fixture):
|
||||
)
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["Source"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["Source"]}},
|
||||
"Source": {"next": {"": ["After"]}},
|
||||
"After": {},
|
||||
}
|
||||
@@ -472,8 +472,8 @@ def test_duplicate_node_action(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["Source"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["Source"]}},
|
||||
"Source": {"next": {"": ["Source-"]}},
|
||||
"Source-": {"next": {"": ["After"]}},
|
||||
"After": {},
|
||||
@@ -487,8 +487,8 @@ def test_duplicate_node_action(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["Source"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["Source"]}},
|
||||
"Source": {"next": {"": ["After"]}},
|
||||
"After": {},
|
||||
}
|
||||
@@ -501,8 +501,8 @@ def test_duplicate_node_action(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["Source"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["Source"]}},
|
||||
"Source": {"next": {"": ["Source-"]}},
|
||||
"Source-": {"next": {"": ["After"]}},
|
||||
"After": {},
|
||||
@@ -530,7 +530,7 @@ def test_duplicate_node_action_with_multiple_outputs(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"router": {
|
||||
"next": {
|
||||
"Default": ["fallback node"],
|
||||
@@ -538,7 +538,7 @@ def test_duplicate_node_action_with_multiple_outputs(data_fixture):
|
||||
"Do this": ["output edge 1"],
|
||||
}
|
||||
},
|
||||
"rows_created": {"next": {"": ["router"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["router"]}},
|
||||
"fallback node": {},
|
||||
"output edge 1": {},
|
||||
"output edge 2": {},
|
||||
@@ -553,8 +553,8 @@ def test_duplicate_node_action_with_multiple_outputs(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["router"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["router"]}},
|
||||
"router": {
|
||||
"next": {
|
||||
"Default": ["Duplicated router"],
|
||||
@@ -573,7 +573,7 @@ def test_duplicate_node_action_with_multiple_outputs(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"router": {
|
||||
"next": {
|
||||
"Default": ["fallback node"],
|
||||
@@ -581,7 +581,7 @@ def test_duplicate_node_action_with_multiple_outputs(data_fixture):
|
||||
"Do this": ["output edge 1"],
|
||||
}
|
||||
},
|
||||
"rows_created": {"next": {"": ["router"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["router"]}},
|
||||
"fallback node": {},
|
||||
"output edge 1": {},
|
||||
"output edge 2": {},
|
||||
@@ -592,8 +592,8 @@ def test_duplicate_node_action_with_multiple_outputs(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["router"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["router"]}},
|
||||
"router": {
|
||||
"next": {
|
||||
"Default": ["Duplicated router"],
|
||||
@@ -629,8 +629,8 @@ def test_move_node_action(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["first action"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["first action"]}},
|
||||
"first action": {"next": {"": ["second action"]}},
|
||||
"second action": {"next": {"": ["moved node"]}},
|
||||
"moved node": {},
|
||||
@@ -644,8 +644,8 @@ def test_move_node_action(data_fixture):
|
||||
assert moved_node == node
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["first action"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["first action"]}},
|
||||
"first action": {"next": {"": ["moved node"]}},
|
||||
"moved node": {"next": {"": ["second action"]}},
|
||||
"second action": {},
|
||||
@@ -656,8 +656,8 @@ def test_move_node_action(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["first action"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["first action"]}},
|
||||
"first action": {"next": {"": ["second action"]}},
|
||||
"second action": {"next": {"": ["moved node"]}},
|
||||
"moved node": {},
|
||||
@@ -668,8 +668,8 @@ def test_move_node_action(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["first action"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["first action"]}},
|
||||
"first action": {"next": {"": ["moved node"]}},
|
||||
"moved node": {"next": {"": ["second action"]}},
|
||||
"second action": {},
|
||||
@@ -697,8 +697,8 @@ def test_move_node_action_to_output(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["router"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["router"]}},
|
||||
"router": {
|
||||
"next": {
|
||||
"Default": ["fallback node"],
|
||||
@@ -721,8 +721,8 @@ def test_move_node_action_to_output(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["router"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["router"]}},
|
||||
"router": {
|
||||
"next": {
|
||||
"Do this": ["output edge 2"],
|
||||
@@ -739,8 +739,8 @@ def test_move_node_action_to_output(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["router"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["router"]}},
|
||||
"router": {
|
||||
"next": {
|
||||
"Default": ["fallback node"],
|
||||
@@ -758,8 +758,8 @@ def test_move_node_action_to_output(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["router"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["router"]}},
|
||||
"router": {
|
||||
"next": {
|
||||
"Do this": ["output edge 2"],
|
||||
|
||||
@@ -169,13 +169,16 @@ def test_run_workflow_with_router_action(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["router"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["router"]}},
|
||||
"router": {
|
||||
"next": {"Edge 1": ["Edge 1 output node"], "Edge 2": ["update_row"]}
|
||||
"next": {
|
||||
"Edge 1": ["Edge 1 output node"],
|
||||
"Edge 2": ["local_baserow_update_row"],
|
||||
}
|
||||
},
|
||||
"Edge 1 output node": {},
|
||||
"update_row": {},
|
||||
"local_baserow_update_row": {},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -233,7 +236,7 @@ def iterator_graph_fixture(data_fixture):
|
||||
workflow = data_fixture.create_automation_workflow(
|
||||
user=user,
|
||||
state=WorkflowState.LIVE,
|
||||
trigger_type="rows_created",
|
||||
trigger_type="local_baserow_rows_created",
|
||||
trigger_service_kwargs={
|
||||
"table": trigger_table,
|
||||
"integration": integration,
|
||||
@@ -324,8 +327,8 @@ def test_run_workflow_with_iterator_action(iterator_graph_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["iterator"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["iterator"]}},
|
||||
"iterator": {
|
||||
"children": ["First action"],
|
||||
"next": {"": ["After iterator"]},
|
||||
@@ -377,8 +380,8 @@ def test_run_workflow_with_iterator_action_simulate(iterator_graph_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["iterator"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["iterator"]}},
|
||||
"iterator": {
|
||||
"children": ["First action"],
|
||||
"next": {"": ["After iterator"]},
|
||||
|
||||
@@ -21,7 +21,7 @@ def test_create_node(data_fixture):
|
||||
user = data_fixture.create_user()
|
||||
workflow = data_fixture.create_automation_workflow(create_trigger=False)
|
||||
|
||||
node_type = automation_node_type_registry.get("rows_created")
|
||||
node_type = automation_node_type_registry.get("local_baserow_rows_created")
|
||||
prepared_values = node_type.prepare_values({"workflow": workflow}, user)
|
||||
|
||||
node = AutomationNodeHandler().create_node(node_type, **prepared_values)
|
||||
@@ -133,7 +133,7 @@ def test_export_node(data_fixture):
|
||||
"id": node.id,
|
||||
"label": node.label,
|
||||
"service": AnyDict(),
|
||||
"type": "create_row",
|
||||
"type": "local_baserow_create_row",
|
||||
"workflow_id": node.workflow.id,
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ def test_simulate_dispatch_node_trigger(data_fixture):
|
||||
|
||||
action_node = data_fixture.create_automation_node(
|
||||
workflow=workflow,
|
||||
type="create_row",
|
||||
type="local_baserow_create_row",
|
||||
)
|
||||
|
||||
# Set initial fake data for the action_node, since we want to test
|
||||
@@ -282,7 +282,7 @@ def create_action_node(data_fixture):
|
||||
action_node = data_fixture.create_automation_node(
|
||||
user=user,
|
||||
workflow=workflow,
|
||||
type="create_row",
|
||||
type="local_baserow_create_row",
|
||||
service=action_service,
|
||||
)
|
||||
|
||||
@@ -364,12 +364,12 @@ def test_simulate_dispatch_node_action_with_simulate_until_node(data_fixture):
|
||||
|
||||
action_node_2 = data_fixture.create_automation_node(
|
||||
workflow=action_node_1.workflow,
|
||||
type="create_row",
|
||||
type="local_baserow_create_row",
|
||||
)
|
||||
|
||||
action_node_3 = data_fixture.create_automation_node(
|
||||
workflow=action_node_1.workflow,
|
||||
type="create_row",
|
||||
type="local_baserow_create_row",
|
||||
)
|
||||
|
||||
nodes = [action_node_1, action_node_2, action_node_3]
|
||||
@@ -517,8 +517,8 @@ def test_simulate_dispatch_node_dispatches_correct_edge_node(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["Router A"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["Router A"]}},
|
||||
"Router A": {
|
||||
"next": {"": ["Create row A"], "Router A, Edge 1": ["Router B"]}
|
||||
},
|
||||
|
||||
@@ -93,8 +93,8 @@ def test_get_previous_service_outputs(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["router a"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["router a"]}},
|
||||
"router a": {"next": {"": ["action a"], "Router A, Edge 1": ["router b"]}},
|
||||
"action a": {},
|
||||
"router b": {
|
||||
|
||||
@@ -23,7 +23,7 @@ SERVICE_PATH = "baserow.contrib.automation.nodes.service"
|
||||
def test_create_node(mocked_signal, data_fixture: Fixtures):
|
||||
user = data_fixture.create_user()
|
||||
workflow = data_fixture.create_automation_workflow(user)
|
||||
node_type = automation_node_type_registry.get("create_row")
|
||||
node_type = automation_node_type_registry.get("local_baserow_create_row")
|
||||
|
||||
service = AutomationNodeService()
|
||||
node = service.create_node(
|
||||
@@ -37,9 +37,9 @@ def test_create_node(mocked_signal, data_fixture: Fixtures):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"create_row": {},
|
||||
"rows_created": {"next": {"": ["create_row"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_create_row": {},
|
||||
"local_baserow_rows_created": {"next": {"": ["local_baserow_create_row"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -54,7 +54,7 @@ def test_create_node_as_child(mocked_signal, data_fixture: Fixtures):
|
||||
user = data_fixture.create_user()
|
||||
workflow = data_fixture.create_automation_workflow(user)
|
||||
iterator = data_fixture.create_core_iterator_action_node(workflow=workflow)
|
||||
node_type = automation_node_type_registry.get("create_row")
|
||||
node_type = automation_node_type_registry.get("local_baserow_create_row")
|
||||
|
||||
service = AutomationNodeService()
|
||||
node = service.create_node(
|
||||
@@ -68,10 +68,10 @@ def test_create_node_as_child(mocked_signal, data_fixture: Fixtures):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"create_row": {},
|
||||
"iterator": {"children": ["create_row"]},
|
||||
"rows_created": {"next": {"": ["iterator"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_create_row": {},
|
||||
"iterator": {"children": ["local_baserow_create_row"]},
|
||||
"local_baserow_rows_created": {"next": {"": ["iterator"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -87,7 +87,7 @@ def test_create_node_as_child_not_in_container(data_fixture: Fixtures):
|
||||
workflow=workflow
|
||||
)
|
||||
|
||||
node_type = automation_node_type_registry.get("create_row")
|
||||
node_type = automation_node_type_registry.get("local_baserow_create_row")
|
||||
|
||||
service = AutomationNodeService()
|
||||
|
||||
@@ -112,7 +112,7 @@ def test_create_node_reference_node_invalid(data_fixture: Fixtures):
|
||||
node1_b = workflow_b.get_trigger()
|
||||
node2_b = data_fixture.create_automation_node(workflow=workflow_b)
|
||||
|
||||
node_type = automation_node_type_registry.get("create_row")
|
||||
node_type = automation_node_type_registry.get("local_baserow_create_row")
|
||||
|
||||
with pytest.raises(AutomationNodeReferenceNodeInvalid) as exc:
|
||||
AutomationNodeService().create_node(
|
||||
@@ -130,7 +130,7 @@ def test_create_node_reference_node_invalid(data_fixture: Fixtures):
|
||||
@pytest.mark.django_db
|
||||
def test_create_node_permission_error(data_fixture: Fixtures):
|
||||
workflow = data_fixture.create_automation_workflow()
|
||||
node_type = automation_node_type_registry.get("create_row")
|
||||
node_type = automation_node_type_registry.get("local_baserow_create_row")
|
||||
another_user = data_fixture.create_user()
|
||||
|
||||
with pytest.raises(UserNotInWorkspace) as e:
|
||||
@@ -307,8 +307,8 @@ def test_duplicate_node(mocked_signal, data_fixture: Fixtures):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["test"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["test"]}},
|
||||
"test": {"next": {"": ["test-"]}},
|
||||
"test-": {},
|
||||
}
|
||||
@@ -342,7 +342,7 @@ def test_replace_simple_node(data_fixture: Fixtures):
|
||||
trigger = workflow.get_trigger()
|
||||
original_node = data_fixture.create_automation_node(workflow=workflow)
|
||||
|
||||
node_type = automation_node_type_registry.get("update_row")
|
||||
node_type = automation_node_type_registry.get("local_baserow_update_row")
|
||||
|
||||
replace_result = AutomationNodeService().replace_node(
|
||||
user, original_node.id, node_type.type
|
||||
@@ -353,9 +353,9 @@ def test_replace_simple_node(data_fixture: Fixtures):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["update_row"]}},
|
||||
"update_row": {},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["local_baserow_update_row"]}},
|
||||
"local_baserow_update_row": {},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -375,7 +375,7 @@ def test_replace_node_in_first(data_fixture: Fixtures):
|
||||
workflow=workflow,
|
||||
)
|
||||
|
||||
node_type = automation_node_type_registry.get("update_row")
|
||||
node_type = automation_node_type_registry.get("local_baserow_update_row")
|
||||
|
||||
service = AutomationNodeService()
|
||||
replace_result = service.replace_node(user, first_node.id, node_type.type)
|
||||
@@ -384,11 +384,11 @@ def test_replace_node_in_first(data_fixture: Fixtures):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["update_row"]}},
|
||||
"update_row": {"next": {"": ["create_row"]}},
|
||||
"create_row": {"next": {"": ["create_row-"]}},
|
||||
"create_row-": {},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["local_baserow_update_row"]}},
|
||||
"local_baserow_update_row": {"next": {"": ["local_baserow_create_row"]}},
|
||||
"local_baserow_create_row": {"next": {"": ["local_baserow_create_row-"]}},
|
||||
"local_baserow_create_row-": {},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -402,7 +402,7 @@ def test_replace_node_in_middle(data_fixture: Fixtures):
|
||||
node_to_replace = data_fixture.create_automation_node(workflow=workflow)
|
||||
last_node = data_fixture.create_automation_node(workflow=workflow, label="last")
|
||||
|
||||
node_type = automation_node_type_registry.get("update_row")
|
||||
node_type = automation_node_type_registry.get("local_baserow_update_row")
|
||||
|
||||
replace_result = AutomationNodeService().replace_node(
|
||||
user, node_to_replace.id, node_type.type
|
||||
@@ -410,10 +410,10 @@ def test_replace_node_in_middle(data_fixture: Fixtures):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["first"]}},
|
||||
"first": {"next": {"": ["update_row"]}},
|
||||
"update_row": {"next": {"": ["last"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["first"]}},
|
||||
"first": {"next": {"": ["local_baserow_update_row"]}},
|
||||
"local_baserow_update_row": {"next": {"": ["last"]}},
|
||||
"last": {},
|
||||
}
|
||||
)
|
||||
@@ -430,7 +430,7 @@ def test_replace_node_in_last(data_fixture: Fixtures):
|
||||
second_node = data_fixture.create_automation_node(workflow=workflow)
|
||||
last_node = data_fixture.create_automation_node(workflow=workflow)
|
||||
|
||||
node_type = automation_node_type_registry.get("update_row")
|
||||
node_type = automation_node_type_registry.get("local_baserow_update_row")
|
||||
|
||||
replace_result = AutomationNodeService().replace_node(
|
||||
user, last_node.id, node_type.type
|
||||
@@ -438,11 +438,11 @@ def test_replace_node_in_last(data_fixture: Fixtures):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["create_row"]}},
|
||||
"create_row": {"next": {"": ["create_row-"]}},
|
||||
"create_row-": {"next": {"": ["update_row"]}},
|
||||
"update_row": {},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["local_baserow_create_row"]}},
|
||||
"local_baserow_create_row": {"next": {"": ["local_baserow_create_row-"]}},
|
||||
"local_baserow_create_row-": {"next": {"": ["local_baserow_update_row"]}},
|
||||
"local_baserow_update_row": {},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -482,12 +482,12 @@ def test_move_simple_node(data_fixture: Fixtures):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"action1": {"next": {"": ["action3"]}},
|
||||
"action3": {"next": {"": ["action2"]}},
|
||||
"action2": {"next": {"": ["action4"]}},
|
||||
"action4": {},
|
||||
"rows_created": {"next": {"": ["action1"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["action1"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -525,8 +525,8 @@ def test_move_node_to_edge_above_existing_output(data_fixture: Fixtures):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["router"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["router"]}},
|
||||
"router": {
|
||||
"next": {
|
||||
"Do this": ["output edge 2"],
|
||||
@@ -567,8 +567,8 @@ def test_move_node_in_container(data_fixture: Fixtures):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["action1"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["action1"]}},
|
||||
"action1": {"next": {"": ["iterator"]}},
|
||||
"iterator": {"children": ["action3"], "next": {"": ["action2"]}},
|
||||
"action3": {},
|
||||
@@ -600,8 +600,8 @@ def test_move_node_outside_of_container(data_fixture: Fixtures):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["action1"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["action1"]}},
|
||||
"action1": {"next": {"": ["iterator"]}},
|
||||
"iterator": {"children": ["action2"], "next": {"": ["action3"]}},
|
||||
"action2": {},
|
||||
@@ -617,8 +617,8 @@ def test_move_node_outside_of_container(data_fixture: Fixtures):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["action1"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["action1"]}},
|
||||
"action1": {"next": {"": ["iterator"]}},
|
||||
"iterator": {"next": {"": ["action3"]}},
|
||||
"action2": {"next": {"": ["action4"]}},
|
||||
@@ -652,8 +652,8 @@ def test_move_container_after_itself(data_fixture: Fixtures):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["action1"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["action1"]}},
|
||||
"action1": {"next": {"": ["action2"]}},
|
||||
"action2": {"next": {"": ["action3"]}},
|
||||
"action3": {"next": {"": ["action4"]}},
|
||||
|
||||
@@ -19,9 +19,9 @@ def test_trashing_and_restoring_node_updates_graph(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"first action": {"next": {"": ["second action"]}},
|
||||
"rows_created": {"next": {"": ["first action"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["first action"]}},
|
||||
"second action": {},
|
||||
}
|
||||
)
|
||||
@@ -37,8 +37,8 @@ def test_trashing_and_restoring_node_updates_graph(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["second action"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["second action"]}},
|
||||
"second action": {},
|
||||
}
|
||||
)
|
||||
@@ -50,9 +50,9 @@ def test_trashing_and_restoring_node_updates_graph(data_fixture):
|
||||
)
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"first action": {"next": {"": ["second action"]}},
|
||||
"rows_created": {"next": {"": ["first action"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["first action"]}},
|
||||
"second action": {},
|
||||
}
|
||||
)
|
||||
@@ -91,8 +91,8 @@ def test_trashing_and_restoring_node_updates_graph_with_router(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["First router"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["First router"]}},
|
||||
"First router": {"next": {"To second router": ["Second router"]}},
|
||||
"Second router": {"next": {"To create row": ["To create row output node"]}},
|
||||
"To create row output node": {},
|
||||
@@ -113,8 +113,8 @@ def test_trashing_and_restoring_node_updates_graph_with_router(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["First router"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["First router"]}},
|
||||
"First router": {
|
||||
"next": {"To second router": ["To create row output node"]}
|
||||
},
|
||||
@@ -129,11 +129,11 @@ def test_trashing_and_restoring_node_updates_graph_with_router(data_fixture):
|
||||
)
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"First router": {"next": {"To second router": ["Second router"]}},
|
||||
"Second router": {"next": {"": ["To create row output node"]}},
|
||||
"To create row output node": {},
|
||||
"rows_created": {"next": {"": ["First router"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["First router"]}},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -153,8 +153,8 @@ def test_restoring_a_trashed_output_node_after_its_edge_is_destroyed_is_disallow
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["router"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["router"]}},
|
||||
"router": {"next": {"Edge 1": ["Edge 1 output node"]}},
|
||||
"Edge 1 output node": {},
|
||||
}
|
||||
|
||||
@@ -26,10 +26,14 @@ API_URL_MOVE = f"{API_URL_BASE}:move"
|
||||
|
||||
|
||||
def test_automation_node_type_is_replaceable_with():
|
||||
trigger_node_type = automation_node_type_registry.get("rows_created")
|
||||
update_trigger_node_type = automation_node_type_registry.get("rows_updated")
|
||||
action_node_type = automation_node_type_registry.get("create_row")
|
||||
update_action_node_type = automation_node_type_registry.get("update_row")
|
||||
trigger_node_type = automation_node_type_registry.get("local_baserow_rows_created")
|
||||
update_trigger_node_type = automation_node_type_registry.get(
|
||||
"local_baserow_rows_updated"
|
||||
)
|
||||
action_node_type = automation_node_type_registry.get("local_baserow_create_row")
|
||||
update_action_node_type = automation_node_type_registry.get(
|
||||
"local_baserow_update_row"
|
||||
)
|
||||
|
||||
assert trigger_node_type.is_replaceable_with(update_trigger_node_type)
|
||||
assert not trigger_node_type.is_replaceable_with(update_action_node_type)
|
||||
@@ -78,7 +82,9 @@ def test_automation_service_node_trigger_type_on_event(
|
||||
@pytest.mark.django_db
|
||||
def test_automation_node_type_create_row_prepare_values_with_instance(data_fixture):
|
||||
user = data_fixture.create_user()
|
||||
node = data_fixture.create_automation_node(user=user, type="create_row")
|
||||
node = data_fixture.create_automation_node(
|
||||
user=user, type="local_baserow_create_row"
|
||||
)
|
||||
|
||||
values = {"service": {}}
|
||||
result = node.get_type().prepare_values(values, user, instance=node)
|
||||
@@ -88,7 +94,9 @@ def test_automation_node_type_create_row_prepare_values_with_instance(data_fixtu
|
||||
@pytest.mark.django_db
|
||||
def test_automation_node_type_create_row_prepare_values_without_instance(data_fixture):
|
||||
user = data_fixture.create_user()
|
||||
node = data_fixture.create_automation_node(user=user, type="create_row")
|
||||
node = data_fixture.create_automation_node(
|
||||
user=user, type="local_baserow_create_row"
|
||||
)
|
||||
|
||||
values = {"service": {}, "workflow": node.workflow}
|
||||
result = node.get_type().prepare_values(values, user)
|
||||
@@ -106,7 +114,9 @@ def test_automation_node_type_create_row_dispatch(mock_dispatch, data_fixture):
|
||||
mock_dispatch.return_value = mock_dispatch_result
|
||||
|
||||
user = data_fixture.create_user()
|
||||
node = data_fixture.create_automation_node(user=user, type="create_row")
|
||||
node = data_fixture.create_automation_node(
|
||||
user=user, type="local_baserow_create_row"
|
||||
)
|
||||
|
||||
dispatch_context = AutomationDispatchContext(node.workflow, None)
|
||||
result = node.get_type().dispatch(node, dispatch_context)
|
||||
@@ -116,10 +126,14 @@ def test_automation_node_type_create_row_dispatch(mock_dispatch, data_fixture):
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_automation_node_type_rows_created_prepare_values_with_instance(data_fixture):
|
||||
def test_automation_node_type_local_baserow_rows_created_prepare_values_with_instance(
|
||||
data_fixture,
|
||||
):
|
||||
user = data_fixture.create_user()
|
||||
workflow = data_fixture.create_automation_workflow(user=user, create_trigger=False)
|
||||
node = data_fixture.create_automation_node(workflow=workflow, type="rows_created")
|
||||
node = data_fixture.create_automation_node(
|
||||
workflow=workflow, type="local_baserow_rows_created"
|
||||
)
|
||||
|
||||
values = {"service": {}}
|
||||
result = node.get_type().prepare_values(values, user, instance=node)
|
||||
@@ -127,10 +141,14 @@ def test_automation_node_type_rows_created_prepare_values_with_instance(data_fix
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_service_node_type_rows_created_prepare_values_without_instance(data_fixture):
|
||||
def test_service_node_type_local_baserow_rows_created_prepare_values_without_instance(
|
||||
data_fixture,
|
||||
):
|
||||
user = data_fixture.create_user()
|
||||
workflow = data_fixture.create_automation_workflow(user=user, create_trigger=False)
|
||||
node = data_fixture.create_automation_node(workflow=workflow, type="rows_created")
|
||||
node = data_fixture.create_automation_node(
|
||||
workflow=workflow, type="local_baserow_rows_created"
|
||||
)
|
||||
|
||||
values = {"service": {}, "workflow": node.workflow}
|
||||
result = node.get_type().prepare_values(values, user)
|
||||
@@ -144,7 +162,9 @@ def test_service_node_type_rows_created_prepare_values_without_instance(data_fix
|
||||
@pytest.mark.django_db
|
||||
def test_automation_node_type_update_row_prepare_values_with_instance(data_fixture):
|
||||
user = data_fixture.create_user()
|
||||
node = data_fixture.create_automation_node(user=user, type="update_row")
|
||||
node = data_fixture.create_automation_node(
|
||||
user=user, type="local_baserow_update_row"
|
||||
)
|
||||
|
||||
values = {"service": {}}
|
||||
result = node.get_type().prepare_values(values, user, instance=node)
|
||||
@@ -158,7 +178,9 @@ def test_automation_node_type_update_row_dispatch(mock_dispatch, data_fixture):
|
||||
mock_dispatch.return_value = mock_dispatch_result
|
||||
|
||||
user = data_fixture.create_user()
|
||||
node = data_fixture.create_automation_node(user=user, type="update_row")
|
||||
node = data_fixture.create_automation_node(
|
||||
user=user, type="local_baserow_update_row"
|
||||
)
|
||||
|
||||
dispatch_context = AutomationDispatchContext(node.workflow, None)
|
||||
result = node.get_type().dispatch(node, dispatch_context)
|
||||
@@ -171,7 +193,9 @@ def test_automation_node_type_update_row_dispatch(mock_dispatch, data_fixture):
|
||||
def test_automation_node_type_delete_row_prepare_values_with_instance(data_fixture):
|
||||
user = data_fixture.create_user()
|
||||
workflow = data_fixture.create_automation_workflow(user=user)
|
||||
node = data_fixture.create_automation_node(workflow=workflow, type="delete_row")
|
||||
node = data_fixture.create_automation_node(
|
||||
workflow=workflow, type="local_baserow_delete_row"
|
||||
)
|
||||
|
||||
values = {"service": {}}
|
||||
result = node.get_type().prepare_values(values, user, instance=node)
|
||||
@@ -183,9 +207,11 @@ def test_automation_node_type_delete_row_prepare_values_without_instance(data_fi
|
||||
user = data_fixture.create_user()
|
||||
workflow = data_fixture.create_automation_workflow(user=user)
|
||||
|
||||
node = data_fixture.create_automation_node(workflow=workflow, type="delete_row")
|
||||
node = data_fixture.create_automation_node(
|
||||
workflow=workflow, type="local_baserow_delete_row"
|
||||
)
|
||||
another_node = data_fixture.create_automation_node(
|
||||
workflow=workflow, type="delete_row"
|
||||
workflow=workflow, type="local_baserow_delete_row"
|
||||
)
|
||||
|
||||
values = {
|
||||
@@ -208,7 +234,9 @@ def test_automation_node_type_delete_row_dispatch(mock_dispatch, data_fixture):
|
||||
mock_dispatch.return_value = mock_dispatch_result
|
||||
|
||||
user = data_fixture.create_user()
|
||||
node = data_fixture.create_automation_node(user=user, type="delete_row")
|
||||
node = data_fixture.create_automation_node(
|
||||
user=user, type="local_baserow_delete_row"
|
||||
)
|
||||
|
||||
dispatch_context = AutomationDispatchContext(node.workflow, None)
|
||||
result = node.get_type().dispatch(node, dispatch_context)
|
||||
@@ -307,8 +335,8 @@ def test_duplicating_router_node(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["router"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["router"]}},
|
||||
"router": {
|
||||
"next": {
|
||||
"Default": ["fallback node"],
|
||||
@@ -326,8 +354,8 @@ def test_duplicating_router_node(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["router"]}},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["router"]}},
|
||||
"router": {
|
||||
"next": {
|
||||
"Default": ["router-"],
|
||||
|
||||
@@ -33,7 +33,7 @@ SAMPLE_WORKFLOW_IMPORT_REFERENCE = {
|
||||
"nodes": [
|
||||
{
|
||||
"id": 1,
|
||||
"type": "rows_created",
|
||||
"type": "local_baserow_rows_created",
|
||||
"workflow_id": 1,
|
||||
"service": {
|
||||
"id": 549,
|
||||
@@ -44,7 +44,7 @@ SAMPLE_WORKFLOW_IMPORT_REFERENCE = {
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": "create_row",
|
||||
"type": "local_baserow_create_row",
|
||||
"workflow_id": 1,
|
||||
"service": {
|
||||
"id": 550,
|
||||
@@ -109,7 +109,7 @@ def test_automation_export_serialized(data_fixture):
|
||||
{
|
||||
"id": trigger.id,
|
||||
"label": trigger.label,
|
||||
"type": "rows_created",
|
||||
"type": "local_baserow_rows_created",
|
||||
"workflow_id": trigger.workflow_id,
|
||||
"service": {
|
||||
"id": trigger.service_id,
|
||||
@@ -122,7 +122,7 @@ def test_automation_export_serialized(data_fixture):
|
||||
{
|
||||
"id": first_action.id,
|
||||
"label": first_action.label,
|
||||
"type": "create_row",
|
||||
"type": "local_baserow_create_row",
|
||||
"workflow_id": first_action.workflow_id,
|
||||
"service": {
|
||||
"id": first_action.service_id,
|
||||
@@ -207,9 +207,9 @@ def test_automation_application_import(data_fixture):
|
||||
|
||||
workflow.assert_reference(
|
||||
{
|
||||
"0": "rows_created",
|
||||
"rows_created": {"next": {"": ["create_row"]}},
|
||||
"create_row": {},
|
||||
"0": "local_baserow_rows_created",
|
||||
"local_baserow_rows_created": {"next": {"": ["local_baserow_create_row"]}},
|
||||
"local_baserow_create_row": {},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ def test_duplicate_workflow_with_nodes(data_fixture):
|
||||
)
|
||||
|
||||
reference = {
|
||||
"0": "rows_created",
|
||||
"0": "local_baserow_rows_created",
|
||||
"fallback node": {},
|
||||
"output edge 1": {},
|
||||
"output edge 2": {},
|
||||
@@ -287,7 +287,7 @@ def test_duplicate_workflow_with_nodes(data_fixture):
|
||||
"Do this": ["output edge 1"],
|
||||
}
|
||||
},
|
||||
"rows_created": {"next": {"": ["router"]}},
|
||||
"local_baserow_rows_created": {"next": {"": ["router"]}},
|
||||
}
|
||||
|
||||
workflow.assert_reference(reference)
|
||||
|
||||
@@ -28,6 +28,11 @@ class FakeModel2(object):
|
||||
pass
|
||||
|
||||
|
||||
class InstanceTypeWithCompatType(Instance):
|
||||
type = "the_new_type_name"
|
||||
compat_type = "the_old_type_name"
|
||||
|
||||
|
||||
class TemporaryApplication1(ModelInstanceMixin, Instance):
|
||||
type = "temporary_1"
|
||||
model_class = FakeModel
|
||||
@@ -137,6 +142,14 @@ def test_registry_get():
|
||||
assert registry.get_types() == ["temporary_1"]
|
||||
|
||||
|
||||
def test_registry_get_compat_type_name():
|
||||
registry = TemporaryRegistry()
|
||||
compat_instance = InstanceTypeWithCompatType()
|
||||
registry.register(compat_instance)
|
||||
assert registry.get(compat_instance.type) == compat_instance
|
||||
assert registry.get(compat_instance.compat_type) == compat_instance
|
||||
|
||||
|
||||
def test_registry_get_by_model_returns_the_most_specific_value():
|
||||
base_app = BaseFakeModelApplication()
|
||||
subtype_of_base_app = SubClassOfBaseFakeModelApplication()
|
||||
|
||||
@@ -81,7 +81,7 @@ first to understand what a trace and span is and why we want them.
|
||||
### Tracing a function
|
||||
|
||||
You can use the helper decorator `baserow_trace` to wrap a function
|
||||
in a span to track it's execution time and other attributes:
|
||||
in a span to track its execution time and other attributes:
|
||||
|
||||
```python
|
||||
from opentelemetry import trace
|
||||
|
||||
@@ -39,7 +39,7 @@ test.describe("Automation node test suite", () => {
|
||||
}) => {
|
||||
const createNode = await createAutomationNode(
|
||||
automationWorkflowPage.automationWorkflow,
|
||||
"create_row",
|
||||
"local_baserow_create_row",
|
||||
trigger.id,
|
||||
"south",
|
||||
""
|
||||
|
||||
@@ -120,7 +120,7 @@ export class AutomationApplicationType extends ApplicationType {
|
||||
}
|
||||
|
||||
get developmentStage() {
|
||||
return DEVELOPMENT_STAGES.ALPHA
|
||||
return DEVELOPMENT_STAGES.BETA
|
||||
}
|
||||
|
||||
getOrder() {
|
||||
|
||||
@@ -15,6 +15,10 @@ class AutomationSettingType extends Registerable {
|
||||
return null
|
||||
}
|
||||
|
||||
isDeactivated() {
|
||||
return false
|
||||
}
|
||||
|
||||
get component() {
|
||||
return null
|
||||
}
|
||||
@@ -37,6 +41,10 @@ export class GeneralAutomationSettingsType extends AutomationSettingType {
|
||||
return 'iconoir-settings'
|
||||
}
|
||||
|
||||
isDeactivated() {
|
||||
return process.env.NODE_ENV !== 'development'
|
||||
}
|
||||
|
||||
getOrder() {
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
<template>
|
||||
<header class="layout__col-2-1 header header--space-between">
|
||||
<ul class="header__filter">
|
||||
<li v-if="isDev" class="header__filter-item">
|
||||
<a data-item-type="settings" class="header__filter-link"
|
||||
<li
|
||||
v-if="
|
||||
$hasPermission(
|
||||
'application.update',
|
||||
automation,
|
||||
automation.workspace.id
|
||||
)
|
||||
"
|
||||
class="header__filter-item"
|
||||
>
|
||||
<a
|
||||
data-item-type="settings"
|
||||
class="header__filter-link"
|
||||
@click="openSettingsModal"
|
||||
><i class="header__filter-icon iconoir-settings"></i>
|
||||
<span class="header__filter-name">{{
|
||||
$t('automationHeader.settingsBtn')
|
||||
@@ -105,6 +117,10 @@
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<AutomationSettingsModal
|
||||
ref="automationSettingsModal"
|
||||
:automation="automation"
|
||||
/>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
@@ -118,10 +134,11 @@ import { notifyIf } from '@baserow/modules/core/utils/error'
|
||||
import { WORKFLOW_STATES } from '@baserow/modules/automation/components/enums'
|
||||
|
||||
import NodeGraphHandler from '@baserow/modules/automation/utils/nodeGraphHandler'
|
||||
import AutomationSettingsModal from '@baserow/modules/automation/components/settings/AutomationSettingsModal'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'AutomationHeader',
|
||||
components: {},
|
||||
components: { AutomationSettingsModal },
|
||||
props: {
|
||||
automation: {
|
||||
type: Object,
|
||||
@@ -263,6 +280,11 @@ export default defineComponent({
|
||||
isPublishing.value = false
|
||||
}
|
||||
|
||||
const automationSettingsModal = ref(null)
|
||||
const openSettingsModal = () => {
|
||||
automationSettingsModal.value.show()
|
||||
}
|
||||
|
||||
return {
|
||||
isDev,
|
||||
debug,
|
||||
@@ -282,6 +304,8 @@ export default defineComponent({
|
||||
workflow,
|
||||
activeSidePanel,
|
||||
testRunDisabled,
|
||||
openSettingsModal,
|
||||
automationSettingsModal,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
:application="application"
|
||||
:workspace="workspace"
|
||||
>
|
||||
<template v-if="isDev" #additional-context-items>
|
||||
<template #additional-context-items>
|
||||
<li
|
||||
v-if="
|
||||
$hasPermission(
|
||||
@@ -36,7 +36,6 @@ import { defineComponent, ref } from 'vue'
|
||||
import AutomationSettingsModal from '@baserow/modules/automation/components/settings/AutomationSettingsModal'
|
||||
import ApplicationContext from '@baserow/modules/core/components/application/ApplicationContext'
|
||||
import applicationContext from '@baserow/modules/core/mixins/applicationContext'
|
||||
import { computed } from '@nuxtjs/composition-api'
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@@ -58,17 +57,12 @@ export default defineComponent({
|
||||
const context = ref(null)
|
||||
const automationSettingsModal = ref(null)
|
||||
|
||||
const isDev = computed(() => {
|
||||
return process.env.NODE_ENV === 'development'
|
||||
})
|
||||
|
||||
const openSettingsModal = () => {
|
||||
automationSettingsModal.value.show()
|
||||
context.value.hide()
|
||||
}
|
||||
|
||||
return {
|
||||
isDev,
|
||||
context,
|
||||
automationSettingsModal,
|
||||
openSettingsModal,
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
{{ buttonLabel }}
|
||||
</Button>
|
||||
|
||||
<div v-if="cantBeTestedReason">
|
||||
{{ cantBeTestedReason }}
|
||||
</div>
|
||||
<Alert v-if="cantBeTestedReason" type="info-neutral">
|
||||
<p>{{ cantBeTestedReason }}</p>
|
||||
</Alert>
|
||||
|
||||
<div v-else-if="showTestNodeDescription">
|
||||
{{ $t('simulateDispatch.testNodeDescription') }}
|
||||
</div>
|
||||
<Alert v-else-if="showTestNodeDescription" type="info-neutral">
|
||||
<p>{{ $t('simulateDispatch.testNodeDescription') }}</p>
|
||||
</Alert>
|
||||
|
||||
<div v-else-if="isLoading">
|
||||
{{ $t('simulateDispatch.triggerNodeAwaitingEvent') }}
|
||||
</div>
|
||||
<Alert v-else-if="isLoading" type="info-neutral">
|
||||
<p>{{ $t('simulateDispatch.triggerNodeAwaitingEvent') }}</p>
|
||||
</Alert>
|
||||
|
||||
<div
|
||||
v-if="hasSampleData && !isSimulating"
|
||||
|
||||
@@ -71,7 +71,9 @@ export default defineComponent({
|
||||
const displaySelectedSettingForm = ref(false)
|
||||
|
||||
const registeredSettings = computed(() => {
|
||||
return app.$registry.getOrderedList('automationSettings')
|
||||
return app.$registry
|
||||
.getOrderedList('automationSettings')
|
||||
.filter((setting) => !setting.isDeactivated())
|
||||
})
|
||||
|
||||
// Watch for changes in the selected setting
|
||||
|
||||
@@ -181,7 +181,7 @@
|
||||
"simulateDispatch": {
|
||||
"sampleDataLabel": "Output",
|
||||
"triggerNodeAwaitingEvent": "The node is waiting. Please manually trigger the event to populate the payload and complete the test.",
|
||||
"errorNodeNotConfigured": "The Node must be configured before it can be tested.",
|
||||
"errorNodeNotConfigured": "The node must be configured before it can be tested.",
|
||||
"errorPreviousNodeNotConfigured": "The previous node \"{node}\" must be configured.",
|
||||
"errorPreviousNodesNotTested": "The previous node \"{node}\" must be tested first.",
|
||||
"buttonLabelTest": "Test event",
|
||||
|
||||
@@ -303,7 +303,7 @@ export class LocalBaserowRowsCreatedTriggerNodeType extends TriggerNodeTypeMixin
|
||||
LocalBaserowSignalTriggerType
|
||||
) {
|
||||
static getType() {
|
||||
return 'rows_created'
|
||||
return 'local_baserow_rows_created'
|
||||
}
|
||||
|
||||
getOrder() {
|
||||
@@ -326,7 +326,7 @@ export class LocalBaserowRowsUpdatedTriggerNodeType extends TriggerNodeTypeMixin
|
||||
LocalBaserowSignalTriggerType
|
||||
) {
|
||||
static getType() {
|
||||
return 'rows_updated'
|
||||
return 'local_baserow_rows_updated'
|
||||
}
|
||||
|
||||
getOrder() {
|
||||
@@ -349,7 +349,7 @@ export class LocalBaserowRowsDeletedTriggerNodeType extends TriggerNodeTypeMixin
|
||||
LocalBaserowSignalTriggerType
|
||||
) {
|
||||
static getType() {
|
||||
return 'rows_deleted'
|
||||
return 'local_baserow_rows_deleted'
|
||||
}
|
||||
|
||||
getOrder() {
|
||||
@@ -439,7 +439,7 @@ export class LocalBaserowCreateRowActionNodeType extends ActionNodeTypeMixin(
|
||||
LocalBaserowNodeType
|
||||
) {
|
||||
static getType() {
|
||||
return 'create_row'
|
||||
return 'local_baserow_create_row'
|
||||
}
|
||||
|
||||
getOrder() {
|
||||
@@ -462,7 +462,7 @@ export class LocalBaserowUpdateRowActionNodeType extends ActionNodeTypeMixin(
|
||||
LocalBaserowNodeType
|
||||
) {
|
||||
static getType() {
|
||||
return 'update_row'
|
||||
return 'local_baserow_update_row'
|
||||
}
|
||||
|
||||
getOrder() {
|
||||
@@ -485,7 +485,7 @@ export class LocalBaserowDeleteRowActionNodeType extends ActionNodeTypeMixin(
|
||||
LocalBaserowNodeType
|
||||
) {
|
||||
static getType() {
|
||||
return 'delete_row'
|
||||
return 'local_baserow_delete_row'
|
||||
}
|
||||
|
||||
getOrder() {
|
||||
@@ -508,7 +508,7 @@ export class LocalBaserowGetRowActionNodeType extends ActionNodeTypeMixin(
|
||||
LocalBaserowNodeType
|
||||
) {
|
||||
static getType() {
|
||||
return 'get_row'
|
||||
return 'local_baserow_get_row'
|
||||
}
|
||||
|
||||
getOrder() {
|
||||
@@ -531,7 +531,7 @@ export class LocalBaserowListRowsActionNodeType extends ActionNodeTypeMixin(
|
||||
LocalBaserowNodeType
|
||||
) {
|
||||
static getType() {
|
||||
return 'list_rows'
|
||||
return 'local_baserow_list_rows'
|
||||
}
|
||||
|
||||
getOrder() {
|
||||
@@ -558,7 +558,7 @@ export class LocalBaserowAggregateRowsActionNodeType extends ActionNodeTypeMixin
|
||||
LocalBaserowNodeType
|
||||
) {
|
||||
static getType() {
|
||||
return 'aggregate_rows'
|
||||
return 'local_baserow_aggregate_rows'
|
||||
}
|
||||
|
||||
getOrder() {
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
<Modal @show="loading = false">
|
||||
<h2 class="box__title">
|
||||
{{ $t('action.createNew') }} {{ applicationType.getName() | lowercase }}
|
||||
<DevelopmentBadge
|
||||
v-if="applicationType.developmentStage === DEVELOPMENT_STAGES.ALPHA"
|
||||
:stage="applicationType.developmentStage"
|
||||
></DevelopmentBadge>
|
||||
</h2>
|
||||
<Error :error="error"></Error>
|
||||
<component
|
||||
@@ -25,12 +21,10 @@
|
||||
import modal from '@baserow/modules/core/mixins/modal'
|
||||
import error from '@baserow/modules/core/mixins/error'
|
||||
import { getNextAvailableNameInSequence } from '@baserow/modules/core/utils/string'
|
||||
import DevelopmentBadge from '@baserow/modules/core/components/DevelopmentBadge'
|
||||
import { DEVELOPMENT_STAGES } from '@baserow/modules/core/constants'
|
||||
|
||||
export default {
|
||||
name: 'CreateApplicationModal',
|
||||
components: { DevelopmentBadge },
|
||||
mixins: [modal, error],
|
||||
props: {
|
||||
applicationType: {
|
||||
|
||||
@@ -22,13 +22,6 @@
|
||||
<template v-if="applicationGroup.applications.length > 0">
|
||||
<div class="tree__heading">
|
||||
{{ applicationGroup.name }}
|
||||
<DevelopmentBadge
|
||||
v-if="
|
||||
applicationGroup.developmentStage ===
|
||||
DEVELOPMENT_STAGES.ALPHA
|
||||
"
|
||||
:stage="applicationGroup.developmentStage"
|
||||
></DevelopmentBadge>
|
||||
</div>
|
||||
<ul
|
||||
class="tree"
|
||||
@@ -108,12 +101,10 @@
|
||||
<script>
|
||||
import { notifyIf } from '@baserow/modules/core/utils/error'
|
||||
import CreateApplicationContext from '@baserow/modules/core/components/application/CreateApplicationContext'
|
||||
import DevelopmentBadge from '@baserow/modules/core/components/DevelopmentBadge'
|
||||
import { DEVELOPMENT_STAGES } from '@baserow/modules/core/constants'
|
||||
|
||||
export default {
|
||||
name: 'SidebarWithWorkspace',
|
||||
components: { DevelopmentBadge, CreateApplicationContext },
|
||||
components: { CreateApplicationContext },
|
||||
props: {
|
||||
applications: {
|
||||
type: Array,
|
||||
@@ -125,9 +116,6 @@ export default {
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
DEVELOPMENT_STAGES() {
|
||||
return DEVELOPMENT_STAGES
|
||||
},
|
||||
/**
|
||||
* Because all the applications that belong to the user are in the store we will
|
||||
* filter on the selected workspace here.
|
||||
|
||||
Reference in new issue
Block a user