mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-02-25 23:55:16 +00:00
run_pyl
This commit is contained in:
parent
ac149c9dcb
commit
6aaae539a0
@ -18,13 +18,13 @@ def setup_database_uri(app: Flask) -> None:
|
||||
if app.config.get("SPIFFWORKFLOW_BACKEND_DATABASE_URI") is None:
|
||||
database_name = f"spiffworkflow_backend_{app.config['ENV_IDENTIFIER']}"
|
||||
if app.config.get("SPIFFWORKFLOW_BACKEND_DATABASE_TYPE") == "sqlite":
|
||||
app.config["SQLALCHEMY_DATABASE_URI"] = (
|
||||
f"sqlite:///{app.instance_path}/db_{app.config['ENV_IDENTIFIER']}.sqlite3"
|
||||
)
|
||||
app.config[
|
||||
"SQLALCHEMY_DATABASE_URI"
|
||||
] = f"sqlite:///{app.instance_path}/db_{app.config['ENV_IDENTIFIER']}.sqlite3"
|
||||
elif app.config.get("SPIFFWORKFLOW_BACKEND_DATABASE_TYPE") == "postgres":
|
||||
app.config["SQLALCHEMY_DATABASE_URI"] = (
|
||||
f"postgresql://spiffworkflow_backend:spiffworkflow_backend@localhost:5432/{database_name}"
|
||||
)
|
||||
app.config[
|
||||
"SQLALCHEMY_DATABASE_URI"
|
||||
] = f"postgresql://spiffworkflow_backend:spiffworkflow_backend@localhost:5432/{database_name}"
|
||||
else:
|
||||
# use pswd to trick flake8 with hardcoded passwords
|
||||
db_pswd = app.config.get("SPIFFWORKFLOW_BACKEND_DATABASE_PASSWORD")
|
||||
|
@ -129,9 +129,9 @@ class ProcessInstanceModel(SpiffworkflowBaseDBModel):
|
||||
def serialized_with_metadata(self) -> dict[str, Any]:
|
||||
process_instance_attributes = self.serialized
|
||||
process_instance_attributes["process_metadata"] = self.process_metadata
|
||||
process_instance_attributes["process_model_with_diagram_identifier"] = (
|
||||
self.process_model_with_diagram_identifier
|
||||
)
|
||||
process_instance_attributes[
|
||||
"process_model_with_diagram_identifier"
|
||||
] = self.process_model_with_diagram_identifier
|
||||
return process_instance_attributes
|
||||
|
||||
@property
|
||||
|
@ -2,6 +2,7 @@
|
||||
import enum
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
from typing import List
|
||||
from typing import Optional
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Union
|
||||
@ -85,7 +86,7 @@ class TaskModel(SpiffworkflowBaseDBModel):
|
||||
can_complete: Optional[bool] = None
|
||||
extensions: Optional[dict] = None
|
||||
name_for_display: Optional[str] = None
|
||||
signal_buttons: Optional[dict] = None
|
||||
signal_buttons: Optional[List[dict]] = None
|
||||
|
||||
def get_data(self) -> dict:
|
||||
return {**self.python_env_data(), **self.json_data()}
|
||||
|
@ -18,7 +18,6 @@ from spiffworkflow_backend.exceptions.process_entity_not_found_error import (
|
||||
)
|
||||
from spiffworkflow_backend.models.principal import PrincipalModel
|
||||
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
|
||||
from spiffworkflow_backend.models.process_instance import ProcessInstanceModelSchema
|
||||
from spiffworkflow_backend.models.process_instance_file_data import (
|
||||
ProcessInstanceFileDataModel,
|
||||
)
|
||||
|
@ -423,9 +423,9 @@ class ProcessInstanceProcessor:
|
||||
tld.process_instance_id = process_instance_model.id
|
||||
|
||||
# we want this to be the fully qualified path to the process model including all group subcomponents
|
||||
current_app.config["THREAD_LOCAL_DATA"].process_model_identifier = (
|
||||
f"{process_instance_model.process_model_identifier}"
|
||||
)
|
||||
current_app.config[
|
||||
"THREAD_LOCAL_DATA"
|
||||
].process_model_identifier = f"{process_instance_model.process_model_identifier}"
|
||||
|
||||
self.process_instance_model = process_instance_model
|
||||
self.process_model_service = ProcessModelService()
|
||||
@ -585,9 +585,9 @@ class ProcessInstanceProcessor:
|
||||
bpmn_subprocess_definition.bpmn_identifier
|
||||
] = bpmn_process_definition_dict
|
||||
spiff_bpmn_process_dict["subprocess_specs"][bpmn_subprocess_definition.bpmn_identifier]["task_specs"] = {}
|
||||
bpmn_subprocess_definition_bpmn_identifiers[bpmn_subprocess_definition.id] = (
|
||||
bpmn_subprocess_definition.bpmn_identifier
|
||||
)
|
||||
bpmn_subprocess_definition_bpmn_identifiers[
|
||||
bpmn_subprocess_definition.id
|
||||
] = bpmn_subprocess_definition.bpmn_identifier
|
||||
|
||||
task_definitions = TaskDefinitionModel.query.filter(
|
||||
TaskDefinitionModel.bpmn_process_definition_id.in_( # type: ignore
|
||||
|
@ -2,7 +2,8 @@ import copy
|
||||
import json
|
||||
import time
|
||||
from hashlib import sha256
|
||||
from typing import Optional, List
|
||||
from typing import List
|
||||
from typing import Optional
|
||||
from typing import Tuple
|
||||
from typing import TypedDict
|
||||
from typing import Union
|
||||
@ -642,17 +643,19 @@ class TaskService:
|
||||
for task_model in waiting_tasks:
|
||||
task_definition = task_model.task_definition
|
||||
extensions: dict = (
|
||||
task_definition.properties_json["extensions"] if "extensions" in task_definition.properties_json else {}
|
||||
task_definition.properties_json["extensions"]
|
||||
if "extensions" in task_definition.properties_json
|
||||
else {}
|
||||
)
|
||||
event_definition: dict = (
|
||||
task_definition.properties_json["event_definition"] if "event_definition" in task_definition.properties_json else {}
|
||||
task_definition.properties_json["event_definition"]
|
||||
if "event_definition" in task_definition.properties_json
|
||||
else {}
|
||||
)
|
||||
if 'signalButtonLabel' in extensions and 'name' in event_definition:
|
||||
result.append({'event': event_definition, 'label': extensions['signalButtonLabel']})
|
||||
if "signalButtonLabel" in extensions and "name" in event_definition:
|
||||
result.append({"event": event_definition, "label": extensions["signalButtonLabel"]})
|
||||
return result
|
||||
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_spec_reference_from_bpmn_process(cls, bpmn_process: BpmnProcessModel) -> SpecReferenceCache:
|
||||
"""Get the bpmn file for a given task model.
|
||||
|
@ -157,7 +157,6 @@ class TestTaskService(BaseTest):
|
||||
bpmn_process = TaskService.bpmn_process_for_called_activity_or_top_level_process(task_model_level_3)
|
||||
assert bpmn_process.bpmn_process_definition.bpmn_identifier == "Level3"
|
||||
|
||||
|
||||
def test_get_button_labels_for_waiting_signal_event_tasks(
|
||||
self,
|
||||
app: Flask,
|
||||
@ -169,18 +168,18 @@ class TestTaskService(BaseTest):
|
||||
bpmn_file_name="signal_event_extensions",
|
||||
)
|
||||
load_test_spec(
|
||||
f"test_group/SpiffCatchEventExtensions",
|
||||
"test_group/SpiffCatchEventExtensions",
|
||||
process_model_source_directory="call_activity_nested",
|
||||
bpmn_file_name="SpiffCatchEventExtensions"
|
||||
bpmn_file_name="SpiffCatchEventExtensions",
|
||||
)
|
||||
process_instance = self.create_process_instance_from_process_model(process_model)
|
||||
processor = ProcessInstanceProcessor(process_instance)
|
||||
processor.do_engine_steps(save=True, execution_strategy_name="greedy")
|
||||
events = TaskService.get_ready_signals_with_button_labels(process_instance.id)
|
||||
assert(len(events) == 1)
|
||||
assert len(events) == 1
|
||||
signal_event = events[0]
|
||||
assert(signal_event['event']['name'] == 'eat_spam')
|
||||
assert(signal_event['event']['typename'] == 'SignalEventDefinition')
|
||||
assert(signal_event['label'] == 'Eat Spam')
|
||||
assert signal_event["event"]["name"] == "eat_spam"
|
||||
assert signal_event["event"]["typename"] == "SignalEventDefinition"
|
||||
assert signal_event["label"] == "Eat Spam"
|
||||
|
||||
print(events)
|
||||
|
@ -196,7 +196,7 @@ export default function TaskShow() {
|
||||
};
|
||||
|
||||
const handleSignalSubmit = (event: EventDefinition) => {
|
||||
console.log("Signal Event ", event)
|
||||
console.log('Signal Event ', event);
|
||||
if (disabled || !task) {
|
||||
return;
|
||||
}
|
||||
@ -211,7 +211,7 @@ export default function TaskShow() {
|
||||
httpMethod: 'POST',
|
||||
postBody: event,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const buildTaskNavigation = () => {
|
||||
let userTasksElement;
|
||||
@ -367,19 +367,25 @@ export default function TaskShow() {
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
reactFragmentToHideSubmitButton = <ButtonSet>
|
||||
reactFragmentToHideSubmitButton = (
|
||||
<ButtonSet>
|
||||
<Button type="submit" id="submit-button" disabled={disabled}>
|
||||
{submitButtonText}
|
||||
</Button>
|
||||
{saveAsDraftButton}
|
||||
<>
|
||||
{task.signal_buttons.map((signal, i) =>
|
||||
<Button name={`signal.signal`} disabled={disabled} onClick={() => handleSignalSubmit(signal.event)}>
|
||||
{task.signal_buttons.map((signal) => (
|
||||
<Button
|
||||
name="signal.signal"
|
||||
disabled={disabled}
|
||||
onClick={() => handleSignalSubmit(signal.event)}
|
||||
>
|
||||
{signal.label}
|
||||
</Button>
|
||||
)}
|
||||
))}
|
||||
</>
|
||||
</ButtonSet>;
|
||||
</ButtonSet>
|
||||
);
|
||||
}
|
||||
|
||||
const customValidate = (formData: any, errors: any) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user