Merge pull request #163 from sartography/feature/process_name_for_log_list

prefer the bpmn process name over the identifier on the logs list pag…
This commit is contained in:
Kevin Burnett 2023-03-01 14:21:37 -08:00 committed by GitHub
commit 64b51a0792
6 changed files with 40 additions and 8 deletions

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

@ -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

@ -212,7 +212,8 @@ class DBHandler(logging.Handler):
# if we do not have a process instance id then do not log and assume we are running a script unit test
# 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_identifier = record.workflow_spec # 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>
</>
);
}