From 17d622d34c3f54a7e1f07dafd1adbc35484f2625 Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 16 Dec 2022 13:17:38 -0500 Subject: [PATCH 1/4] merged in main and pyl passes --- .../src/routes/ProcessModelEditDiagram.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx index 4ef75848..544312c8 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx @@ -6,7 +6,16 @@ import { useSearchParams, } from 'react-router-dom'; // @ts-ignore -import { Button, Modal, Content, Tabs, TabList, Tab, TabPanels, TabPanel } from '@carbon/react'; +import { + Button, + Modal, + Content, + Tabs, + TabList, + Tab, + TabPanels, + TabPanel, +} from '@carbon/react'; import Row from 'react-bootstrap/Row'; import Col from 'react-bootstrap/Col'; @@ -399,10 +408,10 @@ export default function ProcessModelEditDiagram() { const jsonEditorOptions = () => { return Object.assign(generalEditorOptions(), { - minimap: { enabled: false }, - folding: true + minimap: { enabled: false }, + folding: true, }); - } + }; const setPreviousScriptUnitTest = () => { resetUnitTextResult(); From 1b64c9ed6e5df48428f47b14b4abdc20c54e6a9f Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 21 Dec 2022 11:06:09 -0500 Subject: [PATCH 2/4] A hot path that will assume the backend is running on a port that is one less than the front end port (rather than assuming 7000) Updating the docker-compose for all of SpiffArena so that it will fire up on ports 8000 -> 8004 rather than 7000 which has a common conflict with Apple AirPlay --- docker-compose.yml | 27 ++++++++++++++------------- spiffworkflow-frontend/src/config.tsx | 22 +++++++++++++++++----- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1cf55024..b505499b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,9 +10,9 @@ services: environment: - MYSQL_DATABASE=spiffworkflow_backend_development - MYSQL_ROOT_PASSWORD=my-secret-pw - - MYSQL_TCP_PORT=7003 + - MYSQL_TCP_PORT=8003 ports: - - "7003" + - "8003" healthcheck: test: mysql --user=root --password=my-secret-pw -e 'select 1' spiffworkflow_backend_development interval: 10s @@ -30,12 +30,12 @@ services: - SPIFFWORKFLOW_BACKEND_ENV=development - FLASK_DEBUG=0 - FLASK_SESSION_SECRET_KEY=super_secret_key - - OPEN_ID_SERVER_URL=http://localhost:7000/openid - - SPIFFWORKFLOW_FRONTEND_URL=http://localhost:7001 - - SPIFFWORKFLOW_BACKEND_URL=http://localhost:7000 - - SPIFFWORKFLOW_BACKEND_PORT=7000 + - OPEN_ID_SERVER_URL=http://localhost:8000/openid + - SPIFFWORKFLOW_FRONTEND_URL=http://localhost:8001 + - SPIFFWORKFLOW_BACKEND_URL=http://localhost:8000 + - SPIFFWORKFLOW_BACKEND_PORT=8000 - SPIFFWORKFLOW_BACKEND_UPGRADE_DB=true - - SPIFFWORKFLOW_BACKEND_DATABASE_URI=mysql+mysqlconnector://root:my-secret-pw@spiffworkflow-db:7003/spiffworkflow_backend_development + - SPIFFWORKFLOW_BACKEND_DATABASE_URI=mysql+mysqlconnector://root:my-secret-pw@spiffworkflow-db:8003/spiffworkflow_backend_development - BPMN_SPEC_ABSOLUTE_DIR=/app/process_models - SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA=false - SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME=example.yml @@ -43,12 +43,12 @@ services: - OPEN_ID_CLIENT_ID=spiffworkflow-backend - OPEN_ID_CLIENT_SECRET_KEY=my_open_id_secret_key ports: - - "7000:7000" + - "8000:8000" volumes: - ./process_models:/app/process_models - ./log:/app/log healthcheck: - test: curl localhost:7000/v1.0/status --fail + test: curl localhost:8000/v1.0/status --fail interval: 10s timeout: 5s retries: 20 @@ -58,9 +58,9 @@ services: image: ghcr.io/sartography/spiffworkflow-frontend environment: - APPLICATION_ROOT=/ - - PORT0=7001 + - PORT0=8001 ports: - - "7001:7001" + - "8001:8001" spiffworkflow-connector: container_name: spiffworkflow-connector @@ -69,10 +69,11 @@ services: - FLASK_ENV=${FLASK_ENV:-development} - FLASK_DEBUG=0 - FLASK_SESSION_SECRET_KEY=${FLASK_SESSION_SECRET_KEY:-super_secret_key} + - CONNECTOR_PROXY_PORT=8004 ports: - - "7004:7004" + - "8004:8004" healthcheck: - test: curl localhost:7004/liveness --fail + test: curl localhost:8004/liveness --fail interval: 10s timeout: 5s retries: 20 diff --git a/spiffworkflow-frontend/src/config.tsx b/spiffworkflow-frontend/src/config.tsx index b0816a39..abaadd5e 100644 --- a/spiffworkflow-frontend/src/config.tsx +++ b/spiffworkflow-frontend/src/config.tsx @@ -1,11 +1,23 @@ -const host = window.location.hostname; -let hostAndPort = `api.${host}`; +const { port, hostname } = window.location; +let hostAndPort = `api.${hostname}`; let protocol = 'https'; -if (/^\d+\./.test(host) || host === 'localhost') { - hostAndPort = `${host}:7000`; + +if (/^\d+\./.test(hostname) || hostname === 'localhost') { + let serverPort = 7000; + if (!Number.isNaN(Number(port))) { + serverPort = Number(port) - 1; + } + hostAndPort = `${hostname}:${serverPort}`; protocol = 'http'; } -export const BACKEND_BASE_URL = `${protocol}://${hostAndPort}/v1.0`; + +let url = `${protocol}://${hostAndPort}/v1.0`; +// Allow overriding the backend base url with an environment variable at build time. +if (process.env.REACT_APP_BACKEND_BASE_URL) { + url = process.env.REACT_APP_BACKEND_BASE_URL; +} + +export const BACKEND_BASE_URL = url; export const PROCESS_STATUSES = [ 'not_started', From e05c37403446faf81fef22ed64aa0b4054e2db43 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 21 Dec 2022 12:52:56 -0500 Subject: [PATCH 3/4] Do not require a Git Repository to start a process. --- .../services/process_instance_service.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 e933eda9..3427b47b 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py @@ -17,7 +17,7 @@ from spiffworkflow_backend.models.task import MultiInstanceType from spiffworkflow_backend.models.task import Task from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.authorization_service import AuthorizationService -from spiffworkflow_backend.services.git_service import GitService +from spiffworkflow_backend.services.git_service import GitService, GitCommandError from spiffworkflow_backend.services.process_instance_processor import ( ProcessInstanceProcessor, ) @@ -36,7 +36,10 @@ class ProcessInstanceService: user: UserModel, ) -> ProcessInstanceModel: """Get_process_instance_from_spec.""" - current_git_revision = GitService.get_current_revision() + try: + current_git_revision = GitService.get_current_revision() + except GitCommandError as ge: + current_git_revision = "" process_instance_model = ProcessInstanceModel( status=ProcessInstanceStatus.not_started.value, process_initiator=user, From 785d35d415f2d4ad0df1cfd43a648f9ea7d29cfc Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 21 Dec 2022 13:01:38 -0500 Subject: [PATCH 4/4] fixing a linting error --- spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx index cb7967a6..b0a242dd 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx @@ -5,7 +5,6 @@ import { useParams, useSearchParams, } from 'react-router-dom'; -// @ts-ignore import { Button, Modal, @@ -15,6 +14,7 @@ import { Tab, TabPanels, TabPanel, + // @ts-ignore } from '@carbon/react'; import Row from 'react-bootstrap/Row'; import Col from 'react-bootstrap/Col';