prefer the bpmn process name over the identifier on the logs list page w/ burnettk

This commit is contained in:
jasquat 2023-03-01 16:28:42 -05:00
parent d295e6ae94
commit 0fbe7a3e76
No known key found for this signature in database
9 changed files with 42 additions and 20 deletions

View File

@ -272,6 +272,7 @@ class Task(object, metaclass=DeprecatedMetaTask):
extra = dct or {}
extra.update({
'workflow': self.workflow.spec.name,
'workflow_name': self.workflow.spec.description,
'task_spec': self.task_spec.name,
'task_name': self.task_spec.description,
'task_id': self.id,

View File

@ -84,6 +84,7 @@ class Workflow(object):
extra = dct or {}
extra.update({
'workflow': self.spec.name,
'workflow_name': self.spec.description,
'task_spec': '-',
'task_type': None,
'task_id': None,

View File

@ -55,7 +55,7 @@ if [[ "${1:-}" == "clean" ]]; then
fi
tasks="$tasks upgrade"
elif [[ "${1:-}" == "migrate" ]]; then
tasks="$tasks migrate"
tasks="$tasks migrate upgrade"
elif [[ "${1:-}" == "downgrade" ]]; then
tasks="$tasks downgrade"
else

View File

@ -0,0 +1,28 @@
"""empty message
Revision ID: 8930711a75a4
Revises: 7422be14adc4
Create Date: 2023-03-01 16:16:50.446929
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8930711a75a4'
down_revision = '7422be14adc4'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('spiff_logging', sa.Column('bpmn_process_name', sa.String(length=255), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('spiff_logging', 'bpmn_process_name')
# ### end Alembic commands ###

View File

@ -901,14 +901,6 @@ MarkupSafe = ">=2.0"
[package.extras]
i18n = ["Babel (>=2.7)"]
[[package]]
name = "json-delta"
version = "2.0.2"
description = "A diff/patch pair for JSON-serialized data structures."
category = "main"
optional = false
python-versions = "*"
[[package]]
name = "jsonschema"
version = "4.16.0"
@ -2204,7 +2196,7 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools"
[metadata]
lock-version = "1.1"
python-versions = ">=3.9,<3.12"
content-hash = "af711e2941c42b837da47ca8d647b1ae44657bf6805353bc216bb49cb3cbbfae"
content-hash = "3876acb4e3d947787a3ba8e831844ca0b06bde34dc038be46cabc00aa2a4defe"
[metadata.files]
alabaster = [
@ -2610,10 +2602,6 @@ Jinja2 = [
{file = "Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"},
{file = "Jinja2-3.1.2.tar.gz", hash = "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852"},
]
json-delta = [
{file = "json_delta-2.0.2-py2.py3-none-any.whl", hash = "sha256:12bc798354ea722fa04fae21ea06879321c47b0887572c27384accd6ef28efbf"},
{file = "json_delta-2.0.2.tar.gz", hash = "sha256:95ea3ff9908fc7d634c27ffec11db8fd8d935aa3e895d7302915d394b10e0321"},
]
jsonschema = [
{file = "jsonschema-4.16.0-py3-none-any.whl", hash = "sha256:9e74b8f9738d6a946d70705dc692b74b5429cd0960d58e79ffecfc43b2221eb9"},
{file = "jsonschema-4.16.0.tar.gz", hash = "sha256:165059f076eff6971bae5b742fc029a7b4ef3f9bcf04c14e4776a7605de14b23"},

View File

@ -28,7 +28,7 @@ flask-migrate = "*"
flask-restful = "*"
werkzeug = "*"
SpiffWorkflow = {git = "https://github.com/sartography/SpiffWorkflow", rev = "main"}
#SpiffWorkflow = {develop = true, path = "../SpiffWorkflow" }
# SpiffWorkflow = {develop = true, path = "../SpiffWorkflow" }
sentry-sdk = "^1.10"
sphinx-autoapi = "^2.0"
flask-bpmn = {git = "https://github.com/sartography/flask-bpmn", rev = "main"}

View File

@ -14,6 +14,7 @@ class SpiffLoggingModel(SpiffworkflowBaseDBModel):
id: int = db.Column(db.Integer, primary_key=True)
process_instance_id: int = db.Column(db.Integer, nullable=False)
bpmn_process_identifier: str = db.Column(db.String(255), nullable=False)
bpmn_process_name: Optional[str] = db.Column(db.String(255), nullable=True)
bpmn_task_identifier: str = db.Column(db.String(255), nullable=False)
bpmn_task_name: str = db.Column(db.String(255), nullable=True)
bpmn_task_type: str = db.Column(db.String(255), nullable=True)

View File

@ -213,6 +213,7 @@ class DBHandler(logging.Handler):
# that initializes a BpmnWorkflow without a process instance
if record and record.process_instance_id: # type: ignore
bpmn_process_identifier = record.workflow # type: ignore
bpmn_process_name = record.workflow_name # type: ignore
spiff_task_guid = str(record.task_id) # type: ignore
bpmn_task_identifier = str(record.task_spec) # type: ignore
bpmn_task_name = record.task_name if hasattr(record, "task_name") else None # type: ignore
@ -235,6 +236,7 @@ class DBHandler(logging.Handler):
{
"process_instance_id": record.process_instance_id, # type: ignore
"bpmn_process_identifier": bpmn_process_identifier,
"bpmn_process_name": bpmn_process_name,
"spiff_task_guid": spiff_task_guid,
"bpmn_task_name": bpmn_task_name,
"bpmn_task_identifier": bpmn_task_identifier,

View File

@ -29,8 +29,6 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
processInstanceShowPageBaseUrl = `/admin/process-instances/${params.process_model_id}`;
}
const userEmail = UserService.getUserEmail();
useEffect(() => {
const setProcessInstanceLogListFromResult = (result: any) => {
setProcessInstanceLogs(result.results);
@ -59,11 +57,14 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
(row.bpmn_task_type === 'End Event' ? 'Process Ended' : '')}
</td>
);
const bpmnProcessCell = (
<td>{row.bpmn_process_name || row.bpmn_process_identifier}</td>
);
if (isDetailedView) {
tableRow.push(
<>
<td data-qa="paginated-entity-id">{row.id}</td>
<td>{row.bpmn_process_identifier}</td>
{bpmnProcessCell}
{taskNameCell}
</>
);
@ -71,7 +72,7 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
tableRow.push(
<>
{taskNameCell}
<td>{row.bpmn_process_identifier}</td>
{bpmnProcessCell}
</>
);
}
@ -80,7 +81,7 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
<>
<td>{row.bpmn_task_type}</td>
<td>{row.message}</td>
<td>{row.username === userEmail ? 'me 🔥' : row.username}</td>
<td>{row.username}</td>
</>
);
}