Skip to content

Commit

Permalink
Merge pull request #39 from osstotalsoft/simple-task
Browse files Browse the repository at this point in the history
Simple task
  • Loading branch information
niemenX authored Nov 2, 2023
2 parents ee43e31 + e172216 commit bcdac98
Show file tree
Hide file tree
Showing 41 changed files with 722 additions and 338 deletions.
13 changes: 11 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
- ES_VERSION=7
- INDEXING_ENABLED=true
- JAVA_OPTS=-Dpolyglot.engine.WarnInterpreterOnly=false
image: niemen/conductor-server:7.2.0
image: niemen/conductor-server:7.2.2
networks:
- internal
ports:
Expand Down Expand Up @@ -82,13 +82,22 @@ services:
max-file: "3"

nats:
image: nats-streaming:latest
image: nats:latest
networks:
- internal
command: "-js --http_port 8222"
ports:
- 4222:4222
- 8222:8222

nats-streaming:
image: nats-streaming:latest
networks:
- internal
ports:
- 4223:4222
- 8223:8222

schellar:
profiles: ["scheduler"]
image: flaviostutz/schellar
Expand Down
12 changes: 10 additions & 2 deletions gql-bff/src/features/workflow/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,19 @@ const workflowResolvers = {
const { dataSources, tenant } = context;

const workflow = await dataSources.workflowApi.getWorkflow(name, version);
if (!isMultiTenant) return workflow;
const conductorHandlers =
await dataSources.eventHandlerApi.getEventHandlerList();
const startHandlers = conductorHandlers.filter((a) =>
a.actions.some(
(x) =>
x.action === "start_workflow" && x?.start_workflow?.name === name
)
);
if (!isMultiTenant) return { ...workflow, startHandlers };

const wfTenantId = getTenantIdFromDescription(workflow?.description);
if (userCanSeeResource(wfTenantId, tenant?.id)) {
return workflow;
return { ...workflow, startHandlers };
} else
return new ForbiddenError(
"You are not authorized to see this workflow."
Expand Down
3 changes: 2 additions & 1 deletion gql-bff/src/features/workflow/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
extend type WorkflowDef {
readOnly: Boolean
readOnly: Boolean,
startHandlers: [EventHandler]
}

type ExportWorkflows {
Expand Down
Binary file modified react-ui/.yarn/install-state.gz
Binary file not shown.
8 changes: 4 additions & 4 deletions react-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@date-io/moment": "^2.16.1",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@monaco-editor/react": "^4.6.0",
"@mui/icons-material": "^5.11.16",
"@mui/lab": "^5.0.0-alpha.134",
"@mui/material": "^5.13.6",
Expand All @@ -22,7 +23,6 @@
"@totalsoft/rocket-ui": "^0.1.25",
"@totalsoft/rules-algebra-react": "^5.0.22",
"@totalsoft/validations": "^1.0.4",
"ace-builds": "1.23.1",
"apollo-cache-inmemory": "^1.6.6",
"apollo-link-mock": "^1.0.1",
"apollo-upload-client": "^17.0.0",
Expand All @@ -38,7 +38,6 @@
"i18next-browser-languagedetector": "^7.1.0",
"i18next-http-backend": "^2.2.1",
"js-beautify": "^1.14.0",
"jsonlint-mod": "1.7.6",
"lodash": "^4.17.21",
"lodash.curry": "^4.1.1",
"moment": "2.29.4",
Expand All @@ -49,7 +48,6 @@
"paths-js": "^0.4.11",
"ramda": "^0.29.0",
"react": "18.2.0 ",
"react-ace": "10.1.0",
"react-country-flag": "3.1.0",
"react-diff-viewer": "^3.1.1",
"react-dom": "18.2.0 ",
Expand Down Expand Up @@ -78,7 +76,8 @@
"test:ci": "cross-env CI=true npm test -- --reporters=default --reporters=jest-junit --coverage --coverageReporters=cobertura --coverageReporters=lcov --coverageReporters=html",
"eject": "react-scripts eject",
"eslint:report": "eslint --fix --ext .js .",
"prettier": "prettier --write **/*.js"
"prettier": "prettier --write **/*.js",
"analyze": "source-map-explorer 'build/static/js/*.js'"
},
"lint-staged": {
"**/*.+(js|md|css|graphql|json)": "prettier --write"
Expand Down Expand Up @@ -121,6 +120,7 @@
"react-app-rewired": "^2.1.11",
"react-error-overlay": "6.0.11",
"react-test-renderer": "^18.2.0",
"source-map-explorer": "2.5.3",
"styled-components": "6.0.2"
},
"jest": {
Expand Down
3 changes: 2 additions & 1 deletion react-ui/public/static/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@
"Export": "Export as JSON",
"Delete": "Delete selection",
"Execute": "Execute workflow",
"GeneralSettings": "General settings"
"GeneralSettings": "General settings",
"StartHandler": "Start Event Handlers"
},
"Tour": {
"BadgeContent": "{{curr}} of {{tot}}",
Expand Down
3 changes: 2 additions & 1 deletion react-ui/public/static/locales/fr/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@
"Export": "Exporter au format JSON",
"Delete": "Supprimer la sélection",
"Execute": "Exécuter le workflow",
"GeneralSettings": "Paramètres généraux"
"GeneralSettings": "Paramètres généraux",
"StartHandler": "Start Event Handlers"
},
"Tour": {
"BadgeContent": "{{curr}} sur {{tot}}",
Expand Down
3 changes: 2 additions & 1 deletion react-ui/public/static/locales/ro/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@
"Export": "Exporta ca JSON",
"Delete": "Sterge selectia",
"Execute": "Executa fluxul",
"GeneralSettings": "Setari generale"
"GeneralSettings": "Setari generale",
"StartHandler": "Start Event Handlers"
},
"Tour": {
"BadgeContent": "{{curr}} din {{tot}}",
Expand Down
2 changes: 1 addition & 1 deletion react-ui/src/__tests__/learnTesting.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('Here I learn good testing techniques', () => {
it('Should call this function only with numbers', () => {
const mock = jest.fn()
;[(1, 2, 3)] |> map(mock)
expect(mock).toBeCalledWith(expect.anything())
expect(mock).toHaveBeenCalledWith(expect.anything())
})

it('Should filter the the list', () => {
Expand Down
2 changes: 1 addition & 1 deletion react-ui/src/features/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export const sortingDirection = {
DESC: 'DESC'
}

export const fieldsToBeRemoved = ['__typename', 'historyId', 'readOnly']
export const fieldsToBeRemoved = ['__typename', 'historyId', 'readOnly', 'startHandlers']
29 changes: 26 additions & 3 deletions react-ui/src/features/designer/builderHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ const parseTaskToJSON = (link, parentNode, tasks) => {
break
case nodeConfig.DECISION.type: {
const { decideNode, firstNeutralNode } = handleDecideNode(link.targetPort.getNode())
tasks.push({...decideNode.inputs, hasDefaultCase: undefined})
tasks.push({ ...decideNode.inputs, hasDefaultCase: undefined })
if (firstNeutralNode) {
if (firstNeutralNode.inputs && firstNeutralNode.inputs.taskReferenceName !== 'END') {
tasks.push({...firstNeutralNode.inputs, hasDefaultCase: undefined})
tasks.push({ ...firstNeutralNode.inputs, hasDefaultCase: undefined })
}
parentNode = firstNeutralNode
}
Expand All @@ -205,10 +205,15 @@ const parseTaskToJSON = (link, parentNode, tasks) => {
tasks.push({
...parentNode.inputs,
asyncHandler: undefined,
inputTemplate: undefined,
description: JSON.stringify({ description: parentNode.inputs.description, asyncHandler: parentNode.inputs['asyncHandler'] })
})
} else {
tasks.push({ ...parentNode.inputs, asyncHandler: undefined })
tasks.push({
...parentNode.inputs,
asyncHandler: undefined,
inputTemplate: undefined
})
}
}

Expand Down Expand Up @@ -286,3 +291,21 @@ export const getTaskInputsRegex = t => {

return inputParameters
}

export const getTaskInputsWithTemplate = (input, template) => {
if (!template) return input

var newInput = { ...input }
if (!newInput) newInput = {}

const templateKeys = keys(template)
templateKeys.forEach(k => {
if (template[k] === 'object') {
newInput[k] = '{}'
} else {
newInput[k] = ''
}
})

return newInput
}
9 changes: 5 additions & 4 deletions react-ui/src/features/designer/components/BodyWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const S = {
`
}

const BodyWidget = ({ canvasClass, workflow, engine, setIsDirty, locked }) => {
const BodyWidget = ({ canvasClass, workflow, engine, setIsDirty, locked, taskDefs }) => {
//create diagram from workflow definition
useEffect(() => {
if (workflow && workflow.tasks) {
drawDiagram(workflow, engine, workflow?.readOnly || locked)
drawDiagram(workflow, engine, workflow?.readOnly || locked, taskDefs)
}
}, [engine, locked, workflow])
}, [engine, locked, workflow, taskDefs])

const handleOnDrop = useCallback(
event => {
Expand Down Expand Up @@ -64,7 +64,8 @@ BodyWidget.propTypes = {
engine: PropTypes.object.isRequired,
workflow: PropTypes.object.isRequired,
setIsDirty: PropTypes.func,
locked: PropTypes.bool.isRequired
locked: PropTypes.bool.isRequired,
taskDefs: PropTypes.array
}

export default BodyWidget
Loading

0 comments on commit bcdac98

Please sign in to comment.