From 2b62cf87fc56e8a77cb553680e6627a998bfaac8 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 10 Nov 2022 08:42:40 -0500 Subject: [PATCH 01/15] support process-groups in breadcrumb component --- .../src/components/ProcessBreadcrumb.tsx | 11 ++++++++--- .../src/routes/ProcessGroupEdit.tsx | 10 +++++++++- .../src/routes/ProcessModelEdit.tsx | 12 +++++++++++- .../src/routes/ProcessModelNew.tsx | 10 +++++++++- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx b/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx index 3b2a9af9..fcd8b50d 100644 --- a/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx +++ b/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx @@ -13,7 +13,7 @@ type OwnProps = { const explodeCrumb = (crumb: HotCrumbItem) => { const url: string = crumb[1] || ''; // eslint-disable-next-line @typescript-eslint/no-unused-vars - const [_unused, processModelId, link] = url.split(':'); + const [endingUrlType, processModelId, link] = url.split(':'); const processModelIdSegments = splitProcessModelId(processModelId); const paths: string[] = []; const lastPathItem = processModelIdSegments.pop(); @@ -29,7 +29,12 @@ const explodeCrumb = (crumb: HotCrumbItem) => { } ); if (link === 'link') { - const lastUrl = `/admin/process-models/${paths.join(':')}:${lastPathItem}`; + if (lastPathItem !== undefined) { + paths.push(lastPathItem); + } + const lastUrl = `/admin/${endingUrlType.replace('_', '-')}s/${paths.join( + ':' + )}`; breadcrumbItems.push( {lastPathItem} @@ -64,7 +69,7 @@ export default function ProcessBreadcrumb({ ); } - if (url && url.startsWith('process_model:')) { + if (url && url.match(/^process_(model|group):/)) { return explodeCrumb(crumb); } return ( diff --git a/spiffworkflow-frontend/src/routes/ProcessGroupEdit.tsx b/spiffworkflow-frontend/src/routes/ProcessGroupEdit.tsx index d624309c..21bba49d 100644 --- a/spiffworkflow-frontend/src/routes/ProcessGroupEdit.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessGroupEdit.tsx @@ -24,7 +24,15 @@ export default function ProcessGroupEdit() { if (processGroup) { return ( <> - +

Edit Process Group: {(processGroup as any).id}

(null); const processModelPath = `process-models/${params.process_model_id}`; useEffect(() => { @@ -20,6 +21,15 @@ export default function ProcessModelEdit() { if (processModel) { return ( <> +

Edit Process Model: {(processModel as any).id}

- +

Add Process Model

Date: Thu, 10 Nov 2022 09:13:27 -0500 Subject: [PATCH 02/15] cleaned up breadcrumbs some more and cleaned up console.log statements --- .../src/components/ProcessBreadcrumb.tsx | 9 ++--- .../src/components/ProcessGroupForm.tsx | 3 -- .../src/components/ReactDiagramEditor.tsx | 7 ++-- .../src/routes/ProcessGroupNew.tsx | 11 ++++-- .../src/routes/ProcessGroupShow.tsx | 34 ++++++++----------- .../src/routes/ProcessInstanceLogList.tsx | 1 - .../src/routes/ProcessModelEditDiagram.tsx | 5 ++- 7 files changed, 34 insertions(+), 36 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx b/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx index fcd8b50d..6408be2d 100644 --- a/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx +++ b/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx @@ -32,9 +32,10 @@ const explodeCrumb = (crumb: HotCrumbItem) => { if (lastPathItem !== undefined) { paths.push(lastPathItem); } - const lastUrl = `/admin/${endingUrlType.replace('_', '-')}s/${paths.join( - ':' - )}`; + // process_models to process-models + const lastUrl = `/admin/${endingUrlType + .replace('_', '-') + .replace(/s*$/, 's')}/${paths.join(':')}`; breadcrumbItems.push( {lastPathItem} @@ -69,7 +70,7 @@ export default function ProcessBreadcrumb({ ); } - if (url && url.match(/^process_(model|group):/)) { + if (url && url.match(/^process[_-](model|group)s?:/)) { return explodeCrumb(crumb); } return ( diff --git a/spiffworkflow-frontend/src/components/ProcessGroupForm.tsx b/spiffworkflow-frontend/src/components/ProcessGroupForm.tsx index 5006fc0a..3d51adeb 100644 --- a/spiffworkflow-frontend/src/components/ProcessGroupForm.tsx +++ b/spiffworkflow-frontend/src/components/ProcessGroupForm.tsx @@ -79,12 +79,9 @@ export default function ProcessGroupForm({ description: processGroup.description, }; if (mode === 'new') { - console.log(`parentGroupId: ${parentGroupId}`); - console.log(`processGroup.id: ${processGroup.id}`); if (parentGroupId) { newProcessGroupId = `${parentGroupId}/${processGroup.id}`; } - console.log(`newProcessGroupId: ${newProcessGroupId}`); Object.assign(postBody, { id: parentGroupId ? `${parentGroupId}/${processGroup.id}` diff --git a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx index e9ddb445..37a947e4 100644 --- a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx +++ b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx @@ -229,7 +229,7 @@ export default function ReactDiagramEditor({ diagramModeler.on('spiff.script.edit', (event: any) => { const { error, element, scriptType, script, eventBus } = event; if (error) { - console.log(error); + console.error(error); } handleLaunchScriptEditor(element, script, scriptType, eventBus); }); @@ -237,7 +237,7 @@ export default function ReactDiagramEditor({ diagramModeler.on('spiff.markdown.edit', (event: any) => { const { error, element, value, eventBus } = event; if (error) { - console.log(error); + console.error(error); } handleLaunchMarkdownEditor(element, value, eventBus); }); @@ -318,7 +318,7 @@ export default function ReactDiagramEditor({ } function handleError(err: any) { - console.log('ERROR:', err); + console.error('ERROR:', err); } function checkTaskCanBeHighlighted(taskBpmnId: string) { @@ -406,7 +406,6 @@ export default function ReactDiagramEditor({ } function fetchDiagramFromURL(urlToUse: any) { - console.log(`urlToUse: ${urlToUse}`); fetch(urlToUse) .then((response) => response.text()) .then((text) => { diff --git a/spiffworkflow-frontend/src/routes/ProcessGroupNew.tsx b/spiffworkflow-frontend/src/routes/ProcessGroupNew.tsx index d4d8b038..c47b83bd 100644 --- a/spiffworkflow-frontend/src/routes/ProcessGroupNew.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessGroupNew.tsx @@ -1,18 +1,25 @@ import { useState } from 'react'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import ProcessGroupForm from '../components/ProcessGroupForm'; -import { ProcessGroup } from '../interfaces'; +import { ProcessGroup, HotCrumbItem } from '../interfaces'; export default function ProcessGroupNew() { + const searchParams = new URLSearchParams(document.location.search); + const parentGroupId = searchParams.get('parentGroupId'); const [processGroup, setProcessGroup] = useState({ id: '', display_name: '', description: '', }); + const hotCrumbs: HotCrumbItem[] = [['Process Groups', '/admin']]; + if (parentGroupId) { + hotCrumbs.push(['', `process_group:${parentGroupId}:link`]); + } + return ( <> - +

Add Process Group

{ - const modifiedProcessModelId: String = (row as any).id.replace('/', ':'); + const rows = processModels.map((row: ProcessModel) => { + const modifiedProcessModelId: String = row.id.replace('/', ':'); return ( - + - {(row as any).id} + {row.id} - {(row as any).display_name} + {row.display_name} ); }); @@ -85,21 +85,19 @@ export default function ProcessGroupShow() { if (processGroup === null) { return null; } - const rows = processGroups.map((row) => { - const modifiedProcessGroupId: String = modifyProcessModelPath( - (row as any).id - ); + const rows = processGroups.map((row: ProcessGroup) => { + const modifiedProcessGroupId: String = modifyProcessModelPath(row.id); return ( - + - {(row as any).id} + {row.id} - {(row as any).display_name} + {row.display_name} ); }); @@ -121,15 +119,13 @@ export default function ProcessGroupShow() { if (processGroup && pagination) { const { page, perPage } = getPageInfoFromSearchParams(searchParams); - const modifiedProcessGroupId = modifyProcessModelPath( - (processGroup as any).id - ); + const modifiedProcessGroupId = modifyProcessModelPath(processGroup.id); return ( <>
    @@ -159,7 +155,7 @@ export default function ProcessGroupShow() { perPage={perPage} pagination={pagination} tableToDisplay={buildModelTable()} - path={`/admin/process-groups/${(processGroup as any).id}`} + path={`/admin/process-groups/${processGroup.id}`} />

    @@ -168,7 +164,7 @@ export default function ProcessGroupShow() { perPage={perPage} pagination={pagination} tableToDisplay={buildGroupTable()} - path={`/admin/process-groups/${(processGroup as any).id}`} + path={`/admin/process-groups/${processGroup.id}`} />
diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx index 92961b0a..3bec8aef 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx @@ -36,7 +36,6 @@ export default function ProcessInstanceLogList() { // return null; const rows = processInstanceLogs.map((row) => { const rowToUse = row as any; - console.log(`rowToUse: ${rowToUse}`); return ( {rowToUse.bpmn_process_identifier} diff --git a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx index a60a42f0..85668d45 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx @@ -268,7 +268,7 @@ export default function ProcessModelEditDiagram() { }); event.eventBus.fire('spiff.json_files.returned', { options }); } else { - console.log('There is no process Model.'); + console.error('There is no process Model.'); } }; @@ -281,10 +281,9 @@ export default function ProcessModelEditDiagram() { options.push({ label: ref.name, value: ref.id }); }); }); - console.log('Options', options); event.eventBus.fire('spiff.dmn_files.returned', { options }); } else { - console.log('There is no process model.'); + console.error('There is no process model.'); } }; From dfff56e4606422cab5307100c2d2e493c785f696 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 10 Nov 2022 11:37:41 -0500 Subject: [PATCH 03/15] moved usage of ProcessBreadcrumb to use hotCrumbs except for report pages --- .../src/components/ProcessBreadcrumb.tsx | 2 +- .../src/routes/MessageInstanceList.tsx | 37 ++++++---- .../src/routes/ProcessInstanceLogList.tsx | 21 ++++-- .../src/routes/ProcessInstanceShow.tsx | 74 ++++++++++++------- .../src/routes/ProcessModelEdit.tsx | 1 - .../src/routes/ProcessModelShow.tsx | 2 +- .../src/routes/ReactFormEditor.tsx | 3 - 7 files changed, 88 insertions(+), 52 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx b/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx index 6408be2d..23d2558e 100644 --- a/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx +++ b/spiffworkflow-frontend/src/components/ProcessBreadcrumb.tsx @@ -32,7 +32,7 @@ const explodeCrumb = (crumb: HotCrumbItem) => { if (lastPathItem !== undefined) { paths.push(lastPathItem); } - // process_models to process-models + // process_model to process-models const lastUrl = `/admin/${endingUrlType .replace('_', '-') .replace(/s*$/, 's')}/${paths.join(':')}`; diff --git a/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx b/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx index 6bc0a57d..55e885ae 100644 --- a/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx +++ b/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx @@ -7,6 +7,8 @@ import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import { convertSecondsToFormattedDate, getPageInfoFromSearchParams, + modifyProcessModelPath, + unModifyProcessModelPath, } from '../helpers'; import HttpService from '../services/HttpService'; @@ -44,15 +46,9 @@ export default function MessageInstanceList() { - {rowToUse.process_group_identifier} - - - - {rowToUse.process_model_identifier} @@ -60,7 +56,9 @@ export default function MessageInstanceList() { {rowToUse.process_instance_id} @@ -80,7 +78,6 @@ export default function MessageInstanceList() { Instance Id - Process Group Process Model Process Instance Message Model @@ -107,9 +104,21 @@ export default function MessageInstanceList() { )}&process_instance_id=${searchParams.get('process_instance_id')}`; breadcrumbElement = ( ); } diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx index 3bec8aef..22303dec 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx @@ -8,6 +8,7 @@ import { getPageInfoFromSearchParams, convertSecondsToFormattedDate, modifyProcessModelPath, + unModifyProcessModelPath, } from '../helpers'; import HttpService from '../services/HttpService'; @@ -33,7 +34,6 @@ export default function ProcessInstanceLogList() { }, [searchParams, params]); const buildTable = () => { - // return null; const rows = processInstanceLogs.map((row) => { const rowToUse = row as any; return ( @@ -56,7 +56,7 @@ export default function ProcessInstanceLogList() { ); }); return ( - +
@@ -74,13 +74,24 @@ export default function ProcessInstanceLogList() { }; if (pagination) { + console.log('params.process_model_id', params.process_model_id); const { page, perPage } = getPageInfoFromSearchParams(searchParams); return (
{ return ( -
  • - - {label} - -
  • + + {label} + ); }; @@ -150,7 +155,7 @@ export default function ProcessInstanceShow() { return null; } - return spiffStepLink(processInstanceToUse, 'Previous Step', -1); + return spiffStepLink(processInstanceToUse, '<<', -1); }; const nextStepLink = (processInstanceToUse: any) => { @@ -158,7 +163,7 @@ export default function ProcessInstanceShow() { return null; } - return spiffStepLink(processInstanceToUse, 'Next Step', 1); + return spiffStepLink(processInstanceToUse, '>>', 1); }; const getInfoTag = (processInstanceToUse: any) => { @@ -177,7 +182,7 @@ export default function ProcessInstanceShow() { } return ( -
      +
    • Started:{' '} {convertSecondsToFormattedDate(processInstanceToUse.start_in_seconds)} @@ -200,13 +205,7 @@ export default function ProcessInstanceShow() { Messages
    • -
    • - Step {currentSpiffStep(processInstanceToUse)} of{' '} - {processInstanceToUse.spiff_step} -
    • - {previousStepLink(processInstanceToUse)} - {nextStepLink(processInstanceToUse)} -
    + ); }; @@ -433,6 +432,21 @@ export default function ProcessInstanceShow() { return null; }; + const stepsElement = (processInstanceToUse: any) => { + return ( + + + + {previousStepLink(processInstanceToUse)} + Step {currentSpiffStep(processInstanceToUse)} of{' '} + {processInstanceToUse.spiff_step} + {nextStepLink(processInstanceToUse)} + + + + ); + }; + if (processInstance && tasks) { const processInstanceToUse = processInstance as any; const taskIds = getTaskIds(); @@ -449,22 +463,28 @@ export default function ProcessInstanceShow() { `Process Model: ${processModelId}`, `process_model:${processModelId}:link`, ], - [`Process Instance: ${params.process_instance_id}`], + [`${processInstanceToUse.id}`], ]} /> +

    Process Instance Id: {processInstanceToUse.id}

    -

    Process Instance Id: {processInstanceToUse.id}

    {terminateButton(processInstanceToUse)} {suspendButton(processInstanceToUse)} {resumeButton(processInstanceToUse)}
    +
    +
    {getInfoTag(processInstanceToUse)} +
    {taskDataDisplayArea()} + {stepsElement(processInstanceToUse)} +
    -

    Edit Process Model: {(processModel as any).id}

    - + Date: Thu, 10 Nov 2022 12:31:26 -0500 Subject: [PATCH 04/15] Minor fixes for the launch buttons. --- .../src/routes/ProcessModelEditDiagram.tsx | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx index 85668d45..e93be421 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx @@ -640,21 +640,13 @@ export default function ProcessModelEditDiagram() { const markdownEditor = () => { return ( - - Edit Markdown Content - - - - - - - + ); }; @@ -684,33 +676,41 @@ export default function ProcessModelEditDiagram() { * @param processId */ - const fileNameTemplatePath = - '/admin/process-models/:process_model_id/files/:file_name'; + const onLaunchBpmnEditor = (processId: string) => { const file = findFileNameForReferenceId(processId, 'bpmn'); if (file) { - const path = generatePath(fileNameTemplatePath, { - process_model_id: params.process_model_id, - file_name: file.name, - }); + const path = generatePath( + '/admin/process-models/:process_model_id/files/:file_name', + { + process_model_id: params.process_model_id, + file_name: file.name, + } + ); window.open(path); } }; const onLaunchJsonEditor = (fileName: string) => { - const path = generatePath(fileNameTemplatePath, { - process_model_id: params.process_model_id, - file_name: fileName, - }); + const path = generatePath( + '/admin/process-models/:process_model_id/form/:file_name', + { + process_model_id: params.process_model_id, + file_name: fileName, + } + ); window.open(path); }; const onLaunchDmnEditor = (processId: string) => { const file = findFileNameForReferenceId(processId, 'dmn'); if (file) { - const path = generatePath(fileNameTemplatePath, { - process_model_id: params.process_model_id, - file_name: file.name, - }); + const path = generatePath( + '/admin/process-models/:process_model_id/files/:file_name', + { + process_model_id: params.process_model_id, + file_name: file.name, + } + ); window.open(path); } }; From b6a3c89bd4bf5e7e563a2d886dd44196230e947c Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 10 Nov 2022 13:38:28 -0500 Subject: [PATCH 05/15] Assure we are using the latest bpmn-js-spiffworkflow library. --- spiffworkflow-frontend/package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spiffworkflow-frontend/package-lock.json b/spiffworkflow-frontend/package-lock.json index 42c0fad8..79b2bbb5 100644 --- a/spiffworkflow-frontend/package-lock.json +++ b/spiffworkflow-frontend/package-lock.json @@ -7485,7 +7485,7 @@ }, "node_modules/bpmn-js-spiffworkflow": { "version": "0.0.8", - "resolved": "git+ssh://git@github.com/sartography/bpmn-js-spiffworkflow.git#24c2cc36067adf8fed75990c6bf4a1a67bc9122b", + "resolved": "git+ssh://git@github.com/sartography/bpmn-js-spiffworkflow.git#09fa713bb0bb1b9d4f97684afc46bc3711e11770", "license": "MIT", "dependencies": { "inherits": "^2.0.4", @@ -35755,7 +35755,7 @@ } }, "bpmn-js-spiffworkflow": { - "version": "git+ssh://git@github.com/sartography/bpmn-js-spiffworkflow.git#24c2cc36067adf8fed75990c6bf4a1a67bc9122b", + "version": "git+ssh://git@github.com/sartography/bpmn-js-spiffworkflow.git#09fa713bb0bb1b9d4f97684afc46bc3711e11770", "from": "bpmn-js-spiffworkflow@sartography/bpmn-js-spiffworkflow#main", "requires": { "inherits": "^2.0.4", From 701f9dcef9adb113dc95f75508e0972931f722e7 Mon Sep 17 00:00:00 2001 From: burnettk Date: Thu, 10 Nov 2022 14:32:39 -0500 Subject: [PATCH 06/15] fix lint --- .../src/routes/ProcessModelEditDiagram.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx index e93be421..a38be70f 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx @@ -641,12 +641,17 @@ export default function ProcessModelEditDiagram() { return ( - + ); }; @@ -676,8 +681,6 @@ export default function ProcessModelEditDiagram() { * @param processId */ - - const onLaunchBpmnEditor = (processId: string) => { const file = findFileNameForReferenceId(processId, 'bpmn'); if (file) { From 2f992e67cde2e577eba582c40b263c67d03477c4 Mon Sep 17 00:00:00 2001 From: burnettk Date: Thu, 10 Nov 2022 14:33:07 -0500 Subject: [PATCH 07/15] ignore pyrightconfig.json --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..73f59e5e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +pyrightconfig.json From 7aca52035c29c8101db631c0b27b99cbd7bc76a2 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 10 Nov 2022 15:44:58 -0500 Subject: [PATCH 08/15] fixed up the process instance show page and moved contents of scss to css file and load that last w/ burnettk --- .../models/process_instance.py | 1 - .../models/process_instance_report.py | 4 - .../services/process_instance_service.py | 2 +- spiffworkflow-frontend/src/config.tsx | 1 + spiffworkflow-frontend/src/helpers.tsx | 10 +- spiffworkflow-frontend/src/index.css | 110 ++++++++-- spiffworkflow-frontend/src/index.scss | 82 -------- spiffworkflow-frontend/src/index.tsx | 2 +- .../src/routes/MessageInstanceList.tsx | 3 +- .../src/routes/ProcessInstanceLogList.tsx | 3 +- .../src/routes/ProcessInstanceShow.tsx | 194 +++++++++++++----- 11 files changed, 242 insertions(+), 170 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py index 37b65157..64814e8f 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py @@ -64,7 +64,6 @@ class ProcessInstanceStatus(SpiffEnum): faulted = "faulted" suspended = "suspended" terminated = "terminated" - erroring = "erroring" class ProcessInstanceModel(SpiffworkflowBaseDBModel): 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 b6f16288..1425d69f 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_report.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance_report.py @@ -83,10 +83,6 @@ class ProcessInstanceReportModel(SpiffworkflowBaseDBModel): report_metadata = { "columns": [ {"Header": "id", "accessor": "id"}, - { - "Header": "process_group_identifier", - "accessor": "process_group_identifier", - }, { "Header": "process_model_identifier", "accessor": "process_model_identifier", 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 7854537e..d2f1bdaa 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py @@ -64,7 +64,7 @@ class ProcessInstanceService: processor.do_engine_steps(save=True) except Exception as e: db.session.rollback() # in case the above left the database with a bad transaction - process_instance.status = ProcessInstanceStatus.erroring.value + process_instance.status = ProcessInstanceStatus.faulted.value db.session.add(process_instance) db.session.commit() error_message = ( diff --git a/spiffworkflow-frontend/src/config.tsx b/spiffworkflow-frontend/src/config.tsx index c9e94eb0..0ded81e3 100644 --- a/spiffworkflow-frontend/src/config.tsx +++ b/spiffworkflow-frontend/src/config.tsx @@ -17,5 +17,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 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 564c99f1..383c3e0a 100644 --- a/spiffworkflow-frontend/src/helpers.tsx +++ b/spiffworkflow-frontend/src/helpers.tsx @@ -1,5 +1,5 @@ import { format } from 'date-fns'; -import { DATE_FORMAT } from './config'; +import { DATE_TIME_FORMAT, DATE_FORMAT } from './config'; import { DEFAULT_PER_PAGE, DEFAULT_PAGE, @@ -51,6 +51,14 @@ export const convertStringToDate = (dateString: string) => { return null; }; +export const convertSecondsToFormattedDateTime = (seconds: number) => { + if (seconds) { + const dateObject = new Date(seconds * 1000); + return format(dateObject, DATE_TIME_FORMAT); + } + return null; +}; + export const convertSecondsToFormattedDate = (seconds: number) => { if (seconds) { const dateObject = new Date(seconds * 1000); diff --git a/spiffworkflow-frontend/src/index.css b/spiffworkflow-frontend/src/index.css index b1eedf70..c2e2e802 100644 --- a/spiffworkflow-frontend/src/index.css +++ b/spiffworkflow-frontend/src/index.css @@ -1,24 +1,79 @@ -body { - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', - 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', - sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; +/* site is mainly using white theme. */ +/* header is mainly using g100 */ +/* mockup wanted white, not grey, text */ +.cds--header, a.cds--header__menu-item { + color: white; } +h1{ + height: 36px; + font-family: 'IBM Plex Sans'; + font-style: normal; + font-weight: 400; + font-size: 28px; + line-height: 36px; + color: #161616; + flex: none; + order: 0; + align-self: stretch; + flex-grow: 0; + margin-bottom: 1em +} + +.span-tag { + color: black; +} + +.cds--btn.button-white-background { + color: #393939; + background: #FFFFFF; + background-blend-mode: multiply; + border: 1px solid #393939; +} +.cds--btn.button-white-background:hover { + background: #525252; +} + +.cds--breadcrumb-item a.cds--link:hover { + color: #525252; +} +.cds--breadcrumb-item a.cds--link:visited { + color: #525252; +} +.cds--breadcrumb-item a.cds--link:visited:hover { + color: #525252; +} +.cds--breadcrumb-item a.cds--link { + color: #525252; +} + +.cds--btn--ghost { + color: black; +} +.cds--btn--ghost:visited { + color: black; +} +.cds--btn--ghost:hover { + color: black; +} +.cds--btn--ghost:visited:hover { + color: black; +} + +.cds--header__global .cds--btn--primary { + background-color: #161616 +} +.cds--btn--primary { + background-color: #393939; +} +.cds--btn--primary:hover { + background-color: #474747; +} code { font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; } -span.bjs-crumb { - color: #0000ff; -} -.bjs-breadcrumbs li:last-of-type span.bjs-crumb a { - color: black; -} - .app-logo { height: 85%; width: 85%; @@ -52,6 +107,26 @@ span.bjs-crumb { margin-bottom: 2em; } +h1.with-icons { + margin-top: 5px; +} + +.grid-list-title { + font-weight: 600; + font-size: 14px; + line-height: 18px; + color: #161616; +} +.grid-date { + font-size: 14px; + line-height: 18px; + letter-spacing: 0.16px; + color: #525252; +} +.smaller-text { + font-size: 14px; +} + .diagram-editor-canvas { border:1px solid #000000; height:70vh; @@ -59,13 +134,6 @@ span.bjs-crumb { margin:auto; } -.cds--btn.button-white-background { - color: #393939; - background: #FFFFFF; - background-blend-mode: multiply; - border: 1px solid #393939; -} - .with-bottom-margin { margin-bottom: 1em; } diff --git a/spiffworkflow-frontend/src/index.scss b/spiffworkflow-frontend/src/index.scss index 37766c21..86b76998 100644 --- a/spiffworkflow-frontend/src/index.scss +++ b/spiffworkflow-frontend/src/index.scss @@ -15,85 +15,3 @@ @use '@carbon/colors'; // @use '@carbon/react/scss/colors'; @use '@carbon/react/scss/themes'; - -// var(--cds-link-text-color, var(--cds-link-primary, #0f62fe)) - -// site is mainly using white theme. -// header is mainly using g100 -// mockup wanted white, not grey, text -.cds--header, a.cds--header__menu-item { - // background-color: colors.$gray-100; - color: white; -} -h1{ - height: 36px; - font-family: 'IBM Plex Sans'; - font-style: normal; - font-weight: 400; - font-size: 28px; - line-height: 36px; - color: #161616; - flex: none; - order: 0; - align-self: stretch; - flex-grow: 0; - margin-bottom: 1em -} - - -.cds--breadcrumb-item a.cds--link:hover { - color: #525252; -} -.cds--breadcrumb-item a.cds--link:visited { - color: #525252; -} -.cds--breadcrumb-item a.cds--link:visited:hover { - color: #525252; -} -.cds--breadcrumb-item a.cds--link { - color: #525252; -} - -.cds--btn--ghost { - color: black; -} -.cds--btn--ghost:visited { - color: black; -} -.cds--btn--ghost:hover { - color: black; -} -.cds--btn--ghost:visited:hover { - color: black; -} - -$slightly-lighter-gray: #474747; -$spiff-header-background-color: #161616; - -.cds--header__global .cds--btn--primary { - background-color: $spiff-header-background-color; -} -.cds--btn--primary { - background-color: #393939; -} -.cds--btn--primary:hover { - background-color: $slightly-lighter-gray; -} -// .cds--btn--ghost:visited { -// color: black; -// } -// .cds--btn--ghost:hover { -// color: black; -// } -// .cds--btn--ghost:visited:hover { -// color: black; -// } - - -// :root { -// --cds-link-primary: #525252; -// } -// .card { -// background: var(--orange); -// --orange: hsl(255, 72%, var(--lightness)); -// } diff --git a/spiffworkflow-frontend/src/index.tsx b/spiffworkflow-frontend/src/index.tsx index a2fab5c0..7a602be6 100644 --- a/spiffworkflow-frontend/src/index.tsx +++ b/spiffworkflow-frontend/src/index.tsx @@ -3,8 +3,8 @@ import * as ReactDOMClient from 'react-dom/client'; import App from './App'; import 'bootstrap/dist/css/bootstrap.css'; -import './index.css'; import './index.scss'; +import './index.css'; import reportWebVitals from './reportWebVitals'; import UserService from './services/UserService'; diff --git a/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx b/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx index 55e885ae..fe381bf4 100644 --- a/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx +++ b/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx @@ -113,11 +113,12 @@ export default function MessageInstanceList() { )}:link`, ], [ - `${searchParams.get('process_instance_id')}`, + `Process Instance: ${searchParams.get('process_instance_id')}`, `/admin/process-models/${searchParams.get( 'process_model_id' )}/process-instances/${searchParams.get('process_instance_id')}`, ], + ['Messages'], ]} /> ); diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx index 22303dec..bb8ef4c1 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx @@ -88,9 +88,10 @@ export default function ProcessInstanceLogList() { )}:link`, ], [ - `${params.process_instance_id}`, + `Process Instance: ${params.process_instance_id}`, `/admin/process-models/${params.process_model_id}/process-instances/${params.process_instance_id}`, ], + ['Logs'], ]} /> { return ( @@ -155,7 +168,7 @@ export default function ProcessInstanceShow() { return null; } - return spiffStepLink(processInstanceToUse, '<<', -1); + return spiffStepLink(processInstanceToUse, , -1); }; const nextStepLink = (processInstanceToUse: any) => { @@ -163,49 +176,87 @@ export default function ProcessInstanceShow() { return null; } - return spiffStepLink(processInstanceToUse, '>>', 1); + return spiffStepLink(processInstanceToUse, , 1); }; const getInfoTag = (processInstanceToUse: any) => { - const currentEndDate = convertSecondsToFormattedDate( + const currentEndDate = convertSecondsToFormattedDateTime( processInstanceToUse.end_in_seconds ); let currentEndDateTag; if (currentEndDate) { currentEndDateTag = ( -
  • - Completed:{' '} - {convertSecondsToFormattedDate(processInstanceToUse.end_in_seconds) || - 'N/A'} -
  • + + + Completed:{' '} + + + {convertSecondsToFormattedDateTime( + processInstanceToUse.end_in_seconds + ) || 'N/A'} + + ); } + let statusIcon = ; + if (processInstanceToUse.status === 'suspended') { + statusIcon = ; + } else if (processInstanceToUse.status === 'complete') { + statusIcon = ; + } else if (processInstanceToUse.status === 'terminated') { + statusIcon = ; + } else if (processInstanceToUse.status === 'faulted') { + statusIcon = ; + } + return ( - -
  • - Started:{' '} - {convertSecondsToFormattedDate(processInstanceToUse.start_in_seconds)} -
  • + <> + + + Started:{' '} + + + {convertSecondsToFormattedDateTime( + processInstanceToUse.start_in_seconds + )} + + {currentEndDateTag} -
  • Status: {processInstanceToUse.status}
  • -
  • - - Logs - -
  • -
  • - - Messages - -
  • -
    + + + Status:{' '} + + + + {processInstanceToUse.status} {statusIcon} + + + +
    + + + + + + + + + ); }; @@ -216,9 +267,15 @@ export default function ProcessInstanceShow() { ) === -1 ) { return ( - + ); } return
    ; @@ -231,9 +288,14 @@ export default function ProcessInstanceShow() { ) === -1 ) { return ( - + +
    Bpmn Process Identifier
    @@ -145,7 +145,7 @@ export default function HomePage() { ); return ( <> -

    Tasks waiting for me

    +

    Tasks waiting for me

    {breadcrumbElement} -

    Messages

    +

    Messages

    -

    Edit Process Group: {(processGroup as any).id}

    +

    Edit Process Group: {(processGroup as any).id}

    -

    Add Process Group

    +

    Add Process Group

    { - return

    Process Instances

    ; + return

    Process Instances

    ; }; const toggleShowFilterOptions = () => { diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceReportEdit.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceReportEdit.tsx index bdc04b49..638090da 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceReportEdit.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceReportEdit.tsx @@ -112,7 +112,7 @@ export default function ProcessInstanceReportEdit() { return ( <> -

    Edit Process Instance Report: {params.report_identifier}

    +

    Edit Process Instance Report: {params.report_identifier}

    -

    Reports for Process Model: {params.process_model_id}

    +

    Reports for Process Model: {params.process_model_id}

    diff --git a/spiffworkflow-frontend/src/routes/SecretNew.tsx b/spiffworkflow-frontend/src/routes/SecretNew.tsx index 016fec2e..329d7e2f 100644 --- a/spiffworkflow-frontend/src/routes/SecretNew.tsx +++ b/spiffworkflow-frontend/src/routes/SecretNew.tsx @@ -46,7 +46,7 @@ export default function SecretNew() { return (
    -

    Add Secret

    +

    Add Secret

    diff --git a/spiffworkflow-frontend/src/routes/SecretShow.tsx b/spiffworkflow-frontend/src/routes/SecretShow.tsx index 9882247b..6dd446b0 100644 --- a/spiffworkflow-frontend/src/routes/SecretShow.tsx +++ b/spiffworkflow-frontend/src/routes/SecretShow.tsx @@ -65,7 +65,7 @@ export default function SecretShow() { if (secret) { return ( <> -

    Secret Key: {secret.key}

    +

    Secret Key: {secret.key}

    Date: Thu, 10 Nov 2022 15:55:17 -0500 Subject: [PATCH 10/15] use error as a status instead of faulted w/ burnettk --- spiffworkflow-backend/src/spiffworkflow_backend/api.yml | 2 +- .../src/spiffworkflow_backend/models/process_instance.py | 2 +- .../services/acceptance_test_fixtures.py | 2 +- .../services/error_handling_service.py | 2 +- .../services/process_instance_service.py | 2 +- .../spiffworkflow_backend/integration/test_process_api.py | 4 ++-- spiffworkflow-frontend/src/config.tsx | 2 +- spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx | 6 +++--- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml index 2bfa117e..cbd21576 100755 --- a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml @@ -413,7 +413,7 @@ paths: - name: process_status in: query required: false - description: For filtering - not_started, user_input_required, waiting, complete, faulted, or suspended + description: For filtering - not_started, user_input_required, waiting, complete, error, or suspended schema: type: string # process_instance_list diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py index 64814e8f..cfa89252 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/process_instance.py @@ -61,7 +61,7 @@ class ProcessInstanceStatus(SpiffEnum): user_input_required = "user_input_required" waiting = "waiting" complete = "complete" - faulted = "faulted" + error = "error" suspended = "suspended" terminated = "terminated" 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 c6c1b578..cfea3148 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/acceptance_test_fixtures.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/acceptance_test_fixtures.py @@ -24,7 +24,7 @@ def load_acceptance_test_fixtures() -> list[ProcessInstanceModel]: # user_input_required - 2 hours ago # waiting - 3 hourse ago # complete - 4 hours ago - # faulted - 5 hours ago + # error - 5 hours ago # suspended - 6 hours ago process_instances = [] for i in range(len(statuses)): 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 3f1622a4..99e4fbe8 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/error_handling_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/error_handling_service.py @@ -46,7 +46,7 @@ class ErrorHandlingService: # fault is the default self.set_instance_status( _processor.process_instance_model.id, - ProcessInstanceStatus.faulted.value, + ProcessInstanceStatus.error.value, ) if len(process_model.exception_notification_addresses) > 0: 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 d2f1bdaa..ca9f66aa 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py @@ -64,7 +64,7 @@ class ProcessInstanceService: processor.do_engine_steps(save=True) except Exception as e: db.session.rollback() # in case the above left the database with a bad transaction - process_instance.status = ProcessInstanceStatus.faulted.value + process_instance.status = ProcessInstanceStatus.error.value db.session.add(process_instance) db.session.commit() error_message = ( 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 91355e0e..7f9500b0 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py @@ -1716,7 +1716,7 @@ class TestProcessApi(BaseTest): .first() ) assert process is not None - assert process.status == "faulted" + assert process.status == "error" def test_error_handler_suspend( self, @@ -1827,7 +1827,7 @@ class TestProcessApi(BaseTest): .first() ) assert process is not None - assert process.status == "faulted" + assert process.status == "error" def test_process_model_file_create( self, diff --git a/spiffworkflow-frontend/src/config.tsx b/spiffworkflow-frontend/src/config.tsx index 0ded81e3..47ff5025 100644 --- a/spiffworkflow-frontend/src/config.tsx +++ b/spiffworkflow-frontend/src/config.tsx @@ -12,7 +12,7 @@ export const PROCESS_STATUSES = [ 'user_input_required', 'waiting', 'complete', - 'faulted', + 'error', 'suspended', ]; diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx index b9ac85eb..df6944bb 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx @@ -206,7 +206,7 @@ export default function ProcessInstanceShow() { statusIcon = ; } else if (processInstanceToUse.status === 'terminated') { statusIcon = ; - } else if (processInstanceToUse.status === 'faulted') { + } else if (processInstanceToUse.status === 'error') { statusIcon = ; } @@ -262,7 +262,7 @@ export default function ProcessInstanceShow() { const terminateButton = (processInstanceToUse: any) => { if ( - ['complete', 'terminated', 'faulted'].indexOf( + ['complete', 'terminated', 'error'].indexOf( processInstanceToUse.status ) === -1 ) { @@ -283,7 +283,7 @@ export default function ProcessInstanceShow() { const suspendButton = (processInstanceToUse: any) => { if ( - ['complete', 'terminated', 'faulted', 'suspended'].indexOf( + ['complete', 'terminated', 'error', 'suspended'].indexOf( processInstanceToUse.status ) === -1 ) { From e138c0e68c13173debfa2d88c08ee0dd69e39434 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 10 Nov 2022 16:00:44 -0500 Subject: [PATCH 11/15] run backend tests on push and pull_request --- .github/workflows/backend_tests.yml | 270 ++++++++++++++++++++++++++++ .github/workflows/release.yml | 0 .github/workflows/release2.yml | 0 .github/workflows/tests.yml | 29 +++ 4 files changed, 299 insertions(+) create mode 100644 .github/workflows/backend_tests.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/release2.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/backend_tests.yml b/.github/workflows/backend_tests.yml new file mode 100644 index 00000000..ff8b46e9 --- /dev/null +++ b/.github/workflows/backend_tests.yml @@ -0,0 +1,270 @@ +name: Tests + +on: + - push + - pull_request + +jobs: + tests: + name: ${{ matrix.session }} ${{ matrix.python }} / ${{ matrix.os }} ${{ matrix.database }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - { python: "3.11", os: "ubuntu-latest", session: "pre-commit" } + - { python: "3.11", os: "ubuntu-latest", session: "safety" } + - { python: "3.11", os: "ubuntu-latest", session: "mypy" } + - { python: "3.10", os: "ubuntu-latest", session: "mypy" } + - { python: "3.9", os: "ubuntu-latest", session: "mypy" } + - { + python: "3.11", + os: "ubuntu-latest", + session: "tests", + database: "mysql", + } + - { + python: "3.11", + os: "ubuntu-latest", + session: "tests", + database: "postgres", + } + - { + python: "3.11", + os: "ubuntu-latest", + session: "tests", + database: "sqlite", + } + - { + python: "3.10", + os: "ubuntu-latest", + session: "tests", + database: "sqlite", + } + - { + python: "3.9", + os: "ubuntu-latest", + session: "tests", + database: "sqlite", + } + - { + python: "3.10", + os: "windows-latest", + session: "tests", + database: "sqlite", + } + - { + python: "3.11", + os: "macos-latest", + session: "tests", + database: "sqlite", + } + - { + # typeguard 2.13.3 is broken with TypeDict in 3.11. + # probably the next release fixes it. + # https://github.com/agronholm/typeguard/issues/242 + python: "3.11", + os: "ubuntu-latest", + session: "typeguard", + database: "sqlite", + } + - { python: "3.11", os: "ubuntu-latest", session: "xdoctest" } + - { python: "3.11", os: "ubuntu-latest", session: "docs-build" } + + env: + NOXSESSION: ${{ matrix.session }} + SPIFF_DATABASE_TYPE: ${{ matrix.database }} + FORCE_COLOR: "1" + PRE_COMMIT_COLOR: "always" + DB_PASSWORD: password + FLASK_SESSION_SECRET_KEY: super_secret_key + + defaults: + working-directory: subworkflow-backend + + steps: + - name: Check out the repository + uses: actions/checkout@v3.0.2 + + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v4.2.0 + with: + python-version: ${{ matrix.python }} + + - name: Upgrade pip + run: | + pip install --constraint=.github/workflows/constraints.txt pip + pip --version + + - name: Upgrade pip in virtual environments + shell: python + run: | + import os + import pip + + with open(os.environ["GITHUB_ENV"], mode="a") as io: + print(f"VIRTUALENV_PIP={pip.__version__}", file=io) + + - name: Install Poetry + run: | + pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry + poetry --version + + - name: Install Nox + run: | + pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox + pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry + nox --version + + - name: Compute pre-commit cache key + if: matrix.session == 'pre-commit' + id: pre-commit-cache + shell: python + run: | + import hashlib + import sys + + python = "py{}.{}".format(*sys.version_info[:2]) + payload = sys.version.encode() + sys.executable.encode() + digest = hashlib.sha256(payload).hexdigest() + result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8]) + + print("::set-output name=result::{}".format(result)) + + - name: Restore pre-commit cache + uses: actions/cache@v3.0.11 + if: matrix.session == 'pre-commit' + with: + path: ~/.cache/pre-commit + key: ${{ steps.pre-commit-cache.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }} + restore-keys: | + ${{ steps.pre-commit-cache.outputs.result }}- + - name: Setup Mysql + uses: mirromutth/mysql-action@v1.1 + with: + host port: 3306 + container port: 3306 + mysql version: "8.0" + mysql database: "spiffworkflow_backend_testing" + mysql root password: password + if: matrix.database == 'mysql' + + - name: Setup Postgres + run: docker run --name postgres-spiff -p 5432:5432 -e POSTGRES_PASSWORD=spiffworkflow_backend -e POSTGRES_USER=spiffworkflow_backend -e POSTGRES_DB=spiffworkflow_backend_testing -d postgres + if: matrix.database == 'postgres' + + - name: Run Nox + run: | + nox --force-color --python=${{ matrix.python }} + + - name: Upload coverage data + # pin to upload coverage from only one matrix entry, otherwise coverage gets confused later + if: always() && matrix.session == 'tests' && matrix.python == '3.11' && matrix.os == 'ubuntu-latest' + uses: "actions/upload-artifact@v3.0.0" + with: + name: coverage-data + path: ".coverage.*" + + - name: Upload documentation + if: matrix.session == 'docs-build' + uses: actions/upload-artifact@v3.0.0 + with: + name: docs + path: docs/_build + + - name: Upload logs + if: failure() && matrix.session == 'tests' + uses: "actions/upload-artifact@v3.0.0" + with: + name: logs-${{matrix.python}}-${{matrix.os}}-${{matrix.database}} + path: "./log/*.log" + + check_docker_start_script: + runs-on: ubuntu-latest + steps: + - name: Check out the repository + uses: actions/checkout@v3.0.2 + with: + # Disabling shallow clone is recommended for improving relevancy of reporting in sonarcloud + fetch-depth: 0 + - name: start_backend + run: ./bin/build_and_run_with_docker_compose + timeout-minutes: 20 + env: + SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA: "true" + - name: wait_for_backend + run: ./bin/wait_for_server_to_be_up 5 + + coverage: + runs-on: ubuntu-latest + needs: tests + steps: + - name: Check out the repository + uses: actions/checkout@v3.0.2 + with: + # Disabling shallow clone is recommended for improving relevancy of reporting in sonarcloud + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v4.2.0 + with: + python-version: "3.11" + + - name: Upgrade pip + run: | + pip install --constraint=.github/workflows/constraints.txt pip + pip --version + + - name: Install Poetry + run: | + pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry + poetry --version + + - name: Install Nox + run: | + pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox + pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry + nox --version + + - name: Download coverage data + uses: actions/download-artifact@v3.0.1 + with: + name: coverage-data + + - name: Combine coverage data and display human readable report + run: | + find . -name \*.pyc -delete + nox --force-color --session=coverage + + - name: Create coverage report + run: | + nox --force-color --session=coverage -- xml + + - name: Upload coverage report + uses: codecov/codecov-action@v3.1.0 + + - name: SonarCloud Scan + uses: sonarsource/sonarcloud-github-action@master + # thought about just skipping dependabot + # if: ${{ github.actor != 'dependabot[bot]' }} + # but figured all pull requests seems better, since none of them will have access to sonarcloud. + # however, with just skipping pull requests, the build associated with "Triggered via push" is also associated with the pull request and also fails hitting sonarcloud + # if: ${{ github.event_name != 'pull_request' }} + # so just skip everything but main + if: github.ref_name == 'main' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + # part about saving PR number and then using it from auto-merge-dependabot-prs from: + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run + - name: Save PR number + if: ${{ github.event_name == 'pull_request' }} + env: + PR_NUMBER: ${{ github.event.number }} + run: | + mkdir -p ./pr + echo "$PR_NUMBER" > ./pr/pr_number + - uses: actions/upload-artifact@v3 + with: + name: pr_number + path: pr/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/release2.yml b/.github/workflows/release2.yml new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..60e832a5 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,29 @@ +name: Tests + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11"] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: cache poetry install + uses: actions/cache@v3 + with: + path: ~/.local + key: poetry-1.2.1 + - uses: snok/install-poetry@v1 + with: + version: 1.2.1 + virtualenvs-create: true + virtualenvs-in-project: true + - run: poetry install --no-interaction + - run: poetry run pytest From 53b58ba72f7b603f3ee07c4bf97c55a7637adba7 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 10 Nov 2022 16:02:52 -0500 Subject: [PATCH 12/15] just test on 3.11 --- .github/workflows/backend_tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/backend_tests.yml b/.github/workflows/backend_tests.yml index ff8b46e9..d0677680 100644 --- a/.github/workflows/backend_tests.yml +++ b/.github/workflows/backend_tests.yml @@ -15,8 +15,6 @@ jobs: - { python: "3.11", os: "ubuntu-latest", session: "pre-commit" } - { python: "3.11", os: "ubuntu-latest", session: "safety" } - { python: "3.11", os: "ubuntu-latest", session: "mypy" } - - { python: "3.10", os: "ubuntu-latest", session: "mypy" } - - { python: "3.9", os: "ubuntu-latest", session: "mypy" } - { python: "3.11", os: "ubuntu-latest", From 8cba8dcf59899cb5f842ef20e77fd187f1af7b17 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 10 Nov 2022 16:05:00 -0500 Subject: [PATCH 13/15] Remove actions we aren't using yet. --- .github/workflows/release.yml | 0 .github/workflows/release2.yml | 0 .github/workflows/tests.yml | 29 ----------------------------- 3 files changed, 29 deletions(-) delete mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/release2.yml delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index e69de29b..00000000 diff --git a/.github/workflows/release2.yml b/.github/workflows/release2.yml deleted file mode 100644 index e69de29b..00000000 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 60e832a5..00000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Tests - -on: [push] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10", "3.11"] - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: cache poetry install - uses: actions/cache@v3 - with: - path: ~/.local - key: poetry-1.2.1 - - uses: snok/install-poetry@v1 - with: - version: 1.2.1 - virtualenvs-create: true - virtualenvs-in-project: true - - run: poetry install --no-interaction - - run: poetry run pytest From c00574aa15617068e5a259936496f26629cbc35f Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 10 Nov 2022 16:06:14 -0500 Subject: [PATCH 14/15] github action changes. --- .github/workflows/backend_tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/backend_tests.yml b/.github/workflows/backend_tests.yml index d0677680..720da08a 100644 --- a/.github/workflows/backend_tests.yml +++ b/.github/workflows/backend_tests.yml @@ -78,7 +78,8 @@ jobs: FLASK_SESSION_SECRET_KEY: super_secret_key defaults: - working-directory: subworkflow-backend + run: + working-directory: subworkflow-backend steps: - name: Check out the repository From 932baa8c992d8c2e353a8085a72ab9cfb9d86358 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 10 Nov 2022 16:08:11 -0500 Subject: [PATCH 15/15] github action changes. --- .github/workflows/backend_tests.yml | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/.github/workflows/backend_tests.yml b/.github/workflows/backend_tests.yml index 720da08a..26f95efc 100644 --- a/.github/workflows/backend_tests.yml +++ b/.github/workflows/backend_tests.yml @@ -33,24 +33,6 @@ jobs: session: "tests", database: "sqlite", } - - { - python: "3.10", - os: "ubuntu-latest", - session: "tests", - database: "sqlite", - } - - { - python: "3.9", - os: "ubuntu-latest", - session: "tests", - database: "sqlite", - } - - { - python: "3.10", - os: "windows-latest", - session: "tests", - database: "sqlite", - } - { python: "3.11", os: "macos-latest", @@ -79,7 +61,7 @@ jobs: defaults: run: - working-directory: subworkflow-backend + working-directory: spiffworkflow-backend steps: - name: Check out the repository