From 9f2d5244475f20ddd265461f3ceb542791087570 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 17 Nov 2022 11:52:57 -0500 Subject: [PATCH 01/84] a little cleanup to forms w/ burnettk --- spiffworkflow-frontend/package-lock.json | 68 ----------------- .../components/ProcessInstanceListTable.tsx | 43 +++++++---- .../src/routes/TaskShow.tsx | 75 ++++++++++++------- .../BaseInputTemplate/BaseInputTemplate.tsx | 3 + 4 files changed, 81 insertions(+), 108 deletions(-) diff --git a/spiffworkflow-frontend/package-lock.json b/spiffworkflow-frontend/package-lock.json index 4898b19c..0dfe841a 100644 --- a/spiffworkflow-frontend/package-lock.json +++ b/spiffworkflow-frontend/package-lock.json @@ -24,7 +24,6 @@ "@rjsf/mui": "^5.0.0-beta.13", "@rjsf/utils": "^5.0.0-beta.13", "@rjsf/validator-ajv6": "^5.0.0-beta.13", - "@rjsf/validator-ajv8": "^5.0.0-beta.13", "@tanstack/react-table": "^8.2.2", "@testing-library/jest-dom": "^5.16.4", "@testing-library/react": "^13.3.0", @@ -4950,23 +4949,6 @@ "@rjsf/utils": "^5.0.0-beta.1" } }, - "node_modules/@rjsf/validator-ajv8": { - "version": "5.0.0-beta.13", - "resolved": "https://registry.npmjs.org/@rjsf/validator-ajv8/-/validator-ajv8-5.0.0-beta.13.tgz", - "integrity": "sha512-/hrYbiwgCvEqw1Z7YZTWvd+ZAiX5vSN0WAI2hJTJTqKuCTcIH0fqNDCaOg3FBR38BL7seZrUmibIUcPU66iJ1w==", - "dependencies": { - "ajv-formats": "^2.1.1", - "ajv8": "npm:ajv@^8.11.0", - "lodash": "^4.17.15", - "lodash-es": "^4.17.15" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@rjsf/utils": "^5.0.0-beta.12" - } - }, "node_modules/@rollup/plugin-babel": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz", @@ -6840,27 +6822,6 @@ "ajv": "^6.9.1" } }, - "node_modules/ajv8": { - "name": "ajv", - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.2.tgz", - "integrity": "sha512-E4bfmKAhGiSTvMfL1Myyycaub+cUEU2/IvpylXkUu7CHBkBj1f/ikdzbD7YQ6FKUbixDxeYvB/xY4fvyroDlQg==", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ajv8/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" - }, "node_modules/ansi-align": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", @@ -34883,17 +34844,6 @@ "lodash-es": "^4.17.15" } }, - "@rjsf/validator-ajv8": { - "version": "5.0.0-beta.13", - "resolved": "https://registry.npmjs.org/@rjsf/validator-ajv8/-/validator-ajv8-5.0.0-beta.13.tgz", - "integrity": "sha512-/hrYbiwgCvEqw1Z7YZTWvd+ZAiX5vSN0WAI2hJTJTqKuCTcIH0fqNDCaOg3FBR38BL7seZrUmibIUcPU66iJ1w==", - "requires": { - "ajv-formats": "^2.1.1", - "ajv8": "npm:ajv@^8.11.0", - "lodash": "^4.17.15", - "lodash-es": "^4.17.15" - } - }, "@rollup/plugin-babel": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz", @@ -36367,24 +36317,6 @@ "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", "requires": {} }, - "ajv8": { - "version": "npm:ajv@8.11.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.2.tgz", - "integrity": "sha512-E4bfmKAhGiSTvMfL1Myyycaub+cUEU2/IvpylXkUu7CHBkBj1f/ikdzbD7YQ6FKUbixDxeYvB/xY4fvyroDlQg==", - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "dependencies": { - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" - } - } - }, "ansi-align": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", diff --git a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx index 5c7786c0..407ac307 100644 --- a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx +++ b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx @@ -20,12 +20,16 @@ import { TableHeader, TableHead, TableRow, + TimePicker, + TimePickerSelect, + SelectItem, // @ts-ignore } from '@carbon/react'; import { PROCESS_STATUSES, DATE_FORMAT, DATE_FORMAT_CARBON } from '../config'; import { convertDateStringToSeconds, convertSecondsToFormattedDate, + convertSecondsToFormattedDateTime, getPageInfoFromSearchParams, getProcessModelFullIdentifierFromSearchParams, modifyProcessModelPath, @@ -345,21 +349,32 @@ export default function ProcessInstanceListTable({ onChangeFunction: any ) => { return ( - - { - onChangeFunction(dateChangeEvent.srcElement.value); + <> + + { + onChangeFunction(dateChangeEvent.srcElement.value); + }} + value={initialDate} + /> + + { + console.log('event', event); }} - value={initialDate} /> - + ); }; @@ -493,7 +508,7 @@ export default function ProcessInstanceListTable({ ); }; const formatSecondsForDisplay = (_row: any, seconds: any) => { - return convertSecondsToFormattedDate(seconds) || '-'; + return convertSecondsToFormattedDateTime(seconds) || '-'; }; const defaultFormatter = (_row: any, value: any) => { return value; diff --git a/spiffworkflow-frontend/src/routes/TaskShow.tsx b/spiffworkflow-frontend/src/routes/TaskShow.tsx index 9da0e30a..1309b8f3 100644 --- a/spiffworkflow-frontend/src/routes/TaskShow.tsx +++ b/spiffworkflow-frontend/src/routes/TaskShow.tsx @@ -1,5 +1,5 @@ import { useContext, useEffect, useState } from 'react'; -import { Link, useNavigate, useParams } from 'react-router-dom'; +import { useNavigate, useParams } from 'react-router-dom'; // FIXME: npm install @rjsf/validator-ajv8 and use it as soon as // rawErrors is fixed. @@ -9,8 +9,14 @@ import { Link, useNavigate, useParams } from 'react-router-dom'; // https://github.com/rjsf-team/react-jsonschema-form/blob/main/docs/api-reference/uiSchema.md talks about rawErrors import validator from '@rjsf/validator-ajv6'; -// @ts-ignore -import { Button, Stack } from '@carbon/react'; +import { + TabList, + Tab, + Tabs, + Grid, + Column, + // @ts-ignore +} from '@carbon/react'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; @@ -73,39 +79,52 @@ export default function TaskShow() { const buildTaskNavigation = () => { let userTasksElement; + let selectedTabIndex = 0; if (userTasks) { userTasksElement = (userTasks as any).map(function getUserTasksElement( - userTask: any + userTask: any, + index: number ) { const taskUrl = `/tasks/${params.process_instance_id}/${userTask.id}`; if (userTask.id === params.task_id) { - return {userTask.name}; + selectedTabIndex = index; + return {userTask.title}; } if (userTask.state === 'COMPLETED') { return ( - - {userTask.name} - + navigate(taskUrl)} + data-qa={`form-nav-${userTask.name}`} + > + {userTask.title} + ); } if (userTask.state === 'FUTURE') { - return {userTask.name}; + return {userTask.title}; } if (userTask.state === 'READY') { return ( - - {userTask.name} - Current - + navigate(taskUrl)} + data-qa={`form-nav-${userTask.name}`} + > + {userTask.title} + ); } return null; }); } return ( - - - {userTasksElement} - + + + {userTasksElement} + + ); }; @@ -149,15 +168,19 @@ export default function TaskShow() { } return ( -
- {reactFragmentToHideSubmitButton} -
+ + +
+ {reactFragmentToHideSubmitButton} +
+
+
); }; @@ -175,7 +198,7 @@ export default function TaskShow() { ); }; - if (task) { + if (task && userTasks) { const taskToUse = task as any; let statusString = ''; if (taskToUse.state !== 'READY') { diff --git a/spiffworkflow-frontend/src/themes/carbon/BaseInputTemplate/BaseInputTemplate.tsx b/spiffworkflow-frontend/src/themes/carbon/BaseInputTemplate/BaseInputTemplate.tsx index 90cc3f0f..0670c69d 100644 --- a/spiffworkflow-frontend/src/themes/carbon/BaseInputTemplate/BaseInputTemplate.tsx +++ b/spiffworkflow-frontend/src/themes/carbon/BaseInputTemplate/BaseInputTemplate.tsx @@ -82,6 +82,9 @@ export default function BaseInputTemplate< } else if (schema && schema.title) { labelToUse = schema.title; } + if (required) { + labelToUse = `${labelToUse}*`; + } let invalid = false; let errorMessageForField = null; From f88f576dcbd0ab7b74bf5a2870850e11a54530cb Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Thu, 17 Nov 2022 12:08:42 -0500 Subject: [PATCH 02/84] Rename CAT_JSON_FILE, WF_JSON_FILE, add_spec, update_spec --- spiffworkflow-backend/bin/update_all_json.py | 2 +- .../routes/process_api_blueprint.py | 4 ++-- .../services/file_system_service.py | 6 +++--- .../services/process_model_service.py | 16 ++++++++-------- .../services/spec_file_service.py | 2 +- .../helpers/example_data.py | 2 +- .../integration/test_process_api.py | 4 ++-- .../unit/test_process_model_service.py | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/spiffworkflow-backend/bin/update_all_json.py b/spiffworkflow-backend/bin/update_all_json.py index 4e6b1b8a..d8000c45 100644 --- a/spiffworkflow-backend/bin/update_all_json.py +++ b/spiffworkflow-backend/bin/update_all_json.py @@ -15,7 +15,7 @@ def main() -> None: "process_group_id": "", "id": f"{group.id}/{process_model.id}", } - ProcessModelService().update_spec(process_model, update_items) + ProcessModelService().update_process_model(process_model, update_items) if __name__ == "__main__": diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index a5b4c0aa..98d7f68b 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -270,7 +270,7 @@ def process_model_create( status_code=400, ) - process_model_service.add_spec(process_model_info) + process_model_service.add_process_model(process_model_info) return Response( json.dumps(ProcessModelInfoSchema().dump(process_model_info)), status=201, @@ -307,7 +307,7 @@ def process_model_update( # process_model_identifier = f"{process_group_id}/{process_model_id}" process_model = get_process_model(process_model_identifier) - ProcessModelService().update_spec(process_model, body_filtered) + ProcessModelService().update_process_model(process_model, body_filtered) return ProcessModelInfoSchema().dump(process_model) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py index 547159e6..863456ac 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py @@ -20,8 +20,8 @@ class FileSystemService: """ Simple Service meant for extension that provides some useful methods for dealing with the File system. """ - CAT_JSON_FILE = "process_group.json" - WF_JSON_FILE = "workflow.json" + PROCESS_GROUP_JSON_FILE = "process_group.json" + PROCESS_MODEL_JSON_FILE = "workflow.json" @staticmethod def root_path() -> str: @@ -135,7 +135,7 @@ class FileSystemService: if item.is_file(): if item.name.startswith("."): continue # Ignore hidden files - if item.name == FileSystemService.WF_JSON_FILE: + if item.name == FileSystemService.PROCESS_MODEL_JSON_FILE: continue # Ignore the json files. if file_name is not None and item.name != file_name: continue diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py index 06d0a7d7..28547b44 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py @@ -36,14 +36,14 @@ class ProcessModelService(FileSystemService): def is_group(self, path: str) -> bool: """Is_group.""" - group_json_path = os.path.join(path, self.CAT_JSON_FILE) + group_json_path = os.path.join(path, self.PROCESS_GROUP_JSON_FILE) if os.path.exists(group_json_path): return True return False def is_model(self, path: str) -> bool: """Is_model.""" - model_json_path = os.path.join(path, self.WF_JSON_FILE) + model_json_path = os.path.join(path, self.PROCESS_MODEL_JSON_FILE) if os.path.exists(model_json_path): return True return False @@ -59,13 +59,13 @@ class ProcessModelService(FileSystemService): end = start + per_page return items[start:end] - def add_spec(self, process_model: ProcessModelInfo) -> None: + def add_process_model(self, process_model: ProcessModelInfo) -> None: """Add_spec.""" display_order = self.next_display_order(process_model) process_model.display_order = display_order self.save_process_model(process_model) - def update_spec( + def update_process_model( self, process_model: ProcessModelInfo, attributes_to_update: dict ) -> None: """Update_spec.""" @@ -78,7 +78,7 @@ class ProcessModelService(FileSystemService): """Save_process_model.""" spec_path = os.path.join(FileSystemService.root_path(), process_model.id) os.makedirs(spec_path, exist_ok=True) - json_path = os.path.join(spec_path, self.WF_JSON_FILE) + json_path = os.path.join(spec_path, self.PROCESS_MODEL_JSON_FILE) with open(json_path, "w") as wf_json: json.dump( self.WF_SCHEMA.dump(process_model), wf_json, indent=4, sort_keys=True @@ -205,7 +205,7 @@ class ProcessModelService(FileSystemService): """Update_process_group.""" cat_path = self.process_group_path(process_group.id) os.makedirs(cat_path, exist_ok=True) - json_path = os.path.join(cat_path, self.CAT_JSON_FILE) + json_path = os.path.join(cat_path, self.PROCESS_GROUP_JSON_FILE) with open(json_path, "w") as cat_json: json.dump( process_group.serialized, @@ -279,7 +279,7 @@ class ProcessModelService(FileSystemService): def __scan_process_group(self, dir_path: str) -> ProcessGroup: """Reads the process_group.json file, and any nested directories.""" - cat_path = os.path.join(dir_path, self.CAT_JSON_FILE) + cat_path = os.path.join(dir_path, self.PROCESS_GROUP_JSON_FILE) if os.path.exists(cat_path): with open(cat_path) as cat_json: data = json.load(cat_json) @@ -329,7 +329,7 @@ class ProcessModelService(FileSystemService): process_group: Optional[ProcessGroup] = None, ) -> ProcessModelInfo: """__scan_spec.""" - spec_path = os.path.join(path, self.WF_JSON_FILE) + spec_path = os.path.join(path, self.PROCESS_MODEL_JSON_FILE) if os.path.exists(spec_path): with open(spec_path) as wf_json: diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py index 2d5bb76e..044b824b 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py @@ -171,7 +171,7 @@ class SpecFileService(FileSystemService): ref.is_primary = True if ref.is_primary: - ProcessModelService().update_spec( + ProcessModelService().update_process_model( process_model_info, { "primary_process_id": ref.identifier, diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/example_data.py b/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/example_data.py index 2e2289df..befd2602 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/example_data.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/example_data.py @@ -39,7 +39,7 @@ class ExampleDataLoader: is_review=False, ) workflow_spec_service = ProcessModelService() - workflow_spec_service.add_spec(spec) + workflow_spec_service.add_process_model(spec) bpmn_file_name_with_extension = bpmn_file_name if not bpmn_file_name_with_extension: diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py index 5596e72a..fbbf7deb 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py @@ -1830,7 +1830,7 @@ class TestProcessApi(BaseTest): process_model = ProcessModelService().get_process_model( process_model_identifier ) - ProcessModelService().update_spec( + ProcessModelService().update_process_model( process_model, {"fault_or_suspend_on_exception": NotificationType.suspend.value}, ) @@ -1885,7 +1885,7 @@ class TestProcessApi(BaseTest): process_model = ProcessModelService().get_process_model( process_model_identifier ) - ProcessModelService().update_spec( + ProcessModelService().update_process_model( process_model, {"exception_notification_addresses": ["with_super_admin_user@example.com"]}, ) diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_service.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_service.py index 438ef89d..42733775 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_service.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_service.py @@ -32,7 +32,7 @@ class TestProcessModelService(BaseTest): primary_process_id = process_model.primary_process_id assert primary_process_id == "Process_HelloWorld" - ProcessModelService().update_spec(process_model, {"display_name": "new_name"}) + ProcessModelService().update_process_model(process_model, {"display_name": "new_name"}) assert process_model.display_name == "new_name" assert process_model.primary_process_id == primary_process_id From f49d76429eedf1e79cb810be750d1453bb79ebac Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 17 Nov 2022 15:03:11 -0500 Subject: [PATCH 03/84] attempting to use date objects as the date states w/ burnettk --- .../components/ProcessInstanceListTable.tsx | 126 ++++++++++-------- spiffworkflow-frontend/src/helpers.test.tsx | 4 +- spiffworkflow-frontend/src/helpers.tsx | 26 +++- .../src/routes/MessageInstanceList.tsx | 6 +- .../src/routes/ProcessInstanceLogList.tsx | 4 +- 5 files changed, 95 insertions(+), 71 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx index 407ac307..84c3fd62 100644 --- a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx +++ b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx @@ -27,8 +27,11 @@ import { } from '@carbon/react'; import { PROCESS_STATUSES, DATE_FORMAT, DATE_FORMAT_CARBON } from '../config'; import { + convertDateObjectToFormattedString, convertDateStringToSeconds, - convertSecondsToFormattedDate, + convertDateToSeconds, + convertSecondsToDateObject, + convertSecondsToFormattedDateString, convertSecondsToFormattedDateTime, getPageInfoFromSearchParams, getProcessModelFullIdentifierFromSearchParams, @@ -70,10 +73,13 @@ export default function ProcessInstanceListTable({ const oneHourInSeconds = 3600; const oneMonthInSeconds = oneHourInSeconds * 24 * 30; - const [startFrom, setStartFrom] = useState(''); - const [startTo, setStartTo] = useState(''); - const [endFrom, setEndFrom] = useState(''); - const [endTo, setEndTo] = useState(''); + const [startFrom, setStartFrom] = useState( + null + ); + const [startTo, setStartTo] = useState(null); + const [startFromString, setStartFromString] = useState(''); + const [endFrom, setEndFrom] = useState(null); + const [endTo, setEndTo] = useState(null); const [showFilterOptions, setShowFilterOptions] = useState(false); const setErrorMessage = (useContext as any)(ErrorContext)[1]; @@ -140,10 +146,11 @@ export default function ProcessInstanceListTable({ const searchParamValue = searchParams.get(paramName); if (searchParamValue) { queryParamString += `&${paramName}=${searchParamValue}`; - const dateString = convertSecondsToFormattedDate( + const dateObject = convertSecondsToDateObject( searchParamValue as any ); - functionToCall(dateString); + console.log('dateObject1', dateObject); + functionToCall(dateObject); setShowFilterOptions(true); } }); @@ -160,6 +167,10 @@ export default function ProcessInstanceListTable({ const functionToCall = parametersToGetFromSearchParams[paramName]; queryParamString += `&${paramName}=${searchParams.get(paramName)}`; if (functionToCall !== null) { + console.log( + 'searchParams.get(paramName)', + searchParams.get(paramName) + ); functionToCall(searchParams.get(paramName) || ''); } setShowFilterOptions(true); @@ -223,45 +234,6 @@ export default function ProcessInstanceListTable({ perPageOptions, ]); - useEffect(() => { - const filters = processInstanceFilters as any; - Object.keys(parametersToAlwaysFilterBy).forEach((paramName: string) => { - // @ts-expect-error TS(7053) FIXME: - const functionToCall = parametersToAlwaysFilterBy[paramName]; - const paramValue = filters[paramName]; - functionToCall(''); - if (paramValue) { - const dateString = convertSecondsToFormattedDate(paramValue as any); - functionToCall(dateString); - setShowFilterOptions(true); - } - }); - - setProcessModelSelection(null); - processModelAvailableItems.forEach((item: any) => { - if (item.id === filters.process_model_identifier) { - setProcessModelSelection(item); - } - }); - - const processStatusSelectedArray: string[] = []; - if (filters.process_status) { - PROCESS_STATUSES.forEach((processStatusOption: any) => { - const regex = new RegExp(`\\b${processStatusOption}\\b`); - if (filters.process_status.match(regex)) { - processStatusSelectedArray.push(processStatusOption); - } - }); - setShowFilterOptions(true); - } - setProcessStatusSelection(processStatusSelectedArray); - }, [ - processInstanceFilters, - parametersToAlwaysFilterBy, - parametersToGetFromSearchParams, - processModelAvailableItems, - ]); - // does the comparison, but also returns false if either argument // is not truthy and therefore not comparable. const isTrueComparison = (param1: any, operation: any, param2: any) => { @@ -289,10 +261,10 @@ export default function ProcessInstanceListTable({ ); let queryParamString = `per_page=${perPage}&page=${page}&user_filter=true`; - const startFromSeconds = convertDateStringToSeconds(startFrom); - const endFromSeconds = convertDateStringToSeconds(endFrom); - const startToSeconds = convertDateStringToSeconds(startTo); - const endToSeconds = convertDateStringToSeconds(endTo); + const startFromSeconds = convertDateToSeconds(startFrom); + const endFromSeconds = convertDateToSeconds(endFrom); + const startToSeconds = convertDateToSeconds(startTo); + const endToSeconds = convertDateToSeconds(endTo); if (isTrueComparison(startFromSeconds, '>', startToSeconds)) { setErrorMessage({ message: '"Start date from" cannot be after "start date to"', @@ -346,8 +318,10 @@ export default function ProcessInstanceListTable({ labelString: any, name: any, initialDate: any, + initialDateString: string, onChangeFunction: any ) => { + // value={convertDateObjectToFormattedString(initialDate)} return ( <> @@ -360,9 +334,20 @@ export default function ProcessInstanceListTable({ autocomplete="off" allowInput={false} onChange={(dateChangeEvent: any) => { - onChangeFunction(dateChangeEvent.srcElement.value); + let dateTime = new Date(); + if (initialDate) { + dateTime = new Date(initialDate.getTime()); + } + + const [year, month, day] = + dateChangeEvent.srcElement.value.split('-'); + dateTime.setDate(day); + dateTime.setMonth(month - 1); + // @ts-ignore setYear does exist on Date + dateTime.setYear(year); + onChangeFunction(dateTime); }} - value={initialDate} + value={initialDateString} /> { setProcessModelSelection(null); setProcessStatusSelection([]); - setStartFrom(''); - setStartTo(''); - setEndFrom(''); - setEndTo(''); + setStartFrom(null); + setStartTo(null); + setEndFrom(null); + setEndTo(null); }; const filterOptions = () => { if (!showFilterOptions) { return null; } + console.log('startFrom', startFrom); return ( <> @@ -431,17 +417,36 @@ export default function ProcessInstanceListTable({ 'Start date from', 'start-from', startFrom, + startFromString, setStartFrom )} - {dateComponent('Start date to', 'start-to', startTo, setStartTo)} + {dateComponent( + 'Start date to', + 'start-to', + startTo, + startFromString, + setStartTo + )} - {dateComponent('End date from', 'end-from', endFrom, setEndFrom)} + {dateComponent( + 'End date from', + 'end-from', + endFrom, + startFromString, + setEndFrom + )} - {dateComponent('End date to', 'end-to', endTo, setEndTo)} + {dateComponent( + 'End date to', + 'end-to', + endTo, + startFromString, + setEndTo + )} @@ -587,6 +592,9 @@ export default function ProcessInstanceListTable({ }; if (pagination) { + setStartFromString( + convertDateObjectToFormattedString(startFrom as any) || '' + ); // eslint-disable-next-line prefer-const let { page, perPage } = getPageInfoFromSearchParams( searchParams, diff --git a/spiffworkflow-frontend/src/helpers.test.tsx b/spiffworkflow-frontend/src/helpers.test.tsx index 1031fc46..5a0352b8 100644 --- a/spiffworkflow-frontend/src/helpers.test.tsx +++ b/spiffworkflow-frontend/src/helpers.test.tsx @@ -1,4 +1,4 @@ -import { convertSecondsToFormattedDate, slugifyString } from './helpers'; +import { convertSecondsToFormattedDateString, slugifyString } from './helpers'; test('it can slugify a string', () => { expect(slugifyString('hello---world_ and then Some such-')).toEqual( @@ -7,6 +7,6 @@ test('it can slugify a string', () => { }); test('it can keep the correct date when converting seconds to date', () => { - const dateString = convertSecondsToFormattedDate(1666325400); + const dateString = convertSecondsToFormattedDateString(1666325400); expect(dateString).toEqual('2022-10-21'); }); diff --git a/spiffworkflow-frontend/src/helpers.tsx b/spiffworkflow-frontend/src/helpers.tsx index 37286c83..d163c00a 100644 --- a/spiffworkflow-frontend/src/helpers.tsx +++ b/spiffworkflow-frontend/src/helpers.tsx @@ -42,6 +42,13 @@ export const convertDateToSeconds = ( return null; }; +export const convertDateObjectToFormattedString = (dateObject: Date) => { + if (dateObject) { + return format(dateObject, DATE_FORMAT); + } + return null; +}; + export const convertStringToDate = (dateString: string) => { if (dateString) { // add midnight time to the date so it c uses the correct date @@ -51,18 +58,25 @@ export const convertStringToDate = (dateString: string) => { return null; }; -export const convertSecondsToFormattedDateTime = (seconds: number) => { +export const convertSecondsToDateObject = (seconds: number) => { if (seconds) { - const dateObject = new Date(seconds * 1000); + return new Date(seconds * 1000); + } + return null; +}; + +export const convertSecondsToFormattedDateTime = (seconds: number) => { + const dateObject = convertSecondsToDateObject(seconds); + if (dateObject) { return format(dateObject, DATE_TIME_FORMAT); } return null; }; -export const convertSecondsToFormattedDate = (seconds: number) => { - if (seconds) { - const dateObject = new Date(seconds * 1000); - return format(dateObject, DATE_FORMAT); +export const convertSecondsToFormattedDateString = (seconds: number) => { + const dateObject = convertSecondsToDateObject(seconds); + if (dateObject) { + return convertDateObjectToFormattedString(dateObject); } return null; }; diff --git a/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx b/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx index 09d28316..3ead5462 100644 --- a/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx +++ b/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx @@ -5,7 +5,7 @@ import { Link, useParams, useSearchParams } from 'react-router-dom'; import PaginationForTable from '../components/PaginationForTable'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import { - convertSecondsToFormattedDate, + convertSecondsToFormattedDateString, getPageInfoFromSearchParams, modifyProcessModelPath, unModifyProcessModelPath, @@ -68,7 +68,9 @@ export default function MessageInstanceList() { {rowToUse.failure_cause || '-'} {rowToUse.status} - {convertSecondsToFormattedDate(rowToUse.created_at_in_seconds)} + {convertSecondsToFormattedDateString( + rowToUse.created_at_in_seconds + )} ); diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx index 9f2d65b3..bb4468b4 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx @@ -6,7 +6,7 @@ import PaginationForTable from '../components/PaginationForTable'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import { getPageInfoFromSearchParams, - convertSecondsToFormattedDate, + convertSecondsToFormattedDateString, modifyProcessModelPath, unModifyProcessModelPath, } from '../helpers'; @@ -49,7 +49,7 @@ export default function ProcessInstanceLogList() { data-qa="process-instance-show-link" to={`/admin/process-models/${modifiedProcessModelId}/process-instances/${rowToUse.process_instance_id}/${rowToUse.spiff_step}`} > - {convertSecondsToFormattedDate(rowToUse.timestamp)} + {convertSecondsToFormattedDateString(rowToUse.timestamp)} From 82598a9e7ed28b66b1a0c7d8a876f79e2d42cd2c Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 17 Nov 2022 16:05:54 -0500 Subject: [PATCH 04/84] times on instance list table are working now w/ burnettk --- .../components/ProcessInstanceListTable.tsx | 201 +++++++++++------- spiffworkflow-frontend/src/config.tsx | 1 + spiffworkflow-frontend/src/helpers.tsx | 47 +++- 3 files changed, 165 insertions(+), 84 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx index 84c3fd62..636481a4 100644 --- a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx +++ b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx @@ -21,18 +21,15 @@ import { TableHead, TableRow, TimePicker, - TimePickerSelect, - SelectItem, // @ts-ignore } from '@carbon/react'; import { PROCESS_STATUSES, DATE_FORMAT, DATE_FORMAT_CARBON } from '../config'; import { - convertDateObjectToFormattedString, - convertDateStringToSeconds, - convertDateToSeconds, - convertSecondsToDateObject, + convertDateAndTimeStringsToSeconds, + convertDateObjectToFormattedHoursMinutes, convertSecondsToFormattedDateString, convertSecondsToFormattedDateTime, + convertSecondsToFormattedTimeHoursMinutes, getPageInfoFromSearchParams, getProcessModelFullIdentifierFromSearchParams, modifyProcessModelPath, @@ -56,6 +53,10 @@ type OwnProps = { perPageOptions?: number[]; }; +interface dateParameters { + [key: string]: ((..._args: any[]) => any)[]; +} + export default function ProcessInstanceListTable({ filtersEnabled = true, processModelFullIdentifier, @@ -73,14 +74,20 @@ export default function ProcessInstanceListTable({ const oneHourInSeconds = 3600; const oneMonthInSeconds = oneHourInSeconds * 24 * 30; - const [startFrom, setStartFrom] = useState( - null - ); - const [startTo, setStartTo] = useState(null); - const [startFromString, setStartFromString] = useState(''); - const [endFrom, setEndFrom] = useState(null); - const [endTo, setEndTo] = useState(null); + const [startFromDate, setStartFromDate] = useState(''); + const [startToDate, setStartToDate] = useState(''); + const [endFromDate, setEndFromDate] = useState(''); + const [endToDate, setEndToDate] = useState(''); + const [startFromTime, setStartFromTime] = useState(''); + const [startToTime, setStartToTime] = useState(''); + const [endFromTime, setEndFromTime] = useState(''); + const [endToTime, setEndToTime] = useState(''); const [showFilterOptions, setShowFilterOptions] = useState(false); + const [startFromTimeInvalid, setStartFromTimeInvalid] = + useState(false); + const [startToTimeInvalid, setStartToTimeInvalid] = useState(false); + const [endFromTimeInvalid, setEndFromTimeInvalid] = useState(false); + const [endToTimeInvalid, setEndToTimeInvalid] = useState(false); const setErrorMessage = (useContext as any)(ErrorContext)[1]; @@ -96,14 +103,23 @@ export default function ProcessInstanceListTable({ const [processModelSelection, setProcessModelSelection] = useState(null); - const parametersToAlwaysFilterBy = useMemo(() => { + const dateParametersToAlwaysFilterBy: dateParameters = useMemo(() => { return { - start_from: setStartFrom, - start_to: setStartTo, - end_from: setEndFrom, - end_to: setEndTo, + start_from: [setStartFromDate, setStartFromTime], + start_to: [setStartToDate, setStartToTime], + end_from: [setEndFromDate, setEndFromTime], + end_to: [setEndToDate, setEndToTime], }; - }, [setStartFrom, setStartTo, setEndFrom, setEndTo]); + }, [ + setStartFromDate, + setStartFromTime, + setStartToDate, + setStartToTime, + setEndFromDate, + setEndFromTime, + setEndToDate, + setEndToTime, + ]); const parametersToGetFromSearchParams = useMemo(() => { return { @@ -140,20 +156,27 @@ export default function ProcessInstanceListTable({ queryParamString += `&user_filter=${userAppliedFilter}`; } - Object.keys(parametersToAlwaysFilterBy).forEach((paramName: string) => { - // @ts-expect-error TS(7053) FIXME: - const functionToCall = parametersToAlwaysFilterBy[paramName]; - const searchParamValue = searchParams.get(paramName); - if (searchParamValue) { - queryParamString += `&${paramName}=${searchParamValue}`; - const dateObject = convertSecondsToDateObject( - searchParamValue as any - ); - console.log('dateObject1', dateObject); - functionToCall(dateObject); - setShowFilterOptions(true); + Object.keys(dateParametersToAlwaysFilterBy).forEach( + (paramName: string) => { + const dateFunctionToCall = + dateParametersToAlwaysFilterBy[paramName][0]; + const timeFunctionToCall = + dateParametersToAlwaysFilterBy[paramName][1]; + const searchParamValue = searchParams.get(paramName); + if (searchParamValue) { + queryParamString += `&${paramName}=${searchParamValue}`; + const dateString = convertSecondsToFormattedDateString( + searchParamValue as any + ); + dateFunctionToCall(dateString); + const timeString = convertSecondsToFormattedTimeHoursMinutes( + searchParamValue as any + ); + timeFunctionToCall(timeString); + setShowFilterOptions(true); + } } - }); + ); Object.keys(parametersToGetFromSearchParams).forEach( (paramName: string) => { @@ -167,10 +190,6 @@ export default function ProcessInstanceListTable({ const functionToCall = parametersToGetFromSearchParams[paramName]; queryParamString += `&${paramName}=${searchParams.get(paramName)}`; if (functionToCall !== null) { - console.log( - 'searchParams.get(paramName)', - searchParams.get(paramName) - ); functionToCall(searchParams.get(paramName) || ''); } setShowFilterOptions(true); @@ -226,7 +245,7 @@ export default function ProcessInstanceListTable({ params, oneMonthInSeconds, oneHourInSeconds, - parametersToAlwaysFilterBy, + dateParametersToAlwaysFilterBy, parametersToGetFromSearchParams, filtersEnabled, paginationQueryParamPrefix, @@ -261,10 +280,22 @@ export default function ProcessInstanceListTable({ ); let queryParamString = `per_page=${perPage}&page=${page}&user_filter=true`; - const startFromSeconds = convertDateToSeconds(startFrom); - const endFromSeconds = convertDateToSeconds(endFrom); - const startToSeconds = convertDateToSeconds(startTo); - const endToSeconds = convertDateToSeconds(endTo); + const startFromSeconds = convertDateAndTimeStringsToSeconds( + startFromDate, + startFromTime + ); + const startToSeconds = convertDateAndTimeStringsToSeconds( + startToDate, + startToTime + ); + const endFromSeconds = convertDateAndTimeStringsToSeconds( + endFromDate, + endFromTime + ); + const endToSeconds = convertDateAndTimeStringsToSeconds( + endToDate, + endToTime + ); if (isTrueComparison(startFromSeconds, '>', startToSeconds)) { setErrorMessage({ message: '"Start date from" cannot be after "start date to"', @@ -318,10 +349,12 @@ export default function ProcessInstanceListTable({ labelString: any, name: any, initialDate: any, - initialDateString: string, - onChangeFunction: any + initialTime: string, + onChangeDateFunction: any, + onChangeTimeFunction: any, + timeInvalid: boolean, + setTimeInvalid: any ) => { - // value={convertDateObjectToFormattedString(initialDate)} return ( <> @@ -334,29 +367,29 @@ export default function ProcessInstanceListTable({ autocomplete="off" allowInput={false} onChange={(dateChangeEvent: any) => { - let dateTime = new Date(); - if (initialDate) { - dateTime = new Date(initialDate.getTime()); + if (!initialDate && !initialTime) { + onChangeTimeFunction( + convertDateObjectToFormattedHoursMinutes(new Date()) + ); } - - const [year, month, day] = - dateChangeEvent.srcElement.value.split('-'); - dateTime.setDate(day); - dateTime.setMonth(month - 1); - // @ts-ignore setYear does exist on Date - dateTime.setYear(year); - onChangeFunction(dateTime); + onChangeDateFunction(dateChangeEvent.srcElement.value); }} - value={initialDateString} + value={initialDate} /> { - console.log('event', event); + if (event.srcElement.validity.valid) { + setTimeInvalid(false); + } else { + setTimeInvalid(true); + } + onChangeTimeFunction(event.srcElement.value); }} /> @@ -386,17 +419,20 @@ export default function ProcessInstanceListTable({ const clearFilters = () => { setProcessModelSelection(null); setProcessStatusSelection([]); - setStartFrom(null); - setStartTo(null); - setEndFrom(null); - setEndTo(null); + setStartFromDate(''); + setStartFromTime(''); + setStartToDate(''); + setStartToTime(''); + setEndFromDate(''); + setEndFromTime(''); + setEndToDate(''); + setEndToTime(''); }; const filterOptions = () => { if (!showFilterOptions) { return null; } - console.log('startFrom', startFrom); return ( <> @@ -416,36 +452,48 @@ export default function ProcessInstanceListTable({ {dateComponent( 'Start date from', 'start-from', - startFrom, - startFromString, - setStartFrom + startFromDate, + startFromTime, + setStartFromDate, + setStartFromTime, + startFromTimeInvalid, + setStartFromTimeInvalid )} {dateComponent( 'Start date to', 'start-to', - startTo, - startFromString, - setStartTo + startToDate, + startToTime, + setStartToDate, + setStartToTime, + startToTimeInvalid, + setStartToTimeInvalid )} {dateComponent( 'End date from', 'end-from', - endFrom, - startFromString, - setEndFrom + endFromDate, + endFromTime, + setEndFromDate, + setEndFromTime, + endFromTimeInvalid, + setEndFromTimeInvalid )} {dateComponent( 'End date to', 'end-to', - endTo, - startFromString, - setEndTo + endToDate, + endToTime, + setEndToDate, + setEndToTime, + endToTimeInvalid, + setEndToTimeInvalid )} @@ -592,9 +640,6 @@ export default function ProcessInstanceListTable({ }; if (pagination) { - setStartFromString( - convertDateObjectToFormattedString(startFrom as any) || '' - ); // eslint-disable-next-line prefer-const let { page, perPage } = getPageInfoFromSearchParams( searchParams, diff --git a/spiffworkflow-frontend/src/config.tsx b/spiffworkflow-frontend/src/config.tsx index 47ff5025..5e7e96fe 100644 --- a/spiffworkflow-frontend/src/config.tsx +++ b/spiffworkflow-frontend/src/config.tsx @@ -18,5 +18,6 @@ export const PROCESS_STATUSES = [ // with time: yyyy-MM-dd HH:mm:ss export const DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm:ss'; +export const TIME_FORMAT_HOURS_MINUTES = 'HH:mm'; export const DATE_FORMAT = 'yyyy-MM-dd'; export const DATE_FORMAT_CARBON = 'Y-m-d'; diff --git a/spiffworkflow-frontend/src/helpers.tsx b/spiffworkflow-frontend/src/helpers.tsx index d163c00a..96478790 100644 --- a/spiffworkflow-frontend/src/helpers.tsx +++ b/spiffworkflow-frontend/src/helpers.tsx @@ -1,5 +1,9 @@ import { format } from 'date-fns'; -import { DATE_TIME_FORMAT, DATE_FORMAT } from './config'; +import { + DATE_TIME_FORMAT, + DATE_FORMAT, + TIME_FORMAT_HOURS_MINUTES, +} from './config'; import { DEFAULT_PER_PAGE, DEFAULT_PAGE, @@ -49,15 +53,31 @@ export const convertDateObjectToFormattedString = (dateObject: Date) => { return null; }; -export const convertStringToDate = (dateString: string) => { - if (dateString) { - // add midnight time to the date so it c uses the correct date - // after converting to timezone - return new Date(`${dateString}T00:10:00`); +export const convertDateAndTimeStringsToDate = ( + dateString: string, + timeString: string +) => { + if (dateString && timeString) { + return new Date(`${dateString}T${timeString}`); } return null; }; +export const convertDateAndTimeStringsToSeconds = ( + dateString: string, + timeString: string +) => { + const dateObject = convertDateAndTimeStringsToDate(dateString, timeString); + if (dateObject) { + return convertDateToSeconds(dateObject); + } + return null; +}; + +export const convertStringToDate = (dateString: string) => { + return convertDateAndTimeStringsToSeconds(dateString, '00:10:00'); +}; + export const convertSecondsToDateObject = (seconds: number) => { if (seconds) { return new Date(seconds * 1000); @@ -73,6 +93,21 @@ export const convertSecondsToFormattedDateTime = (seconds: number) => { return null; }; +export const convertDateObjectToFormattedHoursMinutes = (dateObject: Date) => { + if (dateObject) { + return format(dateObject, TIME_FORMAT_HOURS_MINUTES); + } + return null; +}; + +export const convertSecondsToFormattedTimeHoursMinutes = (seconds: number) => { + const dateObject = convertSecondsToDateObject(seconds); + if (dateObject) { + return convertDateObjectToFormattedHoursMinutes(dateObject); + } + return null; +}; + export const convertSecondsToFormattedDateString = (seconds: number) => { const dateObject = convertSecondsToDateObject(seconds); if (dateObject) { From 0ccea0e8ac8ed899ba1e14c352b07e68b8bf30f7 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Thu, 17 Nov 2022 16:35:28 -0500 Subject: [PATCH 05/84] Cleanup - renaming frenzy, use os.path.abspath --- .../services/process_model_service.py | 50 ++++++++++--------- .../services/spec_file_service.py | 4 +- .../helpers/base_test.py | 4 +- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py index 28547b44..af37aaa5 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py @@ -32,7 +32,7 @@ class ProcessModelService(FileSystemService): the workflow process_models at once, or manage those file in a git repository. """ GROUP_SCHEMA = ProcessGroupSchema() - WF_SCHEMA = ProcessModelInfoSchema() + PROCESS_MODEL_SCHEMA = ProcessModelInfoSchema() def is_group(self, path: str) -> bool: """Is_group.""" @@ -76,12 +76,12 @@ class ProcessModelService(FileSystemService): def save_process_model(self, process_model: ProcessModelInfo) -> None: """Save_process_model.""" - spec_path = os.path.join(FileSystemService.root_path(), process_model.id) - os.makedirs(spec_path, exist_ok=True) - json_path = os.path.join(spec_path, self.PROCESS_MODEL_JSON_FILE) + process_model_path = os.path.abspath(os.path.join(FileSystemService.root_path(), process_model.id)) + os.makedirs(process_model_path, exist_ok=True) + json_path = os.path.abspath(os.path.join(process_model_path, self.PROCESS_MODEL_JSON_FILE)) with open(json_path, "w") as wf_json: json.dump( - self.WF_SCHEMA.dump(process_model), wf_json, indent=4, sort_keys=True + self.PROCESS_MODEL_SCHEMA.dump(process_model), wf_json, indent=4, sort_keys=True ) def process_model_delete(self, process_model_id: str) -> None: @@ -107,7 +107,7 @@ class ProcessModelService(FileSystemService): process_group_identifier, _ = os.path.split(relative_path) process_group = cls().get_process_group(process_group_identifier) path = os.path.join(FileSystemService.root_path(), relative_path) - return cls().__scan_spec(path, process_group=process_group) + return cls().__scan_process_model(path, process_group=process_group) def get_process_model(self, process_model_id: str) -> ProcessModelInfo: """Get a process model from a model and group id. @@ -117,7 +117,9 @@ class ProcessModelService(FileSystemService): if not os.path.exists(FileSystemService.root_path()): raise ProcessEntityNotFoundError("process_model_root_not_found") - model_path = os.path.join(FileSystemService.root_path(), process_model_id) + model_path = os.path.abspath( + os.path.join(FileSystemService.root_path(), process_model_id) + ) if self.is_model(model_path): process_model = self.get_process_model_from_relative_path(process_model_id) return process_model @@ -140,7 +142,7 @@ class ProcessModelService(FileSystemService): # process_group = self.__scan_process_group( # process_group_dir # ) - # return self.__scan_spec(sd.path, sd.name, process_group) + # return self.__scan_process_model(sd.path, sd.name, process_group) raise ProcessEntityNotFoundError("process_model_not_found") def get_process_models( @@ -172,8 +174,10 @@ class ProcessModelService(FileSystemService): def get_process_group(self, process_group_id: str) -> ProcessGroup: """Look for a given process_group, and return it.""" if os.path.exists(FileSystemService.root_path()): - process_group_path = os.path.join( - FileSystemService.root_path(), process_group_id + process_group_path = os.path.abspath( + os.path.join( + FileSystemService.root_path(), process_group_id + ) ) if self.is_group(process_group_path): return self.__scan_process_group(process_group_path) @@ -312,7 +316,7 @@ class ProcessModelService(FileSystemService): ) elif self.is_model(nested_item.path): process_group.process_models.append( - self.__scan_spec( + self.__scan_process_model( nested_item.path, nested_item.name, process_group=process_group, @@ -322,22 +326,22 @@ class ProcessModelService(FileSystemService): # process_group.process_groups.sort() return process_group - def __scan_spec( + def __scan_process_model( self, path: str, name: Optional[str] = None, process_group: Optional[ProcessGroup] = None, ) -> ProcessModelInfo: - """__scan_spec.""" - spec_path = os.path.join(path, self.PROCESS_MODEL_JSON_FILE) + """__scan_process_model.""" + json_file_path = os.path.join(path, self.PROCESS_MODEL_JSON_FILE) - if os.path.exists(spec_path): - with open(spec_path) as wf_json: + if os.path.exists(json_file_path): + with open(json_file_path) as wf_json: data = json.load(wf_json) if "process_group_id" in data: data.pop("process_group_id") - spec = ProcessModelInfo(**data) - if spec is None: + process_model_info = ProcessModelInfo(**data) + if process_model_info is None: raise ApiError( error_code="process_model_could_not_be_loaded_from_disk", message=f"We could not load the process_model from disk with data: {data}", @@ -349,15 +353,15 @@ class ProcessModelService(FileSystemService): message="Missing name of process model. It should be given", ) - spec = ProcessModelInfo( + process_model_info = ProcessModelInfo( id=name, display_name=name, description="", display_order=0, is_review=False, ) - with open(spec_path, "w") as wf_json: - json.dump(self.WF_SCHEMA.dump(spec), wf_json, indent=4) + with open(json_file_path, "w") as wf_json: + json.dump(self.PROCESS_MODEL_SCHEMA.dump(process_model_info), wf_json, indent=4) if process_group: - spec.process_group = process_group.id - return spec + process_model_info.process_group = process_group.id + return process_model_info diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py index 044b824b..f02e3a6f 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py @@ -197,7 +197,9 @@ class SpecFileService(FileSystemService): @staticmethod def full_file_path(spec: ProcessModelInfo, file_name: str) -> str: """File_path.""" - return os.path.join(SpecFileService.workflow_path(spec), file_name) + return os.path.abspath( + os.path.join(SpecFileService.workflow_path(spec), file_name) + ) @staticmethod def last_modified(spec: ProcessModelInfo, file_name: str) -> datetime: diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py b/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py index 97ce7ae2..44c99908 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py @@ -137,7 +137,9 @@ class BaseTest: # make sure we have a group process_group_id, _ = os.path.split(process_model_id) modified_process_group_id = process_group_id.replace("/", ":") - process_group_path = f"{FileSystemService.root_path()}/{process_group_id}" + process_group_path = os.path.abspath( + os.path.join(FileSystemService.root_path(), process_group_id) + ) if ProcessModelService().is_group(process_group_path): if exception_notification_addresses is None: From ce74b07bc41255cc731ebff75a13f37312033fd0 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 17 Nov 2022 16:36:38 -0500 Subject: [PATCH 06/84] added back the useEffect for report filtering w/ burnettk --- .../components/ProcessInstanceListTable.tsx | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx index 636481a4..75de56c0 100644 --- a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx +++ b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx @@ -253,6 +253,54 @@ export default function ProcessInstanceListTable({ perPageOptions, ]); + // This sets the filter data using the saved reports returned from the initial instance_list query. + // This could probably be merged into the main useEffect but it works here now. + useEffect(() => { + const filters = processInstanceFilters as any; + Object.keys(dateParametersToAlwaysFilterBy).forEach((paramName: string) => { + const dateFunctionToCall = dateParametersToAlwaysFilterBy[paramName][0]; + const timeFunctionToCall = dateParametersToAlwaysFilterBy[paramName][1]; + const paramValue = filters[paramName]; + dateFunctionToCall(''); + timeFunctionToCall(''); + if (paramValue) { + const dateString = convertSecondsToFormattedDateString( + paramValue as any + ); + dateFunctionToCall(dateString); + const timeString = convertSecondsToFormattedTimeHoursMinutes( + paramValue as any + ); + timeFunctionToCall(timeString); + setShowFilterOptions(true); + } + }); + + setProcessModelSelection(null); + processModelAvailableItems.forEach((item: any) => { + if (item.id === filters.process_model_identifier) { + setProcessModelSelection(item); + } + }); + + const processStatusSelectedArray: string[] = []; + if (filters.process_status) { + PROCESS_STATUSES.forEach((processStatusOption: any) => { + const regex = new RegExp(`\\b${processStatusOption}\\b`); + if (filters.process_status.match(regex)) { + processStatusSelectedArray.push(processStatusOption); + } + }); + setShowFilterOptions(true); + } + setProcessStatusSelection(processStatusSelectedArray); + }, [ + processInstanceFilters, + dateParametersToAlwaysFilterBy, + parametersToGetFromSearchParams, + processModelAvailableItems, + ]); + // does the comparison, but also returns false if either argument // is not truthy and therefore not comparable. const isTrueComparison = (param1: any, operation: any, param2: any) => { From c744dd8867927be42bd56253021dde0a6874dc99 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 17 Nov 2022 16:47:29 -0500 Subject: [PATCH 07/84] default time to midnight if it is null when filtering w/ burnettk --- .../src/components/ProcessInstanceListTable.tsx | 8 ++++---- .../src/routes/ProcessInstanceLogList.tsx | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx index 163a2fc4..6d5fbb0b 100644 --- a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx +++ b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx @@ -330,19 +330,19 @@ export default function ProcessInstanceListTable({ const startFromSeconds = convertDateAndTimeStringsToSeconds( startFromDate, - startFromTime + startFromTime || '00:00:00' ); const startToSeconds = convertDateAndTimeStringsToSeconds( startToDate, - startToTime + startToTime || '00:00:00' ); const endFromSeconds = convertDateAndTimeStringsToSeconds( endFromDate, - endFromTime + endFromTime || '00:00:00' ); const endToSeconds = convertDateAndTimeStringsToSeconds( endToDate, - endToTime + endToTime || '00:00:00' ); if (isTrueComparison(startFromSeconds, '>', startToSeconds)) { setErrorMessage({ diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx index bb4468b4..214a0eac 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx @@ -6,9 +6,9 @@ import PaginationForTable from '../components/PaginationForTable'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import { getPageInfoFromSearchParams, - convertSecondsToFormattedDateString, modifyProcessModelPath, unModifyProcessModelPath, + convertSecondsToFormattedDateTime, } from '../helpers'; import HttpService from '../services/HttpService'; @@ -49,7 +49,7 @@ export default function ProcessInstanceLogList() { data-qa="process-instance-show-link" to={`/admin/process-models/${modifiedProcessModelId}/process-instances/${rowToUse.process_instance_id}/${rowToUse.spiff_step}`} > - {convertSecondsToFormattedDateString(rowToUse.timestamp)} + {convertSecondsToFormattedDateTime(rowToUse.timestamp)} From 6607bb6a8ddf86dc06e5a6293e0f1bfde40fa48a Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 17 Nov 2022 17:30:51 -0500 Subject: [PATCH 08/84] hide messages and configuration if not authorized w/ burnettk --- .../src/components/NavigationBar.tsx | 71 +++++++++++++++---- .../src/hooks/UriListForPermissions.tsx | 2 + .../src/routes/Configuration.tsx | 29 ++++++-- 3 files changed, 83 insertions(+), 19 deletions(-) diff --git a/spiffworkflow-frontend/src/components/NavigationBar.tsx b/spiffworkflow-frontend/src/components/NavigationBar.tsx index 6ef62ac8..0cc49158 100644 --- a/spiffworkflow-frontend/src/components/NavigationBar.tsx +++ b/spiffworkflow-frontend/src/components/NavigationBar.tsx @@ -17,9 +17,13 @@ import { import { Logout, Login } from '@carbon/icons-react'; import { useEffect, useState } from 'react'; import { useLocation } from 'react-router-dom'; +import { Can } from '@casl/react'; // @ts-expect-error TS(2307) FIXME: Cannot find module '../logo.svg' or its correspond... Remove this comment to see the full error message import logo from '../logo.svg'; import UserService from '../services/UserService'; +import { useUriListForPermissions } from '../hooks/UriListForPermissions'; +import { PermissionsToCheck } from '../interfaces'; +import { usePermissionFetcher } from '../hooks/PermissionService'; // for ref: https://react-bootstrap.github.io/components/navbar/ export default function NavigationBar() { @@ -34,6 +38,14 @@ export default function NavigationBar() { const location = useLocation(); const [activeKey, setActiveKey] = useState(''); + const { targetUris } = useUriListForPermissions(); + const permissionRequestData: PermissionsToCheck = { + [targetUris.authenticationListPath]: ['GET'], + [targetUris.messageInstanceListPath]: ['GET'], + [targetUris.secretListPath]: ['GET'], + }; + const { ability } = usePermissionFetcher(permissionRequestData); + useEffect(() => { let newActiveKey = '/admin/process-groups'; if (location.pathname.match(/^\/admin\/messages\b/)) { @@ -84,6 +96,42 @@ export default function NavigationBar() { ); }; + const configurationElement = () => { + return ( + + {(authenticationAllowed: boolean) => { + return ( + + {(secretAllowed: boolean) => { + if (secretAllowed || authenticationAllowed) { + return ( + + Configuration + + ); + } + return null; + }} + + ); + }} + + ); + }; + const headerMenuItems = () => { return ( <> @@ -103,18 +151,15 @@ export default function NavigationBar() { > Process Instances - - Messages - - - Configuration - + + + Messages + + + {configurationElement()} ( diff --git a/spiffworkflow-frontend/src/hooks/UriListForPermissions.tsx b/spiffworkflow-frontend/src/hooks/UriListForPermissions.tsx index c00cb286..9c61234b 100644 --- a/spiffworkflow-frontend/src/hooks/UriListForPermissions.tsx +++ b/spiffworkflow-frontend/src/hooks/UriListForPermissions.tsx @@ -3,6 +3,7 @@ import { useParams } from 'react-router-dom'; export const useUriListForPermissions = () => { const params = useParams(); const targetUris = { + authenticationListPath: `/v1.0/authentications`, messageInstanceListPath: '/v1.0/messages', processGroupListPath: '/v1.0/process-groups', processGroupShowPath: `/v1.0/process-groups/${params.process_group_id}`, @@ -12,6 +13,7 @@ export const useUriListForPermissions = () => { processModelFileCreatePath: `/v1.0/process-models/${params.process_model_id}/files`, processModelFileShowPath: `/v1.0/process-models/${params.process_model_id}/files/${params.file_name}`, processModelShowPath: `/v1.0/process-models/${params.process_model_id}`, + secretListPath: `/v1.0/secrets`, }; return { targetUris }; diff --git a/spiffworkflow-frontend/src/routes/Configuration.tsx b/spiffworkflow-frontend/src/routes/Configuration.tsx index 723a33ff..b2e30416 100644 --- a/spiffworkflow-frontend/src/routes/Configuration.tsx +++ b/spiffworkflow-frontend/src/routes/Configuration.tsx @@ -2,11 +2,15 @@ import { useContext, useEffect, useState } from 'react'; import { Route, Routes, useLocation, useNavigate } from 'react-router-dom'; // @ts-ignore import { Tabs, TabList, Tab } from '@carbon/react'; +import { Can } from '@casl/react'; import ErrorContext from '../contexts/ErrorContext'; import SecretList from './SecretList'; import SecretNew from './SecretNew'; import SecretShow from './SecretShow'; import AuthenticationList from './AuthenticationList'; +import { useUriListForPermissions } from '../hooks/UriListForPermissions'; +import { PermissionsToCheck } from '../interfaces'; +import { usePermissionFetcher } from '../hooks/PermissionService'; export default function Configuration() { const location = useLocation(); @@ -14,6 +18,13 @@ export default function Configuration() { const [selectedTabIndex, setSelectedTabIndex] = useState(0); const navigate = useNavigate(); + const { targetUris } = useUriListForPermissions(); + const permissionRequestData: PermissionsToCheck = { + [targetUris.authenticationListPath]: ['GET'], + [targetUris.secretListPath]: ['GET'], + }; + const { ability } = usePermissionFetcher(permissionRequestData); + useEffect(() => { setErrorMessage(null); let newSelectedTabIndex = 0; @@ -27,12 +38,18 @@ export default function Configuration() { <> - navigate('/admin/configuration/secrets')}> - Secrets - - navigate('/admin/configuration/authentications')}> - Authentications - + + navigate('/admin/configuration/secrets')}> + Secrets + + + + navigate('/admin/configuration/authentications')} + > + Authentications + +
From 68130b216d0be14a453121047971e37f812d3cd8 Mon Sep 17 00:00:00 2001 From: burnettk Date: Thu, 17 Nov 2022 17:45:17 -0500 Subject: [PATCH 09/84] upgrades --- spiffworkflow-frontend/package-lock.json | 126 ++++++++--------------- 1 file changed, 43 insertions(+), 83 deletions(-) diff --git a/spiffworkflow-frontend/package-lock.json b/spiffworkflow-frontend/package-lock.json index 0dfe841a..f31017c8 100644 --- a/spiffworkflow-frontend/package-lock.json +++ b/spiffworkflow-frontend/package-lock.json @@ -19523,9 +19523,9 @@ } }, "node_modules/loader-utils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz", - "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", "dependencies": { "big.js": "^5.2.2", "emojis-list": "^3.0.0", @@ -23895,9 +23895,9 @@ } }, "node_modules/react-dev-utils/node_modules/loader-utils": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.2.0.tgz", - "integrity": "sha512-HVl9ZqccQihZ7JM85dco1MvO9G+ONvxoGa9rkhzFsneGLKSUg1gJf9bWzhRhcvm2qChhWpebQhP44qxjKIUCaQ==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.2.1.tgz", + "integrity": "sha512-ZvFw1KWS3GVyYBYb7qkmRM/WwL2TQQBxgCK62rlvm4WpVQ23Nb4tYjApUlfjrEGvOs7KHEsmyUn75OHZrJMWPw==", "engines": { "node": ">= 12.13.0" } @@ -24992,25 +24992,14 @@ } }, "node_modules/recursive-readdir": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz", - "integrity": "sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.3.tgz", + "integrity": "sha512-8HrF5ZsXk5FAH9dgsx3BlUer73nIhuj+9OrQwEbLTPOBzGkL1lsFCR01am+v+0m2Cmbs1nP12hLDl5FA7EszKA==", "dependencies": { - "minimatch": "3.0.4" + "minimatch": "^3.0.5" }, "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/recursive-readdir/node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" + "node": ">=6.0.0" } }, "node_modules/redent": { @@ -26064,9 +26053,9 @@ } }, "node_modules/serve": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/serve/-/serve-14.0.1.tgz", - "integrity": "sha512-tNGwxl27FwA8TbmMQqN0jTaSx8/trL532qZsJHX1VdiEIjjtMJHCs7AFS6OvtC7cTHOvmjXqt5yczejU6CV2Xg==", + "version": "14.1.1", + "resolved": "https://registry.npmjs.org/serve/-/serve-14.1.1.tgz", + "integrity": "sha512-7RhRDEirZ7Qyee4QWhBHO9qRtjIGsIPGecDDPzNzlOsjDiZWcq36GS8FioVJAuJPVJBBDTsGp33WWOO4B9A82g==", "dependencies": { "@zeit/schemas": "2.21.0", "ajv": "8.11.0", @@ -26077,7 +26066,7 @@ "clipboardy": "3.0.0", "compression": "1.7.4", "is-port-reachable": "4.0.0", - "serve-handler": "6.1.3", + "serve-handler": "6.1.5", "update-check": "1.5.4" }, "bin": { @@ -26088,15 +26077,15 @@ } }, "node_modules/serve-handler": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/serve-handler/-/serve-handler-6.1.3.tgz", - "integrity": "sha512-FosMqFBNrLyeiIDvP1zgO6YoTzFYHxLDEIavhlmQ+knB2Z7l1t+kGLHkZIDN7UVWqQAmKI3D20A6F6jo3nDd4w==", + "version": "6.1.5", + "resolved": "https://registry.npmjs.org/serve-handler/-/serve-handler-6.1.5.tgz", + "integrity": "sha512-ijPFle6Hwe8zfmBxJdE+5fta53fdIY0lHISJvuikXB3VYFafRjMRpOffSPvCYsbKyBA7pvy9oYr/BT1O3EArlg==", "dependencies": { "bytes": "3.0.0", "content-disposition": "0.5.2", "fast-url-parser": "1.1.3", "mime-types": "2.1.18", - "minimatch": "3.0.4", + "minimatch": "3.1.2", "path-is-inside": "1.0.2", "path-to-regexp": "2.2.1", "range-parser": "1.2.0" @@ -26121,17 +26110,6 @@ "node": ">= 0.6" } }, - "node_modules/serve-handler/node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/serve-index": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", @@ -30691,9 +30669,9 @@ } }, "node_modules/webpack/node_modules/loader-utils": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", - "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.2.tgz", + "integrity": "sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==", "dependencies": { "big.js": "^5.2.2", "emojis-list": "^3.0.0", @@ -45923,9 +45901,9 @@ "integrity": "sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw==" }, "loader-utils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz", - "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", "requires": { "big.js": "^5.2.2", "emojis-list": "^3.0.0", @@ -48920,9 +48898,9 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "loader-utils": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.2.0.tgz", - "integrity": "sha512-HVl9ZqccQihZ7JM85dco1MvO9G+ONvxoGa9rkhzFsneGLKSUg1gJf9bWzhRhcvm2qChhWpebQhP44qxjKIUCaQ==" + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.2.1.tgz", + "integrity": "sha512-ZvFw1KWS3GVyYBYb7qkmRM/WwL2TQQBxgCK62rlvm4WpVQ23Nb4tYjApUlfjrEGvOs7KHEsmyUn75OHZrJMWPw==" }, "supports-color": { "version": "7.2.0", @@ -49697,21 +49675,11 @@ } }, "recursive-readdir": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz", - "integrity": "sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.3.tgz", + "integrity": "sha512-8HrF5ZsXk5FAH9dgsx3BlUer73nIhuj+9OrQwEbLTPOBzGkL1lsFCR01am+v+0m2Cmbs1nP12hLDl5FA7EszKA==", "requires": { - "minimatch": "3.0.4" - }, - "dependencies": { - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "^1.1.7" - } - } + "minimatch": "^3.0.5" } }, "redent": { @@ -50525,9 +50493,9 @@ } }, "serve": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/serve/-/serve-14.0.1.tgz", - "integrity": "sha512-tNGwxl27FwA8TbmMQqN0jTaSx8/trL532qZsJHX1VdiEIjjtMJHCs7AFS6OvtC7cTHOvmjXqt5yczejU6CV2Xg==", + "version": "14.1.1", + "resolved": "https://registry.npmjs.org/serve/-/serve-14.1.1.tgz", + "integrity": "sha512-7RhRDEirZ7Qyee4QWhBHO9qRtjIGsIPGecDDPzNzlOsjDiZWcq36GS8FioVJAuJPVJBBDTsGp33WWOO4B9A82g==", "requires": { "@zeit/schemas": "2.21.0", "ajv": "8.11.0", @@ -50538,7 +50506,7 @@ "clipboardy": "3.0.0", "compression": "1.7.4", "is-port-reachable": "4.0.0", - "serve-handler": "6.1.3", + "serve-handler": "6.1.5", "update-check": "1.5.4" }, "dependencies": { @@ -50566,15 +50534,15 @@ } }, "serve-handler": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/serve-handler/-/serve-handler-6.1.3.tgz", - "integrity": "sha512-FosMqFBNrLyeiIDvP1zgO6YoTzFYHxLDEIavhlmQ+knB2Z7l1t+kGLHkZIDN7UVWqQAmKI3D20A6F6jo3nDd4w==", + "version": "6.1.5", + "resolved": "https://registry.npmjs.org/serve-handler/-/serve-handler-6.1.5.tgz", + "integrity": "sha512-ijPFle6Hwe8zfmBxJdE+5fta53fdIY0lHISJvuikXB3VYFafRjMRpOffSPvCYsbKyBA7pvy9oYr/BT1O3EArlg==", "requires": { "bytes": "3.0.0", "content-disposition": "0.5.2", "fast-url-parser": "1.1.3", "mime-types": "2.1.18", - "minimatch": "3.0.4", + "minimatch": "3.1.2", "path-is-inside": "1.0.2", "path-to-regexp": "2.2.1", "range-parser": "1.2.0" @@ -50592,14 +50560,6 @@ "requires": { "mime-db": "~1.33.0" } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "^1.1.7" - } } } }, @@ -53954,9 +53914,9 @@ } }, "loader-utils": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", - "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.2.tgz", + "integrity": "sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==", "requires": { "big.js": "^5.2.2", "emojis-list": "^3.0.0", From 0da658c42dcbae8fe8702471589871366262f0f0 Mon Sep 17 00:00:00 2001 From: Elizabeth Esswein Date: Thu, 17 Nov 2022 22:52:26 -0500 Subject: [PATCH 10/84] add simple refresh capability --- spiffworkflow-frontend/src/helpers.tsx | 13 ++++++++ spiffworkflow-frontend/src/routes/MyTasks.tsx | 30 ++++++++++++------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/spiffworkflow-frontend/src/helpers.tsx b/spiffworkflow-frontend/src/helpers.tsx index 96478790..ab97c8dc 100644 --- a/spiffworkflow-frontend/src/helpers.tsx +++ b/spiffworkflow-frontend/src/helpers.tsx @@ -197,3 +197,16 @@ export const getGroupFromModifiedModelId = (modifiedId: string) => { export const splitProcessModelId = (processModelId: string) => { return processModelId.split('/'); }; + +export const refreshAtInterval = ( + interval: number, + timeout: number, + func: Function +) => { + const intervalRef = setInterval(() => func(), interval * 1000); + const timeoutRef = setTimeout( + () => clearInterval(intervalRef), + timeout * 1000 + ); + return [intervalRef, timeoutRef]; +}; diff --git a/spiffworkflow-frontend/src/routes/MyTasks.tsx b/spiffworkflow-frontend/src/routes/MyTasks.tsx index 010f3805..c59c49f5 100644 --- a/spiffworkflow-frontend/src/routes/MyTasks.tsx +++ b/spiffworkflow-frontend/src/routes/MyTasks.tsx @@ -6,11 +6,14 @@ import PaginationForTable from '../components/PaginationForTable'; import { getPageInfoFromSearchParams, modifyProcessModelPath, + refreshAtInterval, } from '../helpers'; import HttpService from '../services/HttpService'; import { PaginationObject, RecentProcessModel } from '../interfaces'; const PER_PAGE_FOR_TASKS_ON_HOME_PAGE = 5; +const REFRESH_INTERVAL = 10; +const REFRESH_TIMEOUT = 600; export default function MyTasks() { const [searchParams] = useSearchParams(); @@ -18,18 +21,23 @@ export default function MyTasks() { const [pagination, setPagination] = useState(null); useEffect(() => { - const { page, perPage } = getPageInfoFromSearchParams( - searchParams, - PER_PAGE_FOR_TASKS_ON_HOME_PAGE - ); - const setTasksFromResult = (result: any) => { - setTasks(result.results); - setPagination(result.pagination); + const getTasks = () => { + const { page, perPage } = getPageInfoFromSearchParams( + searchParams, + PER_PAGE_FOR_TASKS_ON_HOME_PAGE + ); + const setTasksFromResult = (result: any) => { + setTasks(result.results); + setPagination(result.pagination); + }; + HttpService.makeCallToBackend({ + path: `/tasks?per_page=${perPage}&page=${page}`, + successCallback: setTasksFromResult, + }); }; - HttpService.makeCallToBackend({ - path: `/tasks?per_page=${perPage}&page=${page}`, - successCallback: setTasksFromResult, - }); + + getTasks(); + refreshAtInterval(REFRESH_INTERVAL, REFRESH_TIMEOUT, getTasks); }, [searchParams]); let recentProcessModels: RecentProcessModel[] = []; From 5786c8d83c02c29f12620937258bca373a3e2ecf Mon Sep 17 00:00:00 2001 From: jbirddog <100367399+jbirddog@users.noreply.github.com> Date: Fri, 18 Nov 2022 07:40:36 -0500 Subject: [PATCH 11/84] Support reporting on task data (#47) --- .../routes/process_api_blueprint.py | 18 ++++++------------ .../services/process_instance_service.py | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index a5b4c0aa..b3d5ec02 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -811,18 +811,12 @@ def process_instance_list( ProcessInstanceModel.start_in_seconds.desc(), ProcessInstanceModel.id.desc() # type: ignore ).paginate(page=page, per_page=per_page, error_out=False) - # TODO need to look into test failures when the results from result_dict is - # used instead of the process instances - - # substitution_variables = request.args.to_dict() - # result_dict = process_instance_report.generate_report( - # process_instances.items, substitution_variables - # ) - - # results = result_dict["results"] - # report_metadata = result_dict["report_metadata"] - - results = process_instances.items + results = list( + map( + ProcessInstanceService.serialize_flat_with_task_data, + process_instances.items, + ) + ) report_metadata = process_instance_report.report_metadata response_json = { 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 aac9b176..244e6fb2 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py @@ -315,3 +315,22 @@ class ProcessInstanceService: ) return task + + @staticmethod + def serialize_flat_with_task_data( + process_instance: ProcessInstanceModel, + ) -> dict[str, Any]: + """serialize_flat_with_task_data.""" + results = {} + try: + original_status = process_instance.status + processor = ProcessInstanceProcessor(process_instance) + process_instance.data = processor.get_current_data() + results = process_instance.serialized_flat + # this process seems to mutate the status of the process_instance which + # can result in different results than expected from process_instance_list, + # so set the status back to the expected value + results["status"] = original_status + except ApiError: + results = process_instance.serialized + return results From 7f9d02887834b1bbe17c6768c9458bc390b5cbc2 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Fri, 18 Nov 2022 08:49:46 -0500 Subject: [PATCH 12/84] simplified --- .../routes/process_api_blueprint.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index 98d7f68b..83137450 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -253,15 +253,10 @@ def process_model_create( status_code=400, ) - modified_process_model_id = process_model_info.id - unmodified_process_model_id = un_modify_modified_process_model_id( - modified_process_model_id - ) - process_model_info.id = unmodified_process_model_id - process_group_id, _ = os.path.split(process_model_info.id) + unmodified_process_group_id = un_modify_modified_process_model_id(modified_process_group_id) process_model_service = ProcessModelService() process_group = process_model_service.get_process_group( - un_modify_modified_process_model_id(process_group_id) + unmodified_process_group_id ) if process_group is None: raise ApiError( From 64b0490dd540bcdd44cd79107da6b450b2c0f911 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Fri, 18 Nov 2022 08:52:10 -0500 Subject: [PATCH 13/84] Don't save `id` in the process_model json file This allows us to move models around on the file system Add `id` back in when instantiating ProcessModelInfo from json file data --- .../services/process_model_service.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py index af37aaa5..3a5421f8 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py @@ -79,10 +79,16 @@ class ProcessModelService(FileSystemService): process_model_path = os.path.abspath(os.path.join(FileSystemService.root_path(), process_model.id)) os.makedirs(process_model_path, exist_ok=True) json_path = os.path.abspath(os.path.join(process_model_path, self.PROCESS_MODEL_JSON_FILE)) + process_model_id = process_model.id + # we don't save id in the json file + # this allows us to move models around on the filesystem + # the id is determined by its location on the filesystem + delattr(process_model, 'id') with open(json_path, "w") as wf_json: json.dump( self.PROCESS_MODEL_SCHEMA.dump(process_model), wf_json, indent=4, sort_keys=True ) + process_model.id = process_model_id def process_model_delete(self, process_model_id: str) -> None: """Delete Procecss Model.""" @@ -340,6 +346,9 @@ class ProcessModelService(FileSystemService): data = json.load(wf_json) if "process_group_id" in data: data.pop("process_group_id") + # we don't save `id` in the json file, so we add it back in here. + relative_path = os.path.relpath(path, FileSystemService.root_path()) + data['id'] = relative_path process_model_info = ProcessModelInfo(**data) if process_model_info is None: raise ApiError( From 0eaef2add96ed0b5e4bcf44ebc81857a4af6ddef Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Fri, 18 Nov 2022 08:55:53 -0500 Subject: [PATCH 14/84] rename workflow.json -> process_model.json --- .../src/spiffworkflow_backend/services/file_system_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py index 863456ac..cbe007d6 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py @@ -21,7 +21,7 @@ class FileSystemService: methods for dealing with the File system. """ PROCESS_GROUP_JSON_FILE = "process_group.json" - PROCESS_MODEL_JSON_FILE = "workflow.json" + PROCESS_MODEL_JSON_FILE = "process_model.json" @staticmethod def root_path() -> str: From 1bed0fb3ee95a897aa257274a8f9a763940f2453 Mon Sep 17 00:00:00 2001 From: burnettk Date: Fri, 18 Nov 2022 10:03:32 -0500 Subject: [PATCH 15/84] Squashed 'SpiffWorkflow/' changes from 580939cc..cd4da465 cd4da465 Merge pull request #264 from sartography/bugfix/dmn-equality-with-boolean 414a59eb disambiguate DMN expressions eea53c91 Merge pull request #263 from sartography/feature/cleanup-task-completion d248d5b1 execute postscript before other complete hook tasks c09f1a90 streamline predict & remove some duplicated calls to it 64c21791 remove duplicate calls to update 4ca1076d move task update to _on_complete to ensure data is copied consistently after task related activities are done d037a7eb small changes for readability 025bc30f Quick patch -- is_executable needs to be accurate immediately. 14d3d8c3 Merge pull request #262 from sartography/feature/parser_info_features 849c223e We are jumping through a lot of complex xml parsing in SpiffWorkflow-Backend because we need to know some basic information about a BPMN process at the moment it is saved. Rather than do that work in the backend, it seems better to have SpiffWorkflow handle parsing the xml and providing a bit of metadata, including: git-subtree-dir: SpiffWorkflow git-subtree-split: cd4da465e125ca1ae1b57d227bfa324d9d4c507c --- .../SpiffWorkflow/bpmn/BpmnWorkflowTestCase.py | 6 +++++- tests/SpiffWorkflow/bpmn/CollaborationTest.py | 16 ++++++++++++++-- tests/SpiffWorkflow/bpmn/SwimLaneTest.py | 6 ++++++ tests/SpiffWorkflow/camunda/BaseTestCase.py | 10 +++++++--- .../camunda/MultiInstanceParallelArrayTest.py | 8 +++----- .../camunda/ResetTokenMIParallelTest.py | 11 ++--------- .../camunda/StartMessageEventTest.py | 10 ++++++++++ .../data/spiff/control-flow/recursion.path | 2 +- .../control-flow/subworkflow_to_join.path | 2 +- tests/SpiffWorkflow/specs/SubWorkflowTest.py | 18 +++++++++++------- tests/SpiffWorkflow/util.py | 3 --- 11 files changed, 60 insertions(+), 32 deletions(-) diff --git a/tests/SpiffWorkflow/bpmn/BpmnWorkflowTestCase.py b/tests/SpiffWorkflow/bpmn/BpmnWorkflowTestCase.py index e2864919..9b7865bd 100644 --- a/tests/SpiffWorkflow/bpmn/BpmnWorkflowTestCase.py +++ b/tests/SpiffWorkflow/bpmn/BpmnWorkflowTestCase.py @@ -19,11 +19,15 @@ class BpmnWorkflowTestCase(unittest.TestCase): serializer = BpmnWorkflowSerializer(wf_spec_converter) - def load_workflow_spec(self, filename, process_name, validate=True): + def get_parser(self, filename, validate=True): f = os.path.join(os.path.dirname(__file__), 'data', filename) validator = BpmnValidator() if validate else None parser = TestBpmnParser(validator=validator) parser.add_bpmn_files_by_glob(f) + return parser + + def load_workflow_spec(self, filename, process_name, validate=True): + parser = self.get_parser(filename, validate) top_level_spec = parser.get_spec(process_name) subprocesses = parser.get_subprocess_specs(process_name) return top_level_spec, subprocesses diff --git a/tests/SpiffWorkflow/bpmn/CollaborationTest.py b/tests/SpiffWorkflow/bpmn/CollaborationTest.py index e1361dd8..a14d9f99 100644 --- a/tests/SpiffWorkflow/bpmn/CollaborationTest.py +++ b/tests/SpiffWorkflow/bpmn/CollaborationTest.py @@ -6,10 +6,22 @@ from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase class CollaborationTest(BpmnWorkflowTestCase): + def testParserProvidesInfoOnMessagesAndCorrelations(self): + parser = self.get_parser('collaboration.bpmn') + self.assertEqual(list(parser.messages.keys()), ['love_letter', 'love_letter_response']) + self.assertEqual(parser.correlations, + {'lover_name': {'name': "Lover's Name", + 'retrieval_expressions': [ + {'expression': 'lover_name', + 'messageRef': 'love_letter'}, + {'expression': 'from_name', + 'messageRef': 'love_letter_response'}]}} + ) + def testCollaboration(self): spec, subprocesses = self.load_collaboration('collaboration.bpmn', 'my_collaboration') - + # Only executable processes should be started self.assertIn('process_buddy', subprocesses) self.assertNotIn('random_person_process', subprocesses) @@ -122,4 +134,4 @@ class CollaborationTest(BpmnWorkflowTestCase): start = self.workflow.get_tasks_from_spec_name('Start')[0] start.data['lover_name'] = 'Peggy' self.workflow.do_engine_steps() - self.save_restore() \ No newline at end of file + self.save_restore() diff --git a/tests/SpiffWorkflow/bpmn/SwimLaneTest.py b/tests/SpiffWorkflow/bpmn/SwimLaneTest.py index 41638273..12bbeddd 100644 --- a/tests/SpiffWorkflow/bpmn/SwimLaneTest.py +++ b/tests/SpiffWorkflow/bpmn/SwimLaneTest.py @@ -19,6 +19,12 @@ class SwimLaneTest(BpmnWorkflowTestCase): spec, subprocesses = self.load_workflow_spec('lanes.bpmn','lanes') self.workflow = BpmnWorkflow(spec, subprocesses) + def testBpmnParserKnowsLanesExist(self): + parser = self.get_parser('lanes.bpmn') + self.assertTrue(parser.get_process_parser('lanes').has_lanes()) + parser = self.get_parser('random_fact.bpmn') + self.assertFalse(parser.get_process_parser('random_fact').has_lanes()) + def testRunThroughHappy(self): self.workflow.do_engine_steps() diff --git a/tests/SpiffWorkflow/camunda/BaseTestCase.py b/tests/SpiffWorkflow/camunda/BaseTestCase.py index b41a8aab..67d9c590 100644 --- a/tests/SpiffWorkflow/camunda/BaseTestCase.py +++ b/tests/SpiffWorkflow/camunda/BaseTestCase.py @@ -23,13 +23,17 @@ class BaseTestCase(BpmnWorkflowTestCase): serializer = BpmnWorkflowSerializer(wf_spec_converter) - def load_workflow_spec(self, filename, process_name, dmn_filename=None): - bpmn = os.path.join(os.path.dirname(__file__), 'data', filename) + def get_parser(self, filename, dmn_filename=None): + f = os.path.join(os.path.dirname(__file__), 'data', filename) parser = CamundaParser() - parser.add_bpmn_files_by_glob(bpmn) + parser.add_bpmn_files_by_glob(f) if dmn_filename is not None: dmn = os.path.join(os.path.dirname(__file__), 'data', 'dmn', dmn_filename) parser.add_dmn_files_by_glob(dmn) + return parser + + def load_workflow_spec(self, filename, process_name, dmn_filename=None): + parser = self.get_parser(filename, dmn_filename) top_level_spec = parser.get_spec(process_name) subprocesses = parser.get_subprocess_specs(process_name) return top_level_spec, subprocesses diff --git a/tests/SpiffWorkflow/camunda/MultiInstanceParallelArrayTest.py b/tests/SpiffWorkflow/camunda/MultiInstanceParallelArrayTest.py index 42a616f9..14373b0c 100644 --- a/tests/SpiffWorkflow/camunda/MultiInstanceParallelArrayTest.py +++ b/tests/SpiffWorkflow/camunda/MultiInstanceParallelArrayTest.py @@ -70,11 +70,9 @@ class MultiInstanceParallelArrayTest(BaseTestCase): {"CurrentFamilyMember": {"Birthdate": "10/05/1985" + str(x)}}) self.workflow.do_engine_steps() self.workflow.complete_task_from_id(task.id) - # The data should still be available on the current task. - self.assertEqual({'FirstName': "The Funk #%i" % x, - 'Birthdate': '10/05/1985' + str(x)}, - self.workflow.get_task(task.id) - .data['CurrentFamilyMember']) + # We used to check that the current data variable was available in the task, + # but there's no reason to preserve it after the task completes. We removed it + # in some cases and left it in others, which just adds to the confusion. self.workflow.do_engine_steps() if save_restore: self.reload_save_restore() diff --git a/tests/SpiffWorkflow/camunda/ResetTokenMIParallelTest.py b/tests/SpiffWorkflow/camunda/ResetTokenMIParallelTest.py index 39207181..75f2df36 100644 --- a/tests/SpiffWorkflow/camunda/ResetTokenMIParallelTest.py +++ b/tests/SpiffWorkflow/camunda/ResetTokenMIParallelTest.py @@ -44,8 +44,7 @@ class ResetTokenTestMIParallel(BaseTestCase): self.workflow.do_engine_steps() if save_restore: self.save_restore() - self.assertEqual({'current': {'A': 'y'}, - 'do_step': 'Yes', + self.assertEqual({'do_step': 'Yes', 'output': {'1': {'A': 'x'}, '2': {'A': 'y'}, '3': {'A': 'z'}}}, self.workflow.last_task.data) @@ -66,8 +65,7 @@ class ResetTokenTestMIParallel(BaseTestCase): self.assertTrue(self.workflow.is_completed()) - self.assertEqual({'current': {'A': 'x'}, - 'do_step': 'Yes', + self.assertEqual({'do_step': 'Yes', 'C': 'c', 'output': {'1': {'A': 'a1'}, '2': {'A': 'y'}, @@ -75,11 +73,6 @@ class ResetTokenTestMIParallel(BaseTestCase): self.workflow.last_task.data) - - - - - def suite(): return unittest.TestLoader().loadTestsFromTestCase(ResetTokenTestMIParallel) diff --git a/tests/SpiffWorkflow/camunda/StartMessageEventTest.py b/tests/SpiffWorkflow/camunda/StartMessageEventTest.py index a96d2e42..5dd81a06 100644 --- a/tests/SpiffWorkflow/camunda/StartMessageEventTest.py +++ b/tests/SpiffWorkflow/camunda/StartMessageEventTest.py @@ -14,6 +14,16 @@ class StartMessageTest(BaseTestCase): self.spec, self.subprocesses = self.load_workflow_spec('message_test.bpmn', 'ThrowCatch') self.workflow = BpmnWorkflow(self.spec, self.subprocesses) + def testParserCanReturnStartMessages(self): + parser = self.get_parser('message_test.bpmn') + self.assertEqual( + parser.process_parsers['ThrowCatch'].start_messages(), ['Message_1rkbi27']) + + parser = self.get_parser('random_fact.bpmn') + self.assertEqual( + parser.process_parsers['random_fact'].start_messages(), []) + + def testRunThroughHappy(self): self.actual_test(save_restore=False) diff --git a/tests/SpiffWorkflow/data/spiff/control-flow/recursion.path b/tests/SpiffWorkflow/data/spiff/control-flow/recursion.path index 4b406b8f..de57f21f 100644 --- a/tests/SpiffWorkflow/data/spiff/control-flow/recursion.path +++ b/tests/SpiffWorkflow/data/spiff/control-flow/recursion.path @@ -1,11 +1,11 @@ Start first excl_choice_1 - sub_workflow_1 Start first excl_choice_1 last End + sub_workflow_1 last End diff --git a/tests/SpiffWorkflow/data/spiff/control-flow/subworkflow_to_join.path b/tests/SpiffWorkflow/data/spiff/control-flow/subworkflow_to_join.path index e3a1fde8..527c4fd6 100644 --- a/tests/SpiffWorkflow/data/spiff/control-flow/subworkflow_to_join.path +++ b/tests/SpiffWorkflow/data/spiff/control-flow/subworkflow_to_join.path @@ -1,10 +1,10 @@ Start first - sub_workflow_1 Start first last End + sub_workflow_1 second join last diff --git a/tests/SpiffWorkflow/specs/SubWorkflowTest.py b/tests/SpiffWorkflow/specs/SubWorkflowTest.py index 5baacf99..0590192f 100644 --- a/tests/SpiffWorkflow/specs/SubWorkflowTest.py +++ b/tests/SpiffWorkflow/specs/SubWorkflowTest.py @@ -38,6 +38,8 @@ class TaskSpecTest(unittest.TestCase): def do_next_unique_task(self, name): # This method asserts that there is only one ready task! The specified # one - and then completes it + for task in self.workflow.get_tasks(TaskState.WAITING): + task.task_spec._update(task) ready_tasks = self.workflow.get_tasks(TaskState.READY) self.assertEqual(1, len(ready_tasks)) task = ready_tasks[0] @@ -58,12 +60,13 @@ class TaskSpecTest(unittest.TestCase): self.load_workflow_spec('data', 'block_to_subworkflow.xml') self.do_next_unique_task('Start') self.do_next_unique_task('first') - self.do_next_unique_task('sub_workflow_1') - # Inner: + + # Inner. The subworkflow task will complete automatically after the subwokflow completes self.do_next_unique_task('Start') self.do_next_unique_task('first') self.do_next_unique_task('last') self.do_next_unique_task('End') + # Back to outer: self.do_next_unique_task('last') self.do_next_unique_task('End') @@ -72,7 +75,7 @@ class TaskSpecTest(unittest.TestCase): self.load_workflow_spec('data', 'subworkflow_to_block.xml') self.do_next_unique_task('Start') self.do_next_unique_task('first') - self.do_next_unique_task('sub_workflow_1') + # Inner: self.do_next_unique_task('Start') self.do_next_unique_task('first') @@ -86,8 +89,9 @@ class TaskSpecTest(unittest.TestCase): self.load_workflow_spec('control-flow', 'subworkflow_to_join.xml') self.do_next_unique_task('Start') self.do_next_unique_task('first') - self.do_next_named_step('second', ['sub_workflow_1']) - self.do_next_unique_task('sub_workflow_1') + # The subworkflow task now sets its child tasks to READY and waits + self.do_next_named_step('second', ['Start']) + # Inner: self.do_next_unique_task('Start') self.do_next_unique_task('first') @@ -102,8 +106,8 @@ class TaskSpecTest(unittest.TestCase): self.load_workflow_spec('control-flow', 'subworkflow_to_join.xml') self.do_next_unique_task('Start') self.do_next_unique_task('first') - self.do_next_named_step('second', ['sub_workflow_1']) - self.do_next_unique_task('sub_workflow_1') + self.do_next_named_step('second', ['Start']) + # Inner: self.do_next_unique_task('Start') self.do_next_unique_task('first') diff --git a/tests/SpiffWorkflow/util.py b/tests/SpiffWorkflow/util.py index 5bc5a0aa..eeba7d52 100644 --- a/tests/SpiffWorkflow/util.py +++ b/tests/SpiffWorkflow/util.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- -from builtins import str -from builtins import range import time from SpiffWorkflow.task import Task, TaskState from SpiffWorkflow.workflow import Workflow @@ -33,7 +31,6 @@ def on_reached_cb(workflow, task, taken_path): props = [] for key, value in list(task.task_spec.data.items()): props.append('='.join((key, str(value)))) - # print "REACHED:", task.get_name(), atts, props # Store the list of data in the workflow. atts = ';'.join(atts) From f2b16112347ea193b717306e0ab4e1226cd66d16 Mon Sep 17 00:00:00 2001 From: burnettk Date: Fri, 18 Nov 2022 10:03:37 -0500 Subject: [PATCH 16/84] Squashed 'flask-bpmn/' changes from 5e40777f..860f2387 860f2387 Merge pull request #169 from sartography/dependabot/pip/flake8-rst-docstrings-0.3.0 2d0e83c8 Bump flake8-rst-docstrings from 0.2.7 to 0.3.0 6f6762ec Merge pull request #168 from sartography/dependabot/pip/mypy-0.991 579703c1 Bump mypy from 0.990 to 0.991 886bfdc3 Merge pull request #167 from sartography/dependabot/pip/flask-migrate-4.0.0 9b8b70d2 Merge pull request #165 from sartography/dependabot/pip/dot-github/workflows/virtualenv-20.16.7 9ec0402b Bump flask-migrate from 3.1.0 to 4.0.0 bc23eaa5 Bump virtualenv from 20.16.6 to 20.16.7 in /.github/workflows git-subtree-dir: flask-bpmn git-subtree-split: 860f2387bebdaa9220e9fbf6f8fa7f74e805d0d4 --- .github/workflows/constraints.txt | 2 +- poetry.lock | 87 ++++++++++++++++--------------- pyproject.toml | 4 +- 3 files changed, 48 insertions(+), 45 deletions(-) diff --git a/.github/workflows/constraints.txt b/.github/workflows/constraints.txt index a772cfa6..f30a60fc 100644 --- a/.github/workflows/constraints.txt +++ b/.github/workflows/constraints.txt @@ -2,4 +2,4 @@ pip==22.3.1 nox==2022.8.7 nox-poetry==1.0.2 poetry==1.2.2 -virtualenv==20.16.6 +virtualenv==20.16.7 diff --git a/poetry.lock b/poetry.lock index 7648bbd4..8b17963a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -491,17 +491,20 @@ flake8 = "*" [[package]] name = "flake8-rst-docstrings" -version = "0.2.7" -description = "Python docstring reStructuredText (RST) validator" +version = "0.3.0" +description = "Python docstring reStructuredText (RST) validator for flake8" category = "dev" optional = false python-versions = ">=3.7" [package.dependencies] -flake8 = ">=3.0.0" +flake8 = ">=3" pygments = "*" restructuredtext-lint = "*" +[package.extras] +develop = ["build", "twine"] + [[package]] name = "flask" version = "2.2.2" @@ -595,7 +598,7 @@ tests = ["flask-sqlalchemy", "marshmallow-sqlalchemy (>=0.13.0)", "marshmallow-s [[package]] name = "flask-migrate" -version = "3.1.0" +version = "4.0.0" description = "SQLAlchemy database migrations for Flask applications using Alembic." category = "main" optional = false @@ -916,7 +919,7 @@ mypy-extensions = "*" [[package]] name = "mypy" -version = "0.990" +version = "0.991" description = "Optional static typing for Python" category = "dev" optional = false @@ -1501,7 +1504,7 @@ test = ["pytest"] [[package]] name = "SpiffWorkflow" version = "1.2.1" -description = "A workflow framework and BPMN/DMN Processor" +description = "" category = "main" optional = false python-versions = "*" @@ -1517,7 +1520,7 @@ lxml = "*" type = "git" url = "https://github.com/sartography/SpiffWorkflow" reference = "main" -resolved_reference = "580939cc8cb0b7ade1571483bd1e28f554434ac4" +resolved_reference = "025bc30f27366e06dd1286b7563e4b1cb04c1c46" [[package]] name = "sqlalchemy" @@ -1767,7 +1770,7 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>= [metadata] lock-version = "1.1" python-versions = "^3.7" -content-hash = "59fd1a96fd43ad04e57500a4a2f9c2a8b09279872f0277736d52a827634977a6" +content-hash = "6dfda037ebb3024834a45670108756a3057fff1b6fb5b916d222d3a162509b7d" [metadata.files] alabaster = [ @@ -2045,8 +2048,8 @@ flake8-polyfill = [ {file = "flake8_polyfill-1.0.2-py2.py3-none-any.whl", hash = "sha256:12be6a34ee3ab795b19ca73505e7b55826d5f6ad7230d31b18e106400169b9e9"}, ] flake8-rst-docstrings = [ - {file = "flake8-rst-docstrings-0.2.7.tar.gz", hash = "sha256:2740067ab9237559dd45a3434d8c987792c7b259ca563621a3b95efe201f5382"}, - {file = "flake8_rst_docstrings-0.2.7-py3-none-any.whl", hash = "sha256:5d56075dce360bcc9c6775bfe7cb431aa395de600ca7e8d40580a28d50b2a803"}, + {file = "flake8-rst-docstrings-0.3.0.tar.gz", hash = "sha256:d1ce22b4bd37b73cd86b8d980e946ef198cfcc18ed82fedb674ceaa2f8d1afa4"}, + {file = "flake8_rst_docstrings-0.3.0-py3-none-any.whl", hash = "sha256:f8c3c6892ff402292651c31983a38da082480ad3ba253743de52989bdc84ca1c"}, ] flask = [ {file = "Flask-2.2.2-py3-none-any.whl", hash = "sha256:b9c46cc36662a7949f34b52d8ec7bb59c0d74ba08ba6cb9ce9adc1d8676d9526"}, @@ -2071,8 +2074,8 @@ flask-marshmallow = [ {file = "flask_marshmallow-0.14.0-py2.py3-none-any.whl", hash = "sha256:2adcd782b5a4a6c5ae3c96701f320d8ca6997995a52b2661093c56cc3ed24754"}, ] flask-migrate = [ - {file = "Flask-Migrate-3.1.0.tar.gz", hash = "sha256:57d6060839e3a7f150eaab6fe4e726d9e3e7cffe2150fb223d73f92421c6d1d9"}, - {file = "Flask_Migrate-3.1.0-py3-none-any.whl", hash = "sha256:a6498706241aba6be7a251078de9cf166d74307bca41a4ca3e403c9d39e2f897"}, + {file = "Flask-Migrate-4.0.0.tar.gz", hash = "sha256:2a301c3040af6844f29d9149abe428a0f08ebc8fa149e72113bbb36fa341920a"}, + {file = "Flask_Migrate-4.0.0-py3-none-any.whl", hash = "sha256:e75a46b657e3062296b9f6e92f31e19662f76cfee8abd6ae94640cbcb79fe016"}, ] flask-restful = [ {file = "Flask-RESTful-0.3.9.tar.gz", hash = "sha256:ccec650b835d48192138c85329ae03735e6ced58e9b2d9c2146d6c84c06fa53e"}, @@ -2391,36 +2394,36 @@ monkeytype = [ {file = "MonkeyType-22.2.0.tar.gz", hash = "sha256:6b0c00b49dcc5095a2c08d28246cf005e05673fc51f64d203f9a6bca2036dfab"}, ] mypy = [ - {file = "mypy-0.990-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:aaf1be63e0207d7d17be942dcf9a6b641745581fe6c64df9a38deb562a7dbafa"}, - {file = "mypy-0.990-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d555aa7f44cecb7ea3c0ac69d58b1a5afb92caa017285a8e9c4efbf0518b61b4"}, - {file = "mypy-0.990-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8f694d6d09a460b117dccb6857dda269188e3437c880d7b60fa0014fa872d1e9"}, - {file = "mypy-0.990-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:269f0dfb6463b8780333310ff4b5134425157ef0d2b1d614015adaf6d6a7eabd"}, - {file = "mypy-0.990-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8798c8ed83aa809f053abff08664bdca056038f5a02af3660de00b7290b64c47"}, - {file = "mypy-0.990-cp310-cp310-win_amd64.whl", hash = "sha256:47a9955214615108c3480a500cfda8513a0b1cd3c09a1ed42764ca0dd7b931dd"}, - {file = "mypy-0.990-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:4a8a6c10f4c63fbf6ad6c03eba22c9331b3946a4cec97f008e9ffb4d3b31e8e2"}, - {file = "mypy-0.990-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cd2dd3730ba894ec2a2082cc703fbf3e95a08479f7be84912e3131fc68809d46"}, - {file = "mypy-0.990-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7da0005e47975287a92b43276e460ac1831af3d23032c34e67d003388a0ce8d0"}, - {file = "mypy-0.990-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:262c543ef24deb10470a3c1c254bb986714e2b6b1a67d66daf836a548a9f316c"}, - {file = "mypy-0.990-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:3ff201a0c6d3ea029d73b1648943387d75aa052491365b101f6edd5570d018ea"}, - {file = "mypy-0.990-cp311-cp311-win_amd64.whl", hash = "sha256:1767830da2d1afa4e62b684647af0ff79b401f004d7fa08bc5b0ce2d45bcd5ec"}, - {file = "mypy-0.990-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:6826d9c4d85bbf6d68cb279b561de6a4d8d778ca8e9ab2d00ee768ab501a9852"}, - {file = "mypy-0.990-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:46897755f944176fbc504178422a5a2875bbf3f7436727374724842c0987b5af"}, - {file = "mypy-0.990-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:0680389c34284287fe00e82fc8bccdea9aff318f7e7d55b90d967a13a9606013"}, - {file = "mypy-0.990-cp37-cp37m-win_amd64.whl", hash = "sha256:b08541a06eed35b543ae1a6b301590eb61826a1eb099417676ddc5a42aa151c5"}, - {file = "mypy-0.990-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:be88d665e76b452c26fb2bdc3d54555c01226fba062b004ede780b190a50f9db"}, - {file = "mypy-0.990-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9b8f4a8213b1fd4b751e26b59ae0e0c12896568d7e805861035c7a15ed6dc9eb"}, - {file = "mypy-0.990-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:2b6f85c2ad378e3224e017904a051b26660087b3b76490d533b7344f1546d3ff"}, - {file = "mypy-0.990-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1ee5f99817ee70254e7eb5cf97c1b11dda29c6893d846c8b07bce449184e9466"}, - {file = "mypy-0.990-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49082382f571c3186ce9ea0bd627cb1345d4da8d44a8377870f4442401f0a706"}, - {file = "mypy-0.990-cp38-cp38-win_amd64.whl", hash = "sha256:aba38e3dd66bdbafbbfe9c6e79637841928ea4c79b32e334099463c17b0d90ef"}, - {file = "mypy-0.990-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:9d851c09b981a65d9d283a8ccb5b1d0b698e580493416a10942ef1a04b19fd37"}, - {file = "mypy-0.990-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d847dd23540e2912d9667602271e5ebf25e5788e7da46da5ffd98e7872616e8e"}, - {file = "mypy-0.990-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:cc6019808580565040cd2a561b593d7c3c646badd7e580e07d875eb1bf35c695"}, - {file = "mypy-0.990-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2a3150d409609a775c8cb65dbe305c4edd7fe576c22ea79d77d1454acd9aeda8"}, - {file = "mypy-0.990-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:3227f14fe943524f5794679156488f18bf8d34bfecd4623cf76bc55958d229c5"}, - {file = "mypy-0.990-cp39-cp39-win_amd64.whl", hash = "sha256:c76c769c46a1e6062a84837badcb2a7b0cdb153d68601a61f60739c37d41cc74"}, - {file = "mypy-0.990-py3-none-any.whl", hash = "sha256:8f1940325a8ed460ba03d19ab83742260fa9534804c317224e5d4e5aa588e2d6"}, - {file = "mypy-0.990.tar.gz", hash = "sha256:72382cb609142dba3f04140d016c94b4092bc7b4d98ca718740dc989e5271b8d"}, + {file = "mypy-0.991-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7d17e0a9707d0772f4a7b878f04b4fd11f6f5bcb9b3813975a9b13c9332153ab"}, + {file = "mypy-0.991-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0714258640194d75677e86c786e80ccf294972cc76885d3ebbb560f11db0003d"}, + {file = "mypy-0.991-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0c8f3be99e8a8bd403caa8c03be619544bc2c77a7093685dcf308c6b109426c6"}, + {file = "mypy-0.991-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc9ec663ed6c8f15f4ae9d3c04c989b744436c16d26580eaa760ae9dd5d662eb"}, + {file = "mypy-0.991-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:4307270436fd7694b41f913eb09210faff27ea4979ecbcd849e57d2da2f65305"}, + {file = "mypy-0.991-cp310-cp310-win_amd64.whl", hash = "sha256:901c2c269c616e6cb0998b33d4adbb4a6af0ac4ce5cd078afd7bc95830e62c1c"}, + {file = "mypy-0.991-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:d13674f3fb73805ba0c45eb6c0c3053d218aa1f7abead6e446d474529aafc372"}, + {file = "mypy-0.991-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1c8cd4fb70e8584ca1ed5805cbc7c017a3d1a29fb450621089ffed3e99d1857f"}, + {file = "mypy-0.991-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:209ee89fbb0deed518605edddd234af80506aec932ad28d73c08f1400ef80a33"}, + {file = "mypy-0.991-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:37bd02ebf9d10e05b00d71302d2c2e6ca333e6c2a8584a98c00e038db8121f05"}, + {file = "mypy-0.991-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:26efb2fcc6b67e4d5a55561f39176821d2adf88f2745ddc72751b7890f3194ad"}, + {file = "mypy-0.991-cp311-cp311-win_amd64.whl", hash = "sha256:3a700330b567114b673cf8ee7388e949f843b356a73b5ab22dd7cff4742a5297"}, + {file = "mypy-0.991-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:1f7d1a520373e2272b10796c3ff721ea1a0712288cafaa95931e66aa15798813"}, + {file = "mypy-0.991-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:641411733b127c3e0dab94c45af15fea99e4468f99ac88b39efb1ad677da5711"}, + {file = "mypy-0.991-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:3d80e36b7d7a9259b740be6d8d906221789b0d836201af4234093cae89ced0cd"}, + {file = "mypy-0.991-cp37-cp37m-win_amd64.whl", hash = "sha256:e62ebaad93be3ad1a828a11e90f0e76f15449371ffeecca4a0a0b9adc99abcef"}, + {file = "mypy-0.991-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:b86ce2c1866a748c0f6faca5232059f881cda6dda2a893b9a8373353cfe3715a"}, + {file = "mypy-0.991-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ac6e503823143464538efda0e8e356d871557ef60ccd38f8824a4257acc18d93"}, + {file = "mypy-0.991-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:0cca5adf694af539aeaa6ac633a7afe9bbd760df9d31be55ab780b77ab5ae8bf"}, + {file = "mypy-0.991-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a12c56bf73cdab116df96e4ff39610b92a348cc99a1307e1da3c3768bbb5b135"}, + {file = "mypy-0.991-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:652b651d42f155033a1967739788c436491b577b6a44e4c39fb340d0ee7f0d70"}, + {file = "mypy-0.991-cp38-cp38-win_amd64.whl", hash = "sha256:4175593dc25d9da12f7de8de873a33f9b2b8bdb4e827a7cae952e5b1a342e243"}, + {file = "mypy-0.991-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:98e781cd35c0acf33eb0295e8b9c55cdbef64fcb35f6d3aa2186f289bed6e80d"}, + {file = "mypy-0.991-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6d7464bac72a85cb3491c7e92b5b62f3dcccb8af26826257760a552a5e244aa5"}, + {file = "mypy-0.991-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c9166b3f81a10cdf9b49f2d594b21b31adadb3d5e9db9b834866c3258b695be3"}, + {file = "mypy-0.991-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8472f736a5bfb159a5e36740847808f6f5b659960115ff29c7cecec1741c648"}, + {file = "mypy-0.991-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5e80e758243b97b618cdf22004beb09e8a2de1af481382e4d84bc52152d1c476"}, + {file = "mypy-0.991-cp39-cp39-win_amd64.whl", hash = "sha256:74e259b5c19f70d35fcc1ad3d56499065c601dfe94ff67ae48b85596b9ec1461"}, + {file = "mypy-0.991-py3-none-any.whl", hash = "sha256:de32edc9b0a7e67c2775e574cb061a537660e51210fbf6006b0b36ea695ae9bb"}, + {file = "mypy-0.991.tar.gz", hash = "sha256:3c0165ba8f354a6d9881809ef29f1a9318a236a6d81c690094c5df32107bde06"}, ] mypy-extensions = [ {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, diff --git a/pyproject.toml b/pyproject.toml index c13cd007..3cb3217a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ greenlet = "^2.0.1" pytest = "^6.2.5" coverage = {extras = ["toml"], version = "^6.5"} safety = "^2.3.1" -mypy = "^0.990" +mypy = "^0.991" typeguard = "^2.13.2" xdoctest = {extras = ["colors"], version = "^1.1.0"} sphinx = "^4.3.0" @@ -55,7 +55,7 @@ bandit = "1.7.2" flake8-bugbear = "^22.10.27" flake8-docstrings = "^1.6.0" -flake8-rst-docstrings = "^0.2.7" +flake8-rst-docstrings = "^0.3.0" pep8-naming = "^0.13.2" darglint = "^1.8.1" reorder-python-imports = "^3.9.0" From c574ceba766b56be43633c24694294363a4da4f2 Mon Sep 17 00:00:00 2001 From: burnettk Date: Fri, 18 Nov 2022 10:03:38 -0500 Subject: [PATCH 17/84] Squashed 'bpmn-js-spiffworkflow/' changes from 4f23f860..e92f48da e92f48da minor fixes to the Bpmn-js-subworkflow spec. af88025a Merge remote-tracking branch 'origin/main' into feature/call_activity_selection f3bd1e56 Minor tweak to bpmn-js-spiffworkflow 9207ef45 Minor tweak, in the hopes of getting a text box to update correctly. 084f4646 Fixing a bug in the Call Activity's handing of an update. c9035994 Return the event bus when calling a search. git-subtree-dir: bpmn-js-spiffworkflow git-subtree-split: e92f48da7cb4416310af71bb1699caaca87324cd --- README.md | 49 ++++++++++--------- app/app.js | 11 +++++ .../CallActivityPropertiesProvider.js | 23 ++++++--- .../propertiesPanel/SpiffExtensionSelect.js | 5 +- test/spec/CallActivitySpec.js | 3 +- 5 files changed, 58 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 43c3eb8e..de473b9f 100644 --- a/README.md +++ b/README.md @@ -71,30 +71,31 @@ the behavior of the editor making it easier for your end users. There are many this in the app.js file. Below is a table of all the events that are sent and accepted: -| Event Name | Description | Fired or Acceped | Parameters | Description | -|--------------------------------|------------------------------------------------------------------------------| ---------------- |----------------------|--------------------------------------------------------------------------| -| spiff.service\_tasks.requested | Request a list of available services that can be called from a service task. | Fired | \- | | -| spiff.service\_tasks.returned | Provides a list of services. | Recieved | serviceTaskOperators | ex: \[{id:'Chuck Facts', parameters\[{id:'category', type:'string'}\]}\] | -| spiff.script.edit | Request to edit a python script in some sort of facy editor. | Fired | scriptType | one of: script, preScript, postScript | -| | | | value | The actual python script | -| | | | element | The element that needs updating | -| | | | eventBus | Used by receiver to fire back an event | -| spiff.script.update | Update a python script to a new value. | Recieved | scriptType | one of: script, preScript, postScript | -| | | | value | The updated script | -| | | | element | The element that needs updating | -| spiff.markdown.edit | Request to edit markdown in a fancy editor. | Fired | element | The element that needs updating | -| | | | value | The current markdown content | -| spiff.markdown.update | Update Markdown content for a paticular elements 'instructions'. | Recieved | element | The element that needs updating | -| | | | value | Tne updated Markdown content | -| spiff.callactivity.edit | Requst to edit a call activity by process id. | Fired | processId | The Process the users wants to edit | -| spiff.callactivity.search | Requst to search for a call activity | Fired | | | -| spiff.callactivity.update | Update the process id from a call activity (based on search) | Fired | processId | The Process the users wants to edit | -| spiff.file.edit | request to edit a file, but file name. | Fired | value | The file name the user wants to edit | -| spiff.dmn.edit | request to edit a dmn by process id. | Fired | value | The DMN id the user wants to edit | -| spiff.json\_files.requested | request a list of local json files. | Fired | optionType | The type of options required ('json' or 'dmn') | -| spff.dmn\_files.requested | request of list of local dmn files. | | | | -| spiff.json\_files.returned | Return a list of available json files | Recieved | options | \[{lable:'My Label', value:'1'}\] | -| spff.dmn\_files.returned | Return a list of available dmn files. | Recieved | options | \[{lable:'My Label', value:'1'}\] | +| Event Name | Description | Fired or Acceped | Parameters | Description | +|--------------------------------|------------------------------------------------------------------|---------|----------------------|--------------------------------------------------------------------------| +| spiff.service\_tasks.requested | Request a list of available services for service task. | Fired | \- | | +| spiff.service\_tasks.returned | Provides a list of services. | Recieved | serviceTaskOperators | ex: \[{id:'Chuck Facts', parameters\[{id:'category', type:'string'}\]}\] | +| spiff.script.edit | Request to edit a python script in some sort of facy editor. | Fired | scriptType | one of: script, preScript, postScript | +| | | | value | The actual python script | +| | | | element | The element that needs updating | +| | | | eventBus | Used by receiver to fire back an event | +| spiff.script.update | Update a python script to a new value. | Recieved | scriptType | one of: script, preScript, postScript | +| | | | value | The updated script | +| | | | element | The element that needs updating | +| spiff.markdown.edit | Request to edit markdown in a fancy editor. | Fired | element | The element that needs updating | +| | | | value | The current markdown content | +| spiff.markdown.update | Update Markdown content for a paticular elements 'instructions'. | Recieved | element | The element that needs updating | +| | | | value | Tne updated Markdown content | +| spiff.callactivity.edit | Requst to edit a call activity by process id. | Fired | processId | The Process the users wants to edit | +| spiff.callactivity.search | Requst to search for a call activity | Fired | processUd | The currently seleted process id | +| | | | eventBus | For sending back the selected process id. | +| spiff.callactivity.update | Update the process id from a call activity (based on search) | Received | processId | The Process the users wants to edit | +| spiff.file.edit | request to edit a file, but file name. | Fired | value | The file name the user wants to edit | +| spiff.dmn.edit | request to edit a dmn by process id. | Fired | value | The DMN id the user wants to edit | +| spiff.json\_files.requested | request a list of local json files. | Fired | optionType | The type of options required ('json' or 'dmn') | +| spff.dmn\_files.requested | request of list of local dmn files. | | | | +| spiff.json\_files.returned | Return a list of available json files | Recieved | options | \[{lable:'My Label', value:'1'}\] | +| spff.dmn\_files.returned | Return a list of available dmn files. | Recieved | options | \[{lable:'My Label', value:'1'}\] | diff --git a/app/app.js b/app/app.js index 00eac02e..3876df3d 100644 --- a/app/app.js +++ b/app/app.js @@ -181,6 +181,17 @@ bpmnModeler.on('spiff.dmn_files.requested', (event) => { }); }); +// As call activites might refernce processes across the system +// it should be possible to search for a paticular call activity. +bpmnModeler.on('spiff.callactivity.search', (event) => { + console.log("Firing call activity update", event.element) + event.eventBus.fire('spiff.callactivity.update', { + value: 'searched_bpmn_id', + element: event.element, + }); +}); + + // This handles the download and upload buttons - it isn't specific to // the BPMN modeler or these extensions, just a quick way to allow you to // create and save files, so keeping it outside the example. diff --git a/app/spiffworkflow/callActivity/propertiesPanel/CallActivityPropertiesProvider.js b/app/spiffworkflow/callActivity/propertiesPanel/CallActivityPropertiesProvider.js index c5d20851..8aee91db 100644 --- a/app/spiffworkflow/callActivity/propertiesPanel/CallActivityPropertiesProvider.js +++ b/app/spiffworkflow/callActivity/propertiesPanel/CallActivityPropertiesProvider.js @@ -98,20 +98,29 @@ function CalledElementTextField(props) { } function FindProcessButton(props) { - const { element } = props; + const { element, commandStack } = props; const eventBus = useService('eventBus'); return HeaderButton({ id: 'spiffworkflow-search-call-activity-button', class: 'spiffworkflow-properties-panel-button', onClick: () => { const processId = getCalledElementValue(element); - eventBus.fire('spiff.callactivity.search', { - element, - processId, - }); - // Listen for a response, to update the script. + + // First, set up the listen, then fire the event, just + // in case we are testing and things are happening superfast. eventBus.once('spiff.callactivity.update', (response) => { - element.businessObject.calledElement = response.value; + commandStack.execute('element.updateProperties', { + element: response.element, + moddleElement: response.element.businessObject, + properties: { + calledElement: response.value, + }, + }); + }); + eventBus.fire('spiff.callactivity.search', { + processId, + eventBus, + element }); }, children: 'Search', diff --git a/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionSelect.js b/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionSelect.js index 5bc6f505..9f7bbbaa 100644 --- a/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionSelect.js +++ b/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionSelect.js @@ -53,7 +53,10 @@ export function SpiffExtensionSelect(props) { } const getOptions = () => { const optionList = []; - if (optionType in spiffExtensionOptions) { + if ( + optionType in spiffExtensionOptions && + spiffExtensionOptions[optionType] !== null + ) { spiffExtensionOptions[optionType].forEach((opt) => { optionList.push({ label: opt.label, diff --git a/test/spec/CallActivitySpec.js b/test/spec/CallActivitySpec.js index b2110bb0..56c52cee 100644 --- a/test/spec/CallActivitySpec.js +++ b/test/spec/CallActivitySpec.js @@ -102,8 +102,9 @@ describe('Call Activities should work', function () { }); await pressButton(button); expect(launchEvent.processId).to.exist; + expect(launchEvent.element).to.exist; - eventBus.fire('spiff.callactivity.update', {value: 'searchedProcessId'}); + eventBus.fire('spiff.callactivity.update', {value: 'searchedProcessId', element: launchEvent.element}); const textInput = domQuery('input', entry); expect(businessObject.get('calledElement')).to.equal('searchedProcessId'); From d393683794c1a853e6419283ef28c7e4dc32c0e8 Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 18 Nov 2022 12:42:08 -0500 Subject: [PATCH 18/84] display groups as tiles on list page w/ burnettk --- .../src/spiffworkflow_backend/api.yml | 1 - .../models/process_group.py | 13 ++- spiffworkflow-frontend/src/index.css | 48 +++++++++- spiffworkflow-frontend/src/interfaces.ts | 14 +-- .../src/routes/ProcessGroupList.tsx | 92 +++++++++---------- .../src/routes/ProcessModelShow.tsx | 1 - 6 files changed, 107 insertions(+), 62 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml index 76d821e1..068efa2f 100755 --- a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml @@ -445,7 +445,6 @@ paths: description: For filtering - indicates the user has manually entered a query schema: type: boolean - # process_instance_list get: operationId: spiffworkflow_backend.routes.process_api_blueprint.process_instance_list summary: Returns a list of process instances for a given process model diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_group.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_group.py index 6edb19e5..236641e3 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_group.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_group.py @@ -55,13 +55,24 @@ class ProcessGroupSchema(Schema): """Meta.""" model = ProcessGroup - fields = ["id", "display_name", "display_order", "admin", "process_models"] + fields = [ + "id", + "display_name", + "display_order", + "admin", + "process_models", + "description", + "process_groups", + ] process_models = marshmallow.fields.List( marshmallow.fields.Nested( "ProcessModelInfoSchema", dump_only=True, required=False ) ) + process_groups = marshmallow.fields.List( + marshmallow.fields.Nested("ProcessGroupSchema", dump_only=True, required=False) + ) @post_load def make_process_group( diff --git a/spiffworkflow-frontend/src/index.css b/spiffworkflow-frontend/src/index.css index 6baa40d9..a89f6725 100644 --- a/spiffworkflow-frontend/src/index.css +++ b/spiffworkflow-frontend/src/index.css @@ -71,7 +71,7 @@ h1{ } code { font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', - monospace; + monospace; } .app-logo { @@ -182,9 +182,53 @@ h1.with-icons { } /* Json Web Form CSS Fix - Bootstrap now requries that each li have a "list-inline-item." Also have a PR - in on this with the react-jsonschema-form repo. This is just a patch fix to allow date inputs to layout a little more cleanly */ +in on this with the react-jsonschema-form repo. This is just a patch fix to allow date inputs to layout a little more cleanly */ .list-inline>li { display: inline-block; padding-right: 5px; padding-left: 5px; } + +.cds--tile.tile-process-group { + padding: 0px; + margin: 16px; + width: 354px; + height: 264px; + background: #F4F4F4; + order: 1; + float: left; +} + +.tile-process-group-content-container { + width: 354px; + height: 264px; + padding: 1em; + position: relative; +} + +.tile-process-group-display-name { + margin-top: 2em; + margin-bottom: 1em; + font-size: 20px; + line-height: 28px; + color: #161616; + order: 0; +} + +.tile-process-group-description { + font-size: 14px; + line-height: 20px; + letter-spacing: 0.16px; + color: #161616; + order: 1; +} + +.tile-process-group-children-count { + font-size: 14px; + line-height: 20px; + letter-spacing: 0.16px; + color: #161616; + order: 1; + position: absolute; + bottom: 1em; +} diff --git a/spiffworkflow-frontend/src/interfaces.ts b/spiffworkflow-frontend/src/interfaces.ts index d1a12c2f..a9ac1ec0 100644 --- a/spiffworkflow-frontend/src/interfaces.ts +++ b/spiffworkflow-frontend/src/interfaces.ts @@ -11,12 +11,6 @@ export interface RecentProcessModel { processModelDisplayName: string; } -export interface ProcessGroup { - id: string; - display_name: string; - description?: string | null; -} - export interface ProcessReference { id: string; // The unique id of the process or decision table. name: string; // The process or decision Display name. @@ -50,6 +44,14 @@ export interface ProcessModel { files: ProcessFile[]; } +export interface ProcessGroup { + id: string; + display_name: string; + description?: string | null; + process_models?: ProcessModel[]; + process_groups?: ProcessGroup[]; +} + // tuple of display value and URL export type HotCrumbItem = [displayValue: string, url?: string]; diff --git a/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx b/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx index 564a80dd..a4813020 100644 --- a/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx @@ -1,35 +1,36 @@ import { useEffect, useState } from 'react'; -import { Link, useNavigate, useSearchParams } from 'react-router-dom'; +import { useNavigate, useSearchParams } from 'react-router-dom'; +import { + ArrowRight, + // @ts-ignore +} from '@carbon/icons-react'; import { Button, - Table, + ClickableTile, // @ts-ignore } from '@carbon/react'; import { Can } from '@casl/react'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; -import PaginationForTable from '../components/PaginationForTable'; import HttpService from '../services/HttpService'; -import { - getPageInfoFromSearchParams, - modifyProcessModelPath, -} from '../helpers'; +import { modifyProcessModelPath, truncateString } from '../helpers'; import { CarbonComboBoxSelection, PermissionsToCheck, ProcessGroup, } from '../interfaces'; -import ProcessModelSearch from '../components/ProcessModelSearch'; import { useUriListForPermissions } from '../hooks/UriListForPermissions'; import { usePermissionFetcher } from '../hooks/PermissionService'; +import ProcessModelSearch from '../components/ProcessModelSearch'; // Example process group json // {'process_group_id': 'sure', 'display_name': 'Test Workflows', 'id': 'test_process_group'} export default function ProcessGroupList() { - const navigate = useNavigate(); const [searchParams] = useSearchParams(); + const navigate = useNavigate(); - const [processGroups, setProcessGroups] = useState([]); - const [pagination, setPagination] = useState(null); + const [processGroups, setProcessGroups] = useState( + null + ); const [processModelAvailableItems, setProcessModelAvailableItems] = useState( [] ); @@ -43,7 +44,6 @@ export default function ProcessGroupList() { useEffect(() => { const setProcessGroupsFromResult = (result: any) => { setProcessGroups(result.results); - setPagination(result.pagination); }; const processResultForProcessModels = (result: any) => { const selectionArray = result.results.map((item: any) => { @@ -54,10 +54,9 @@ export default function ProcessGroupList() { setProcessModelAvailableItems(selectionArray); }; - const { page, perPage } = getPageInfoFromSearchParams(searchParams); // for browsing HttpService.makeCallToBackend({ - path: `/process-groups?per_page=${perPage}&page=${page}`, + path: `/process-groups?per_page=1000`, successCallback: setProcessGroupsFromResult, }); // for search box @@ -67,48 +66,38 @@ export default function ProcessGroupList() { }); }, [searchParams]); - const buildTable = () => { - const rows = processGroups.map((row: ProcessGroup) => { - return ( - - - - {(row as any).display_name} - - - - ); - }); + const processGroupDirectChildrenCount = (processGroup: ProcessGroup) => { return ( - - - - - - - {rows} -
Process Group
+ (processGroup.process_models || []).length + + (processGroup.process_groups || []).length ); }; const processGroupsDisplayArea = () => { - const { page, perPage } = getPageInfoFromSearchParams(searchParams); let displayText = null; - if (processGroups?.length > 0) { - displayText = ( - <> -

Browse

- - - ); + if (processGroups && processGroups.length > 0) { + displayText = (processGroups || []).map((row: ProcessGroup) => { + return ( + +
+ +
+ {row.display_name} +
+

+ {truncateString(row.description || '', 25)} +

+

+ Total Sub Items: {processGroupDirectChildrenCount(row)} +

+
+
+ ); + }); } else { displayText =

No Groups To Display

; } @@ -131,7 +120,7 @@ export default function ProcessGroupList() { ); }; - if (pagination) { + if (processGroups) { return ( <> @@ -142,6 +131,7 @@ export default function ProcessGroupList() {

+
{processModelSearchArea()}
{processGroupsDisplayArea()} diff --git a/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx b/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx index 47994b31..549d964e 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx @@ -368,7 +368,6 @@ export default function ProcessModelShow() { return constructedTag; }); - // return
    {tags}
; const headers = ['Name', 'Actions']; return ( From 1dcaddf7158dedbeae897eacb7662e0d4d43ae04 Mon Sep 17 00:00:00 2001 From: Jon Herron Date: Fri, 18 Nov 2022 13:22:31 -0500 Subject: [PATCH 19/84] WIP --- spiffworkflow-backend/src/spiffworkflow_backend/api.yml | 6 ++++++ .../spiffworkflow_backend/routes/process_api_blueprint.py | 1 + 2 files changed, 7 insertions(+) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml index 068efa2f..1f3e7971 100755 --- a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml @@ -445,6 +445,12 @@ paths: description: For filtering - indicates the user has manually entered a query schema: type: boolean + - name: report_identifier + in: query + required: false + description: Specifies the identifier of a report to use, if any + schema: + type: string get: operationId: spiffworkflow_backend.routes.process_api_blueprint.process_instance_list summary: Returns a list of process instances for a given process model diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index b3d5ec02..deb34707 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -736,6 +736,7 @@ def process_instance_list( end_to: Optional[int] = None, process_status: Optional[str] = None, user_filter: Optional[bool] = False, + report_identifier: Optional[str] = None ) -> flask.wrappers.Response: """Process_instance_list.""" process_instance_report = ProcessInstanceReportModel.default_report(g.user) From a2dd2bb2410b676a6a7cb004a059e62b2f418727 Mon Sep 17 00:00:00 2001 From: Jon Herron Date: Fri, 18 Nov 2022 13:27:01 -0500 Subject: [PATCH 20/84] Squashed 'connector-proxy-demo/' content from commit fb5c24e git-subtree-dir: connector-proxy-demo git-subtree-split: fb5c24eaf274acf8ab11163710230610242cfc6e --- .gitignore | 132 +++++++++++++ LICENSE | 504 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 37 ++++ app.py | 18 ++ poetry.lock | 506 +++++++++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 24 +++ 6 files changed, 1221 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 app.py create mode 100644 poetry.lock create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..85cfcadb --- /dev/null +++ b/.gitignore @@ -0,0 +1,132 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# Intellij +.idea/ \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..8000a6fa --- /dev/null +++ b/LICENSE @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random + Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/README.md b/README.md new file mode 100644 index 00000000..49e651af --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# connector-proxy-demo +A Spiff-Connector for demonstration purposes - shows how to build connectors to some common 3rd party systems. + +# How to create a Connector Proxy for SpiffWorklow + +## Step 1. Create a python project with a few dependencies: +Create a bare-bones Flask application that depends on the core spiffworkflow-proxy (a flask blueprint) +and any connector dependencies you wish to use. +We will hopefully be adding a number of available connectors in the future. Please checkout the connector-aws repository for an example of how to create connections to new services. +``` python + python = "^3.11" + Flask = "^2.2.2" + spiffworkflow-proxy = {git = "https://github.com/sartography/spiffworkflow-proxy"} + connector-aws = { git = "https://github.com/sartography/connector-aws.git"} +``` + +## Step 2. +Create a basic Flask Application that uses the SpiffWorkflow Proxy's Flask Blueprint +```python +import os +from spiffworkflow_proxy.blueprint import proxy_blueprint +from flask import Flask + +app = Flask(__name__) +app.config.from_pyfile("config.py", silent=True) +app.register_blueprint(proxy_blueprint) +if __name__ == "__main__": + app.run(host="localhost", port=5000) +``` + +## Step 3. +Fire it up. +```bash +#> flask run +``` + +Any dependencies you add will now be available for SpiffWorkflow to call using a Service Task. What's more, those services are now discoverable! So when someone drops a Service Task into their diagram, they will have a dropdown list of all the services you have made available to them. And those services will know what parameters are required, and can prompt diagram authors to provide information necessary to make the call. This can be no parameters at all (just give me a fact about Chuck Norris) to arbitrarily complex parameters such as a json structure to be added to a DynamoDB Table. diff --git a/app.py b/app.py new file mode 100644 index 00000000..8b2cff71 --- /dev/null +++ b/app.py @@ -0,0 +1,18 @@ +import os + +from spiffworkflow_proxy.blueprint import proxy_blueprint +from flask import Flask + +app = Flask(__name__) +app.config.from_pyfile("config.py", silent=True) + +if app.config["ENV"] != "production": + os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1" + +# Use the SpiffConnector Blueprint, which will auto-discover any +# connector-* packages and provide API endpoints for listing and executing +# available services. +app.register_blueprint(proxy_blueprint) + +if __name__ == "__main__": + app.run(host="localhost", port=5000) \ No newline at end of file diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 00000000..9147d031 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,506 @@ +[[package]] +name = "boto3" +version = "1.26.6" +description = "The AWS SDK for Python" +category = "main" +optional = false +python-versions = ">= 3.7" + +[package.dependencies] +botocore = ">=1.29.6,<1.30.0" +jmespath = ">=0.7.1,<2.0.0" +s3transfer = ">=0.6.0,<0.7.0" + +[package.extras] +crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] + +[[package]] +name = "botocore" +version = "1.29.6" +description = "Low-level, data-driven core of boto 3." +category = "main" +optional = false +python-versions = ">= 3.7" + +[package.dependencies] +jmespath = ">=0.7.1,<2.0.0" +python-dateutil = ">=2.1,<3.0.0" +urllib3 = ">=1.25.4,<1.27" + +[package.extras] +crt = ["awscrt (==0.14.0)"] + +[[package]] +name = "cachelib" +version = "0.9.0" +description = "A collection of cache libraries in the same API interface." +category = "main" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "certifi" +version = "2022.9.24" +description = "Python package for providing Mozilla's CA Bundle." +category = "main" +optional = false +python-versions = ">=3.6" + +[[package]] +name = "charset-normalizer" +version = "2.1.1" +description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +category = "main" +optional = false +python-versions = ">=3.6.0" + +[package.extras] +unicode_backport = ["unicodedata2"] + +[[package]] +name = "click" +version = "8.1.3" +description = "Composable command line interface toolkit" +category = "main" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +category = "main" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" + +[[package]] +name = "connector-aws" +version = "0.1.0" +description = "Connect Service Tasks to AWS web services." +category = "main" +optional = false +python-versions = "^3.10" +develop = false + +[package.dependencies] +boto3 = "^1.26.5" +simplejson = "^3.17.6" + +[package.source] +type = "git" +url = "https://github.com/sartography/connector-aws.git" +reference = "HEAD" +resolved_reference = "ad386286bcc72eeb000b9b053596dfee40f7c6b5" + +[[package]] +name = "Flask" +version = "2.2.2" +description = "A simple framework for building complex web applications." +category = "main" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +click = ">=8.0" +itsdangerous = ">=2.0" +Jinja2 = ">=3.0" +Werkzeug = ">=2.2.2" + +[package.extras] +async = ["asgiref (>=3.2)"] +dotenv = ["python-dotenv"] + +[[package]] +name = "Flask-OAuthlib" +version = "0.9.6" +description = "OAuthlib for Flask" +category = "main" +optional = false +python-versions = "*" + +[package.dependencies] +cachelib = "*" +Flask = "*" +oauthlib = ">=1.1.2,<2.0.3 || >2.0.3,<2.0.4 || >2.0.4,<2.0.5 || >2.0.5,<3.0.0" +requests-oauthlib = ">=0.6.2,<1.2.0" + +[[package]] +name = "idna" +version = "3.4" +description = "Internationalized Domain Names in Applications (IDNA)" +category = "main" +optional = false +python-versions = ">=3.5" + +[[package]] +name = "itsdangerous" +version = "2.1.2" +description = "Safely pass data to untrusted environments and back." +category = "main" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "Jinja2" +version = "3.1.2" +description = "A very fast and expressive template engine." +category = "main" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +MarkupSafe = ">=2.0" + +[package.extras] +i18n = ["Babel (>=2.7)"] + +[[package]] +name = "jmespath" +version = "1.0.1" +description = "JSON Matching Expressions" +category = "main" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "MarkupSafe" +version = "2.1.1" +description = "Safely add untrusted strings to HTML/XML markup." +category = "main" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "oauthlib" +version = "2.1.0" +description = "A generic, spec-compliant, thorough implementation of the OAuth request-signing logic" +category = "main" +optional = false +python-versions = "*" + +[package.extras] +rsa = ["cryptography"] +signals = ["blinker"] +signedtoken = ["cryptography", "pyjwt (>=1.0.0)"] +test = ["blinker", "cryptography", "mock", "nose", "pyjwt (>=1.0.0)", "unittest2"] + +[[package]] +name = "python-dateutil" +version = "2.8.2" +description = "Extensions to the standard Python datetime module" +category = "main" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" + +[package.dependencies] +six = ">=1.5" + +[[package]] +name = "requests" +version = "2.28.1" +description = "Python HTTP for Humans." +category = "main" +optional = false +python-versions = ">=3.7, <4" + +[package.dependencies] +certifi = ">=2017.4.17" +charset-normalizer = ">=2,<3" +idna = ">=2.5,<4" +urllib3 = ">=1.21.1,<1.27" + +[package.extras] +socks = ["PySocks (>=1.5.6,!=1.5.7)"] +use_chardet_on_py3 = ["chardet (>=3.0.2,<6)"] + +[[package]] +name = "requests-oauthlib" +version = "1.1.0" +description = "OAuthlib authentication support for Requests." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[package.dependencies] +oauthlib = ">=2.1.0,<3.0.0" +requests = ">=2.0.0" + +[package.extras] +rsa = ["oauthlib[signedtoken] (>=2.1.0,<3.0.0)"] + +[[package]] +name = "s3transfer" +version = "0.6.0" +description = "An Amazon S3 Transfer Manager" +category = "main" +optional = false +python-versions = ">= 3.7" + +[package.dependencies] +botocore = ">=1.12.36,<2.0a.0" + +[package.extras] +crt = ["botocore[crt] (>=1.20.29,<2.0a.0)"] + +[[package]] +name = "simplejson" +version = "3.17.6" +description = "Simple, fast, extensible JSON encoder/decoder for Python" +category = "main" +optional = false +python-versions = ">=2.5, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "spiffworkflow-proxy" +version = "0.1.0" +description = "A blueprint that can allow (and limit) SpiffWorkflow's Service Tasks access to an organizations API's, such as connections to AWS Services and existing applications." +category = "main" +optional = false +python-versions = "^3.10" +develop = false + +[package.dependencies] +Flask = "^2.2" +Flask-OAuthlib = "^0.9.6" + +[package.source] +type = "git" +url = "https://github.com/sartography/spiffworkflow-proxy" +reference = "HEAD" +resolved_reference = "5e4926030cf6f2808ddb8e65527168dd914e5fc3" + +[[package]] +name = "urllib3" +version = "1.26.12" +description = "HTTP library with thread-safe connection pooling, file post, and more." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4" + +[package.extras] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] +secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] +socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] + +[[package]] +name = "Werkzeug" +version = "2.2.2" +description = "The comprehensive WSGI web application library." +category = "main" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +MarkupSafe = ">=2.1.1" + +[package.extras] +watchdog = ["watchdog"] + +[metadata] +lock-version = "1.1" +python-versions = "^3.10" +content-hash = "86cf682d49dc495c8cf6dc60a8aedc31ad32a293e6ceaf7b1428e0c232f8319e" + +[metadata.files] +boto3 = [ + {file = "boto3-1.26.6-py3-none-any.whl", hash = "sha256:2bd7d3e8362f0e0d84fe4c3a06f1bd46fd2dbedbea76ac24e89f28439837a9e7"}, + {file = "boto3-1.26.6.tar.gz", hash = "sha256:4943faf38979ac445627390b431b0c08a73ccd5ecd46983e1d29cee454d14aaa"}, +] +botocore = [ + {file = "botocore-1.29.6-py3-none-any.whl", hash = "sha256:bb595ed6a42ff85b4d5fb7a2e31b8584b87df46933a6f830fd98f91b1feea279"}, + {file = "botocore-1.29.6.tar.gz", hash = "sha256:574a9dc8b7cf1d866e6255c57af25de1f0da1babc6ce9faf05f227fd28ca905e"}, +] +cachelib = [ + {file = "cachelib-0.9.0-py3-none-any.whl", hash = "sha256:811ceeb1209d2fe51cd2b62810bd1eccf70feba5c52641532498be5c675493b3"}, + {file = "cachelib-0.9.0.tar.gz", hash = "sha256:38222cc7c1b79a23606de5c2607f4925779e37cdcea1c2ad21b8bae94b5425a5"}, +] +certifi = [ + {file = "certifi-2022.9.24-py3-none-any.whl", hash = "sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382"}, + {file = "certifi-2022.9.24.tar.gz", hash = "sha256:0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14"}, +] +charset-normalizer = [ + {file = "charset-normalizer-2.1.1.tar.gz", hash = "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845"}, + {file = "charset_normalizer-2.1.1-py3-none-any.whl", hash = "sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f"}, +] +click = [ + {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, + {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, +] +colorama = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] +connector-aws = [] +Flask = [ + {file = "Flask-2.2.2-py3-none-any.whl", hash = "sha256:b9c46cc36662a7949f34b52d8ec7bb59c0d74ba08ba6cb9ce9adc1d8676d9526"}, + {file = "Flask-2.2.2.tar.gz", hash = "sha256:642c450d19c4ad482f96729bd2a8f6d32554aa1e231f4f6b4e7e5264b16cca2b"}, +] +Flask-OAuthlib = [ + {file = "Flask-OAuthlib-0.9.6.tar.gz", hash = "sha256:5bb79c8a8e670c2eb4cb553dfc3283b6c8d1202f674934676dc173cee94fe39c"}, + {file = "Flask_OAuthlib-0.9.6-py3-none-any.whl", hash = "sha256:a5c3b62959aa1922470a62b6ebf4273b75f1c29561a7eb4a69cde85d45a1d669"}, +] +idna = [ + {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, + {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, +] +itsdangerous = [ + {file = "itsdangerous-2.1.2-py3-none-any.whl", hash = "sha256:2c2349112351b88699d8d4b6b075022c0808887cb7ad10069318a8b0bc88db44"}, + {file = "itsdangerous-2.1.2.tar.gz", hash = "sha256:5dbbc68b317e5e42f327f9021763545dc3fc3bfe22e6deb96aaf1fc38874156a"}, +] +Jinja2 = [ + {file = "Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"}, + {file = "Jinja2-3.1.2.tar.gz", hash = "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852"}, +] +jmespath = [ + {file = "jmespath-1.0.1-py3-none-any.whl", hash = "sha256:02e2e4cc71b5bcab88332eebf907519190dd9e6e82107fa7f83b1003a6252980"}, + {file = "jmespath-1.0.1.tar.gz", hash = "sha256:90261b206d6defd58fdd5e85f478bf633a2901798906be2ad389150c5c60edbe"}, +] +MarkupSafe = [ + {file = "MarkupSafe-2.1.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:86b1f75c4e7c2ac2ccdaec2b9022845dbb81880ca318bb7a0a01fbf7813e3812"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:f121a1420d4e173a5d96e47e9a0c0dcff965afdf1626d28de1460815f7c4ee7a"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a49907dd8420c5685cfa064a1335b6754b74541bbb3706c259c02ed65b644b3e"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10c1bfff05d95783da83491be968e8fe789263689c02724e0c691933c52994f5"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b7bd98b796e2b6553da7225aeb61f447f80a1ca64f41d83612e6139ca5213aa4"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b09bf97215625a311f669476f44b8b318b075847b49316d3e28c08e41a7a573f"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:694deca8d702d5db21ec83983ce0bb4b26a578e71fbdbd4fdcd387daa90e4d5e"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:efc1913fd2ca4f334418481c7e595c00aad186563bbc1ec76067848c7ca0a933"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-win32.whl", hash = "sha256:4a33dea2b688b3190ee12bd7cfa29d39c9ed176bda40bfa11099a3ce5d3a7ac6"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:dda30ba7e87fbbb7eab1ec9f58678558fd9a6b8b853530e176eabd064da81417"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:671cd1187ed5e62818414afe79ed29da836dde67166a9fac6d435873c44fdd02"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3799351e2336dc91ea70b034983ee71cf2f9533cdff7c14c90ea126bfd95d65a"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e72591e9ecd94d7feb70c1cbd7be7b3ebea3f548870aa91e2732960fa4d57a37"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6fbf47b5d3728c6aea2abb0589b5d30459e369baa772e0f37a0320185e87c980"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:d5ee4f386140395a2c818d149221149c54849dfcfcb9f1debfe07a8b8bd63f9a"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:bcb3ed405ed3222f9904899563d6fc492ff75cce56cba05e32eff40e6acbeaa3"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:e1c0b87e09fa55a220f058d1d49d3fb8df88fbfab58558f1198e08c1e1de842a"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-win32.whl", hash = "sha256:8dc1c72a69aa7e082593c4a203dcf94ddb74bb5c8a731e4e1eb68d031e8498ff"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:97a68e6ada378df82bc9f16b800ab77cbf4b2fada0081794318520138c088e4a"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e8c843bbcda3a2f1e3c2ab25913c80a3c5376cd00c6e8c4a86a89a28c8dc5452"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0212a68688482dc52b2d45013df70d169f542b7394fc744c02a57374a4207003"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e576a51ad59e4bfaac456023a78f6b5e6e7651dcd383bcc3e18d06f9b55d6d1"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4b9fe39a2ccc108a4accc2676e77da025ce383c108593d65cc909add5c3bd601"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:96e37a3dc86e80bf81758c152fe66dbf60ed5eca3d26305edf01892257049925"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:6d0072fea50feec76a4c418096652f2c3238eaa014b2f94aeb1d56a66b41403f"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:089cf3dbf0cd6c100f02945abeb18484bd1ee57a079aefd52cffd17fba910b88"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6a074d34ee7a5ce3effbc526b7083ec9731bb3cbf921bbe1d3005d4d2bdb3a63"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-win32.whl", hash = "sha256:421be9fbf0ffe9ffd7a378aafebbf6f4602d564d34be190fc19a193232fd12b1"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:fc7b548b17d238737688817ab67deebb30e8073c95749d55538ed473130ec0c7"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:e04e26803c9c3851c931eac40c695602c6295b8d432cbe78609649ad9bd2da8a"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b87db4360013327109564f0e591bd2a3b318547bcef31b468a92ee504d07ae4f"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:99a2a507ed3ac881b975a2976d59f38c19386d128e7a9a18b7df6fff1fd4c1d6"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:56442863ed2b06d19c37f94d999035e15ee982988920e12a5b4ba29b62ad1f77"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3ce11ee3f23f79dbd06fb3d63e2f6af7b12db1d46932fe7bd8afa259a5996603"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:33b74d289bd2f5e527beadcaa3f401e0df0a89927c1559c8566c066fa4248ab7"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:43093fb83d8343aac0b1baa75516da6092f58f41200907ef92448ecab8825135"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:8e3dcf21f367459434c18e71b2a9532d96547aef8a871872a5bd69a715c15f96"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-win32.whl", hash = "sha256:d4306c36ca495956b6d568d276ac11fdd9c30a36f1b6eb928070dc5360b22e1c"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:46d00d6cfecdde84d40e572d63735ef81423ad31184100411e6e3388d405e247"}, + {file = "MarkupSafe-2.1.1.tar.gz", hash = "sha256:7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b"}, +] +oauthlib = [ + {file = "oauthlib-2.1.0-py2.py3-none-any.whl", hash = "sha256:d883b36b21a6ad813953803edfa563b1b579d79ca758fe950d1bc9e8b326025b"}, + {file = "oauthlib-2.1.0.tar.gz", hash = "sha256:ac35665a61c1685c56336bda97d5eefa246f1202618a1d6f34fccb1bdd404162"}, +] +python-dateutil = [ + {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, + {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, +] +requests = [ + {file = "requests-2.28.1-py3-none-any.whl", hash = "sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"}, + {file = "requests-2.28.1.tar.gz", hash = "sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983"}, +] +requests-oauthlib = [ + {file = "requests-oauthlib-1.1.0.tar.gz", hash = "sha256:eabd8eb700ebed81ba080c6ead96d39d6bdc39996094bd23000204f6965786b0"}, + {file = "requests_oauthlib-1.1.0-py2.py3-none-any.whl", hash = "sha256:be76f2bb72ca5525998e81d47913e09b1ca8b7957ae89b46f787a79e68ad5e61"}, +] +s3transfer = [ + {file = "s3transfer-0.6.0-py3-none-any.whl", hash = "sha256:06176b74f3a15f61f1b4f25a1fc29a4429040b7647133a463da8fa5bd28d5ecd"}, + {file = "s3transfer-0.6.0.tar.gz", hash = "sha256:2ed07d3866f523cc561bf4a00fc5535827981b117dd7876f036b0c1aca42c947"}, +] +simplejson = [ + {file = "simplejson-3.17.6-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:a89acae02b2975b1f8e4974cb8cdf9bf9f6c91162fb8dec50c259ce700f2770a"}, + {file = "simplejson-3.17.6-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:82ff356ff91be0ab2293fc6d8d262451eb6ac4fd999244c4b5f863e049ba219c"}, + {file = "simplejson-3.17.6-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:0de783e9c2b87bdd75b57efa2b6260c24b94605b5c9843517577d40ee0c3cc8a"}, + {file = "simplejson-3.17.6-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:d24a9e61df7a7787b338a58abfba975414937b609eb6b18973e25f573bc0eeeb"}, + {file = "simplejson-3.17.6-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:e8603e691580487f11306ecb066c76f1f4a8b54fb3bdb23fa40643a059509366"}, + {file = "simplejson-3.17.6-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:9b01e7b00654115965a206e3015f0166674ec1e575198a62a977355597c0bef5"}, + {file = "simplejson-3.17.6-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:37bc0cf0e5599f36072077e56e248f3336917ded1d33d2688624d8ed3cefd7d2"}, + {file = "simplejson-3.17.6-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:cf6e7d5fe2aeb54898df18db1baf479863eae581cce05410f61f6b4188c8ada1"}, + {file = "simplejson-3.17.6-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:bdfc54b4468ed4cd7415928cbe782f4d782722a81aeb0f81e2ddca9932632211"}, + {file = "simplejson-3.17.6-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:dd16302d39c4d6f4afde80edd0c97d4db643327d355a312762ccd9bd2ca515ed"}, + {file = "simplejson-3.17.6-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:deac4bdafa19bbb89edfb73b19f7f69a52d0b5bd3bb0c4ad404c1bbfd7b4b7fd"}, + {file = "simplejson-3.17.6-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a8bbdb166e2fb816e43ab034c865147edafe28e1b19c72433147789ac83e2dda"}, + {file = "simplejson-3.17.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a7854326920d41c3b5d468154318fe6ba4390cb2410480976787c640707e0180"}, + {file = "simplejson-3.17.6-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:04e31fa6ac8e326480703fb6ded1488bfa6f1d3f760d32e29dbf66d0838982ce"}, + {file = "simplejson-3.17.6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f63600ec06982cdf480899026f4fda622776f5fabed9a869fdb32d72bc17e99a"}, + {file = "simplejson-3.17.6-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e03c3b8cc7883a54c3f34a6a135c4a17bc9088a33f36796acdb47162791b02f6"}, + {file = "simplejson-3.17.6-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:a2d30d6c1652140181dc6861f564449ad71a45e4f165a6868c27d36745b65d40"}, + {file = "simplejson-3.17.6-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a1aa6e4cae8e3b8d5321be4f51c5ce77188faf7baa9fe1e78611f93a8eed2882"}, + {file = "simplejson-3.17.6-cp310-cp310-win32.whl", hash = "sha256:97202f939c3ff341fc3fa84d15db86156b1edc669424ba20b0a1fcd4a796a045"}, + {file = "simplejson-3.17.6-cp310-cp310-win_amd64.whl", hash = "sha256:80d3bc9944be1d73e5b1726c3bbfd2628d3d7fe2880711b1eb90b617b9b8ac70"}, + {file = "simplejson-3.17.6-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:9fa621b3c0c05d965882c920347b6593751b7ab20d8fa81e426f1735ca1a9fc7"}, + {file = "simplejson-3.17.6-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dd2fb11922f58df8528adfca123f6a84748ad17d066007e7ac977720063556bd"}, + {file = "simplejson-3.17.6-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:724c1fe135aa437d5126138d977004d165a3b5e2ee98fc4eb3e7c0ef645e7e27"}, + {file = "simplejson-3.17.6-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:4ff4ac6ff3aa8f814ac0f50bf218a2e1a434a17aafad4f0400a57a8cc62ef17f"}, + {file = "simplejson-3.17.6-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:67093a526e42981fdd954868062e56c9b67fdd7e712616cc3265ad0c210ecb51"}, + {file = "simplejson-3.17.6-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:5d6b4af7ad7e4ac515bc6e602e7b79e2204e25dbd10ab3aa2beef3c5a9cad2c7"}, + {file = "simplejson-3.17.6-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:1c9b1ed7ed282b36571638297525f8ef80f34b3e2d600a56f962c6044f24200d"}, + {file = "simplejson-3.17.6-cp36-cp36m-win32.whl", hash = "sha256:632ecbbd2228575e6860c9e49ea3cc5423764d5aa70b92acc4e74096fb434044"}, + {file = "simplejson-3.17.6-cp36-cp36m-win_amd64.whl", hash = "sha256:4c09868ddb86bf79b1feb4e3e7e4a35cd6e61ddb3452b54e20cf296313622566"}, + {file = "simplejson-3.17.6-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:4b6bd8144f15a491c662f06814bd8eaa54b17f26095bb775411f39bacaf66837"}, + {file = "simplejson-3.17.6-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5decdc78849617917c206b01e9fc1d694fd58caa961be816cb37d3150d613d9a"}, + {file = "simplejson-3.17.6-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:521877c7bd060470806eb6335926e27453d740ac1958eaf0d8c00911bc5e1802"}, + {file = "simplejson-3.17.6-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:65b998193bd7b0c7ecdfffbc825d808eac66279313cb67d8892bb259c9d91494"}, + {file = "simplejson-3.17.6-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:ac786f6cb7aa10d44e9641c7a7d16d7f6e095b138795cd43503769d4154e0dc2"}, + {file = "simplejson-3.17.6-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:3ff5b3464e1ce86a8de8c88e61d4836927d5595c2162cab22e96ff551b916e81"}, + {file = "simplejson-3.17.6-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:69bd56b1d257a91e763256d63606937ae4eb890b18a789b66951c00062afec33"}, + {file = "simplejson-3.17.6-cp37-cp37m-win32.whl", hash = "sha256:b81076552d34c27e5149a40187a8f7e2abb2d3185576a317aaf14aeeedad862a"}, + {file = "simplejson-3.17.6-cp37-cp37m-win_amd64.whl", hash = "sha256:07ecaafc1b1501f275bf5acdee34a4ad33c7c24ede287183ea77a02dc071e0c0"}, + {file = "simplejson-3.17.6-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:068670af975247acbb9fc3d5393293368cda17026db467bf7a51548ee8f17ee1"}, + {file = "simplejson-3.17.6-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:4d1c135af0c72cb28dd259cf7ba218338f4dc027061262e46fe058b4e6a4c6a3"}, + {file = "simplejson-3.17.6-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:23fe704da910ff45e72543cbba152821685a889cf00fc58d5c8ee96a9bad5f94"}, + {file = "simplejson-3.17.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f444762fed1bc1fd75187ef14a20ed900c1fbb245d45be9e834b822a0223bc81"}, + {file = "simplejson-3.17.6-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:681eb4d37c9a9a6eb9b3245a5e89d7f7b2b9895590bb08a20aa598c1eb0a1d9d"}, + {file = "simplejson-3.17.6-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:8e8607d8f6b4f9d46fee11447e334d6ab50e993dd4dbfb22f674616ce20907ab"}, + {file = "simplejson-3.17.6-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:b10556817f09d46d420edd982dd0653940b90151d0576f09143a8e773459f6fe"}, + {file = "simplejson-3.17.6-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:e1ec8a9ee0987d4524ffd6299e778c16cc35fef6d1a2764e609f90962f0b293a"}, + {file = "simplejson-3.17.6-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:0b4126cac7d69ac06ff22efd3e0b3328a4a70624fcd6bca4fc1b4e6d9e2e12bf"}, + {file = "simplejson-3.17.6-cp38-cp38-win32.whl", hash = "sha256:35a49ebef25f1ebdef54262e54ae80904d8692367a9f208cdfbc38dbf649e00a"}, + {file = "simplejson-3.17.6-cp38-cp38-win_amd64.whl", hash = "sha256:743cd768affaa508a21499f4858c5b824ffa2e1394ed94eb85caf47ac0732198"}, + {file = "simplejson-3.17.6-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:fb62d517a516128bacf08cb6a86ecd39fb06d08e7c4980251f5d5601d29989ba"}, + {file = "simplejson-3.17.6-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:12133863178a8080a3dccbf5cb2edfab0001bc41e5d6d2446af2a1131105adfe"}, + {file = "simplejson-3.17.6-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:5540fba2d437edaf4aa4fbb80f43f42a8334206ad1ad3b27aef577fd989f20d9"}, + {file = "simplejson-3.17.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d74ee72b5071818a1a5dab47338e87f08a738cb938a3b0653b9e4d959ddd1fd9"}, + {file = "simplejson-3.17.6-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:28221620f4dcabdeac310846629b976e599a13f59abb21616356a85231ebd6ad"}, + {file = "simplejson-3.17.6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:b09bc62e5193e31d7f9876220fb429ec13a6a181a24d897b9edfbbdbcd678851"}, + {file = "simplejson-3.17.6-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:7255a37ff50593c9b2f1afa8fafd6ef5763213c1ed5a9e2c6f5b9cc925ab979f"}, + {file = "simplejson-3.17.6-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:401d40969cee3df7bda211e57b903a534561b77a7ade0dd622a8d1a31eaa8ba7"}, + {file = "simplejson-3.17.6-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a649d0f66029c7eb67042b15374bd93a26aae202591d9afd71e111dd0006b198"}, + {file = "simplejson-3.17.6-cp39-cp39-win32.whl", hash = "sha256:522fad7be85de57430d6d287c4b635813932946ebf41b913fe7e880d154ade2e"}, + {file = "simplejson-3.17.6-cp39-cp39-win_amd64.whl", hash = "sha256:3fe87570168b2ae018391e2b43fbf66e8593a86feccb4b0500d134c998983ccc"}, + {file = "simplejson-3.17.6.tar.gz", hash = "sha256:cf98038d2abf63a1ada5730e91e84c642ba6c225b0198c3684151b1f80c5f8a6"}, +] +six = [ + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, +] +spiffworkflow-proxy = [] +urllib3 = [ + {file = "urllib3-1.26.12-py2.py3-none-any.whl", hash = "sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997"}, + {file = "urllib3-1.26.12.tar.gz", hash = "sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e"}, +] +Werkzeug = [ + {file = "Werkzeug-2.2.2-py3-none-any.whl", hash = "sha256:f979ab81f58d7318e064e99c4506445d60135ac5cd2e177a2de0089bfd4c9bd5"}, + {file = "Werkzeug-2.2.2.tar.gz", hash = "sha256:7ea2d48322cc7c0f8b3a215ed73eabd7b5d75d0b50e31ab006286ccff9e00b8f"}, +] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..9a6f51f8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,24 @@ +[tool.poetry] +name = "connector-proxy-demo" +version = "0.1.0" +description = "An example showing how to use the Spiffworkflow-proxy's Flask Blueprint to make services available to Service Tasks." +authors = ["Dan "] +license = "LGPL" +readme = "README.md" +packages = [{include = "connector_proxy_demo", from = "src"}] + +[tool.poetry.dependencies] +python = "^3.10" +Flask = "^2.2.2" +spiffworkflow-proxy = {git = "https://github.com/sartography/spiffworkflow-proxy"} +connector-aws = { git = "https://github.com/sartography/connector-aws.git"} + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[tool.pytest.ini_options] +pythonpath = [ + ".", "src", +] \ No newline at end of file From 128993d255a3ef047a27f9aaf7008d6bd2b9c2be Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 18 Nov 2022 13:57:40 -0500 Subject: [PATCH 21/84] moved group list tiles to component and use on group show page w/ burnettk --- .../src/components/ProcessGroupListTiles.tsx | 96 +++++++++++++++++++ spiffworkflow-frontend/src/index.css | 16 ++-- .../src/routes/ProcessGroupList.tsx | 68 +------------ .../src/routes/ProcessGroupShow.tsx | 16 ++-- 4 files changed, 114 insertions(+), 82 deletions(-) create mode 100644 spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx diff --git a/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx b/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx new file mode 100644 index 00000000..e6916e95 --- /dev/null +++ b/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx @@ -0,0 +1,96 @@ +import { ReactElement, useEffect, useState } from 'react'; +import { useNavigate, useSearchParams } from 'react-router-dom'; +import { + ArrowRight, + // @ts-ignore +} from '@carbon/icons-react'; +import { + ClickableTile, + // @ts-ignore +} from '@carbon/react'; +import HttpService from '../services/HttpService'; +import { ProcessGroup } from '../interfaces'; +import { modifyProcessModelPath, truncateString } from '../helpers'; + +type OwnProps = { + processGroup?: ProcessGroup; + headerElement?: ReactElement; +}; + +export default function ProcessGroupListTiles({ + processGroup, + headerElement, +}: OwnProps) { + const [searchParams] = useSearchParams(); + + const [processGroups, setProcessGroups] = useState( + null + ); + + useEffect(() => { + const setProcessGroupsFromResult = (result: any) => { + setProcessGroups(result.results); + }; + let queryParams = '?per_page=1000'; + if (processGroup) { + queryParams = `${queryParams}&process_group_identifier=${processGroup.id}`; + } + HttpService.makeCallToBackend({ + path: `/process-groups${queryParams}`, + successCallback: setProcessGroupsFromResult, + }); + }, [searchParams]); + + const processGroupDirectChildrenCount = (pg: ProcessGroup) => { + return (pg.process_models || []).length + (pg.process_groups || []).length; + }; + + const processGroupsDisplayArea = () => { + let displayText = null; + if (processGroups && processGroups.length > 0) { + displayText = (processGroups || []).map((row: ProcessGroup) => { + return ( + +
+ +
+ {row.display_name} +
+

+ {truncateString(row.description || '', 25)} +

+

+ Total Sub Items: {processGroupDirectChildrenCount(row)} +

+
+
+ ); + }); + } else { + displayText =

No Groups To Display

; + } + return displayText; + }; + + const processGroupArea = () => { + if (processGroups) { + if (!processGroup || processGroups.length > 0) { + return ( + <> + {headerElement} + {processGroupsDisplayArea()} + + ); + } + } + }; + + if (processGroups) { + return <>{processGroupArea()}; + } + return null; +} diff --git a/spiffworkflow-frontend/src/index.css b/spiffworkflow-frontend/src/index.css index a89f6725..3b803517 100644 --- a/spiffworkflow-frontend/src/index.css +++ b/spiffworkflow-frontend/src/index.css @@ -5,21 +5,21 @@ color: white; } -h1{ - height: 36px; - font-family: 'IBM Plex Sans'; - font-style: normal; +h1 { font-weight: 400; font-size: 28px; line-height: 36px; color: #161616; - flex: none; - order: 0; - align-self: stretch; - flex-grow: 0; margin-bottom: 1em } +h2 { + font-weight: 400; + font-size: 20px; + line-height: 28px; + color: #161616; +} + .span-tag { color: black; } diff --git a/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx b/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx index a4813020..ba4513bb 100644 --- a/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx @@ -1,36 +1,23 @@ import { useEffect, useState } from 'react'; import { useNavigate, useSearchParams } from 'react-router-dom'; -import { - ArrowRight, - // @ts-ignore -} from '@carbon/icons-react'; import { Button, - ClickableTile, // @ts-ignore } from '@carbon/react'; import { Can } from '@casl/react'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import HttpService from '../services/HttpService'; import { modifyProcessModelPath, truncateString } from '../helpers'; -import { - CarbonComboBoxSelection, - PermissionsToCheck, - ProcessGroup, -} from '../interfaces'; +import { CarbonComboBoxSelection, PermissionsToCheck } from '../interfaces'; import { useUriListForPermissions } from '../hooks/UriListForPermissions'; import { usePermissionFetcher } from '../hooks/PermissionService'; import ProcessModelSearch from '../components/ProcessModelSearch'; +import ProcessGroupListTiles from '../components/ProcessGroupListTiles'; -// Example process group json -// {'process_group_id': 'sure', 'display_name': 'Test Workflows', 'id': 'test_process_group'} export default function ProcessGroupList() { const [searchParams] = useSearchParams(); const navigate = useNavigate(); - const [processGroups, setProcessGroups] = useState( - null - ); const [processModelAvailableItems, setProcessModelAvailableItems] = useState( [] ); @@ -42,9 +29,6 @@ export default function ProcessGroupList() { const { ability } = usePermissionFetcher(permissionRequestData); useEffect(() => { - const setProcessGroupsFromResult = (result: any) => { - setProcessGroups(result.results); - }; const processResultForProcessModels = (result: any) => { const selectionArray = result.results.map((item: any) => { const label = `${item.id}`; @@ -53,12 +37,6 @@ export default function ProcessGroupList() { }); setProcessModelAvailableItems(selectionArray); }; - - // for browsing - HttpService.makeCallToBackend({ - path: `/process-groups?per_page=1000`, - successCallback: setProcessGroupsFromResult, - }); // for search box HttpService.makeCallToBackend({ path: `/process-models?per_page=1000`, @@ -66,44 +44,6 @@ export default function ProcessGroupList() { }); }, [searchParams]); - const processGroupDirectChildrenCount = (processGroup: ProcessGroup) => { - return ( - (processGroup.process_models || []).length + - (processGroup.process_groups || []).length - ); - }; - - const processGroupsDisplayArea = () => { - let displayText = null; - if (processGroups && processGroups.length > 0) { - displayText = (processGroups || []).map((row: ProcessGroup) => { - return ( - -
- -
- {row.display_name} -
-

- {truncateString(row.description || '', 25)} -

-

- Total Sub Items: {processGroupDirectChildrenCount(row)} -

-
-
- ); - }); - } else { - displayText =

No Groups To Display

; - } - return displayText; - }; - const processModelSearchArea = () => { const processModelSearchOnChange = (selection: CarbonComboBoxSelection) => { const processModel = selection.selectedItem; @@ -120,7 +60,7 @@ export default function ProcessGroupList() { ); }; - if (processGroups) { + if (processModelAvailableItems) { return ( <> @@ -134,7 +74,7 @@ export default function ProcessGroupList() {
{processModelSearchArea()}
- {processGroupsDisplayArea()} + ); } diff --git a/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx b/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx index 7bcda61b..31f5297e 100644 --- a/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx @@ -19,6 +19,7 @@ import { } from '../interfaces'; import { useUriListForPermissions } from '../hooks/UriListForPermissions'; import { usePermissionFetcher } from '../hooks/PermissionService'; +import ProcessGroupListTiles from '../components/ProcessGroupListTiles'; export default function ProcessGroupShow() { const params = useParams(); @@ -95,7 +96,7 @@ export default function ProcessGroupShow() { }); return (
-

Process Models

+

Process Models

@@ -198,15 +199,10 @@ export default function ProcessGroupShow() { )}

- {/* eslint-disable-next-line sonarjs/no-gratuitous-expressions */} - {groupPagination && groupPagination.total > 0 && ( - - )} + Process Groups} + /> ); From afc89fc620d0f9f8b01eababd463cd62ca46bd01 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Fri, 18 Nov 2022 14:17:31 -0500 Subject: [PATCH 22/84] No need for script. --- spiffworkflow-backend/bin/update_all_json.py | 22 -------------------- 1 file changed, 22 deletions(-) delete mode 100644 spiffworkflow-backend/bin/update_all_json.py diff --git a/spiffworkflow-backend/bin/update_all_json.py b/spiffworkflow-backend/bin/update_all_json.py deleted file mode 100644 index d8000c45..00000000 --- a/spiffworkflow-backend/bin/update_all_json.py +++ /dev/null @@ -1,22 +0,0 @@ -"""Updates all JSON files, based on the current state of BPMN_SPEC_ABSOLUTE_DIR.""" -from spiffworkflow_backend import get_hacked_up_app_for_script -from spiffworkflow_backend.services.process_model_service import ProcessModelService - - -def main() -> None: - """Main.""" - app = get_hacked_up_app_for_script() - with app.app_context(): - - groups = ProcessModelService().get_process_groups() - for group in groups: - for process_model in group.process_models: - update_items = { - "process_group_id": "", - "id": f"{group.id}/{process_model.id}", - } - ProcessModelService().update_process_model(process_model, update_items) - - -if __name__ == "__main__": - main() From d3c1c0d31a48102876554a76a991874329f38a06 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Fri, 18 Nov 2022 14:19:29 -0500 Subject: [PATCH 23/84] Don't save `id` in json files Added helper method `write_json_file` --- .../services/process_model_service.py | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py index 3a5421f8..ccdf56b1 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py @@ -48,6 +48,11 @@ class ProcessModelService(FileSystemService): return True return False + @staticmethod + def write_json_file(file_path, json_data, indent=4, sort_keys=True): + with open(file_path, "w") as h_open: + json.dump(json_data, h_open, indent=indent, sort_keys=sort_keys) + @staticmethod def get_batch( items: list[T], @@ -84,10 +89,8 @@ class ProcessModelService(FileSystemService): # this allows us to move models around on the filesystem # the id is determined by its location on the filesystem delattr(process_model, 'id') - with open(json_path, "w") as wf_json: - json.dump( - self.PROCESS_MODEL_SCHEMA.dump(process_model), wf_json, indent=4, sort_keys=True - ) + json_data = self.PROCESS_MODEL_SCHEMA.dump(process_model) + self.write_json_file(json_path, json_data) process_model.id = process_model_id def process_model_delete(self, process_model_id: str) -> None: @@ -216,13 +219,11 @@ class ProcessModelService(FileSystemService): cat_path = self.process_group_path(process_group.id) os.makedirs(cat_path, exist_ok=True) json_path = os.path.join(cat_path, self.PROCESS_GROUP_JSON_FILE) - with open(json_path, "w") as cat_json: - json.dump( - process_group.serialized, - cat_json, - indent=4, - sort_keys=True, - ) + serialized_process_group = process_group.serialized + # we don't store `id` in the json files + # this allows us to move groups around on the filesystem + del serialized_process_group['id'] + self.write_json_file(json_path, serialized_process_group) return process_group def __get_all_nested_models(self, group_path: str) -> list: @@ -293,6 +294,9 @@ class ProcessModelService(FileSystemService): if os.path.exists(cat_path): with open(cat_path) as cat_json: data = json.load(cat_json) + # we don't store `id` in the json files, so we add it back in here + relative_path = os.path.relpath(dir_path, FileSystemService.root_path()) + data['id'] = relative_path process_group = ProcessGroup(**data) if process_group is None: raise ApiError( @@ -302,13 +306,13 @@ class ProcessModelService(FileSystemService): else: process_group_id = dir_path.replace(FileSystemService.root_path(), "") process_group = ProcessGroup( - id=process_group_id, display_name=process_group_id, display_order=10000, admin=False, ) - with open(cat_path, "w") as wf_json: - json.dump(self.GROUP_SCHEMA.dump(process_group), wf_json, indent=4) + self.write_json_file(cat_path, self.GROUP_SCHEMA.dump(process_group)) + # we don't store `id` in the json files, so we add it in here + process_group.id = process_group_id with os.scandir(dir_path) as nested_items: process_group.process_models = [] process_group.process_groups = [] @@ -363,14 +367,14 @@ class ProcessModelService(FileSystemService): ) process_model_info = ProcessModelInfo( - id=name, display_name=name, description="", display_order=0, is_review=False, ) - with open(json_file_path, "w") as wf_json: - json.dump(self.PROCESS_MODEL_SCHEMA.dump(process_model_info), wf_json, indent=4) + self.write_json_file(json_file_path, self.PROCESS_MODEL_SCHEMA.dump(process_model_info)) + # we don't store `id` in the json files, so we add it in here + process_model_info.id = name if process_group: process_model_info.process_group = process_group.id return process_model_info From 513da570e27e481cd4e392b6409fb475759bf3bc Mon Sep 17 00:00:00 2001 From: Jon Herron Date: Fri, 18 Nov 2022 14:29:04 -0500 Subject: [PATCH 24/84] Accept report_identifier --- .../models/process_instance_report.py | 1 + .../routes/process_api_blueprint.py | 2 +- .../process_instance_report_service.py | 58 +++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_report.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_report.py index 1425d69f..ea85a23e 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_report.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_report.py @@ -79,6 +79,7 @@ class ProcessInstanceReportModel(SpiffworkflowBaseDBModel): identifier=identifier, created_by_id=user.id ).first() + # TODO replace with system report that is loaded on launch (or similar) if process_instance_report is None: report_metadata = { "columns": [ diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index deb34707..dd4037e7 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -739,7 +739,7 @@ def process_instance_list( report_identifier: Optional[str] = None ) -> flask.wrappers.Response: """Process_instance_list.""" - process_instance_report = ProcessInstanceReportModel.default_report(g.user) + process_instance_report = ProcessInstanceReportService.report_with_identifier(g.user, report_identifier) if user_filter: report_filter = ProcessInstanceReportFilter( diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py index e90120d8..541bdee2 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py @@ -5,6 +5,7 @@ from typing import Optional from spiffworkflow_backend.models.process_instance_report import ( ProcessInstanceReportModel, ) +from spiffworkflow_backend.models.user import UserModel @dataclass @@ -41,6 +42,63 @@ class ProcessInstanceReportFilter: class ProcessInstanceReportService: """ProcessInstanceReportService.""" + @classmethod + def report_with_identifier( + cls, + user: UserModel, + report_identifier: Optional[str] = None + ) -> ProcessInstanceReportModel: + if report_identifier is None: + return ProcessInstanceReportModel.default_report(user) + + # TODO replace with system reports that are loaded on launch (or similar) + temp_system_metdata_map = { + "system_report_instances_initiated_by_me": { + "columns": [ + {"Header": "id", "accessor": "id"}, + { + "Header": "process_model_identifier", + "accessor": "process_model_identifier", + }, + {"Header": "start_in_seconds", "accessor": "start_in_seconds"}, + {"Header": "end_in_seconds", "accessor": "end_in_seconds"}, + {"Header": "status", "accessor": "status"}, + ], + }, + "system_report_instances_with_tasks_completed_by_me": { + "columns": [ + {"Header": "start_in_seconds", "accessor": "start_in_seconds"}, + {"Header": "end_in_seconds", "accessor": "end_in_seconds"}, + {"Header": "status", "accessor": "status"}, + {"Header": "id", "accessor": "id"}, + { + "Header": "process_model_identifier", + "accessor": "process_model_identifier", + }, + ], + }, + "system_report_instances_with_tasks_completed_by_my_groups": { + "columns": [ + { + "Header": "process_model_identifier", + "accessor": "process_model_identifier", + }, + {"Header": "start_in_seconds", "accessor": "start_in_seconds"}, + {"Header": "end_in_seconds", "accessor": "end_in_seconds"}, + {"Header": "status", "accessor": "status"}, + {"Header": "id", "accessor": "id"}, + ], + }, + } + + process_instance_report = cls( + identifier=identifier, + created_by_id=user.id, + report_metadata=temp_system_metadata_map[report_identifier], + ) + + return process_instance_report + @classmethod def filter_by_to_dict( cls, process_instance_report: ProcessInstanceReportModel From 9944eebbae1d148cbd227db735e45c5cefd8ab07 Mon Sep 17 00:00:00 2001 From: Jon Herron Date: Fri, 18 Nov 2022 14:34:52 -0500 Subject: [PATCH 25/84] Get ./bin/pyl to pass --- .../routes/process_api_blueprint.py | 6 ++++-- .../services/process_instance_report_service.py | 11 +++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index dd4037e7..307daa8c 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -736,10 +736,12 @@ def process_instance_list( end_to: Optional[int] = None, process_status: Optional[str] = None, user_filter: Optional[bool] = False, - report_identifier: Optional[str] = None + report_identifier: Optional[str] = None, ) -> flask.wrappers.Response: """Process_instance_list.""" - process_instance_report = ProcessInstanceReportService.report_with_identifier(g.user, report_identifier) + process_instance_report = ProcessInstanceReportService.report_with_identifier( + g.user, report_identifier + ) if user_filter: report_filter = ProcessInstanceReportFilter( diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py index 541bdee2..df302934 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py @@ -44,15 +44,14 @@ class ProcessInstanceReportService: @classmethod def report_with_identifier( - cls, - user: UserModel, - report_identifier: Optional[str] = None + cls, user: UserModel, report_identifier: Optional[str] = None ) -> ProcessInstanceReportModel: + """Report_with_filter.""" if report_identifier is None: return ProcessInstanceReportModel.default_report(user) # TODO replace with system reports that are loaded on launch (or similar) - temp_system_metdata_map = { + temp_system_metadata_map = { "system_report_instances_initiated_by_me": { "columns": [ {"Header": "id", "accessor": "id"}, @@ -91,8 +90,8 @@ class ProcessInstanceReportService: }, } - process_instance_report = cls( - identifier=identifier, + process_instance_report = ProcessInstanceReportModel( + identifier=report_identifier, created_by_id=user.id, report_metadata=temp_system_metadata_map[report_identifier], ) From a795514570ebd77bd7fee6bd2fd743e6119473ec Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 18 Nov 2022 14:36:54 -0500 Subject: [PATCH 26/84] moved model delete button to show page as an icon w/ burnettk --- .../src/components/ProcessModelForm.tsx | 18 -------- .../src/routes/ProcessModelShow.tsx | 41 +++++++++++++++++-- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ProcessModelForm.tsx b/spiffworkflow-frontend/src/components/ProcessModelForm.tsx index 15e4c270..d579d599 100644 --- a/spiffworkflow-frontend/src/components/ProcessModelForm.tsx +++ b/spiffworkflow-frontend/src/components/ProcessModelForm.tsx @@ -52,14 +52,6 @@ export default function ProcessModelForm({ return identifierToCheck.match(/^[a-z0-9][0-9a-z-]+[a-z0-9]$/); }; - const deleteProcessModel = () => { - HttpService.makeCallToBackend({ - path: `/process-models/${modifiedProcessModelPath}`, - successCallback: navigateToProcessModels, - httpMethod: 'DELETE', - }); - }; - const handleFormSubmission = (event: any) => { event.preventDefault(); let hasErrors = false; @@ -172,16 +164,6 @@ export default function ProcessModelForm({ Submit , ]; - if (mode === 'edit') { - buttons.push( - - ); - } return {buttons}; }; return ( diff --git a/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx b/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx index 549d964e..957a37e7 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx @@ -31,7 +31,10 @@ import { Can } from '@casl/react'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import HttpService from '../services/HttpService'; import ErrorContext from '../contexts/ErrorContext'; -import { modifyProcessModelPath } from '../helpers'; +import { + getGroupFromModifiedModelId, + modifyProcessModelPath, +} from '../helpers'; import { PermissionsToCheck, ProcessFile, @@ -106,7 +109,7 @@ export default function ProcessModelShow() { const { targetUris } = useUriListForPermissions(); const permissionRequestData: PermissionsToCheck = { - [targetUris.processModelShowPath]: ['PUT'], + [targetUris.processModelShowPath]: ['PUT', 'DELETE'], [targetUris.processInstanceListPath]: ['GET'], [targetUris.processInstanceActionPath]: ['POST'], [targetUris.processModelFileCreatePath]: ['POST', 'GET', 'DELETE'], @@ -251,6 +254,22 @@ export default function ProcessModelShow() { return null; }; + const navigateToProcessModels = (_result: any) => { + navigate( + `/admin/process-groups/${getGroupFromModifiedModelId( + modifiedProcessModelId + )}` + ); + }; + + const deleteProcessModel = () => { + HttpService.makeCallToBackend({ + path: `/process-models/${modifiedProcessModelId}`, + successCallback: navigateToProcessModels, + httpMethod: 'DELETE', + }); + }; + const navigateToFileEdit = (processModelFile: ProcessFile) => { const url = profileModelFileEditUrl(processModelFile); if (url) { @@ -529,7 +548,23 @@ export default function ProcessModelShow() { ], ]} /> -

Process Model: {processModel.display_name}

+ +

+ Process Model: {processModel.display_name} +

+ + + + +

{processModel.description}

Date: Fri, 18 Nov 2022 14:45:33 -0500 Subject: [PATCH 27/84] Tweak temp report metadata --- .../services/process_instance_report_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py index df302934..a521c1a3 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_report_service.py @@ -54,12 +54,12 @@ class ProcessInstanceReportService: temp_system_metadata_map = { "system_report_instances_initiated_by_me": { "columns": [ - {"Header": "id", "accessor": "id"}, { "Header": "process_model_identifier", "accessor": "process_model_identifier", }, {"Header": "start_in_seconds", "accessor": "start_in_seconds"}, + {"Header": "id", "accessor": "id"}, {"Header": "end_in_seconds", "accessor": "end_in_seconds"}, {"Header": "status", "accessor": "status"}, ], From 2464df4b8146c9f24f27de427bb1e0af4dd5b6ac Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 18 Nov 2022 15:01:41 -0500 Subject: [PATCH 28/84] load diagram page even if processes are not set w/ burnettk cullerton --- spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx index af691153..537406ee 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx @@ -838,9 +838,7 @@ export default function ProcessModelEditDiagram() { // if a file name is not given then this is a new model and the ReactDiagramEditor component will handle it if ( - (bpmnXmlForDiagramRendering || !params.file_name) && - processModel && - processes.length > 0 + (bpmnXmlForDiagramRendering || !params.file_name) && processModel ) { const processModelFileName = processModelFile ? processModelFile.name : ''; return ( From e2cfe5cb8af0a0ff986078932dd5d60cff8615b6 Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 18 Nov 2022 15:06:02 -0500 Subject: [PATCH 29/84] ran some pyl w/ burnettk cullerton --- .../routes/process_api_blueprint.py | 9 +++---- .../services/process_model_service.py | 27 +++++++++++-------- .../unit/test_process_model_service.py | 4 ++- .../src/routes/ProcessModelEditDiagram.tsx | 4 +-- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index 0e1d26ea..6918ad35 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -1,6 +1,5 @@ """APIs for dealing with process groups, process models, and process instances.""" import json -import os import random import string import uuid @@ -253,11 +252,11 @@ def process_model_create( status_code=400, ) - unmodified_process_group_id = un_modify_modified_process_model_id(modified_process_group_id) - process_model_service = ProcessModelService() - process_group = process_model_service.get_process_group( - unmodified_process_group_id + unmodified_process_group_id = un_modify_modified_process_model_id( + modified_process_group_id ) + process_model_service = ProcessModelService() + process_group = process_model_service.get_process_group(unmodified_process_group_id) if process_group is None: raise ApiError( error_code="process_model_could_not_be_created", diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py index ccdf56b1..7f37c7cf 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py @@ -49,7 +49,8 @@ class ProcessModelService(FileSystemService): return False @staticmethod - def write_json_file(file_path, json_data, indent=4, sort_keys=True): + def write_json_file(file_path: str, json_data: dict, indent: int = 4, sort_keys: bool = True): + """Write json file.""" with open(file_path, "w") as h_open: json.dump(json_data, h_open, indent=indent, sort_keys=sort_keys) @@ -81,14 +82,18 @@ class ProcessModelService(FileSystemService): def save_process_model(self, process_model: ProcessModelInfo) -> None: """Save_process_model.""" - process_model_path = os.path.abspath(os.path.join(FileSystemService.root_path(), process_model.id)) + process_model_path = os.path.abspath( + os.path.join(FileSystemService.root_path(), process_model.id) + ) os.makedirs(process_model_path, exist_ok=True) - json_path = os.path.abspath(os.path.join(process_model_path, self.PROCESS_MODEL_JSON_FILE)) + json_path = os.path.abspath( + os.path.join(process_model_path, self.PROCESS_MODEL_JSON_FILE) + ) process_model_id = process_model.id # we don't save id in the json file # this allows us to move models around on the filesystem # the id is determined by its location on the filesystem - delattr(process_model, 'id') + delattr(process_model, "id") json_data = self.PROCESS_MODEL_SCHEMA.dump(process_model) self.write_json_file(json_path, json_data) process_model.id = process_model_id @@ -184,9 +189,7 @@ class ProcessModelService(FileSystemService): """Look for a given process_group, and return it.""" if os.path.exists(FileSystemService.root_path()): process_group_path = os.path.abspath( - os.path.join( - FileSystemService.root_path(), process_group_id - ) + os.path.join(FileSystemService.root_path(), process_group_id) ) if self.is_group(process_group_path): return self.__scan_process_group(process_group_path) @@ -222,7 +225,7 @@ class ProcessModelService(FileSystemService): serialized_process_group = process_group.serialized # we don't store `id` in the json files # this allows us to move groups around on the filesystem - del serialized_process_group['id'] + del serialized_process_group["id"] self.write_json_file(json_path, serialized_process_group) return process_group @@ -296,7 +299,7 @@ class ProcessModelService(FileSystemService): data = json.load(cat_json) # we don't store `id` in the json files, so we add it back in here relative_path = os.path.relpath(dir_path, FileSystemService.root_path()) - data['id'] = relative_path + data["id"] = relative_path process_group = ProcessGroup(**data) if process_group is None: raise ApiError( @@ -352,7 +355,7 @@ class ProcessModelService(FileSystemService): data.pop("process_group_id") # we don't save `id` in the json file, so we add it back in here. relative_path = os.path.relpath(path, FileSystemService.root_path()) - data['id'] = relative_path + data["id"] = relative_path process_model_info = ProcessModelInfo(**data) if process_model_info is None: raise ApiError( @@ -372,7 +375,9 @@ class ProcessModelService(FileSystemService): display_order=0, is_review=False, ) - self.write_json_file(json_file_path, self.PROCESS_MODEL_SCHEMA.dump(process_model_info)) + self.write_json_file( + json_file_path, self.PROCESS_MODEL_SCHEMA.dump(process_model_info) + ) # we don't store `id` in the json files, so we add it in here process_model_info.id = name if process_group: diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_service.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_service.py index 42733775..7127eb41 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_service.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_service.py @@ -32,7 +32,9 @@ class TestProcessModelService(BaseTest): primary_process_id = process_model.primary_process_id assert primary_process_id == "Process_HelloWorld" - ProcessModelService().update_process_model(process_model, {"display_name": "new_name"}) + ProcessModelService().update_process_model( + process_model, {"display_name": "new_name"} + ) assert process_model.display_name == "new_name" assert process_model.primary_process_id == primary_process_id diff --git a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx index 537406ee..1a954cf2 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx @@ -837,9 +837,7 @@ export default function ProcessModelEditDiagram() { }; // if a file name is not given then this is a new model and the ReactDiagramEditor component will handle it - if ( - (bpmnXmlForDiagramRendering || !params.file_name) && processModel - ) { + if ((bpmnXmlForDiagramRendering || !params.file_name) && processModel) { const processModelFileName = processModelFile ? processModelFile.name : ''; return ( <> From ea61d7819df4f7cd72580f15c78cc99a5dac3aad Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 18 Nov 2022 15:25:04 -0500 Subject: [PATCH 30/84] fixed eslint issues w/ burnettk --- .../src/components/ProcessGroupListTiles.tsx | 21 ++++---- .../src/components/ProcessModelForm.tsx | 15 +----- .../src/routes/ProcessGroupList.tsx | 2 +- .../src/routes/ProcessGroupShow.tsx | 49 +------------------ 4 files changed, 13 insertions(+), 74 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx b/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx index e6916e95..839f2149 100644 --- a/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx +++ b/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx @@ -1,5 +1,5 @@ import { ReactElement, useEffect, useState } from 'react'; -import { useNavigate, useSearchParams } from 'react-router-dom'; +import { useSearchParams } from 'react-router-dom'; import { ArrowRight, // @ts-ignore @@ -39,7 +39,7 @@ export default function ProcessGroupListTiles({ path: `/process-groups${queryParams}`, successCallback: setProcessGroupsFromResult, }); - }, [searchParams]); + }, [searchParams, processGroup]); const processGroupDirectChildrenCount = (pg: ProcessGroup) => { return (pg.process_models || []).length + (pg.process_groups || []).length; @@ -77,16 +77,15 @@ export default function ProcessGroupListTiles({ }; const processGroupArea = () => { - if (processGroups) { - if (!processGroup || processGroups.length > 0) { - return ( - <> - {headerElement} - {processGroupsDisplayArea()} - - ); - } + if (processGroups && (!processGroup || processGroups.length > 0)) { + return ( + <> + {headerElement} + {processGroupsDisplayArea()} + + ); } + return null; }; if (processGroups) { diff --git a/spiffworkflow-frontend/src/components/ProcessModelForm.tsx b/spiffworkflow-frontend/src/components/ProcessModelForm.tsx index d579d599..10f4ffd3 100644 --- a/spiffworkflow-frontend/src/components/ProcessModelForm.tsx +++ b/spiffworkflow-frontend/src/components/ProcessModelForm.tsx @@ -2,14 +2,9 @@ import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; // @ts-ignore import { Button, ButtonSet, Form, Stack, TextInput } from '@carbon/react'; -import { - getGroupFromModifiedModelId, - modifyProcessModelPath, - slugifyString, -} from '../helpers'; +import { modifyProcessModelPath, slugifyString } from '../helpers'; import HttpService from '../services/HttpService'; import { ProcessModel } from '../interfaces'; -import ButtonWithConfirmation from './ButtonWithConfirmation'; type OwnProps = { mode: string; @@ -40,14 +35,6 @@ export default function ProcessModelForm({ } }; - const navigateToProcessModels = (_result: any) => { - navigate( - `/admin/process-groups/${getGroupFromModifiedModelId( - modifiedProcessModelPath - )}` - ); - }; - const hasValidIdentifier = (identifierToCheck: string) => { return identifierToCheck.match(/^[a-z0-9][0-9a-z-]+[a-z0-9]$/); }; diff --git a/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx b/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx index ba4513bb..4c448f08 100644 --- a/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessGroupList.tsx @@ -7,7 +7,7 @@ import { import { Can } from '@casl/react'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import HttpService from '../services/HttpService'; -import { modifyProcessModelPath, truncateString } from '../helpers'; +import { modifyProcessModelPath } from '../helpers'; import { CarbonComboBoxSelection, PermissionsToCheck } from '../interfaces'; import { useUriListForPermissions } from '../hooks/UriListForPermissions'; import { usePermissionFetcher } from '../hooks/PermissionService'; diff --git a/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx b/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx index 31f5297e..3d6a0ee4 100644 --- a/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessGroupShow.tsx @@ -27,11 +27,8 @@ export default function ProcessGroupShow() { const [processGroup, setProcessGroup] = useState(null); const [processModels, setProcessModels] = useState([]); - const [processGroups, setProcessGroups] = useState([]); const [modelPagination, setModelPagination] = useState(null); - const [groupPagination, setGroupPagination] = - useState(null); const { targetUris } = useUriListForPermissions(); const permissionRequestData: PermissionsToCheck = { @@ -48,10 +45,6 @@ export default function ProcessGroupShow() { setProcessModels(result.results); setModelPagination(result.pagination); }; - const setProcessGroupFromResult = (result: any) => { - setProcessGroups(result.results); - setGroupPagination(result.pagination); - }; const processResult = (result: any) => { setProcessGroup(result); const unmodifiedProcessGroupId = unModifyProcessModelPath( @@ -61,10 +54,6 @@ export default function ProcessGroupShow() { path: `/process-models?process_group_identifier=${unmodifiedProcessGroupId}&per_page=${perPage}&page=${page}`, successCallback: setProcessModelFromResult, }); - HttpService.makeCallToBackend({ - path: `/process-groups?process_group_identifier=${unmodifiedProcessGroupId}&per_page=${perPage}&page=${page}`, - successCallback: setProcessGroupFromResult, - }); }; HttpService.makeCallToBackend({ path: `/process-groups/${params.process_group_id}`, @@ -110,43 +99,7 @@ export default function ProcessGroupShow() { ); }; - const buildGroupTable = () => { - if (processGroup === null) { - return null; - } - const rows = processGroups.map((row: ProcessGroup) => { - const modifiedProcessGroupId: String = modifyProcessModelPath(row.id); - return ( -
- - - - ); - }); - return ( -
-

Process Groups

-
- - {row.id} - - {row.display_name}
- - - - - - - {rows} -
Process Group IdDisplay Name
- - ); - }; - - if (processGroup && groupPagination && modelPagination) { + if (processGroup && modelPagination) { const { page, perPage } = getPageInfoFromSearchParams(searchParams); const modifiedProcessGroupId = modifyProcessModelPath(processGroup.id); return ( From a4b88ecf8b5725e41c41446de1a62c893a48752e Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Fri, 18 Nov 2022 15:39:51 -0500 Subject: [PATCH 31/84] mypy --- .../spiffworkflow_backend/services/process_model_service.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py index ccdf56b1..7715b5ec 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py @@ -49,7 +49,7 @@ class ProcessModelService(FileSystemService): return False @staticmethod - def write_json_file(file_path, json_data, indent=4, sort_keys=True): + def write_json_file(file_path: str, json_data: dict, indent: int = 4, sort_keys: bool = True) -> None: with open(file_path, "w") as h_open: json.dump(json_data, h_open, indent=indent, sort_keys=sort_keys) @@ -306,6 +306,7 @@ class ProcessModelService(FileSystemService): else: process_group_id = dir_path.replace(FileSystemService.root_path(), "") process_group = ProcessGroup( + id='', display_name=process_group_id, display_order=10000, admin=False, @@ -367,6 +368,7 @@ class ProcessModelService(FileSystemService): ) process_model_info = ProcessModelInfo( + id='', display_name=name, description="", display_order=0, From 576d60e41d9eaa23275142db29bd179caee2ce23 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Fri, 18 Nov 2022 15:50:20 -0500 Subject: [PATCH 32/84] precommit --- .../bin/import_tickets_for_command_line.py | 1 - .../bin/start_blocking_appscheduler.py | 1 - spiffworkflow-backend/conftest.py | 3 +- spiffworkflow-backend/migrations/env.py | 25 +- .../migrations/versions/b7790c9c8174_.py | 813 ++++++++++++------ .../src/spiffworkflow_backend/__init__.py | 5 +- .../src/spiffworkflow_backend/api.yml | 5 +- .../spiffworkflow_backend/config/__init__.py | 3 +- .../models/active_task.py | 7 +- .../models/active_task_user.py | 3 +- .../src/spiffworkflow_backend/models/file.py | 1 - .../models/message_correlation.py | 5 +- .../message_correlation_message_instance.py | 3 +- .../models/message_correlation_property.py | 3 +- .../models/message_instance.py | 5 +- .../message_triggerable_process_model.py | 3 +- .../models/permission_assignment.py | 5 +- .../spiffworkflow_backend/models/principal.py | 5 +- .../models/process_group.py | 1 - .../models/process_instance.py | 9 +- .../models/process_instance_report.py | 7 +- .../models/process_model.py | 1 - .../models/secret_model.py | 3 +- .../models/spiff_step_details.py | 3 +- .../src/spiffworkflow_backend/models/user.py | 5 +- .../models/user_group_assignment.py | 5 +- .../routes/admin_blueprint/admin_blueprint.py | 3 +- .../routes/process_api_blueprint.py | 7 +- .../src/spiffworkflow_backend/routes/user.py | 3 +- .../routes/user_blueprint.py | 3 +- .../scripts/get_current_user.py | 1 - .../scripts/get_frontend_url.py | 1 - .../scripts/get_localtime.py | 1 - .../spiffworkflow_backend/scripts/script.py | 1 - .../services/acceptance_test_fixtures.py | 3 +- .../services/authentication_service.py | 3 +- .../services/authorization_service.py | 5 +- .../services/background_processing_service.py | 1 - .../services/data_setup_service.py | 1 - .../services/error_handling_service.py | 1 - .../services/file_system_service.py | 1 - .../services/git_service.py | 1 - .../services/group_service.py | 1 - .../services/logging_service.py | 1 - .../services/message_service.py | 7 +- .../services/process_instance_processor.py | 1 - .../services/process_instance_service.py | 3 +- .../services/process_model_service.py | 9 +- .../services/script_unit_test_runner.py | 1 - .../services/secret_service.py | 1 - .../services/service_task_service.py | 1 - .../services/spec_file_service.py | 1 - .../services/user_service.py | 1 - .../tests/data/simple_form/simple_form.json | 10 +- .../data/simple_form/simple_form_ui.json | 4 +- .../helpers/base_test.py | 5 +- .../helpers/example_data.py | 1 - .../helpers/test_data.py | 3 +- .../integration/test_authentication.py | 3 +- .../integration/test_logging_service.py | 3 +- .../integration/test_nested_groups.py | 3 +- .../integration/test_process_api.py | 5 +- .../integration/test_secret_service.py | 5 +- .../scripts/test_get_group_members.py | 5 +- .../scripts/test_get_localtime.py | 5 +- .../unit/test_acceptance_test_fixtures.py | 1 - .../unit/test_authorization_service.py | 3 +- .../unit/test_dot_notation.py | 3 +- .../unit/test_environment_var_script.py | 3 +- .../unit/test_message_instance.py | 3 +- .../unit/test_message_service.py | 5 +- .../unit/test_permission_target.py | 3 +- .../unit/test_permissions.py | 5 +- .../unit/test_process_group.py | 1 - .../unit/test_process_instance_processor.py | 5 +- .../unit/test_process_instance_report.py | 3 +- .../test_process_instance_report_service.py | 3 +- .../unit/test_process_model.py | 5 +- .../unit/test_process_model_service.py | 5 +- .../unit/test_restricted_script_engine.py | 5 +- .../unit/test_script_unit_test_runner.py | 5 +- .../unit/test_service_task_delegate.py | 3 +- .../unit/test_spec_file_service.py | 5 +- .../unit/test_spiff_logging.py | 3 +- .../unit/test_various_bpmn_constructs.py | 3 +- spiffworkflow-backend/tests/test_main.py | 1 - 86 files changed, 644 insertions(+), 474 deletions(-) diff --git a/spiffworkflow-backend/bin/import_tickets_for_command_line.py b/spiffworkflow-backend/bin/import_tickets_for_command_line.py index 8b145dc4..5818d438 100644 --- a/spiffworkflow-backend/bin/import_tickets_for_command_line.py +++ b/spiffworkflow-backend/bin/import_tickets_for_command_line.py @@ -2,7 +2,6 @@ import csv from flask_bpmn.models.db import db - from spiffworkflow_backend import get_hacked_up_app_for_script from spiffworkflow_backend.models.process_instance import ProcessInstanceModel from spiffworkflow_backend.models.user import UserModel diff --git a/spiffworkflow-backend/bin/start_blocking_appscheduler.py b/spiffworkflow-backend/bin/start_blocking_appscheduler.py index 4af99e41..61b753f2 100755 --- a/spiffworkflow-backend/bin/start_blocking_appscheduler.py +++ b/spiffworkflow-backend/bin/start_blocking_appscheduler.py @@ -2,7 +2,6 @@ import time from apscheduler.schedulers.background import BlockingScheduler # type: ignore - from spiffworkflow_backend import create_app from spiffworkflow_backend import start_scheduler from spiffworkflow_backend.helpers.db_helper import try_to_connect diff --git a/spiffworkflow-backend/conftest.py b/spiffworkflow-backend/conftest.py index 4751b858..012f3c77 100644 --- a/spiffworkflow-backend/conftest.py +++ b/spiffworkflow-backend/conftest.py @@ -7,8 +7,6 @@ from flask.app import Flask from flask.testing import FlaskClient from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel -from tests.spiffworkflow_backend.helpers.base_test import BaseTest - from spiffworkflow_backend.models.active_task_user import ActiveTaskUserModel from spiffworkflow_backend.models.process_instance import ProcessInstanceModel from spiffworkflow_backend.models.user import UserModel @@ -19,6 +17,7 @@ from spiffworkflow_backend.services.process_instance_service import ( ProcessInstanceService, ) from spiffworkflow_backend.services.process_model_service import ProcessModelService +from tests.spiffworkflow_backend.helpers.base_test import BaseTest # from tests.spiffworkflow_backend.helpers.test_data import load_test_spec diff --git a/spiffworkflow-backend/migrations/env.py b/spiffworkflow-backend/migrations/env.py index 630e381a..4bd0316c 100644 --- a/spiffworkflow-backend/migrations/env.py +++ b/spiffworkflow-backend/migrations/env.py @@ -1,9 +1,8 @@ import logging from logging.config import fileConfig -from flask import current_app - from alembic import context +from flask import current_app # this is the Alembic Config object, which provides # access to the values within the .ini file in use. @@ -12,17 +11,17 @@ config = context.config # Interpret the config file for Python logging. # This line sets up loggers basically. fileConfig(config.config_file_name) -logger = logging.getLogger('alembic.env') +logger = logging.getLogger("alembic.env") # add your model's MetaData object here # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata config.set_main_option( - 'sqlalchemy.url', - str(current_app.extensions['migrate'].db.get_engine().url).replace( - '%', '%%')) -target_metadata = current_app.extensions['migrate'].db.metadata + "sqlalchemy.url", + str(current_app.extensions["migrate"].db.get_engine().url).replace("%", "%%"), +) +target_metadata = current_app.extensions["migrate"].db.metadata # other values from the config, defined by the needs of env.py, # can be acquired: @@ -43,9 +42,7 @@ def run_migrations_offline(): """ url = config.get_main_option("sqlalchemy.url") - context.configure( - url=url, target_metadata=target_metadata, literal_binds=True - ) + context.configure(url=url, target_metadata=target_metadata, literal_binds=True) with context.begin_transaction(): context.run_migrations() @@ -63,20 +60,20 @@ def run_migrations_online(): # when there are no changes to the schema # reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html def process_revision_directives(context, revision, directives): - if getattr(config.cmd_opts, 'autogenerate', False): + if getattr(config.cmd_opts, "autogenerate", False): script = directives[0] if script.upgrade_ops.is_empty(): directives[:] = [] - logger.info('No changes in schema detected.') + logger.info("No changes in schema detected.") - connectable = current_app.extensions['migrate'].db.get_engine() + connectable = current_app.extensions["migrate"].db.get_engine() with connectable.connect() as connection: context.configure( connection=connection, target_metadata=target_metadata, process_revision_directives=process_revision_directives, - **current_app.extensions['migrate'].configure_args + **current_app.extensions["migrate"].configure_args ) with context.begin_transaction(): diff --git a/spiffworkflow-backend/migrations/versions/b7790c9c8174_.py b/spiffworkflow-backend/migrations/versions/b7790c9c8174_.py index 6ad9b2b3..8ec66bcd 100644 --- a/spiffworkflow-backend/migrations/versions/b7790c9c8174_.py +++ b/spiffworkflow-backend/migrations/versions/b7790c9c8174_.py @@ -1,16 +1,16 @@ """empty message Revision ID: b7790c9c8174 -Revises: +Revises: Create Date: 2022-11-15 14:11:47.309399 """ -from alembic import op import sqlalchemy as sa +from alembic import op # revision identifiers, used by Alembic. -revision = 'b7790c9c8174' +revision = "b7790c9c8174" down_revision = None branch_labels = None depends_on = None @@ -18,305 +18,562 @@ depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.create_table('group', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(length=255), nullable=True), - sa.Column('identifier', sa.String(length=255), nullable=True), - sa.PrimaryKeyConstraint('id') + op.create_table( + "group", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("name", sa.String(length=255), nullable=True), + sa.Column("identifier", sa.String(length=255), nullable=True), + sa.PrimaryKeyConstraint("id"), ) - op.create_table('message_model', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('identifier', sa.String(length=50), nullable=True), - sa.Column('name', sa.String(length=50), nullable=True), - sa.PrimaryKeyConstraint('id') + op.create_table( + "message_model", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("identifier", sa.String(length=50), nullable=True), + sa.Column("name", sa.String(length=50), nullable=True), + sa.PrimaryKeyConstraint("id"), ) - op.create_index(op.f('ix_message_model_identifier'), 'message_model', ['identifier'], unique=True) - op.create_index(op.f('ix_message_model_name'), 'message_model', ['name'], unique=True) - op.create_table('permission_target', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('uri', sa.String(length=255), nullable=False), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('uri') + op.create_index( + op.f("ix_message_model_identifier"), + "message_model", + ["identifier"], + unique=True, ) - op.create_table('spec_reference_cache', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('identifier', sa.String(length=255), nullable=True), - sa.Column('display_name', sa.String(length=255), nullable=True), - sa.Column('process_model_id', sa.String(length=255), nullable=True), - sa.Column('type', sa.String(length=255), nullable=True), - sa.Column('file_name', sa.String(length=255), nullable=True), - sa.Column('relative_path', sa.String(length=255), nullable=True), - sa.Column('has_lanes', sa.Boolean(), nullable=True), - sa.Column('is_executable', sa.Boolean(), nullable=True), - sa.Column('is_primary', sa.Boolean(), nullable=True), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('identifier', 'type', name='_identifier_type_unique') + op.create_index( + op.f("ix_message_model_name"), "message_model", ["name"], unique=True ) - op.create_index(op.f('ix_spec_reference_cache_display_name'), 'spec_reference_cache', ['display_name'], unique=False) - op.create_index(op.f('ix_spec_reference_cache_identifier'), 'spec_reference_cache', ['identifier'], unique=False) - op.create_index(op.f('ix_spec_reference_cache_type'), 'spec_reference_cache', ['type'], unique=False) - op.create_table('spiff_logging', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('process_instance_id', sa.Integer(), nullable=False), - sa.Column('bpmn_process_identifier', sa.String(length=255), nullable=False), - sa.Column('bpmn_task_identifier', sa.String(length=255), nullable=False), - sa.Column('bpmn_task_name', sa.String(length=255), nullable=True), - sa.Column('bpmn_task_type', sa.String(length=255), nullable=True), - sa.Column('spiff_task_guid', sa.String(length=50), nullable=False), - sa.Column('timestamp', sa.DECIMAL(precision=17, scale=6), nullable=False), - sa.Column('message', sa.String(length=255), nullable=True), - sa.Column('current_user_id', sa.Integer(), nullable=True), - sa.Column('spiff_step', sa.Integer(), nullable=False), - sa.PrimaryKeyConstraint('id') + op.create_table( + "permission_target", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("uri", sa.String(length=255), nullable=False), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("uri"), ) - op.create_table('user', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('username', sa.String(length=255), nullable=False), - sa.Column('uid', sa.String(length=50), nullable=True), - sa.Column('service', sa.String(length=50), nullable=False), - sa.Column('service_id', sa.String(length=255), nullable=False), - sa.Column('name', sa.String(length=255), nullable=True), - sa.Column('email', sa.String(length=255), nullable=True), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('service', 'service_id', name='service_key'), - sa.UniqueConstraint('uid'), - sa.UniqueConstraint('username') + op.create_table( + "spec_reference_cache", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("identifier", sa.String(length=255), nullable=True), + sa.Column("display_name", sa.String(length=255), nullable=True), + sa.Column("process_model_id", sa.String(length=255), nullable=True), + sa.Column("type", sa.String(length=255), nullable=True), + sa.Column("file_name", sa.String(length=255), nullable=True), + sa.Column("relative_path", sa.String(length=255), nullable=True), + sa.Column("has_lanes", sa.Boolean(), nullable=True), + sa.Column("is_executable", sa.Boolean(), nullable=True), + sa.Column("is_primary", sa.Boolean(), nullable=True), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("identifier", "type", name="_identifier_type_unique"), ) - op.create_table('message_correlation_property', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('identifier', sa.String(length=50), nullable=True), - sa.Column('message_model_id', sa.Integer(), nullable=False), - sa.Column('updated_at_in_seconds', sa.Integer(), nullable=True), - sa.Column('created_at_in_seconds', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['message_model_id'], ['message_model.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('identifier', 'message_model_id', name='message_correlation_property_unique') + op.create_index( + op.f("ix_spec_reference_cache_display_name"), + "spec_reference_cache", + ["display_name"], + unique=False, ) - op.create_index(op.f('ix_message_correlation_property_identifier'), 'message_correlation_property', ['identifier'], unique=False) - op.create_table('message_triggerable_process_model', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('message_model_id', sa.Integer(), nullable=False), - sa.Column('process_model_identifier', sa.String(length=50), nullable=False), - sa.Column('process_group_identifier', sa.String(length=50), nullable=False), - sa.Column('updated_at_in_seconds', sa.Integer(), nullable=True), - sa.Column('created_at_in_seconds', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['message_model_id'], ['message_model.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('message_model_id') + op.create_index( + op.f("ix_spec_reference_cache_identifier"), + "spec_reference_cache", + ["identifier"], + unique=False, ) - op.create_index(op.f('ix_message_triggerable_process_model_process_group_identifier'), 'message_triggerable_process_model', ['process_group_identifier'], unique=False) - op.create_index(op.f('ix_message_triggerable_process_model_process_model_identifier'), 'message_triggerable_process_model', ['process_model_identifier'], unique=False) - op.create_table('principal', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('user_id', sa.Integer(), nullable=True), - sa.Column('group_id', sa.Integer(), nullable=True), - sa.CheckConstraint('NOT(user_id IS NULL AND group_id IS NULL)'), - sa.ForeignKeyConstraint(['group_id'], ['group.id'], ), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('group_id'), - sa.UniqueConstraint('user_id') + op.create_index( + op.f("ix_spec_reference_cache_type"), + "spec_reference_cache", + ["type"], + unique=False, ) - op.create_table('process_instance', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('process_model_identifier', sa.String(length=255), nullable=False), - sa.Column('process_group_identifier', sa.String(length=50), nullable=False), - sa.Column('process_initiator_id', sa.Integer(), nullable=False), - sa.Column('bpmn_json', sa.JSON(), nullable=True), - sa.Column('start_in_seconds', sa.Integer(), nullable=True), - sa.Column('end_in_seconds', sa.Integer(), nullable=True), - sa.Column('updated_at_in_seconds', sa.Integer(), nullable=True), - sa.Column('created_at_in_seconds', sa.Integer(), nullable=True), - sa.Column('status', sa.String(length=50), nullable=True), - sa.Column('bpmn_version_control_type', sa.String(length=50), nullable=True), - sa.Column('bpmn_version_control_identifier', sa.String(length=255), nullable=True), - sa.Column('spiff_step', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['process_initiator_id'], ['user.id'], ), - sa.PrimaryKeyConstraint('id') + op.create_table( + "spiff_logging", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("process_instance_id", sa.Integer(), nullable=False), + sa.Column("bpmn_process_identifier", sa.String(length=255), nullable=False), + sa.Column("bpmn_task_identifier", sa.String(length=255), nullable=False), + sa.Column("bpmn_task_name", sa.String(length=255), nullable=True), + sa.Column("bpmn_task_type", sa.String(length=255), nullable=True), + sa.Column("spiff_task_guid", sa.String(length=50), nullable=False), + sa.Column("timestamp", sa.DECIMAL(precision=17, scale=6), nullable=False), + sa.Column("message", sa.String(length=255), nullable=True), + sa.Column("current_user_id", sa.Integer(), nullable=True), + sa.Column("spiff_step", sa.Integer(), nullable=False), + sa.PrimaryKeyConstraint("id"), ) - op.create_index(op.f('ix_process_instance_process_group_identifier'), 'process_instance', ['process_group_identifier'], unique=False) - op.create_index(op.f('ix_process_instance_process_model_identifier'), 'process_instance', ['process_model_identifier'], unique=False) - op.create_table('process_instance_report', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('identifier', sa.String(length=50), nullable=False), - sa.Column('report_metadata', sa.JSON(), nullable=True), - sa.Column('created_by_id', sa.Integer(), nullable=False), - sa.Column('created_at_in_seconds', sa.Integer(), nullable=True), - sa.Column('updated_at_in_seconds', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['created_by_id'], ['user.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('created_by_id', 'identifier', name='process_instance_report_unique') + op.create_table( + "user", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("username", sa.String(length=255), nullable=False), + sa.Column("uid", sa.String(length=50), nullable=True), + sa.Column("service", sa.String(length=50), nullable=False), + sa.Column("service_id", sa.String(length=255), nullable=False), + sa.Column("name", sa.String(length=255), nullable=True), + sa.Column("email", sa.String(length=255), nullable=True), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("service", "service_id", name="service_key"), + sa.UniqueConstraint("uid"), + sa.UniqueConstraint("username"), ) - op.create_index(op.f('ix_process_instance_report_created_by_id'), 'process_instance_report', ['created_by_id'], unique=False) - op.create_index(op.f('ix_process_instance_report_identifier'), 'process_instance_report', ['identifier'], unique=False) - op.create_table('refresh_token', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('user_id', sa.Integer(), nullable=False), - sa.Column('token', sa.String(length=1024), nullable=False), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('user_id') + op.create_table( + "message_correlation_property", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("identifier", sa.String(length=50), nullable=True), + sa.Column("message_model_id", sa.Integer(), nullable=False), + sa.Column("updated_at_in_seconds", sa.Integer(), nullable=True), + sa.Column("created_at_in_seconds", sa.Integer(), nullable=True), + sa.ForeignKeyConstraint( + ["message_model_id"], + ["message_model.id"], + ), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint( + "identifier", "message_model_id", name="message_correlation_property_unique" + ), ) - op.create_table('secret', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('key', sa.String(length=50), nullable=False), - sa.Column('value', sa.Text(), nullable=False), - sa.Column('user_id', sa.Integer(), nullable=False), - sa.Column('updated_at_in_seconds', sa.Integer(), nullable=True), - sa.Column('created_at_in_seconds', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('key') + op.create_index( + op.f("ix_message_correlation_property_identifier"), + "message_correlation_property", + ["identifier"], + unique=False, ) - op.create_table('spiff_step_details', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('process_instance_id', sa.Integer(), nullable=False), - sa.Column('spiff_step', sa.Integer(), nullable=False), - sa.Column('task_json', sa.JSON(), nullable=False), - sa.Column('timestamp', sa.DECIMAL(precision=17, scale=6), nullable=False), - sa.Column('completed_by_user_id', sa.Integer(), nullable=True), - sa.Column('lane_assignment_id', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['lane_assignment_id'], ['group.id'], ), - sa.PrimaryKeyConstraint('id') + op.create_table( + "message_triggerable_process_model", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("message_model_id", sa.Integer(), nullable=False), + sa.Column("process_model_identifier", sa.String(length=50), nullable=False), + sa.Column("process_group_identifier", sa.String(length=50), nullable=False), + sa.Column("updated_at_in_seconds", sa.Integer(), nullable=True), + sa.Column("created_at_in_seconds", sa.Integer(), nullable=True), + sa.ForeignKeyConstraint( + ["message_model_id"], + ["message_model.id"], + ), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("message_model_id"), ) - op.create_table('user_group_assignment', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('user_id', sa.Integer(), nullable=False), - sa.Column('group_id', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['group_id'], ['group.id'], ), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('user_id', 'group_id', name='user_group_assignment_unique') + op.create_index( + op.f("ix_message_triggerable_process_model_process_group_identifier"), + "message_triggerable_process_model", + ["process_group_identifier"], + unique=False, ) - op.create_table('active_task', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('process_instance_id', sa.Integer(), nullable=False), - sa.Column('actual_owner_id', sa.Integer(), nullable=True), - sa.Column('lane_assignment_id', sa.Integer(), nullable=True), - sa.Column('form_file_name', sa.String(length=50), nullable=True), - sa.Column('ui_form_file_name', sa.String(length=50), nullable=True), - sa.Column('updated_at_in_seconds', sa.Integer(), nullable=True), - sa.Column('created_at_in_seconds', sa.Integer(), nullable=True), - sa.Column('task_id', sa.String(length=50), nullable=True), - sa.Column('task_name', sa.String(length=50), nullable=True), - sa.Column('task_title', sa.String(length=50), nullable=True), - sa.Column('task_type', sa.String(length=50), nullable=True), - sa.Column('task_status', sa.String(length=50), nullable=True), - sa.Column('process_model_display_name', sa.String(length=255), nullable=True), - sa.ForeignKeyConstraint(['actual_owner_id'], ['user.id'], ), - sa.ForeignKeyConstraint(['lane_assignment_id'], ['group.id'], ), - sa.ForeignKeyConstraint(['process_instance_id'], ['process_instance.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('task_id', 'process_instance_id', name='active_task_unique') + op.create_index( + op.f("ix_message_triggerable_process_model_process_model_identifier"), + "message_triggerable_process_model", + ["process_model_identifier"], + unique=False, ) - op.create_table('message_correlation', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('process_instance_id', sa.Integer(), nullable=False), - sa.Column('message_correlation_property_id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(length=255), nullable=False), - sa.Column('value', sa.String(length=255), nullable=False), - sa.Column('updated_at_in_seconds', sa.Integer(), nullable=True), - sa.Column('created_at_in_seconds', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['message_correlation_property_id'], ['message_correlation_property.id'], ), - sa.ForeignKeyConstraint(['process_instance_id'], ['process_instance.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('process_instance_id', 'message_correlation_property_id', 'name', name='message_instance_id_name_unique') + op.create_table( + "principal", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("user_id", sa.Integer(), nullable=True), + sa.Column("group_id", sa.Integer(), nullable=True), + sa.CheckConstraint("NOT(user_id IS NULL AND group_id IS NULL)"), + sa.ForeignKeyConstraint( + ["group_id"], + ["group.id"], + ), + sa.ForeignKeyConstraint( + ["user_id"], + ["user.id"], + ), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("group_id"), + sa.UniqueConstraint("user_id"), ) - op.create_index(op.f('ix_message_correlation_message_correlation_property_id'), 'message_correlation', ['message_correlation_property_id'], unique=False) - op.create_index(op.f('ix_message_correlation_name'), 'message_correlation', ['name'], unique=False) - op.create_index(op.f('ix_message_correlation_process_instance_id'), 'message_correlation', ['process_instance_id'], unique=False) - op.create_index(op.f('ix_message_correlation_value'), 'message_correlation', ['value'], unique=False) - op.create_table('message_instance', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('process_instance_id', sa.Integer(), nullable=False), - sa.Column('message_model_id', sa.Integer(), nullable=False), - sa.Column('message_type', sa.String(length=20), nullable=False), - sa.Column('payload', sa.JSON(), nullable=True), - sa.Column('status', sa.String(length=20), nullable=False), - sa.Column('failure_cause', sa.Text(), nullable=True), - sa.Column('updated_at_in_seconds', sa.Integer(), nullable=True), - sa.Column('created_at_in_seconds', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['message_model_id'], ['message_model.id'], ), - sa.ForeignKeyConstraint(['process_instance_id'], ['process_instance.id'], ), - sa.PrimaryKeyConstraint('id') + op.create_table( + "process_instance", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("process_model_identifier", sa.String(length=255), nullable=False), + sa.Column("process_group_identifier", sa.String(length=50), nullable=False), + sa.Column("process_initiator_id", sa.Integer(), nullable=False), + sa.Column("bpmn_json", sa.JSON(), nullable=True), + sa.Column("start_in_seconds", sa.Integer(), nullable=True), + sa.Column("end_in_seconds", sa.Integer(), nullable=True), + sa.Column("updated_at_in_seconds", sa.Integer(), nullable=True), + sa.Column("created_at_in_seconds", sa.Integer(), nullable=True), + sa.Column("status", sa.String(length=50), nullable=True), + sa.Column("bpmn_version_control_type", sa.String(length=50), nullable=True), + sa.Column( + "bpmn_version_control_identifier", sa.String(length=255), nullable=True + ), + sa.Column("spiff_step", sa.Integer(), nullable=True), + sa.ForeignKeyConstraint( + ["process_initiator_id"], + ["user.id"], + ), + sa.PrimaryKeyConstraint("id"), ) - op.create_table('permission_assignment', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('principal_id', sa.Integer(), nullable=False), - sa.Column('permission_target_id', sa.Integer(), nullable=False), - sa.Column('grant_type', sa.String(length=50), nullable=False), - sa.Column('permission', sa.String(length=50), nullable=False), - sa.ForeignKeyConstraint(['permission_target_id'], ['permission_target.id'], ), - sa.ForeignKeyConstraint(['principal_id'], ['principal.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('principal_id', 'permission_target_id', 'permission', name='permission_assignment_uniq') + op.create_index( + op.f("ix_process_instance_process_group_identifier"), + "process_instance", + ["process_group_identifier"], + unique=False, ) - op.create_table('active_task_user', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('active_task_id', sa.Integer(), nullable=False), - sa.Column('user_id', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['active_task_id'], ['active_task.id'], ), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('active_task_id', 'user_id', name='active_task_user_unique') + op.create_index( + op.f("ix_process_instance_process_model_identifier"), + "process_instance", + ["process_model_identifier"], + unique=False, ) - op.create_index(op.f('ix_active_task_user_active_task_id'), 'active_task_user', ['active_task_id'], unique=False) - op.create_index(op.f('ix_active_task_user_user_id'), 'active_task_user', ['user_id'], unique=False) - op.create_table('message_correlation_message_instance', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('message_instance_id', sa.Integer(), nullable=False), - sa.Column('message_correlation_id', sa.Integer(), nullable=False), - sa.ForeignKeyConstraint(['message_correlation_id'], ['message_correlation.id'], ), - sa.ForeignKeyConstraint(['message_instance_id'], ['message_instance.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('message_instance_id', 'message_correlation_id', name='message_correlation_message_instance_unique') + op.create_table( + "process_instance_report", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("identifier", sa.String(length=50), nullable=False), + sa.Column("report_metadata", sa.JSON(), nullable=True), + sa.Column("created_by_id", sa.Integer(), nullable=False), + sa.Column("created_at_in_seconds", sa.Integer(), nullable=True), + sa.Column("updated_at_in_seconds", sa.Integer(), nullable=True), + sa.ForeignKeyConstraint( + ["created_by_id"], + ["user.id"], + ), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint( + "created_by_id", "identifier", name="process_instance_report_unique" + ), + ) + op.create_index( + op.f("ix_process_instance_report_created_by_id"), + "process_instance_report", + ["created_by_id"], + unique=False, + ) + op.create_index( + op.f("ix_process_instance_report_identifier"), + "process_instance_report", + ["identifier"], + unique=False, + ) + op.create_table( + "refresh_token", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("user_id", sa.Integer(), nullable=False), + sa.Column("token", sa.String(length=1024), nullable=False), + sa.ForeignKeyConstraint( + ["user_id"], + ["user.id"], + ), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("user_id"), + ) + op.create_table( + "secret", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("key", sa.String(length=50), nullable=False), + sa.Column("value", sa.Text(), nullable=False), + sa.Column("user_id", sa.Integer(), nullable=False), + sa.Column("updated_at_in_seconds", sa.Integer(), nullable=True), + sa.Column("created_at_in_seconds", sa.Integer(), nullable=True), + sa.ForeignKeyConstraint( + ["user_id"], + ["user.id"], + ), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("key"), + ) + op.create_table( + "spiff_step_details", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("process_instance_id", sa.Integer(), nullable=False), + sa.Column("spiff_step", sa.Integer(), nullable=False), + sa.Column("task_json", sa.JSON(), nullable=False), + sa.Column("timestamp", sa.DECIMAL(precision=17, scale=6), nullable=False), + sa.Column("completed_by_user_id", sa.Integer(), nullable=True), + sa.Column("lane_assignment_id", sa.Integer(), nullable=True), + sa.ForeignKeyConstraint( + ["lane_assignment_id"], + ["group.id"], + ), + sa.PrimaryKeyConstraint("id"), + ) + op.create_table( + "user_group_assignment", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("user_id", sa.Integer(), nullable=False), + sa.Column("group_id", sa.Integer(), nullable=False), + sa.ForeignKeyConstraint( + ["group_id"], + ["group.id"], + ), + sa.ForeignKeyConstraint( + ["user_id"], + ["user.id"], + ), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("user_id", "group_id", name="user_group_assignment_unique"), + ) + op.create_table( + "active_task", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("process_instance_id", sa.Integer(), nullable=False), + sa.Column("actual_owner_id", sa.Integer(), nullable=True), + sa.Column("lane_assignment_id", sa.Integer(), nullable=True), + sa.Column("form_file_name", sa.String(length=50), nullable=True), + sa.Column("ui_form_file_name", sa.String(length=50), nullable=True), + sa.Column("updated_at_in_seconds", sa.Integer(), nullable=True), + sa.Column("created_at_in_seconds", sa.Integer(), nullable=True), + sa.Column("task_id", sa.String(length=50), nullable=True), + sa.Column("task_name", sa.String(length=50), nullable=True), + sa.Column("task_title", sa.String(length=50), nullable=True), + sa.Column("task_type", sa.String(length=50), nullable=True), + sa.Column("task_status", sa.String(length=50), nullable=True), + sa.Column("process_model_display_name", sa.String(length=255), nullable=True), + sa.ForeignKeyConstraint( + ["actual_owner_id"], + ["user.id"], + ), + sa.ForeignKeyConstraint( + ["lane_assignment_id"], + ["group.id"], + ), + sa.ForeignKeyConstraint( + ["process_instance_id"], + ["process_instance.id"], + ), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint( + "task_id", "process_instance_id", name="active_task_unique" + ), + ) + op.create_table( + "message_correlation", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("process_instance_id", sa.Integer(), nullable=False), + sa.Column("message_correlation_property_id", sa.Integer(), nullable=False), + sa.Column("name", sa.String(length=255), nullable=False), + sa.Column("value", sa.String(length=255), nullable=False), + sa.Column("updated_at_in_seconds", sa.Integer(), nullable=True), + sa.Column("created_at_in_seconds", sa.Integer(), nullable=True), + sa.ForeignKeyConstraint( + ["message_correlation_property_id"], + ["message_correlation_property.id"], + ), + sa.ForeignKeyConstraint( + ["process_instance_id"], + ["process_instance.id"], + ), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint( + "process_instance_id", + "message_correlation_property_id", + "name", + name="message_instance_id_name_unique", + ), + ) + op.create_index( + op.f("ix_message_correlation_message_correlation_property_id"), + "message_correlation", + ["message_correlation_property_id"], + unique=False, + ) + op.create_index( + op.f("ix_message_correlation_name"), + "message_correlation", + ["name"], + unique=False, + ) + op.create_index( + op.f("ix_message_correlation_process_instance_id"), + "message_correlation", + ["process_instance_id"], + unique=False, + ) + op.create_index( + op.f("ix_message_correlation_value"), + "message_correlation", + ["value"], + unique=False, + ) + op.create_table( + "message_instance", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("process_instance_id", sa.Integer(), nullable=False), + sa.Column("message_model_id", sa.Integer(), nullable=False), + sa.Column("message_type", sa.String(length=20), nullable=False), + sa.Column("payload", sa.JSON(), nullable=True), + sa.Column("status", sa.String(length=20), nullable=False), + sa.Column("failure_cause", sa.Text(), nullable=True), + sa.Column("updated_at_in_seconds", sa.Integer(), nullable=True), + sa.Column("created_at_in_seconds", sa.Integer(), nullable=True), + sa.ForeignKeyConstraint( + ["message_model_id"], + ["message_model.id"], + ), + sa.ForeignKeyConstraint( + ["process_instance_id"], + ["process_instance.id"], + ), + sa.PrimaryKeyConstraint("id"), + ) + op.create_table( + "permission_assignment", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("principal_id", sa.Integer(), nullable=False), + sa.Column("permission_target_id", sa.Integer(), nullable=False), + sa.Column("grant_type", sa.String(length=50), nullable=False), + sa.Column("permission", sa.String(length=50), nullable=False), + sa.ForeignKeyConstraint( + ["permission_target_id"], + ["permission_target.id"], + ), + sa.ForeignKeyConstraint( + ["principal_id"], + ["principal.id"], + ), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint( + "principal_id", + "permission_target_id", + "permission", + name="permission_assignment_uniq", + ), + ) + op.create_table( + "active_task_user", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("active_task_id", sa.Integer(), nullable=False), + sa.Column("user_id", sa.Integer(), nullable=False), + sa.ForeignKeyConstraint( + ["active_task_id"], + ["active_task.id"], + ), + sa.ForeignKeyConstraint( + ["user_id"], + ["user.id"], + ), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint( + "active_task_id", "user_id", name="active_task_user_unique" + ), + ) + op.create_index( + op.f("ix_active_task_user_active_task_id"), + "active_task_user", + ["active_task_id"], + unique=False, + ) + op.create_index( + op.f("ix_active_task_user_user_id"), + "active_task_user", + ["user_id"], + unique=False, + ) + op.create_table( + "message_correlation_message_instance", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("message_instance_id", sa.Integer(), nullable=False), + sa.Column("message_correlation_id", sa.Integer(), nullable=False), + sa.ForeignKeyConstraint( + ["message_correlation_id"], + ["message_correlation.id"], + ), + sa.ForeignKeyConstraint( + ["message_instance_id"], + ["message_instance.id"], + ), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint( + "message_instance_id", + "message_correlation_id", + name="message_correlation_message_instance_unique", + ), + ) + op.create_index( + op.f("ix_message_correlation_message_instance_message_correlation_id"), + "message_correlation_message_instance", + ["message_correlation_id"], + unique=False, + ) + op.create_index( + op.f("ix_message_correlation_message_instance_message_instance_id"), + "message_correlation_message_instance", + ["message_instance_id"], + unique=False, ) - op.create_index(op.f('ix_message_correlation_message_instance_message_correlation_id'), 'message_correlation_message_instance', ['message_correlation_id'], unique=False) - op.create_index(op.f('ix_message_correlation_message_instance_message_instance_id'), 'message_correlation_message_instance', ['message_instance_id'], unique=False) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f('ix_message_correlation_message_instance_message_instance_id'), table_name='message_correlation_message_instance') - op.drop_index(op.f('ix_message_correlation_message_instance_message_correlation_id'), table_name='message_correlation_message_instance') - op.drop_table('message_correlation_message_instance') - op.drop_index(op.f('ix_active_task_user_user_id'), table_name='active_task_user') - op.drop_index(op.f('ix_active_task_user_active_task_id'), table_name='active_task_user') - op.drop_table('active_task_user') - op.drop_table('permission_assignment') - op.drop_table('message_instance') - op.drop_index(op.f('ix_message_correlation_value'), table_name='message_correlation') - op.drop_index(op.f('ix_message_correlation_process_instance_id'), table_name='message_correlation') - op.drop_index(op.f('ix_message_correlation_name'), table_name='message_correlation') - op.drop_index(op.f('ix_message_correlation_message_correlation_property_id'), table_name='message_correlation') - op.drop_table('message_correlation') - op.drop_table('active_task') - op.drop_table('user_group_assignment') - op.drop_table('spiff_step_details') - op.drop_table('secret') - op.drop_table('refresh_token') - op.drop_index(op.f('ix_process_instance_report_identifier'), table_name='process_instance_report') - op.drop_index(op.f('ix_process_instance_report_created_by_id'), table_name='process_instance_report') - op.drop_table('process_instance_report') - op.drop_index(op.f('ix_process_instance_process_model_identifier'), table_name='process_instance') - op.drop_index(op.f('ix_process_instance_process_group_identifier'), table_name='process_instance') - op.drop_table('process_instance') - op.drop_table('principal') - op.drop_index(op.f('ix_message_triggerable_process_model_process_model_identifier'), table_name='message_triggerable_process_model') - op.drop_index(op.f('ix_message_triggerable_process_model_process_group_identifier'), table_name='message_triggerable_process_model') - op.drop_table('message_triggerable_process_model') - op.drop_index(op.f('ix_message_correlation_property_identifier'), table_name='message_correlation_property') - op.drop_table('message_correlation_property') - op.drop_table('user') - op.drop_table('spiff_logging') - op.drop_index(op.f('ix_spec_reference_cache_type'), table_name='spec_reference_cache') - op.drop_index(op.f('ix_spec_reference_cache_identifier'), table_name='spec_reference_cache') - op.drop_index(op.f('ix_spec_reference_cache_display_name'), table_name='spec_reference_cache') - op.drop_table('spec_reference_cache') - op.drop_table('permission_target') - op.drop_index(op.f('ix_message_model_name'), table_name='message_model') - op.drop_index(op.f('ix_message_model_identifier'), table_name='message_model') - op.drop_table('message_model') - op.drop_table('group') + op.drop_index( + op.f("ix_message_correlation_message_instance_message_instance_id"), + table_name="message_correlation_message_instance", + ) + op.drop_index( + op.f("ix_message_correlation_message_instance_message_correlation_id"), + table_name="message_correlation_message_instance", + ) + op.drop_table("message_correlation_message_instance") + op.drop_index(op.f("ix_active_task_user_user_id"), table_name="active_task_user") + op.drop_index( + op.f("ix_active_task_user_active_task_id"), table_name="active_task_user" + ) + op.drop_table("active_task_user") + op.drop_table("permission_assignment") + op.drop_table("message_instance") + op.drop_index( + op.f("ix_message_correlation_value"), table_name="message_correlation" + ) + op.drop_index( + op.f("ix_message_correlation_process_instance_id"), + table_name="message_correlation", + ) + op.drop_index(op.f("ix_message_correlation_name"), table_name="message_correlation") + op.drop_index( + op.f("ix_message_correlation_message_correlation_property_id"), + table_name="message_correlation", + ) + op.drop_table("message_correlation") + op.drop_table("active_task") + op.drop_table("user_group_assignment") + op.drop_table("spiff_step_details") + op.drop_table("secret") + op.drop_table("refresh_token") + op.drop_index( + op.f("ix_process_instance_report_identifier"), + table_name="process_instance_report", + ) + op.drop_index( + op.f("ix_process_instance_report_created_by_id"), + table_name="process_instance_report", + ) + op.drop_table("process_instance_report") + op.drop_index( + op.f("ix_process_instance_process_model_identifier"), + table_name="process_instance", + ) + op.drop_index( + op.f("ix_process_instance_process_group_identifier"), + table_name="process_instance", + ) + op.drop_table("process_instance") + op.drop_table("principal") + op.drop_index( + op.f("ix_message_triggerable_process_model_process_model_identifier"), + table_name="message_triggerable_process_model", + ) + op.drop_index( + op.f("ix_message_triggerable_process_model_process_group_identifier"), + table_name="message_triggerable_process_model", + ) + op.drop_table("message_triggerable_process_model") + op.drop_index( + op.f("ix_message_correlation_property_identifier"), + table_name="message_correlation_property", + ) + op.drop_table("message_correlation_property") + op.drop_table("user") + op.drop_table("spiff_logging") + op.drop_index( + op.f("ix_spec_reference_cache_type"), table_name="spec_reference_cache" + ) + op.drop_index( + op.f("ix_spec_reference_cache_identifier"), table_name="spec_reference_cache" + ) + op.drop_index( + op.f("ix_spec_reference_cache_display_name"), table_name="spec_reference_cache" + ) + op.drop_table("spec_reference_cache") + op.drop_table("permission_target") + op.drop_index(op.f("ix_message_model_name"), table_name="message_model") + op.drop_index(op.f("ix_message_model_identifier"), table_name="message_model") + op.drop_table("message_model") + op.drop_table("group") # ### end Alembic commands ### diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py b/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py index d17beac3..a6dc7f38 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py @@ -5,6 +5,7 @@ from typing import Any import connexion # type: ignore import flask.app import flask.json +import spiffworkflow_backend.load_database_models # noqa: F401 import sqlalchemy from apscheduler.schedulers.background import BackgroundScheduler # type: ignore from apscheduler.schedulers.base import BaseScheduler # type: ignore @@ -14,9 +15,6 @@ from flask_bpmn.models.db import db from flask_bpmn.models.db import migrate from flask_cors import CORS # type: ignore from flask_mail import Mail # type: ignore -from werkzeug.exceptions import NotFound - -import spiffworkflow_backend.load_database_models # noqa: F401 from spiffworkflow_backend.config import setup_config from spiffworkflow_backend.routes.admin_blueprint.admin_blueprint import admin_blueprint from spiffworkflow_backend.routes.process_api_blueprint import process_api_blueprint @@ -26,6 +24,7 @@ from spiffworkflow_backend.services.authorization_service import AuthorizationSe from spiffworkflow_backend.services.background_processing_service import ( BackgroundProcessingService, ) +from werkzeug.exceptions import NotFound class MyJSONEncoder(DefaultJSONProvider): diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml index 76d821e1..f559c532 100755 --- a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml @@ -375,8 +375,9 @@ paths: /processes: get: operationId: spiffworkflow_backend.routes.process_api_blueprint.process_list - summary: Return a list of all processes (not just primary process of a process model) - useful for finding processes for call activites. + summary: + Return a list of all processes (not just primary process of a process model) + useful for finding processes for call activites. tags: - Process Models responses: diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py index b56683ca..08219579 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py @@ -3,9 +3,8 @@ import os import threading from flask.app import Flask -from werkzeug.utils import ImportStringError - from spiffworkflow_backend.services.logging_service import setup_logger +from werkzeug.utils import ImportStringError class ConfigurationError(Exception): diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task.py index ea9e1055..50bd8c75 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task.py @@ -6,14 +6,13 @@ from typing import TYPE_CHECKING from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel -from sqlalchemy import ForeignKey -from sqlalchemy.orm import relationship -from sqlalchemy.orm import RelationshipProperty - from spiffworkflow_backend.models.group import GroupModel from spiffworkflow_backend.models.process_instance import ProcessInstanceModel from spiffworkflow_backend.models.task import Task from spiffworkflow_backend.models.user import UserModel +from sqlalchemy import ForeignKey +from sqlalchemy.orm import relationship +from sqlalchemy.orm import RelationshipProperty if TYPE_CHECKING: diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task_user.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task_user.py index f194c38e..002759b1 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task_user.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/active_task_user.py @@ -5,10 +5,9 @@ from dataclasses import dataclass from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel -from sqlalchemy import ForeignKey - from spiffworkflow_backend.models.active_task import ActiveTaskModel from spiffworkflow_backend.models.user import UserModel +from sqlalchemy import ForeignKey @dataclass diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/file.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/file.py index 449c145d..c75799c7 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/file.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/file.py @@ -7,7 +7,6 @@ from typing import Optional import marshmallow from marshmallow import INCLUDE from marshmallow import Schema - from spiffworkflow_backend.helpers.spiff_enum import SpiffEnum from spiffworkflow_backend.models.spec_reference import SpecReference diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation.py index 08bc1cb1..5e8a1e87 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation.py @@ -4,13 +4,12 @@ from typing import TYPE_CHECKING from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel -from sqlalchemy import ForeignKey -from sqlalchemy.orm import relationship - from spiffworkflow_backend.models.message_correlation_property import ( MessageCorrelationPropertyModel, ) from spiffworkflow_backend.models.process_instance import ProcessInstanceModel +from sqlalchemy import ForeignKey +from sqlalchemy.orm import relationship if TYPE_CHECKING: from spiffworkflow_backend.models.message_correlation_message_instance import ( # noqa: F401 diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_message_instance.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_message_instance.py index 320dfba3..f056aec6 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_message_instance.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_message_instance.py @@ -3,10 +3,9 @@ from dataclasses import dataclass from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel -from sqlalchemy import ForeignKey - from spiffworkflow_backend.models.message_correlation import MessageCorrelationModel from spiffworkflow_backend.models.message_instance import MessageInstanceModel +from sqlalchemy import ForeignKey @dataclass diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_property.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_property.py index b84b7140..04acaa94 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_property.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation_property.py @@ -1,9 +1,8 @@ """Message_correlation_property.""" from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel -from sqlalchemy import ForeignKey - from spiffworkflow_backend.models.message_model import MessageModel +from sqlalchemy import ForeignKey class MessageCorrelationPropertyModel(SpiffworkflowBaseDBModel): diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_instance.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_instance.py index 2559a635..20d03d13 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_instance.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_instance.py @@ -7,15 +7,14 @@ from typing import TYPE_CHECKING from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel +from spiffworkflow_backend.models.message_model import MessageModel +from spiffworkflow_backend.models.process_instance import ProcessInstanceModel from sqlalchemy import ForeignKey from sqlalchemy.event import listens_for from sqlalchemy.orm import relationship from sqlalchemy.orm import Session from sqlalchemy.orm import validates -from spiffworkflow_backend.models.message_model import MessageModel -from spiffworkflow_backend.models.process_instance import ProcessInstanceModel - if TYPE_CHECKING: from spiffworkflow_backend.models.message_correlation_message_instance import ( # noqa: F401 MessageCorrelationMessageInstanceModel, diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_triggerable_process_model.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_triggerable_process_model.py index 9e4c3928..4532f692 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_triggerable_process_model.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_triggerable_process_model.py @@ -1,9 +1,8 @@ """Message_correlation_property.""" from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel -from sqlalchemy import ForeignKey - from spiffworkflow_backend.models.message_model import MessageModel +from sqlalchemy import ForeignKey class MessageTriggerableProcessModel(SpiffworkflowBaseDBModel): diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/permission_assignment.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/permission_assignment.py index 63295f74..19434192 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/permission_assignment.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/permission_assignment.py @@ -4,11 +4,10 @@ from typing import Any from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel -from sqlalchemy import ForeignKey -from sqlalchemy.orm import validates - from spiffworkflow_backend.models.permission_target import PermissionTargetModel from spiffworkflow_backend.models.principal import PrincipalModel +from sqlalchemy import ForeignKey +from sqlalchemy.orm import validates class PermitDeny(enum.Enum): diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/principal.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/principal.py index c7efa860..d43be35a 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/principal.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/principal.py @@ -3,13 +3,12 @@ from dataclasses import dataclass from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel +from spiffworkflow_backend.models.group import GroupModel +from spiffworkflow_backend.models.user import UserModel from sqlalchemy import ForeignKey from sqlalchemy.orm import relationship from sqlalchemy.schema import CheckConstraint -from spiffworkflow_backend.models.group import GroupModel -from spiffworkflow_backend.models.user import UserModel - class DataValidityError(Exception): """DataValidityError.""" diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_group.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_group.py index 6edb19e5..98bdbaeb 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_group.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_group.py @@ -9,7 +9,6 @@ from typing import Any import marshmallow from marshmallow import post_load from marshmallow import Schema - from spiffworkflow_backend.models.process_model import ProcessModelInfo diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py index 2e94e994..ee95007b 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py @@ -12,16 +12,15 @@ from marshmallow import INCLUDE from marshmallow import Schema from marshmallow_enum import EnumField # type: ignore from SpiffWorkflow.util.deep_merge import DeepMerge # type: ignore -from sqlalchemy import ForeignKey -from sqlalchemy.orm import deferred -from sqlalchemy.orm import relationship -from sqlalchemy.orm import validates - from spiffworkflow_backend.helpers.spiff_enum import SpiffEnum from spiffworkflow_backend.models.process_model import ProcessModelInfo from spiffworkflow_backend.models.task import Task from spiffworkflow_backend.models.task import TaskSchema from spiffworkflow_backend.models.user import UserModel +from sqlalchemy import ForeignKey +from sqlalchemy.orm import deferred +from sqlalchemy.orm import relationship +from sqlalchemy.orm import validates class NavigationItemSchema(Schema): diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_report.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_report.py index 1425d69f..c4fcbad2 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_report.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_report.py @@ -9,10 +9,6 @@ from typing import TypedDict from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel -from sqlalchemy import ForeignKey -from sqlalchemy.orm import deferred -from sqlalchemy.orm import relationship - from spiffworkflow_backend.exceptions.process_entity_not_found_error import ( ProcessEntityNotFoundError, ) @@ -21,6 +17,9 @@ from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.process_instance_processor import ( ProcessInstanceProcessor, ) +from sqlalchemy import ForeignKey +from sqlalchemy.orm import deferred +from sqlalchemy.orm import relationship ReportMetadata = dict[str, Any] diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_model.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_model.py index 3ab55d07..8a065cd7 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_model.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_model.py @@ -10,7 +10,6 @@ from typing import Any import marshmallow from marshmallow import Schema from marshmallow.decorators import post_load - from spiffworkflow_backend.models.file import File diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/secret_model.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/secret_model.py index 92fd470a..9cc338ed 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/secret_model.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/secret_model.py @@ -4,9 +4,8 @@ from dataclasses import dataclass from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel from marshmallow import Schema -from sqlalchemy import ForeignKey - from spiffworkflow_backend.models.user import UserModel +from sqlalchemy import ForeignKey @dataclass() diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py index e00e7cac..effd44ec 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py @@ -4,11 +4,10 @@ from typing import Optional from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel +from spiffworkflow_backend.models.group import GroupModel from sqlalchemy import ForeignKey from sqlalchemy.orm import deferred -from spiffworkflow_backend.models.group import GroupModel - @dataclass class SpiffStepDetailsModel(SpiffworkflowBaseDBModel): diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/user.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/user.py index c33a72e7..0df4c9c2 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/user.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/user.py @@ -10,13 +10,12 @@ from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel from marshmallow import Schema -from sqlalchemy.orm import relationship -from sqlalchemy.orm import validates - from spiffworkflow_backend.models.group import GroupModel from spiffworkflow_backend.services.authentication_service import ( AuthenticationProviderTypes, ) +from sqlalchemy.orm import relationship +from sqlalchemy.orm import validates class UserNotFoundError(Exception): diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/user_group_assignment.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/user_group_assignment.py index fa5b620c..8cccf1d8 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/user_group_assignment.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/user_group_assignment.py @@ -1,11 +1,10 @@ """UserGroupAssignment.""" from flask_bpmn.models.db import db from flask_bpmn.models.db import SpiffworkflowBaseDBModel -from sqlalchemy import ForeignKey -from sqlalchemy.orm import relationship - from spiffworkflow_backend.models.group import GroupModel from spiffworkflow_backend.models.user import UserModel +from sqlalchemy import ForeignKey +from sqlalchemy.orm import relationship class UserGroupAssignmentModel(SpiffworkflowBaseDBModel): diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/admin_blueprint/admin_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/admin_blueprint/admin_blueprint.py index 2e480f2a..f13e4e07 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/admin_blueprint/admin_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/admin_blueprint/admin_blueprint.py @@ -7,8 +7,6 @@ from flask import redirect from flask import render_template from flask import request from flask import url_for -from werkzeug.wrappers import Response - from spiffworkflow_backend.services.process_instance_processor import ( ProcessInstanceProcessor, ) @@ -18,6 +16,7 @@ from spiffworkflow_backend.services.process_instance_service import ( from spiffworkflow_backend.services.process_model_service import ProcessModelService from spiffworkflow_backend.services.spec_file_service import SpecFileService from spiffworkflow_backend.services.user_service import UserService +from werkzeug.wrappers import Response admin_blueprint = Blueprint( "admin", __name__, template_folder="templates", static_folder="static" diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index 6918ad35..5aef7298 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -27,10 +27,6 @@ from lxml import etree # type: ignore from lxml.builder import ElementMaker # type: ignore from SpiffWorkflow.task import Task as SpiffTask # type: ignore from SpiffWorkflow.task import TaskState -from sqlalchemy import and_ -from sqlalchemy import asc -from sqlalchemy import desc - from spiffworkflow_backend.exceptions.process_entity_not_found_error import ( ProcessEntityNotFoundError, ) @@ -86,6 +82,9 @@ from spiffworkflow_backend.services.secret_service import SecretService from spiffworkflow_backend.services.service_task_service import ServiceTaskService from spiffworkflow_backend.services.spec_file_service import SpecFileService from spiffworkflow_backend.services.user_service import UserService +from sqlalchemy import and_ +from sqlalchemy import asc +from sqlalchemy import desc class TaskDataSelectOption(TypedDict): diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/user.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/user.py index 5fe10e0a..45d7c2ae 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/user.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/user.py @@ -12,14 +12,13 @@ from flask import g from flask import redirect from flask import request from flask_bpmn.api.api_error import ApiError -from werkzeug.wrappers import Response - from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.authentication_service import ( AuthenticationService, ) from spiffworkflow_backend.services.authorization_service import AuthorizationService from spiffworkflow_backend.services.user_service import UserService +from werkzeug.wrappers import Response """ .. module:: crc.api.user diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/user_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/user_blueprint.py index 29bbddcd..9520dfc8 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/user_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/user_blueprint.py @@ -9,11 +9,10 @@ from flask import request from flask import Response from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db -from sqlalchemy.exc import IntegrityError - from spiffworkflow_backend.models.group import GroupModel from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.models.user_group_assignment import UserGroupAssignmentModel +from sqlalchemy.exc import IntegrityError APPLICATION_JSON: Final = "application/json" diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_current_user.py b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_current_user.py index a1a1b47e..4cdcdc37 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_current_user.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_current_user.py @@ -2,7 +2,6 @@ from typing import Any from flask import g - from spiffworkflow_backend.models.script_attributes_context import ( ScriptAttributesContext, ) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_frontend_url.py b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_frontend_url.py index 9490df95..6930c57e 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_frontend_url.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_frontend_url.py @@ -2,7 +2,6 @@ from typing import Any from flask import current_app - from spiffworkflow_backend.models.script_attributes_context import ( ScriptAttributesContext, ) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_localtime.py b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_localtime.py index 689b86d8..16b9bf57 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_localtime.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/get_localtime.py @@ -4,7 +4,6 @@ from typing import Any import pytz from flask_bpmn.api.api_error import ApiError - from spiffworkflow_backend.models.script_attributes_context import ( ScriptAttributesContext, ) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/script.py b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/script.py index b744694a..7ed745d6 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/scripts/script.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/scripts/script.py @@ -9,7 +9,6 @@ from typing import Any from typing import Callable from flask_bpmn.api.api_error import ApiError - from spiffworkflow_backend.models.script_attributes_context import ( ScriptAttributesContext, ) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/acceptance_test_fixtures.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/acceptance_test_fixtures.py index cfea3148..c71e6069 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/acceptance_test_fixtures.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/acceptance_test_fixtures.py @@ -4,10 +4,9 @@ import time from flask import current_app from flask_bpmn.models.db import db -from tests.spiffworkflow_backend.helpers.base_test import BaseTest - from spiffworkflow_backend.models.process_instance import ProcessInstanceModel from spiffworkflow_backend.models.process_instance import ProcessInstanceStatus +from tests.spiffworkflow_backend.helpers.base_test import BaseTest def load_acceptance_test_fixtures() -> list[ProcessInstanceModel]: diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/authentication_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/authentication_service.py index 18f08d0f..1ec35ae1 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/authentication_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/authentication_service.py @@ -11,9 +11,8 @@ from flask import current_app from flask import redirect from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db -from werkzeug.wrappers import Response - from spiffworkflow_backend.models.refresh_token import RefreshTokenModel +from werkzeug.wrappers import Response class AuthenticationProviderTypes(enum.Enum): diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/authorization_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/authorization_service.py index 29ee7884..08de0fb9 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/authorization_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/authorization_service.py @@ -11,9 +11,6 @@ from flask import request from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db from SpiffWorkflow.task import Task as SpiffTask # type: ignore -from sqlalchemy import or_ -from sqlalchemy import text - from spiffworkflow_backend.models.active_task import ActiveTaskModel from spiffworkflow_backend.models.group import GroupModel from spiffworkflow_backend.models.permission_assignment import PermissionAssignmentModel @@ -28,6 +25,8 @@ from spiffworkflow_backend.services.process_instance_processor import ( ProcessInstanceProcessor, ) from spiffworkflow_backend.services.user_service import UserService +from sqlalchemy import or_ +from sqlalchemy import text class PermissionsFileNotSetError(Exception): diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/background_processing_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/background_processing_service.py index 08a2b02d..8c4fee6e 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/background_processing_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/background_processing_service.py @@ -1,6 +1,5 @@ """Background_processing_service.""" import flask - from spiffworkflow_backend.services.message_service import MessageService from spiffworkflow_backend.services.process_instance_service import ( ProcessInstanceService, diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/data_setup_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/data_setup_service.py index 412c4b82..4026b28b 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/data_setup_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/data_setup_service.py @@ -1,7 +1,6 @@ """Data_setup_service.""" from flask import current_app from flask_bpmn.models.db import db - from spiffworkflow_backend.services.process_model_service import ProcessModelService from spiffworkflow_backend.services.spec_file_service import SpecFileService diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/error_handling_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/error_handling_service.py index 99e4fbe8..8bf377bd 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/error_handling_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/error_handling_service.py @@ -5,7 +5,6 @@ from typing import Union from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db - from spiffworkflow_backend.models.process_instance import ProcessInstanceModel from spiffworkflow_backend.models.process_instance import ProcessInstanceStatus from spiffworkflow_backend.services.email_service import EmailService diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py index cbe007d6..c1ef4026 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/file_system_service.py @@ -7,7 +7,6 @@ from typing import Optional import pytz from flask import current_app from flask_bpmn.api.api_error import ApiError - from spiffworkflow_backend.models.file import CONTENT_TYPES from spiffworkflow_backend.models.file import File from spiffworkflow_backend.models.file import FileType diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py index 815e4cad..08f45386 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py @@ -2,7 +2,6 @@ import os from flask import current_app - from spiffworkflow_backend.models.process_model import ProcessModelInfo from spiffworkflow_backend.services.file_system_service import FileSystemService diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/group_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/group_service.py index aa560009..a2e54460 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/group_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/group_service.py @@ -2,7 +2,6 @@ from typing import Optional from flask_bpmn.models.db import db - from spiffworkflow_backend.models.group import GroupModel from spiffworkflow_backend.services.user_service import UserService diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py index c4e8c8ae..201a7e5c 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py @@ -8,7 +8,6 @@ from typing import Optional from flask import g from flask.app import Flask from flask_bpmn.models.db import db - from spiffworkflow_backend.models.spiff_logging import SpiffLoggingModel diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/message_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/message_service.py index 216a66a5..190eaaa4 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/message_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/message_service.py @@ -3,10 +3,6 @@ from typing import Any from typing import Optional from flask_bpmn.models.db import db -from sqlalchemy import and_ -from sqlalchemy import or_ -from sqlalchemy import select - from spiffworkflow_backend.models.message_correlation import MessageCorrelationModel from spiffworkflow_backend.models.message_correlation_message_instance import ( MessageCorrelationMessageInstanceModel, @@ -23,6 +19,9 @@ from spiffworkflow_backend.services.process_instance_processor import ( from spiffworkflow_backend.services.process_instance_service import ( ProcessInstanceService, ) +from sqlalchemy import and_ +from sqlalchemy import or_ +from sqlalchemy import select class MessageServiceError(Exception): 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 be32a2f0..3b9c6c30 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py @@ -64,7 +64,6 @@ from SpiffWorkflow.spiff.serializer.task_spec_converters import UserTaskConverte from SpiffWorkflow.task import Task as SpiffTask # type: ignore from SpiffWorkflow.task import TaskState from SpiffWorkflow.util.deep_merge import DeepMerge # type: ignore - from spiffworkflow_backend.models.active_task import ActiveTaskModel from spiffworkflow_backend.models.active_task_user import ActiveTaskUserModel from spiffworkflow_backend.models.file import File 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 244e6fb2..6fa443c0 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py @@ -7,7 +7,6 @@ from flask import current_app from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db from SpiffWorkflow.task import Task as SpiffTask # type: ignore - from spiffworkflow_backend.models.active_task import ActiveTaskModel from spiffworkflow_backend.models.process_instance import ProcessInstanceApi from spiffworkflow_backend.models.process_instance import ProcessInstanceModel @@ -320,7 +319,7 @@ class ProcessInstanceService: def serialize_flat_with_task_data( process_instance: ProcessInstanceModel, ) -> dict[str, Any]: - """serialize_flat_with_task_data.""" + """Serialize_flat_with_task_data.""" results = {} try: original_status = process_instance.status diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py index 4d376726..60d1c301 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_service.py @@ -8,7 +8,6 @@ from typing import Optional from typing import TypeVar from flask_bpmn.api.api_error import ApiError - from spiffworkflow_backend.exceptions.process_entity_not_found_error import ( ProcessEntityNotFoundError, ) @@ -49,7 +48,9 @@ class ProcessModelService(FileSystemService): return False @staticmethod - def write_json_file(file_path: str, json_data: dict, indent: int = 4, sort_keys: bool = True) -> None: + def write_json_file( + file_path: str, json_data: dict, indent: int = 4, sort_keys: bool = True + ) -> None: """Write json file.""" with open(file_path, "w") as h_open: json.dump(json_data, h_open, indent=indent, sort_keys=sort_keys) @@ -309,7 +310,7 @@ class ProcessModelService(FileSystemService): else: process_group_id = dir_path.replace(FileSystemService.root_path(), "") process_group = ProcessGroup( - id='', + id="", display_name=process_group_id, display_order=10000, admin=False, @@ -371,7 +372,7 @@ class ProcessModelService(FileSystemService): ) process_model_info = ProcessModelInfo( - id='', + id="", display_name=name, description="", display_order=0, diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/script_unit_test_runner.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/script_unit_test_runner.py index 9112e20f..b9ec129e 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/script_unit_test_runner.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/script_unit_test_runner.py @@ -8,7 +8,6 @@ from typing import Optional from SpiffWorkflow.bpmn.exceptions import WorkflowTaskExecException # type: ignore from SpiffWorkflow.task import Task as SpiffTask # type: ignore - from spiffworkflow_backend.services.process_instance_processor import ( CustomBpmnScriptEngine, ) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/secret_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/secret_service.py index 42f401c1..33264499 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/secret_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/secret_service.py @@ -3,7 +3,6 @@ from typing import Optional from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db - from spiffworkflow_backend.models.secret_model import SecretModel # from cryptography.fernet import Fernet diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/service_task_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/service_task_service.py index 97ce1495..fb2961f5 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/service_task_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/service_task_service.py @@ -5,7 +5,6 @@ from typing import Any import requests from flask import current_app from flask import g - from spiffworkflow_backend.services.file_system_service import FileSystemService from spiffworkflow_backend.services.secret_service import SecretService diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py index f02e3a6f..97ac5365 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/spec_file_service.py @@ -7,7 +7,6 @@ from typing import Optional from flask_bpmn.models.db import db from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException # type: ignore - from spiffworkflow_backend.models.file import File from spiffworkflow_backend.models.file import FileType from spiffworkflow_backend.models.file import SpecReference diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/user_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/user_service.py index 0e8e65c2..c65c4887 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/user_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/user_service.py @@ -6,7 +6,6 @@ from flask import current_app from flask import g from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db - from spiffworkflow_backend.models.active_task import ActiveTaskModel from spiffworkflow_backend.models.active_task_user import ActiveTaskUserModel from spiffworkflow_backend.models.group import GroupModel diff --git a/spiffworkflow-backend/tests/data/simple_form/simple_form.json b/spiffworkflow-backend/tests/data/simple_form/simple_form.json index 68a9e4de..3a1fd3ac 100644 --- a/spiffworkflow-backend/tests/data/simple_form/simple_form.json +++ b/spiffworkflow-backend/tests/data/simple_form/simple_form.json @@ -2,9 +2,7 @@ "title": "Simple form", "description": "A simple form example.", "type": "object", - "required": [ - "name" - ], + "required": ["name"], "properties": { "name": { "type": "string", @@ -14,11 +12,7 @@ "department": { "type": "string", "title": "Department", - "enum": [ - "Finance", - "HR", - "IT" - ] + "enum": ["Finance", "HR", "IT"] } } } diff --git a/spiffworkflow-backend/tests/data/simple_form/simple_form_ui.json b/spiffworkflow-backend/tests/data/simple_form/simple_form_ui.json index 9ceddac0..dc6916e0 100644 --- a/spiffworkflow-backend/tests/data/simple_form/simple_form_ui.json +++ b/spiffworkflow-backend/tests/data/simple_form/simple_form_ui.json @@ -1,9 +1,9 @@ { - "name": { + "name": { "ui:title": "Name", "ui:description": "(Your name)" }, - "department": { + "department": { "ui:title": "Department", "ui:description": "(Your department)" }, diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py b/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py index 44c99908..9bc08bcd 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/base_test.py @@ -11,9 +11,6 @@ from flask import current_app from flask.testing import FlaskClient from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db -from tests.spiffworkflow_backend.helpers.test_data import load_test_spec -from werkzeug.test import TestResponse # type: ignore - from spiffworkflow_backend.models.permission_assignment import Permission from spiffworkflow_backend.models.permission_target import PermissionTargetModel from spiffworkflow_backend.models.process_group import ProcessGroup @@ -27,6 +24,8 @@ from spiffworkflow_backend.services.authorization_service import AuthorizationSe from spiffworkflow_backend.services.file_system_service import FileSystemService from spiffworkflow_backend.services.process_model_service import ProcessModelService from spiffworkflow_backend.services.user_service import UserService +from tests.spiffworkflow_backend.helpers.test_data import load_test_spec +from werkzeug.test import TestResponse # type: ignore # from tests.spiffworkflow_backend.helpers.test_data import logged_in_headers diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/example_data.py b/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/example_data.py index befd2602..eff4b13c 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/example_data.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/example_data.py @@ -4,7 +4,6 @@ import os from typing import Optional from flask import current_app - from spiffworkflow_backend.models.process_model import ProcessModelInfo from spiffworkflow_backend.services.process_model_service import ProcessModelService from spiffworkflow_backend.services.spec_file_service import SpecFileService diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/test_data.py b/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/test_data.py index d6b4f730..0ce535d1 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/test_data.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/helpers/test_data.py @@ -1,14 +1,13 @@ """User.""" from typing import Optional -from tests.spiffworkflow_backend.helpers.example_data import ExampleDataLoader - from spiffworkflow_backend.exceptions.process_entity_not_found_error import ( ProcessEntityNotFoundError, ) from spiffworkflow_backend.models.process_group import ProcessGroup from spiffworkflow_backend.models.process_model import ProcessModelInfo from spiffworkflow_backend.services.process_model_service import ProcessModelService +from tests.spiffworkflow_backend.helpers.example_data import ExampleDataLoader def assure_process_group_exists(process_group_id: Optional[str] = None) -> ProcessGroup: diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_authentication.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_authentication.py index 34e4d71b..53794348 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_authentication.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_authentication.py @@ -2,11 +2,10 @@ import ast import base64 -from tests.spiffworkflow_backend.helpers.base_test import BaseTest - from spiffworkflow_backend.services.authentication_service import ( AuthenticationService, ) +from tests.spiffworkflow_backend.helpers.base_test import BaseTest class TestAuthentication(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_logging_service.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_logging_service.py index 97dafaf3..a5e3e36d 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_logging_service.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_logging_service.py @@ -1,9 +1,8 @@ """Test_logging_service.""" from flask.app import Flask from flask.testing import FlaskClient -from tests.spiffworkflow_backend.helpers.base_test import BaseTest - from spiffworkflow_backend.models.user import UserModel +from tests.spiffworkflow_backend.helpers.base_test import BaseTest class TestLoggingService(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_nested_groups.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_nested_groups.py index 3a12acf6..2c42aaf6 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_nested_groups.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_nested_groups.py @@ -3,8 +3,6 @@ import json from flask.app import Flask from flask.testing import FlaskClient -from tests.spiffworkflow_backend.helpers.base_test import BaseTest - from spiffworkflow_backend.models.process_group import ProcessGroup from spiffworkflow_backend.models.process_group import ProcessGroupSchema from spiffworkflow_backend.models.process_model import ProcessModelInfo @@ -13,6 +11,7 @@ from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.process_instance_service import ( ProcessInstanceService, ) +from tests.spiffworkflow_backend.helpers.base_test import BaseTest class TestNestedGroups(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py index fbbf7deb..9aa91f8b 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py @@ -9,9 +9,6 @@ import pytest from flask.app import Flask from flask.testing import FlaskClient from flask_bpmn.models.db import db -from tests.spiffworkflow_backend.helpers.base_test import BaseTest -from tests.spiffworkflow_backend.helpers.test_data import load_test_spec - from spiffworkflow_backend.exceptions.process_entity_not_found_error import ( ProcessEntityNotFoundError, ) @@ -36,6 +33,8 @@ from spiffworkflow_backend.services.process_instance_service import ( ProcessInstanceService, ) from spiffworkflow_backend.services.process_model_service import ProcessModelService +from tests.spiffworkflow_backend.helpers.base_test import BaseTest +from tests.spiffworkflow_backend.helpers.test_data import load_test_spec # from spiffworkflow_backend.services.git_service import GitService diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_secret_service.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_secret_service.py index 071ef6cc..ea1a486e 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_secret_service.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_secret_service.py @@ -6,15 +6,14 @@ import pytest from flask.app import Flask from flask.testing import FlaskClient from flask_bpmn.api.api_error import ApiError -from tests.spiffworkflow_backend.helpers.base_test import BaseTest -from werkzeug.test import TestResponse # type: ignore - from spiffworkflow_backend.models.process_model import ProcessModelInfo from spiffworkflow_backend.models.secret_model import SecretModel from spiffworkflow_backend.models.secret_model import SecretModelSchema from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.process_model_service import ProcessModelService from spiffworkflow_backend.services.secret_service import SecretService +from tests.spiffworkflow_backend.helpers.base_test import BaseTest +from werkzeug.test import TestResponse # type: ignore class SecretServiceTestHelpers(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_group_members.py b/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_group_members.py index 8a6046b5..b38296be 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_group_members.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_group_members.py @@ -2,15 +2,14 @@ from flask.app import Flask from flask.testing import FlaskClient from flask_bpmn.models.db import db -from tests.spiffworkflow_backend.helpers.base_test import BaseTest -from tests.spiffworkflow_backend.helpers.test_data import load_test_spec - from spiffworkflow_backend.models.group import GroupModel from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.process_instance_processor import ( ProcessInstanceProcessor, ) from spiffworkflow_backend.services.user_service import UserService +from tests.spiffworkflow_backend.helpers.base_test import BaseTest +from tests.spiffworkflow_backend.helpers.test_data import load_test_spec class TestGetGroupMembers(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_localtime.py b/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_localtime.py index f1834ab3..7b5ba383 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_localtime.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_localtime.py @@ -4,9 +4,6 @@ import datetime import pytz from flask.app import Flask from flask.testing import FlaskClient -from tests.spiffworkflow_backend.helpers.base_test import BaseTest -from tests.spiffworkflow_backend.helpers.test_data import load_test_spec - from spiffworkflow_backend.models.script_attributes_context import ( ScriptAttributesContext, ) @@ -17,6 +14,8 @@ from spiffworkflow_backend.services.process_instance_processor import ( from spiffworkflow_backend.services.process_instance_service import ( ProcessInstanceService, ) +from tests.spiffworkflow_backend.helpers.base_test import BaseTest +from tests.spiffworkflow_backend.helpers.test_data import load_test_spec class TestGetLocaltime(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_acceptance_test_fixtures.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_acceptance_test_fixtures.py index 1d515712..a9305a04 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_acceptance_test_fixtures.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_acceptance_test_fixtures.py @@ -1,6 +1,5 @@ """Test_acceptance_test_fixtures.""" from flask.app import Flask - from spiffworkflow_backend.services.acceptance_test_fixtures import ( load_acceptance_test_fixtures, ) diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_authorization_service.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_authorization_service.py index 36f07743..00134bdd 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_authorization_service.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_authorization_service.py @@ -2,8 +2,6 @@ import pytest from flask import Flask from flask.testing import FlaskClient -from tests.spiffworkflow_backend.helpers.base_test import BaseTest - from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.models.user import UserNotFoundError from spiffworkflow_backend.services.authorization_service import AuthorizationService @@ -14,6 +12,7 @@ from spiffworkflow_backend.services.process_instance_service import ( ProcessInstanceService, ) from spiffworkflow_backend.services.process_model_service import ProcessModelService +from tests.spiffworkflow_backend.helpers.base_test import BaseTest class TestAuthorizationService(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_dot_notation.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_dot_notation.py index 80b05254..6dcd385d 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_dot_notation.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_dot_notation.py @@ -1,8 +1,6 @@ """Test_various_bpmn_constructs.""" from flask.app import Flask from flask.testing import FlaskClient -from tests.spiffworkflow_backend.helpers.base_test import BaseTest - from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.process_instance_processor import ( ProcessInstanceProcessor, @@ -10,6 +8,7 @@ from spiffworkflow_backend.services.process_instance_processor import ( from spiffworkflow_backend.services.process_instance_service import ( ProcessInstanceService, ) +from tests.spiffworkflow_backend.helpers.base_test import BaseTest class TestDotNotation(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_environment_var_script.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_environment_var_script.py index ac96e7e4..e00fb770 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_environment_var_script.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_environment_var_script.py @@ -1,10 +1,9 @@ """Test_environment_var_script.""" from flask import Flask -from tests.spiffworkflow_backend.helpers.base_test import BaseTest - from spiffworkflow_backend.services.process_instance_processor import ( ProcessInstanceProcessor, ) +from tests.spiffworkflow_backend.helpers.base_test import BaseTest class TestEnvironmentVarScript(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_message_instance.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_message_instance.py index 0292032e..f91290e5 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_message_instance.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_message_instance.py @@ -3,12 +3,11 @@ import pytest from flask import Flask from flask.testing import FlaskClient from flask_bpmn.models.db import db -from tests.spiffworkflow_backend.helpers.base_test import BaseTest - from spiffworkflow_backend.models.message_instance import MessageInstanceModel from spiffworkflow_backend.models.message_model import MessageModel from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.process_model_service import ProcessModelService +from tests.spiffworkflow_backend.helpers.base_test import BaseTest class TestMessageInstance(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_message_service.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_message_service.py index aa1f2805..46b98c4a 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_message_service.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_message_service.py @@ -1,9 +1,6 @@ """Test_message_service.""" from flask import Flask from flask.testing import FlaskClient -from tests.spiffworkflow_backend.helpers.base_test import BaseTest -from tests.spiffworkflow_backend.helpers.test_data import load_test_spec - from spiffworkflow_backend.models.message_correlation import MessageCorrelationModel from spiffworkflow_backend.models.message_correlation_message_instance import ( MessageCorrelationMessageInstanceModel, @@ -18,6 +15,8 @@ from spiffworkflow_backend.services.process_instance_processor import ( from spiffworkflow_backend.services.process_instance_service import ( ProcessInstanceService, ) +from tests.spiffworkflow_backend.helpers.base_test import BaseTest +from tests.spiffworkflow_backend.helpers.test_data import load_test_spec class TestMessageService(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permission_target.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permission_target.py index 56768142..a6fefd68 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permission_target.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permission_target.py @@ -2,12 +2,11 @@ import pytest from flask.app import Flask from flask_bpmn.models.db import db -from tests.spiffworkflow_backend.helpers.base_test import BaseTest - from spiffworkflow_backend.models.permission_target import ( InvalidPermissionTargetUriError, ) from spiffworkflow_backend.models.permission_target import PermissionTargetModel +from tests.spiffworkflow_backend.helpers.base_test import BaseTest class TestPermissionTarget(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permissions.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permissions.py index b66f3237..efb414cf 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permissions.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_permissions.py @@ -2,15 +2,14 @@ from flask.app import Flask from flask.testing import FlaskClient from flask_bpmn.models.db import db -from tests.spiffworkflow_backend.helpers.base_test import BaseTest -from tests.spiffworkflow_backend.helpers.test_data import load_test_spec - from spiffworkflow_backend.models.group import GroupModel from spiffworkflow_backend.models.permission_assignment import PermissionAssignmentModel from spiffworkflow_backend.models.permission_target import PermissionTargetModel from spiffworkflow_backend.models.principal import PrincipalModel from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.user_service import UserService +from tests.spiffworkflow_backend.helpers.base_test import BaseTest +from tests.spiffworkflow_backend.helpers.test_data import load_test_spec # we think we can get the list of roles for a user. diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_group.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_group.py index 6c3ad0ad..b2cf3c44 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_group.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_group.py @@ -1,6 +1,5 @@ """Process Model.""" from flask.app import Flask - from spiffworkflow_backend.models.process_group import ProcessGroup from spiffworkflow_backend.services.process_model_service import ProcessModelService diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_processor.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_processor.py index f0de77aa..77109809 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_processor.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_processor.py @@ -3,9 +3,6 @@ import pytest from flask import g from flask.app import Flask from flask.testing import FlaskClient -from tests.spiffworkflow_backend.helpers.base_test import BaseTest -from tests.spiffworkflow_backend.helpers.test_data import load_test_spec - from spiffworkflow_backend.models.group import GroupModel from spiffworkflow_backend.models.process_instance import ProcessInstanceStatus from spiffworkflow_backend.models.user import UserModel @@ -19,6 +16,8 @@ from spiffworkflow_backend.services.process_instance_processor import ( from spiffworkflow_backend.services.process_instance_service import ( ProcessInstanceService, ) +from tests.spiffworkflow_backend.helpers.base_test import BaseTest +from tests.spiffworkflow_backend.helpers.test_data import load_test_spec class TestProcessInstanceProcessor(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_report.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_report.py index 48239507..ccfb088f 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_report.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_report.py @@ -2,12 +2,11 @@ from typing import Optional from flask.app import Flask -from tests.spiffworkflow_backend.helpers.base_test import BaseTest - from spiffworkflow_backend.models.process_instance import ProcessInstanceModel from spiffworkflow_backend.models.process_instance_report import ( ProcessInstanceReportModel, ) +from tests.spiffworkflow_backend.helpers.base_test import BaseTest # from tests.spiffworkflow_backend.helpers.test_data import find_or_create_process_group # from spiffworkflow_backend.models.permission_assignment import PermissionAssignmentModel diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_report_service.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_report_service.py index 98412faa..8cf0d3e2 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_report_service.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_instance_report_service.py @@ -3,8 +3,6 @@ from typing import Optional from flask import Flask from flask.testing import FlaskClient -from tests.spiffworkflow_backend.helpers.base_test import BaseTest - from spiffworkflow_backend.models.process_instance_report import ( ProcessInstanceReportModel, ) @@ -15,6 +13,7 @@ from spiffworkflow_backend.services.process_instance_report_service import ( from spiffworkflow_backend.services.process_instance_report_service import ( ProcessInstanceReportService, ) +from tests.spiffworkflow_backend.helpers.base_test import BaseTest class TestProcessInstanceReportFilter(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model.py index 09421bc7..b4f62bab 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model.py @@ -2,15 +2,14 @@ from flask.app import Flask from flask.testing import FlaskClient from flask_bpmn.models.db import db -from tests.spiffworkflow_backend.helpers.base_test import BaseTest -from tests.spiffworkflow_backend.helpers.test_data import load_test_spec - from spiffworkflow_backend.models.process_model import ProcessModelInfo from spiffworkflow_backend.models.spec_reference import SpecReferenceCache from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.process_instance_processor import ( ProcessInstanceProcessor, ) +from tests.spiffworkflow_backend.helpers.base_test import BaseTest +from tests.spiffworkflow_backend.helpers.test_data import load_test_spec class TestProcessModel(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_service.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_service.py index 7127eb41..44497542 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_service.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_service.py @@ -1,11 +1,10 @@ """Test_process_model_service.""" from flask import Flask from flask.testing import FlaskClient -from tests.spiffworkflow_backend.helpers.base_test import BaseTest -from tests.spiffworkflow_backend.helpers.test_data import load_test_spec - from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.process_model_service import ProcessModelService +from tests.spiffworkflow_backend.helpers.base_test import BaseTest +from tests.spiffworkflow_backend.helpers.test_data import load_test_spec class TestProcessModelService(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_restricted_script_engine.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_restricted_script_engine.py index d31ea424..46f88e74 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_restricted_script_engine.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_restricted_script_engine.py @@ -3,13 +3,12 @@ import pytest from flask.app import Flask from flask.testing import FlaskClient from flask_bpmn.api.api_error import ApiError -from tests.spiffworkflow_backend.helpers.base_test import BaseTest -from tests.spiffworkflow_backend.helpers.test_data import load_test_spec - from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.process_instance_processor import ( ProcessInstanceProcessor, ) +from tests.spiffworkflow_backend.helpers.base_test import BaseTest +from tests.spiffworkflow_backend.helpers.test_data import load_test_spec class TestOpenFile(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_script_unit_test_runner.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_script_unit_test_runner.py index 9ece043a..38a03c11 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_script_unit_test_runner.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_script_unit_test_runner.py @@ -1,15 +1,14 @@ """Test Permissions.""" from flask.app import Flask from flask.testing import FlaskClient -from tests.spiffworkflow_backend.helpers.base_test import BaseTest -from tests.spiffworkflow_backend.helpers.test_data import load_test_spec - from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.process_instance_processor import ( ProcessInstanceProcessor, ) from spiffworkflow_backend.services.script_unit_test_runner import PythonScriptContext from spiffworkflow_backend.services.script_unit_test_runner import ScriptUnitTestRunner +from tests.spiffworkflow_backend.helpers.base_test import BaseTest +from tests.spiffworkflow_backend.helpers.test_data import load_test_spec class TestScriptUnitTestRunner(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_service_task_delegate.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_service_task_delegate.py index 95b55756..647db175 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_service_task_delegate.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_service_task_delegate.py @@ -1,9 +1,8 @@ """Test_various_bpmn_constructs.""" from flask.app import Flask -from tests.spiffworkflow_backend.helpers.base_test import BaseTest - from spiffworkflow_backend.services.secret_service import SecretService from spiffworkflow_backend.services.service_task_service import ServiceTaskDelegate +from tests.spiffworkflow_backend.helpers.base_test import BaseTest class TestServiceTaskDelegate(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spec_file_service.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spec_file_service.py index 9f5c5f8a..25d9e444 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spec_file_service.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spec_file_service.py @@ -6,13 +6,12 @@ from flask import Flask from flask.testing import FlaskClient from flask_bpmn.models.db import db from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException # type: ignore -from tests.spiffworkflow_backend.helpers.base_test import BaseTest -from tests.spiffworkflow_backend.helpers.test_data import load_test_spec - from spiffworkflow_backend.models.spec_reference import SpecReferenceCache from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.process_model_service import ProcessModelService from spiffworkflow_backend.services.spec_file_service import SpecFileService +from tests.spiffworkflow_backend.helpers.base_test import BaseTest +from tests.spiffworkflow_backend.helpers.test_data import load_test_spec class TestSpecFileService(BaseTest): diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spiff_logging.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spiff_logging.py index d8680b71..fe5c8afe 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spiff_logging.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_spiff_logging.py @@ -3,11 +3,10 @@ from decimal import Decimal from flask.app import Flask from flask_bpmn.models.db import db +from spiffworkflow_backend.models.spiff_logging import SpiffLoggingModel from tests.spiffworkflow_backend.helpers.base_test import BaseTest from tests.spiffworkflow_backend.helpers.test_data import load_test_spec -from spiffworkflow_backend.models.spiff_logging import SpiffLoggingModel - class TestSpiffLogging(BaseTest): """TestSpiffLogging.""" diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_various_bpmn_constructs.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_various_bpmn_constructs.py index aa91fcfd..9ff29907 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_various_bpmn_constructs.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_various_bpmn_constructs.py @@ -1,13 +1,12 @@ """Test_various_bpmn_constructs.""" from flask.app import Flask from flask.testing import FlaskClient -from tests.spiffworkflow_backend.helpers.base_test import BaseTest - from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.process_instance_processor import ( ProcessInstanceProcessor, ) from spiffworkflow_backend.services.process_model_service import ProcessModelService +from tests.spiffworkflow_backend.helpers.base_test import BaseTest class TestVariousBpmnConstructs(BaseTest): diff --git a/spiffworkflow-backend/tests/test_main.py b/spiffworkflow-backend/tests/test_main.py index 7917a970..001dbcc6 100644 --- a/spiffworkflow-backend/tests/test_main.py +++ b/spiffworkflow-backend/tests/test_main.py @@ -1,7 +1,6 @@ """Test cases for the __main__ module.""" import pytest from click.testing import CliRunner - from spiffworkflow_backend import __main__ From df213893ca3b12faed6a92a75edf7137420016fc Mon Sep 17 00:00:00 2001 From: jbirddog <100367399+jbirddog@users.noreply.github.com> Date: Fri, 18 Nov 2022 15:54:52 -0500 Subject: [PATCH 33/84] Insert every spiff log, see if it helps the deadlock issue on demo (#51) --- .../src/spiffworkflow_backend/services/logging_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py index c4e8c8ae..b93e8665 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py @@ -236,5 +236,5 @@ class DBHandler(logging.Handler): "spiff_step": spiff_step, } ) - if len(self.logs) % 1000 == 0: + if len(self.logs) % 1 == 0: self.bulk_insert_logs() From 7b21ff4eec69f304de3a2415803ba00dca2c000f Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 18 Nov 2022 16:40:49 -0500 Subject: [PATCH 34/84] added create new instance page and moved model run to a component w/ burnettk cullerton --- .../src/components/ProcessGroupListTiles.tsx | 4 +- .../src/components/ProcessInstanceRun.tsx | 64 +++++++++++ .../src/components/ProcessModelForm.tsx | 2 +- .../src/components/ProcessModelListTiles.tsx | 105 ++++++++++++++++++ spiffworkflow-frontend/src/index.css | 13 ++- spiffworkflow-frontend/src/interfaces.ts | 5 + .../src/routes/CreateNewInstance.tsx | 9 ++ .../src/routes/HomePageRoutes.tsx | 7 ++ .../src/routes/ProcessModelShow.tsx | 42 ++----- 9 files changed, 216 insertions(+), 35 deletions(-) create mode 100644 spiffworkflow-frontend/src/components/ProcessInstanceRun.tsx create mode 100644 spiffworkflow-frontend/src/components/ProcessModelListTiles.tsx create mode 100644 spiffworkflow-frontend/src/routes/CreateNewInstance.tsx diff --git a/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx b/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx index 839f2149..4c964bec 100644 --- a/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx +++ b/spiffworkflow-frontend/src/components/ProcessGroupListTiles.tsx @@ -60,10 +60,10 @@ export default function ProcessGroupListTiles({
{row.display_name}
-

+

{truncateString(row.description || '', 25)}

-

+

Total Sub Items: {processGroupDirectChildrenCount(row)}

diff --git a/spiffworkflow-frontend/src/components/ProcessInstanceRun.tsx b/spiffworkflow-frontend/src/components/ProcessInstanceRun.tsx new file mode 100644 index 00000000..c4f288c0 --- /dev/null +++ b/spiffworkflow-frontend/src/components/ProcessInstanceRun.tsx @@ -0,0 +1,64 @@ +import { useContext } from 'react'; +import { useNavigate } from 'react-router-dom'; +import { + Button, + // @ts-ignore +} from '@carbon/react'; +import { ProcessModel } from '../interfaces'; +import HttpService from '../services/HttpService'; +import ErrorContext from '../contexts/ErrorContext'; +import { modifyProcessModelPath } from '../helpers'; + +type OwnProps = { + processModel: ProcessModel; + onSuccessCallback: Function; + className?: string; +}; + +export default function ProcessInstanceRun({ + processModel, + onSuccessCallback, + className, +}: OwnProps) { + const navigate = useNavigate(); + const setErrorMessage = (useContext as any)(ErrorContext)[1]; + const modifiedProcessModelId = modifyProcessModelPath(processModel.id); + + const onProcessInstanceRun = (processInstance: any) => { + // FIXME: ensure that the task is actually for the current user as well + const processInstanceId = (processInstance as any).id; + const nextTask = (processInstance as any).next_task; + if (nextTask && nextTask.state === 'READY') { + navigate(`/tasks/${processInstanceId}/${nextTask.id}`); + } + onSuccessCallback(processInstance); + }; + + const processModelRun = (processInstance: any) => { + setErrorMessage(null); + HttpService.makeCallToBackend({ + path: `/process-instances/${processInstance.id}/run`, + successCallback: onProcessInstanceRun, + failureCallback: setErrorMessage, + httpMethod: 'POST', + }); + }; + + const processInstanceCreateAndRun = () => { + HttpService.makeCallToBackend({ + path: `/process-models/${modifiedProcessModelId}/process-instances`, + successCallback: processModelRun, + httpMethod: 'POST', + }); + }; + + return ( + + ); +} diff --git a/spiffworkflow-frontend/src/components/ProcessModelForm.tsx b/spiffworkflow-frontend/src/components/ProcessModelForm.tsx index 10f4ffd3..532e3927 100644 --- a/spiffworkflow-frontend/src/components/ProcessModelForm.tsx +++ b/spiffworkflow-frontend/src/components/ProcessModelForm.tsx @@ -42,7 +42,7 @@ export default function ProcessModelForm({ const handleFormSubmission = (event: any) => { event.preventDefault(); let hasErrors = false; - if (!hasValidIdentifier(processModel.id)) { + if (mode === 'new' && !hasValidIdentifier(processModel.id)) { setIdentifierInvalid(true); hasErrors = true; } diff --git a/spiffworkflow-frontend/src/components/ProcessModelListTiles.tsx b/spiffworkflow-frontend/src/components/ProcessModelListTiles.tsx new file mode 100644 index 00000000..a10fd754 --- /dev/null +++ b/spiffworkflow-frontend/src/components/ProcessModelListTiles.tsx @@ -0,0 +1,105 @@ +import { ReactElement, useEffect, useState } from 'react'; +import { Link, useSearchParams } from 'react-router-dom'; +import { + Tile, + // @ts-ignore +} from '@carbon/react'; +import HttpService from '../services/HttpService'; +import { ProcessModel, ProcessInstance } from '../interfaces'; +import { modifyProcessModelPath, truncateString } from '../helpers'; +import ProcessInstanceRun from './ProcessInstanceRun'; + +type OwnProps = { + headerElement?: ReactElement; +}; + +export default function ProcessModelListTiles({ headerElement }: OwnProps) { + const [searchParams] = useSearchParams(); + const [processModels, setProcessModels] = useState( + null + ); + const [processInstance, setProcessInstance] = + useState(null); + + useEffect(() => { + const setProcessModelsFromResult = (result: any) => { + setProcessModels(result.results); + }; + // only allow 10 for now until we get the backend only returnin certain models for user execution + const queryParams = '?per_page=10'; + HttpService.makeCallToBackend({ + path: `/process-models${queryParams}`, + successCallback: setProcessModelsFromResult, + }); + }, [searchParams]); + + const processInstanceRunResultTag = () => { + if (processInstance) { + return ( +
+

+ Process Instance {processInstance.id} kicked off ( + + view + + ). +

+
+ ); + } + return null; + }; + + const processModelsDisplayArea = () => { + let displayText = null; + if (processModels && processModels.length > 0) { + displayText = (processModels || []).map((row: ProcessModel) => { + return ( + +
+
{row.display_name}
+

+ {truncateString(row.description || '', 25)} +

+ +
+
+ ); + }); + } else { + displayText =

No Models To Display

; + } + return displayText; + }; + + const processModelArea = () => { + if (processModels && processModels.length > 0) { + return ( + <> + {headerElement} + {processInstanceRunResultTag()} + {processModelsDisplayArea()} + + ); + } + return null; + }; + + if (processModels) { + return <>{processModelArea()}; + } + return null; +} diff --git a/spiffworkflow-frontend/src/index.css b/spiffworkflow-frontend/src/index.css index 3b803517..0d267086 100644 --- a/spiffworkflow-frontend/src/index.css +++ b/spiffworkflow-frontend/src/index.css @@ -215,7 +215,15 @@ in on this with the react-jsonschema-form repo. This is just a patch fix to allo order: 0; } -.tile-process-group-description { +.tile-title-top { + margin-bottom: 2em; + font-size: 20px; + line-height: 28px; + color: #161616; + order: 0; +} + +.tile-description { font-size: 14px; line-height: 20px; letter-spacing: 0.16px; @@ -229,6 +237,9 @@ in on this with the react-jsonschema-form repo. This is just a patch fix to allo letter-spacing: 0.16px; color: #161616; order: 1; +} + +.tile-pin-bottom { position: absolute; bottom: 1em; } diff --git a/spiffworkflow-frontend/src/interfaces.ts b/spiffworkflow-frontend/src/interfaces.ts index a9ac1ec0..aceca049 100644 --- a/spiffworkflow-frontend/src/interfaces.ts +++ b/spiffworkflow-frontend/src/interfaces.ts @@ -36,6 +36,11 @@ export interface ProcessFile { file_contents?: string; } +export interface ProcessInstance { + id: number; + process_model_identifier: string; +} + export interface ProcessModel { id: string; description: string; diff --git a/spiffworkflow-frontend/src/routes/CreateNewInstance.tsx b/spiffworkflow-frontend/src/routes/CreateNewInstance.tsx new file mode 100644 index 00000000..fbb3f844 --- /dev/null +++ b/spiffworkflow-frontend/src/routes/CreateNewInstance.tsx @@ -0,0 +1,9 @@ +import ProcessModelListTiles from '../components/ProcessModelListTiles'; + +export default function CreateNewInstance() { + return ( + Process models available to you} + /> + ); +} diff --git a/spiffworkflow-frontend/src/routes/HomePageRoutes.tsx b/spiffworkflow-frontend/src/routes/HomePageRoutes.tsx index 9f4bc698..99e535e5 100644 --- a/spiffworkflow-frontend/src/routes/HomePageRoutes.tsx +++ b/spiffworkflow-frontend/src/routes/HomePageRoutes.tsx @@ -7,6 +7,7 @@ import ErrorContext from '../contexts/ErrorContext'; import MyTasks from './MyTasks'; import GroupedTasks from './GroupedTasks'; import CompletedInstances from './CompletedInstances'; +import CreateNewInstance from './CreateNewInstance'; export default function HomePageRoutes() { const location = useLocation(); @@ -21,6 +22,8 @@ export default function HomePageRoutes() { newSelectedTabIndex = 1; } else if (location.pathname.match(/^\/tasks\/completed-instances\b/)) { newSelectedTabIndex = 2; + } else if (location.pathname.match(/^\/tasks\/create-new-instance\b/)) { + newSelectedTabIndex = 3; } setSelectedTabIndex(newSelectedTabIndex); }, [location, setErrorMessage]); @@ -34,6 +37,9 @@ export default function HomePageRoutes() { navigate('/tasks/completed-instances')}> Completed Instances + navigate('/tasks/create-new-instance')}> + Create New Instance + +
@@ -43,6 +49,7 @@ export default function HomePageRoutes() { } /> } /> } /> + } /> ); diff --git a/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx b/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx index 957a37e7..d154075a 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelShow.tsx @@ -38,6 +38,7 @@ import { import { PermissionsToCheck, ProcessFile, + ProcessInstance, ProcessModel, RecentProcessModel, } from '../interfaces'; @@ -45,6 +46,7 @@ import ButtonWithConfirmation from '../components/ButtonWithConfirmation'; import ProcessInstanceListTable from '../components/ProcessInstanceListTable'; import { usePermissionFetcher } from '../hooks/PermissionService'; import { useUriListForPermissions } from '../hooks/UriListForPermissions'; +import ProcessInstanceRun from '../components/ProcessInstanceRun'; const storeRecentProcessModelInLocalStorage = ( processModelForStorage: ProcessModel @@ -100,7 +102,8 @@ export default function ProcessModelShow() { const setErrorMessage = (useContext as any)(ErrorContext)[1]; const [processModel, setProcessModel] = useState(null); - const [processInstanceResult, setProcessInstanceResult] = useState(null); + const [processInstance, setProcessInstance] = + useState(null); const [reloadModel, setReloadModel] = useState(false); const [filesToUpload, setFilesToUpload] = useState(null); const [showFileUploadModal, setShowFileUploadModal] = @@ -132,38 +135,14 @@ export default function ProcessModelShow() { }); }, [reloadModel, modifiedProcessModelId]); - const processModelRun = (processInstance: any) => { - setErrorMessage(null); - HttpService.makeCallToBackend({ - path: `/process-instances/${processInstance.id}/run`, - successCallback: setProcessInstanceResult, - failureCallback: setErrorMessage, - httpMethod: 'POST', - }); - }; - - const processInstanceCreateAndRun = () => { - HttpService.makeCallToBackend({ - path: `/process-models/${modifiedProcessModelId}/process-instances`, - successCallback: processModelRun, - httpMethod: 'POST', - }); - }; - const processInstanceRunResultTag = () => { - if (processModel && processInstanceResult) { - // FIXME: ensure that the task is actually for the current user as well - const processInstanceId = (processInstanceResult as any).id; - const nextTask = (processInstanceResult as any).next_task; - if (nextTask && nextTask.state === 'READY') { - navigate(`/tasks/${processInstanceId}/${nextTask.id}`); - } + if (processInstance) { return (

- Process Instance {processInstanceId} kicked off ( + Process Instance {processInstance.id} kicked off ( view @@ -572,9 +551,10 @@ export default function ProcessModelShow() { a={targetUris.processInstanceActionPath} ability={ability} > - +