From 3ea5d9a0556ca7782a89ec14500bb65b4e2fe412 Mon Sep 17 00:00:00 2001 From: burnettk Date: Tue, 28 Mar 2023 10:05:29 -0400 Subject: [PATCH 1/4] fix all sonar bugs --- .../routes/openid_blueprint/static/login.css | 2 +- .../routes/openid_blueprint/templates/login.html | 4 ++-- .../services/process_instance_service.py | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/static/login.css b/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/static/login.css index 15b093f67..94d1e0577 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/static/login.css +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/static/login.css @@ -2,7 +2,7 @@ margin: 0; padding: 0; background-color:white; - font-family: 'Arial'; + font-family: 'Arial, sans-serif'; } header { width: 100%; diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/templates/login.html b/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/templates/login.html index 858355c36..815275d2b 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/templates/login.html +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/templates/login.html @@ -1,12 +1,12 @@ - + Login Form
- + Small SpiffWorkflow logo

Login

diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py index 37f77ac14..711ea0d80 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py @@ -157,8 +157,7 @@ class ProcessInstanceService: # navigation = processor.bpmn_process_instance.get_deep_nav_list() # ProcessInstanceService.update_navigation(navigation, processor) process_model_service = ProcessModelService() - process_model = process_model_service.get_process_model(processor.process_model_identifier) - process_model.display_name if process_model else "" + process_model_service.get_process_model(processor.process_model_identifier) process_instance_api = ProcessInstanceApi( id=processor.get_process_instance_id(), status=processor.get_status(), From e20ada5d496b4c9798ee9de07f5337ab7f01ddbe Mon Sep 17 00:00:00 2001 From: burnettk Date: Tue, 28 Mar 2023 10:33:53 -0400 Subject: [PATCH 2/4] get backend working with new spiff --- spiffworkflow-backend/poetry.lock | 2 +- .../services/process_instance_processor.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spiffworkflow-backend/poetry.lock b/spiffworkflow-backend/poetry.lock index b96b8d782..ef67a53e4 100644 --- a/spiffworkflow-backend/poetry.lock +++ b/spiffworkflow-backend/poetry.lock @@ -1895,7 +1895,7 @@ lxml = "*" type = "git" url = "https://github.com/sartography/SpiffWorkflow" reference = "main" -resolved_reference = "3c3345c85dd7f3b7112ad04aaa6487abbd2e9414" +resolved_reference = "62454c99c3a711c38f4249a3b5e7215d42037d72" [[package]] name = "SQLAlchemy" diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py index 7e3028fd7..6d236ef64 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py @@ -1779,7 +1779,7 @@ class ProcessInstanceProcessor: ) task_model.start_in_seconds = time.time() - self.bpmn_process_instance.complete_task_from_id(spiff_task.id) + self.bpmn_process_instance.run_task_from_id(spiff_task.id) task_model.end_in_seconds = time.time() human_task.completed_by_user_id = user.id From dc005c36dc2e489a64d11a4e23495fc478ed8c3b Mon Sep 17 00:00:00 2001 From: burnettk Date: Tue, 28 Mar 2023 11:22:42 -0400 Subject: [PATCH 3/4] kill commented out code --- spiffworkflow-backend/conftest.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/spiffworkflow-backend/conftest.py b/spiffworkflow-backend/conftest.py index 9d05dfe5a..4e902e22c 100644 --- a/spiffworkflow-backend/conftest.py +++ b/spiffworkflow-backend/conftest.py @@ -19,8 +19,6 @@ from spiffworkflow_backend.services.process_instance_service import ( ) from spiffworkflow_backend.services.process_model_service import ProcessModelService -# from tests.spiffworkflow_backend.helpers.test_data import load_test_spec - # We need to call this before importing spiffworkflow_backend # otherwise typeguard cannot work. hence the noqa: E402 From 293d3a9295fca062a3f89bdc58f95602d70085ec Mon Sep 17 00:00:00 2001 From: burnettk Date: Tue, 28 Mar 2023 13:41:58 -0400 Subject: [PATCH 4/4] notion 183: Home Page Refresh, keep it refreshing for 4 hours instead of 10 minutes --- .../src/components/ProcessInstanceListTable.tsx | 9 ++++----- .../src/components/TaskListTable.tsx | 10 +++++++--- spiffworkflow-frontend/src/helpers.tsx | 8 ++++++++ spiffworkflow-frontend/src/routes/MyTasks.tsx | 10 +++++++--- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx index 870dc4408..81b644d1a 100644 --- a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx +++ b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx @@ -36,6 +36,8 @@ import { getProcessModelFullIdentifierFromSearchParams, modifyProcessIdentifierForPathParam, refreshAtInterval, + REFRESH_INTERVAL_SECONDS, + REFRESH_TIMEOUT_SECONDS, } from '../helpers'; import { useUriListForPermissions } from '../hooks/UriListForPermissions'; @@ -68,9 +70,6 @@ import useAPIError from '../hooks/UseApiError'; import { usePermissionFetcher } from '../hooks/PermissionService'; import { Can } from '../contexts/Can'; -const REFRESH_INTERVAL = 5; -const REFRESH_TIMEOUT = 600; - type OwnProps = { filtersEnabled?: boolean; processModelFullIdentifier?: string; @@ -389,8 +388,8 @@ export default function ProcessInstanceListTable({ checkFiltersAndRun(); if (autoReload) { return refreshAtInterval( - REFRESH_INTERVAL, - REFRESH_TIMEOUT, + REFRESH_INTERVAL_SECONDS, + REFRESH_TIMEOUT_SECONDS, checkFiltersAndRun ); } diff --git a/spiffworkflow-frontend/src/components/TaskListTable.tsx b/spiffworkflow-frontend/src/components/TaskListTable.tsx index 1951b4cc7..b6901f73e 100644 --- a/spiffworkflow-frontend/src/components/TaskListTable.tsx +++ b/spiffworkflow-frontend/src/components/TaskListTable.tsx @@ -9,14 +9,14 @@ import { getPageInfoFromSearchParams, modifyProcessIdentifierForPathParam, refreshAtInterval, + REFRESH_INTERVAL_SECONDS, + REFRESH_TIMEOUT_SECONDS, } from '../helpers'; import HttpService from '../services/HttpService'; import { PaginationObject, ProcessInstanceTask } from '../interfaces'; import TableCellWithTimeAgoInWords from './TableCellWithTimeAgoInWords'; const PER_PAGE_FOR_TASKS_ON_HOME_PAGE = 5; -const REFRESH_INTERVAL = 5; -const REFRESH_TIMEOUT = 600; type OwnProps = { apiPath: string; @@ -89,7 +89,11 @@ export default function TaskListTable({ }; getTasks(); if (autoReload) { - return refreshAtInterval(REFRESH_INTERVAL, REFRESH_TIMEOUT, getTasks); + return refreshAtInterval( + REFRESH_INTERVAL_SECONDS, + REFRESH_TIMEOUT_SECONDS, + getTasks + ); } return undefined; }, [ diff --git a/spiffworkflow-frontend/src/helpers.tsx b/spiffworkflow-frontend/src/helpers.tsx index 88ab15227..273e12ae9 100644 --- a/spiffworkflow-frontend/src/helpers.tsx +++ b/spiffworkflow-frontend/src/helpers.tsx @@ -270,3 +270,11 @@ export const encodeBase64 = (data: string) => { export const decodeBase64 = (data: string) => { return Buffer.from(data, 'base64').toString('ascii'); }; + +const MINUTES_IN_HOUR = 60; +const SECONDS_IN_MINUTE = 60; +const SECONDS_IN_HOUR = MINUTES_IN_HOUR * SECONDS_IN_MINUTE; +const FOUR_HOURS_IN_SECONDS = SECONDS_IN_HOUR * 4; + +export const REFRESH_INTERVAL_SECONDS = 5; +export const REFRESH_TIMEOUT_SECONDS = FOUR_HOURS_IN_SECONDS; diff --git a/spiffworkflow-frontend/src/routes/MyTasks.tsx b/spiffworkflow-frontend/src/routes/MyTasks.tsx index 3daaaef6a..810c811bf 100644 --- a/spiffworkflow-frontend/src/routes/MyTasks.tsx +++ b/spiffworkflow-frontend/src/routes/MyTasks.tsx @@ -8,6 +8,8 @@ import { getPageInfoFromSearchParams, modifyProcessIdentifierForPathParam, refreshAtInterval, + REFRESH_INTERVAL_SECONDS, + REFRESH_TIMEOUT_SECONDS, } from '../helpers'; import HttpService from '../services/HttpService'; import { @@ -19,8 +21,6 @@ import { import ProcessInstanceRun from '../components/ProcessInstanceRun'; const PER_PAGE_FOR_TASKS_ON_HOME_PAGE = 5; -const REFRESH_INTERVAL = 5; -const REFRESH_TIMEOUT = 600; export default function MyTasks() { const [searchParams] = useSearchParams(); @@ -46,7 +46,11 @@ export default function MyTasks() { }; getTasks(); - refreshAtInterval(REFRESH_INTERVAL, REFRESH_TIMEOUT, getTasks); + refreshAtInterval( + REFRESH_INTERVAL_SECONDS, + REFRESH_TIMEOUT_SECONDS, + getTasks + ); }, [searchParams]); const processInstanceRunResultTag = () => {