Started unit test for Workflows.py and WorkflowDesigner.py
This commit is contained in:
@@ -12,7 +12,7 @@ icon_dismiss_regular = NotStr(
|
||||
)
|
||||
|
||||
# Fluent Add16Regular
|
||||
icon_add_regular = NotStr("""<svg name="addd" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16">
|
||||
icon_add_regular = NotStr("""<svg name="add" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16">
|
||||
<g fill="none">
|
||||
<path d="M8 2.5a.5.5 0 0 0-1 0V7H2.5a.5.5 0 0 0 0 1H7v4.5a.5.5 0 0 0 1 0V8h4.5a.5.5 0 0 0 0-1H8V2.5z" fill="currentColor">
|
||||
</path>
|
||||
|
||||
@@ -89,6 +89,17 @@
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.wkf-component-content {
|
||||
padding: 0.75rem; /* p-3 in Tailwind */
|
||||
border-radius: 0.5rem; /* rounded-lg in Tailwind */
|
||||
border-width: 2px; /* border-2 in Tailwind */
|
||||
background-color: white; /* bg-white in Tailwind */
|
||||
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* shadow-lg in Tailwind */
|
||||
display: flex; /* flex in Tailwind */
|
||||
align-items: center; /* items-center in Tailwind */
|
||||
}
|
||||
|
||||
|
||||
.wkf-connection-line {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
|
||||
@@ -6,7 +6,7 @@ from fasthtml.xtend import Script
|
||||
|
||||
from components.BaseComponent import BaseComponent
|
||||
from components.workflows.commands import WorkflowDesignerCommandManager
|
||||
from components.workflows.constants import WORKFLOW_DESIGNER_INSTANCE_ID
|
||||
from components.workflows.constants import WORKFLOW_DESIGNER_INSTANCE_ID, ProcessorTypes
|
||||
from components.workflows.db_management import WorkflowsDesignerSettings, WorkflowComponent, \
|
||||
Connection, WorkflowsDesignerDbManager
|
||||
from components_helpers import apply_boundaries, mk_tooltip, mk_dialog_buttons
|
||||
@@ -17,19 +17,19 @@ logger = logging.getLogger("WorkflowDesigner")
|
||||
|
||||
# Component templates
|
||||
COMPONENT_TYPES = {
|
||||
"producer": {
|
||||
ProcessorTypes.Producer: {
|
||||
"title": "Data Producer",
|
||||
"description": "Generates or loads data",
|
||||
"icon": "📊",
|
||||
"color": "bg-green-100 border-green-300 text-neutral"
|
||||
},
|
||||
"filter": {
|
||||
ProcessorTypes.Filter: {
|
||||
"title": "Data Filter",
|
||||
"description": "Filters and transforms data",
|
||||
"icon": "🔍",
|
||||
"color": "bg-blue-100 border-blue-300 text-neutral"
|
||||
},
|
||||
"presenter": {
|
||||
ProcessorTypes.Presenter: {
|
||||
"title": "Data Presenter",
|
||||
"description": "Displays or exports data",
|
||||
"icon": "📋",
|
||||
@@ -38,9 +38,9 @@ COMPONENT_TYPES = {
|
||||
}
|
||||
|
||||
PROCESSOR_TYPES = {
|
||||
"producer": ["Repository", "Jira"],
|
||||
"filter": ["Default"],
|
||||
"presenter": ["Default"]}
|
||||
ProcessorTypes.Producer: ["Repository", "Jira"],
|
||||
ProcessorTypes.Filter: ["Default"],
|
||||
ProcessorTypes.Presenter: ["Default"]}
|
||||
|
||||
|
||||
class WorkflowDesigner(BaseComponent):
|
||||
@@ -229,7 +229,7 @@ class WorkflowDesigner(BaseComponent):
|
||||
|
||||
# Render components
|
||||
*[self._mk_workflow_component(comp) for comp in self._state.components.values()],
|
||||
),
|
||||
)
|
||||
|
||||
def _mk_canvas(self, oob=False):
|
||||
return Div(
|
||||
@@ -264,9 +264,9 @@ class WorkflowDesigner(BaseComponent):
|
||||
return self._mk_jira_processor_details(component)
|
||||
elif processor_name == "Repository":
|
||||
return self._mk_repository_processor_details(component)
|
||||
elif component.type == "filter" and processor_name == "Default":
|
||||
elif component.type == ProcessorTypes.Filter and processor_name == "Default":
|
||||
return self._mk_filter_processor_details(component)
|
||||
elif component.type == "presenter" and processor_name == "Default":
|
||||
elif component.type == ProcessorTypes.Presenter and processor_name == "Default":
|
||||
return self._mk_presenter_processor_details(component)
|
||||
|
||||
return Div('Not defined yet !')
|
||||
@@ -403,9 +403,9 @@ class WorkflowDesigner(BaseComponent):
|
||||
def _mk_presenter_processor_details(component):
|
||||
return Div(
|
||||
Fieldset(
|
||||
Legend("Filter", cls="fieldset-legend"),
|
||||
Legend("Presenter", cls="fieldset-legend"),
|
||||
Input(type="text",
|
||||
name="filter",
|
||||
name="presenter",
|
||||
value=component.properties.get("filter", ""),
|
||||
placeholder="Enter filter expression",
|
||||
cls="input w-full"),
|
||||
@@ -454,7 +454,7 @@ class WorkflowDesigner(BaseComponent):
|
||||
Div(
|
||||
Span(info["icon"], cls="text-xl mb-1"),
|
||||
H4(component.title, cls="font-semibold text-xs"),
|
||||
cls=f"p-3 rounded-lg border-2 {info['color']} bg-white shadow-lg flex items-center"
|
||||
cls=f"wkf-component-content {info['color']}"
|
||||
),
|
||||
|
||||
# Output connection point
|
||||
|
||||
@@ -75,7 +75,7 @@ class Workflows(BaseComponentSingleton):
|
||||
|
||||
self.tabs_manager.select_tab_by_key(tab_key)
|
||||
self.db.select_workflow(workflow_name)
|
||||
return self.tabs_manager.refresh(), self.refresh()
|
||||
return self.refresh(), self.tabs_manager.refresh()
|
||||
|
||||
def refresh(self):
|
||||
return self._mk_workflows(True)
|
||||
|
||||
@@ -5,6 +5,11 @@ WORKFLOW_DESIGNER_DB_ENTRY = "WorkflowDesigner"
|
||||
WORKFLOW_DESIGNER_DB_SETTINGS_ENTRY = "Settings"
|
||||
WORKFLOW_DESIGNER_DB_STATE_ENTRY = "State"
|
||||
|
||||
class ProcessorTypes:
|
||||
Producer = "producer"
|
||||
Filter = "filter"
|
||||
Presenter = "presenter"
|
||||
|
||||
ROUTE_ROOT = "/workflows"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user