cognite-neat 0.92.2__py3-none-any.whl → 0.93.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cognite-neat might be problematic. Click here for more details.
- cognite/neat/__init__.py +3 -2
- cognite/neat/{app → _app}/api/configuration.py +9 -7
- cognite/neat/_app/api/context_manager/__init__.py +3 -0
- cognite/neat/{app → _app}/api/context_manager/manager.py +1 -1
- cognite/neat/{app → _app}/api/explorer.py +5 -5
- cognite/neat/{app → _app}/api/routers/configuration.py +2 -2
- cognite/neat/{app → _app}/api/routers/crud.py +4 -4
- cognite/neat/{app → _app}/api/routers/workflows.py +7 -7
- cognite/neat/{app → _app}/main.py +1 -1
- cognite/neat/_app/ui/neat-app/package-lock.json +18306 -0
- cognite/neat/_app/ui/neat-app/package.json +62 -0
- cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
- cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +116 -0
- cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +112 -0
- cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +34 -0
- cognite/neat/_app/ui/neat-app/public/index.html +43 -0
- cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
- cognite/neat/_app/ui/neat-app/public/manifest.json +25 -0
- cognite/neat/_app/ui/neat-app/public/robots.txt +3 -0
- cognite/neat/_app/ui/neat-app/src/App.css +38 -0
- cognite/neat/_app/ui/neat-app/src/App.js +17 -0
- cognite/neat/_app/ui/neat-app/src/App.test.js +8 -0
- cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +70 -0
- cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +43 -0
- cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +124 -0
- cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +63 -0
- cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +511 -0
- cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +36 -0
- cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +56 -0
- cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +60 -0
- cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +112 -0
- cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +67 -0
- cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +79 -0
- cognite/neat/_app/ui/neat-app/src/index.css +13 -0
- cognite/neat/_app/ui/neat-app/src/index.js +13 -0
- cognite/neat/_app/ui/neat-app/src/logo.svg +1 -0
- cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +13 -0
- cognite/neat/_app/ui/neat-app/src/setupTests.js +5 -0
- cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +388 -0
- cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +61 -0
- cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +184 -0
- cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +180 -0
- cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +570 -0
- cognite/neat/_app/ui/neat-app/tsconfig.json +27 -0
- cognite/neat/{config.py → _config.py} +3 -3
- cognite/neat/{constants.py → _constants.py} +13 -5
- cognite/neat/_graph/_shared.py +34 -0
- cognite/neat/{graph → _graph}/_tracking/base.py +1 -1
- cognite/neat/{graph → _graph}/_tracking/log.py +1 -1
- cognite/neat/{graph → _graph}/extractors/__init__.py +5 -0
- cognite/neat/{graph → _graph}/extractors/_base.py +2 -2
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_assets.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_base.py +4 -4
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_classic.py +5 -5
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_data_sets.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_events.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_files.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_labels.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_relationships.py +2 -2
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_sequences.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_classic_cdf/_timeseries.py +1 -1
- cognite/neat/{graph → _graph}/extractors/_dexpi.py +5 -5
- cognite/neat/{graph → _graph}/extractors/_dms.py +3 -3
- cognite/neat/_graph/extractors/_iodd.py +402 -0
- cognite/neat/{graph → _graph}/extractors/_mock_graph_generator.py +9 -8
- cognite/neat/_graph/extractors/_rdf_file.py +49 -0
- cognite/neat/{graph → _graph}/loaders/_base.py +5 -5
- cognite/neat/{graph → _graph}/loaders/_rdf2asset.py +11 -10
- cognite/neat/{graph → _graph}/loaders/_rdf2dms.py +10 -10
- cognite/neat/{graph → _graph}/queries/_base.py +91 -19
- cognite/neat/{graph → _graph}/queries/_construct.py +5 -5
- cognite/neat/{graph → _graph}/queries/_shared.py +3 -3
- cognite/neat/{graph → _graph}/transformers/__init__.py +6 -0
- cognite/neat/{graph → _graph}/transformers/_classic_cdf.py +135 -3
- cognite/neat/_graph/transformers/_iodd.py +25 -0
- cognite/neat/_graph/transformers/_prune_graph.py +126 -0
- cognite/neat/{graph → _graph}/transformers/_rdfpath.py +3 -3
- cognite/neat/_graph/transformers/_value_type.py +66 -0
- cognite/neat/{issues → _issues}/_base.py +32 -17
- cognite/neat/{issues → _issues}/errors/__init__.py +1 -1
- cognite/neat/{issues → _issues}/errors/_external.py +8 -8
- cognite/neat/{issues → _issues}/errors/_general.py +5 -5
- cognite/neat/{issues → _issues}/errors/_properties.py +7 -7
- cognite/neat/{issues → _issues}/errors/_resources.py +11 -11
- cognite/neat/{issues → _issues}/errors/_workflow.py +5 -5
- cognite/neat/{issues → _issues}/warnings/__init__.py +1 -1
- cognite/neat/{issues → _issues}/warnings/_external.py +5 -5
- cognite/neat/{issues → _issues}/warnings/_general.py +4 -4
- cognite/neat/{issues → _issues}/warnings/_models.py +10 -10
- cognite/neat/{issues → _issues}/warnings/_properties.py +6 -6
- cognite/neat/{issues → _issues}/warnings/_resources.py +5 -5
- cognite/neat/{issues → _issues}/warnings/user_modeling.py +9 -9
- cognite/neat/_rules/_constants.py +190 -0
- cognite/neat/{rules → _rules}/_shared.py +5 -5
- cognite/neat/_rules/analysis/__init__.py +5 -0
- cognite/neat/{rules → _rules}/analysis/_asset.py +5 -5
- cognite/neat/{rules → _rules}/analysis/_base.py +5 -5
- cognite/neat/_rules/analysis/_dms.py +43 -0
- cognite/neat/{rules → _rules}/analysis/_information.py +12 -6
- cognite/neat/_rules/catalog/__init__.py +6 -0
- cognite/neat/_rules/catalog/info-rules-imf.xlsx +0 -0
- cognite/neat/{rules → _rules}/exporters/__init__.py +2 -0
- cognite/neat/{rules → _rules}/exporters/_base.py +3 -3
- cognite/neat/{rules → _rules}/exporters/_rules2dms.py +5 -5
- cognite/neat/{rules → _rules}/exporters/_rules2excel.py +26 -7
- cognite/neat/_rules/exporters/_rules2instance_template.py +152 -0
- cognite/neat/{rules → _rules}/exporters/_rules2ontology.py +10 -9
- cognite/neat/{rules → _rules}/exporters/_rules2yaml.py +1 -3
- cognite/neat/{rules → _rules}/exporters/_validation.py +2 -2
- cognite/neat/{rules → _rules}/importers/_base.py +3 -3
- cognite/neat/{rules → _rules}/importers/_dms2rules.py +9 -9
- cognite/neat/{rules → _rules}/importers/_dtdl2rules/dtdl_converter.py +7 -7
- cognite/neat/{rules → _rules}/importers/_dtdl2rules/dtdl_importer.py +9 -9
- cognite/neat/{rules → _rules}/importers/_dtdl2rules/spec.py +1 -1
- cognite/neat/_rules/importers/_rdf/_base.py +144 -0
- cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2classes.py +1 -1
- cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2metadata.py +4 -4
- cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2properties.py +2 -1
- cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/_imf2rules.py +8 -39
- cognite/neat/{rules → _rules}/importers/_rdf/_inference2rules.py +33 -106
- cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/_owl2classes.py +1 -1
- cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/_owl2metadata.py +5 -5
- cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/_owl2properties.py +1 -1
- cognite/neat/_rules/importers/_rdf/_owl2rules/_owl2rules.py +39 -0
- cognite/neat/{rules → _rules}/importers/_rdf/_shared.py +4 -4
- cognite/neat/{rules → _rules}/importers/_spreadsheet2rules.py +40 -6
- cognite/neat/{rules → _rules}/importers/_yaml2rules.py +5 -5
- cognite/neat/{rules → _rules}/models/__init__.py +5 -5
- cognite/neat/{rules → _rules}/models/_base_input.py +30 -11
- cognite/neat/{rules → _rules}/models/_base_rules.py +22 -8
- cognite/neat/{rules → _rules}/models/_rdfpath.py +1 -1
- cognite/neat/_rules/models/_types.py +151 -0
- cognite/neat/{rules → _rules}/models/asset/_rules.py +4 -4
- cognite/neat/{rules → _rules}/models/asset/_rules_input.py +4 -4
- cognite/neat/{rules → _rules}/models/asset/_validation.py +7 -7
- cognite/neat/{rules → _rules}/models/data_types.py +15 -12
- cognite/neat/{rules → _rules}/models/dms/_exporter.py +60 -12
- cognite/neat/{rules → _rules}/models/dms/_rules.py +29 -26
- cognite/neat/{rules → _rules}/models/dms/_rules_input.py +4 -4
- cognite/neat/{rules → _rules}/models/dms/_schema.py +15 -14
- cognite/neat/{rules → _rules}/models/dms/_validation.py +8 -8
- cognite/neat/{rules → _rules}/models/domain.py +6 -6
- cognite/neat/{rules → _rules}/models/entities/__init__.py +1 -2
- cognite/neat/_rules/models/entities/_constants.py +15 -0
- cognite/neat/{rules → _rules}/models/entities/_loaders.py +2 -2
- cognite/neat/{rules → _rules}/models/entities/_multi_value.py +15 -2
- cognite/neat/{rules → _rules}/models/entities/_single_value.py +16 -4
- cognite/neat/{rules → _rules}/models/information/_rules.py +37 -25
- cognite/neat/{rules → _rules}/models/information/_rules_input.py +3 -3
- cognite/neat/{rules → _rules}/models/information/_validation.py +6 -5
- cognite/neat/_rules/models/mapping/__init__.py +4 -0
- cognite/neat/_rules/models/mapping/_base.py +131 -0
- cognite/neat/_rules/models/mapping/_classic2core.py +150 -0
- cognite/neat/{rules → _rules}/transformers/__init__.py +15 -2
- cognite/neat/{rules → _rules}/transformers/_base.py +3 -3
- cognite/neat/{rules → _rules}/transformers/_converters.py +289 -20
- cognite/neat/{rules/transformers/_map_onto.py → _rules/transformers/_mapping.py} +46 -4
- cognite/neat/{rules → _rules}/transformers/_pipelines.py +4 -4
- cognite/neat/{rules → _rules}/transformers/_verification.py +10 -4
- cognite/neat/_session/__init__.py +3 -0
- cognite/neat/_session/_base.py +86 -0
- cognite/neat/_session/_prepare.py +61 -0
- cognite/neat/_session/_read.py +118 -0
- cognite/neat/_session/_show.py +96 -0
- cognite/neat/_session/_state.py +69 -0
- cognite/neat/_session/_to.py +70 -0
- cognite/neat/_session/_wizard.py +39 -0
- cognite/neat/_session/exceptions.py +42 -0
- cognite/neat/{store → _store}/_base.py +63 -32
- cognite/neat/{store → _store}/_provenance.py +11 -1
- cognite/neat/{utils → _utils}/auth.py +14 -3
- cognite/neat/{utils → _utils}/auxiliary.py +1 -1
- cognite/neat/{utils → _utils}/cdf/loaders/_data_modeling.py +8 -2
- cognite/neat/{utils → _utils}/cdf/loaders/_ingestion.py +1 -1
- cognite/neat/{utils → _utils}/upload.py +1 -1
- cognite/neat/_version.py +1 -1
- cognite/neat/_workflows/__init__.py +17 -0
- cognite/neat/{workflows → _workflows}/base.py +10 -10
- cognite/neat/{workflows → _workflows}/cdf_store.py +3 -3
- cognite/neat/{workflows → _workflows}/examples/Export_DMS/workflow.yaml +89 -89
- cognite/neat/{workflows → _workflows}/manager.py +6 -6
- cognite/neat/{workflows → _workflows}/steps/data_contracts.py +3 -3
- cognite/neat/{workflows → _workflows}/steps/lib/current/graph_extractor.py +8 -31
- cognite/neat/{workflows → _workflows}/steps/lib/current/graph_loader.py +4 -4
- cognite/neat/{workflows → _workflows}/steps/lib/current/graph_store.py +4 -4
- cognite/neat/{workflows → _workflows}/steps/lib/current/rules_exporter.py +8 -8
- cognite/neat/{workflows → _workflows}/steps/lib/current/rules_importer.py +13 -13
- cognite/neat/{workflows → _workflows}/steps/lib/current/rules_validator.py +8 -8
- cognite/neat/{workflows → _workflows}/steps/lib/io/io_steps.py +3 -3
- cognite/neat/{workflows → _workflows}/steps/step_model.py +3 -3
- cognite/neat/{workflows → _workflows}/steps_registry.py +9 -9
- cognite/neat/{workflows → _workflows}/tasks.py +1 -1
- cognite/neat/{workflows → _workflows}/triggers.py +2 -2
- {cognite_neat-0.92.2.dist-info → cognite_neat-0.93.0.dist-info}/METADATA +6 -2
- cognite_neat-0.93.0.dist-info/RECORD +276 -0
- {cognite_neat-0.92.2.dist-info → cognite_neat-0.93.0.dist-info}/WHEEL +1 -1
- cognite_neat-0.93.0.dist-info/entry_points.txt +3 -0
- cognite/neat/app/api/context_manager/__init__.py +0 -3
- cognite/neat/graph/_shared.py +0 -5
- cognite/neat/graph/extractors/_iodd.py +0 -160
- cognite/neat/graph/extractors/_rdf_file.py +0 -26
- cognite/neat/rules/analysis/__init__.py +0 -6
- cognite/neat/rules/examples/__init__.py +0 -10
- cognite/neat/rules/examples/info-rules-imf.xlsx +0 -0
- cognite/neat/rules/examples/wind-energy.owl +0 -1511
- cognite/neat/rules/importers/_rdf/_owl2rules/_owl2rules.py +0 -65
- cognite/neat/rules/models/_types.py +0 -96
- cognite/neat/rules/models/entities/_constants.py +0 -73
- cognite/neat/utils/regex_patterns.py +0 -58
- cognite/neat/workflows/__init__.py +0 -12
- cognite_neat-0.92.2.dist-info/RECORD +0 -224
- cognite_neat-0.92.2.dist-info/entry_points.txt +0 -3
- /cognite/neat/{app → _app}/api/__init__.py +0 -0
- /cognite/neat/{app → _app}/api/asgi/metrics.py +0 -0
- /cognite/neat/{app → _app}/api/data_classes/__init__.py +0 -0
- /cognite/neat/{app → _app}/api/data_classes/rest.py +0 -0
- /cognite/neat/{app → _app}/api/routers/metrics.py +0 -0
- /cognite/neat/{app → _app}/api/utils/__init__.py +0 -0
- /cognite/neat/{app → _app}/api/utils/data_mapping.py +0 -0
- /cognite/neat/{app → _app}/api/utils/logging.py +0 -0
- /cognite/neat/{app → _app}/api/utils/query_templates.py +0 -0
- /cognite/neat/{app → _app}/monitoring/__init__.py +0 -0
- /cognite/neat/{app → _app}/monitoring/metrics.py +0 -0
- /cognite/neat/{app → _app}/ui/index.html +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/.gitignore +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/README.md +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/asset-manifest.json +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/favicon.ico +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/img/architect-icon.svg +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/img/developer-icon.svg +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/img/sme-icon.svg +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/index.html +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/logo192.png +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/manifest.json +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/robots.txt +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/css/main.72e3d92e.css +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/js/main.5a52cf09.js +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -0
- /cognite/neat/{app → _app}/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
- /cognite/neat/{graph → _graph}/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/_tracking/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- /cognite/neat/{graph → _graph}/examples/Knowledge-Graph-Nordic44.xml +0 -0
- /cognite/neat/{graph → _graph}/examples/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- /cognite/neat/{graph → _graph}/extractors/_classic_cdf/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/loaders/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/models.py +0 -0
- /cognite/neat/{graph → _graph}/queries/__init__.py +0 -0
- /cognite/neat/{graph → _graph}/transformers/_base.py +0 -0
- /cognite/neat/{issues → _issues}/__init__.py +0 -0
- /cognite/neat/{issues → _issues}/formatters.py +0 -0
- /cognite/neat/{rules → _rules}/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_dtdl2rules/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_dtdl2rules/_unit_lookup.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_rdf/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_rdf/_imf2rules/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/importers/_rdf/_owl2rules/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/models/asset/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/models/dms/__init__.py +0 -0
- /cognite/neat/{rules → _rules}/models/entities/_types.py +0 -0
- /cognite/neat/{rules → _rules}/models/entities/_wrapped.py +0 -0
- /cognite/neat/{rules → _rules}/models/information/__init__.py +0 -0
- /cognite/neat/{store → _store}/__init__.py +0 -0
- /cognite/neat/{utils → _utils}/__init__.py +0 -0
- /cognite/neat/{utils → _utils}/cdf/__init__.py +0 -0
- /cognite/neat/{utils → _utils}/cdf/data_classes.py +0 -0
- /cognite/neat/{utils → _utils}/cdf/loaders/__init__.py +0 -0
- /cognite/neat/{utils → _utils}/cdf/loaders/_base.py +0 -0
- /cognite/neat/{utils → _utils}/collection_.py +0 -0
- /cognite/neat/{utils → _utils}/rdf_.py +0 -0
- /cognite/neat/{utils → _utils}/spreadsheet.py +0 -0
- /cognite/neat/{utils → _utils}/text.py +0 -0
- /cognite/neat/{utils → _utils}/time_.py +0 -0
- /cognite/neat/{utils → _utils}/xml_.py +0 -0
- /cognite/neat/{workflows → _workflows}/examples/Export_Semantic_Data_Model/workflow.yaml +0 -0
- /cognite/neat/{workflows → _workflows}/examples/Import_DMS/workflow.yaml +0 -0
- /cognite/neat/{workflows → _workflows}/examples/Validate_Rules/workflow.yaml +0 -0
- /cognite/neat/{workflows → _workflows}/examples/Validate_Solution_Model/workflow.yaml +0 -0
- /cognite/neat/{workflows → _workflows}/model.py +0 -0
- /cognite/neat/{workflows → _workflows}/steps/__init__.py +0 -0
- /cognite/neat/{workflows → _workflows}/steps/lib/__init__.py +0 -0
- /cognite/neat/{workflows → _workflows}/steps/lib/current/__init__.py +0 -0
- /cognite/neat/{workflows → _workflows}/steps/lib/io/__init__.py +0 -0
- /cognite/neat/{workflows → _workflows}/utils.py +0 -0
- {cognite_neat-0.92.2.dist-info → cognite_neat-0.93.0.dist-info}/LICENSE +0 -0
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
import Button from "@mui/material/Button"
|
|
2
|
+
import Checkbox from "@mui/material/Checkbox"
|
|
3
|
+
import { red } from "@mui/material/colors"
|
|
4
|
+
import Dialog from "@mui/material/Dialog"
|
|
5
|
+
import DialogActions from "@mui/material/DialogActions"
|
|
6
|
+
import DialogContent from "@mui/material/DialogContent"
|
|
7
|
+
import DialogTitle from "@mui/material/DialogTitle"
|
|
8
|
+
import FormControl from "@mui/material/FormControl"
|
|
9
|
+
import FormControlLabel from "@mui/material/FormControlLabel"
|
|
10
|
+
import MenuItem from "@mui/material/MenuItem"
|
|
11
|
+
import Select from "@mui/material/Select"
|
|
12
|
+
import TextField from "@mui/material/TextField"
|
|
13
|
+
import React, { ChangeEvent, useEffect, useState } from "react"
|
|
14
|
+
import { StepMetadata, StepRegistry, WorkflowDefinition, WorkflowStepDefinition, WorkflowSystemComponent } from "types/WorkflowTypes"
|
|
15
|
+
import { getNeatApiRootUrl } from "./Utils"
|
|
16
|
+
import LocalUploader from "./LocalUploader"
|
|
17
|
+
import WarningIcon from '@mui/icons-material/Warning';
|
|
18
|
+
import { Autocomplete, Box, Container, FormGroup, InputLabel, Link, List, ListItem, ListItemText, Stack, Tooltip, Typography, darken, lighten, styled } from "@mui/material"
|
|
19
|
+
import CheckCircleOutlineOutlinedIcon from '@mui/icons-material/CheckCircleOutlineOutlined';
|
|
20
|
+
import PlayCircleOutlineIcon from '@mui/icons-material/PlayCircleOutline';
|
|
21
|
+
import { Height } from "@mui/icons-material"
|
|
22
|
+
|
|
23
|
+
const GroupHeader = styled('div')(({ theme }) => ({
|
|
24
|
+
position: 'sticky',
|
|
25
|
+
top: '-8px',
|
|
26
|
+
padding: '4px 10px',
|
|
27
|
+
color: theme.palette.primary.main,
|
|
28
|
+
backgroundColor:
|
|
29
|
+
theme.palette.mode === 'light'
|
|
30
|
+
? lighten(theme.palette.primary.light, 0.85)
|
|
31
|
+
: darken(theme.palette.primary.main, 0.8),
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
const GroupItems = styled('ul')({
|
|
35
|
+
padding: 0,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export default function StepEditorDialog(props: any)
|
|
39
|
+
{
|
|
40
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
41
|
+
const [selectedStep, setSelectedStep] = useState<WorkflowStepDefinition>();
|
|
42
|
+
const neatApiRootUrl = getNeatApiRootUrl();
|
|
43
|
+
const [runPayload,setRunPayload] = useState<string>(JSON.stringify({"action":"approve"}))
|
|
44
|
+
const [statusText,setStatusText] = useState<string>("")
|
|
45
|
+
const [stepRegistry,setStepRegistry] = useState<StepRegistry>()
|
|
46
|
+
const [selectedStepTemplate,setSelectedStepTemplate] = useState<StepMetadata>()
|
|
47
|
+
const [workflowDefinitions, setWorkflowDefinitions] = useState<WorkflowDefinition>();
|
|
48
|
+
const [showStepIdError, setShowStepIdError] = useState(false);
|
|
49
|
+
const [isConfigurationValid, setIsConfigurationValid] = useState(true);
|
|
50
|
+
|
|
51
|
+
const handleDialogSave = () => {
|
|
52
|
+
setDialogOpen(false);
|
|
53
|
+
|
|
54
|
+
console.dir(selectedStep);
|
|
55
|
+
props.onClose(selectedStep,"save");
|
|
56
|
+
setShowStepIdError(false);
|
|
57
|
+
setIsConfigurationValid(true);
|
|
58
|
+
};
|
|
59
|
+
const handleDialogCancel = () => {
|
|
60
|
+
setDialogOpen(false);
|
|
61
|
+
props.onClose(selectedStep,"cancel");
|
|
62
|
+
setShowStepIdError(false);
|
|
63
|
+
setIsConfigurationValid(true);
|
|
64
|
+
};
|
|
65
|
+
const handleDelete = () => {
|
|
66
|
+
setDialogOpen(false);
|
|
67
|
+
props.onClose(selectedStep,"delete");
|
|
68
|
+
setShowStepIdError(false);
|
|
69
|
+
setIsConfigurationValid(true);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const handleRunCommand = () => {
|
|
73
|
+
setDialogOpen(false);
|
|
74
|
+
// send POST request to run the step
|
|
75
|
+
fetch(neatApiRootUrl +'/api/workflow/'+props.workflowName+'/http_trigger/'+selectedStep.id, { method: 'POST', body: runPayload })
|
|
76
|
+
.then(response => response.json())
|
|
77
|
+
.then(data => {
|
|
78
|
+
|
|
79
|
+
}).catch((error) => {
|
|
80
|
+
console.error('Error:', error);
|
|
81
|
+
})
|
|
82
|
+
props.onClose(selectedStep,"run");
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const handleResumeCommand = () => {
|
|
86
|
+
setDialogOpen(false);
|
|
87
|
+
// send POST request to run the step
|
|
88
|
+
fetch(neatApiRootUrl +'/api/workflow/'+props.workflowName+'/resume/'+selectedStep.id+'/default', { method: 'POST', body: runPayload })
|
|
89
|
+
.then(response => response.json())
|
|
90
|
+
.then(data => {
|
|
91
|
+
|
|
92
|
+
}).catch((error) => {
|
|
93
|
+
console.error('Error:', error);
|
|
94
|
+
})
|
|
95
|
+
props.onClose(selectedStep,"run");
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const onUpload = (fileName:string , hash: string) => {
|
|
99
|
+
|
|
100
|
+
setStatusText("File uploaded "+fileName)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (props.open){
|
|
105
|
+
setDialogOpen(true);
|
|
106
|
+
if (props.step.stype == "stdstep") {
|
|
107
|
+
setSelectedStepTemplate(props.stepRegistry?.getStepByName(props.step.method))
|
|
108
|
+
let updStep = updateStepConfigsFromConfigurables(props.stepRegistry?.getStepByName(props.step.method),props.step,false)
|
|
109
|
+
setSelectedStep(updStep);
|
|
110
|
+
}else {
|
|
111
|
+
setSelectedStep(props.step);
|
|
112
|
+
}
|
|
113
|
+
setStepRegistry(props.stepRegistry);
|
|
114
|
+
setWorkflowDefinitions(props.workflowDefinitions);
|
|
115
|
+
|
|
116
|
+
console.dir(props.stepRegistry);
|
|
117
|
+
}
|
|
118
|
+
}, [props.open]);
|
|
119
|
+
|
|
120
|
+
// useEffect(() => {
|
|
121
|
+
// updateStepConfigsFromConfigurables(selectedStepTemplate,selectedStep,true);
|
|
122
|
+
// }, [selectedStepTemplate]);
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
const handleStepConfigurableChange = (name: string, value: any) => {
|
|
126
|
+
|
|
127
|
+
console.dir(selectedStep);
|
|
128
|
+
let updStep= Object.assign({},selectedStep);
|
|
129
|
+
if (selectedStep) {
|
|
130
|
+
if (!selectedStep.configs)
|
|
131
|
+
selectedStep.configs = new Map<string,string>();
|
|
132
|
+
selectedStep.configs[name] = value;
|
|
133
|
+
}
|
|
134
|
+
setSelectedStep(updStep);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const updateStepConfigsFromConfigurables = (stepTemplate: StepMetadata, currentStep:WorkflowStepDefinition,loadDefaults:boolean) => {
|
|
138
|
+
// Configuring default valus from step template
|
|
139
|
+
|
|
140
|
+
let updStep= Object.assign({},currentStep);
|
|
141
|
+
if (!updStep.configs || loadDefaults) {
|
|
142
|
+
updStep.configs = new Map<string,string>();
|
|
143
|
+
updStep.complex_configs = new Map<string,Map<string,any>>();
|
|
144
|
+
}
|
|
145
|
+
if(!currentStep?.configs)
|
|
146
|
+
currentStep.configs = new Map<string,string>();
|
|
147
|
+
if(!currentStep?.complex_configs)
|
|
148
|
+
currentStep.complex_configs = new Map<string,Map<string,any>>();
|
|
149
|
+
for (let i=0;i<stepTemplate?.configurables.length;i++) {
|
|
150
|
+
let confFromTemplate = stepTemplate?.configurables[i];
|
|
151
|
+
if (confFromTemplate.type == "multi_select") {
|
|
152
|
+
if (currentStep?.complex_configs[confFromTemplate.name] != undefined) {
|
|
153
|
+
updStep.complex_configs[confFromTemplate.name] = currentStep?.complex_configs[confFromTemplate.name];
|
|
154
|
+
} else {
|
|
155
|
+
updStep.complex_configs[confFromTemplate.name] = new Map<string,boolean>();
|
|
156
|
+
for (let j=0;j<confFromTemplate?.options.length;j++) {
|
|
157
|
+
updStep.complex_configs[confFromTemplate.name][confFromTemplate?.options[j]] = false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
else{
|
|
162
|
+
if (currentStep?.configs[confFromTemplate.name])
|
|
163
|
+
updStep.configs[confFromTemplate.name] = currentStep?.configs[confFromTemplate.name];
|
|
164
|
+
else
|
|
165
|
+
updStep.configs[confFromTemplate.name] = confFromTemplate?.value;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
}
|
|
169
|
+
return updStep;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const handleStepConfigChange = (name: string, value: any) => {
|
|
173
|
+
|
|
174
|
+
let updStep= Object.assign({},selectedStep);
|
|
175
|
+
|
|
176
|
+
if (selectedStep) {
|
|
177
|
+
if (!selectedStep.params) {
|
|
178
|
+
selectedStep.params = {}
|
|
179
|
+
}
|
|
180
|
+
if (name == "stype") {
|
|
181
|
+
switch (value) {
|
|
182
|
+
case "time_trigger":
|
|
183
|
+
updStep.params = { "interval": "every 60 minutes" }
|
|
184
|
+
updStep.trigger = true;
|
|
185
|
+
break;
|
|
186
|
+
case "http_trigger":
|
|
187
|
+
updStep.trigger = true;
|
|
188
|
+
break;
|
|
189
|
+
case "file_uploader":
|
|
190
|
+
updStep.trigger = true;
|
|
191
|
+
if( updStep.params["file_type"] == undefined)
|
|
192
|
+
updStep.params["file_type"] = "rules"
|
|
193
|
+
break;
|
|
194
|
+
|
|
195
|
+
case "start_workflow_task_step":
|
|
196
|
+
updStep.params = { "workflow_name": "", "sync": "false" }
|
|
197
|
+
break;
|
|
198
|
+
case "stdstep":
|
|
199
|
+
setSelectedStepTemplate(null)
|
|
200
|
+
|
|
201
|
+
}
|
|
202
|
+
updStep["stype"] = value;
|
|
203
|
+
} else {
|
|
204
|
+
switch (name) {
|
|
205
|
+
case "id":
|
|
206
|
+
// validate if id is unique
|
|
207
|
+
let isUnique = workflowDefinitions?.isNewIdUnique(value);
|
|
208
|
+
if (!isUnique) {
|
|
209
|
+
setShowStepIdError(true);
|
|
210
|
+
setIsConfigurationValid(false);
|
|
211
|
+
} else {
|
|
212
|
+
setShowStepIdError(false);
|
|
213
|
+
setIsConfigurationValid(true);
|
|
214
|
+
}
|
|
215
|
+
updStep.id = value;
|
|
216
|
+
break;
|
|
217
|
+
case "method":
|
|
218
|
+
if (selectedStep.stype == "stdstep") {
|
|
219
|
+
updStep = updateStepConfigsFromConfigurables(stepRegistry.getStepByName(value),updStep,true)
|
|
220
|
+
selectedStep.configs = updStep.configs;
|
|
221
|
+
setSelectedStepTemplate(stepRegistry.getStepByName(value))
|
|
222
|
+
}
|
|
223
|
+
updStep.method = value;
|
|
224
|
+
break
|
|
225
|
+
case "time-interval":
|
|
226
|
+
updStep.params["interval"] = value;
|
|
227
|
+
break;
|
|
228
|
+
case "workflow_name":
|
|
229
|
+
updStep.params["workflow_name"] = value;
|
|
230
|
+
break;
|
|
231
|
+
case "workflow_sync_run_flag":
|
|
232
|
+
value = "false"
|
|
233
|
+
if (value) {
|
|
234
|
+
value = "true"
|
|
235
|
+
}
|
|
236
|
+
updStep.params["sync"] = value;
|
|
237
|
+
break;
|
|
238
|
+
case "workflow_start_method":
|
|
239
|
+
updStep.params["workflow_start_method"] = value;
|
|
240
|
+
break;
|
|
241
|
+
case "max_wait_time":
|
|
242
|
+
updStep.params["max_wait_time"] = value;
|
|
243
|
+
break;
|
|
244
|
+
case "wait_timeout":
|
|
245
|
+
updStep.params["wait_timeout"] = value;
|
|
246
|
+
break;
|
|
247
|
+
case "file_upload_type":
|
|
248
|
+
updStep.params["file_type"] = value;
|
|
249
|
+
break;
|
|
250
|
+
default:
|
|
251
|
+
updStep[name] = value;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
}
|
|
256
|
+
setSelectedStep(updStep);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
function checkboxHandler(configItemName:string,selectedItemName:string,checked:boolean): void {
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
if (selectedStep) {
|
|
264
|
+
let updStep= Object.assign({},selectedStep);
|
|
265
|
+
if (!selectedStep.complex_configs)
|
|
266
|
+
updStep.complex_configs = new Map<string,Map<string,boolean>>();
|
|
267
|
+
|
|
268
|
+
if (selectedStep.complex_configs[configItemName]==undefined)
|
|
269
|
+
updStep.complex_configs[configItemName] = new Map<string,boolean>( );
|
|
270
|
+
|
|
271
|
+
updStep.complex_configs[configItemName][selectedItemName] = checked;
|
|
272
|
+
console.dir(updStep)
|
|
273
|
+
setSelectedStep(updStep);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return (
|
|
279
|
+
<Dialog open={dialogOpen} onClose={handleDialogCancel} fullWidth={true} maxWidth={"xl"} >
|
|
280
|
+
<DialogTitle>Step configurator</DialogTitle>
|
|
281
|
+
<DialogContent sx={{height:"90vh" }}>
|
|
282
|
+
<FormControl fullWidth>
|
|
283
|
+
<TextField sx={{ marginTop: 1 }} id="step-config-id" fullWidth label="Step id" size='small' variant="outlined" value={selectedStep?.id} onChange={(event) => { handleStepConfigChange("id", event.target.value) }} />
|
|
284
|
+
{showStepIdError && ( <Typography sx={{ marginTop: 1 }} color="error"> Step id must be unique </Typography>)}
|
|
285
|
+
<TextField sx={{ marginTop: 1 }} id="step-config-label" fullWidth label="Label" size='small' variant="outlined" value={selectedStep?.label} onChange={(event) => { handleStepConfigChange("label", event.target.value) }} />
|
|
286
|
+
</FormControl>
|
|
287
|
+
<FormControl sx={{ marginTop: 2 }} fullWidth >
|
|
288
|
+
<InputLabel id="step_type_label">Step type</InputLabel>
|
|
289
|
+
<Select sx={{ marginTop: 1 }}
|
|
290
|
+
id="step-config-stype"
|
|
291
|
+
labelId="step_type_label"
|
|
292
|
+
value={selectedStep?.stype}
|
|
293
|
+
label="Step type"
|
|
294
|
+
size='small'
|
|
295
|
+
variant="outlined"
|
|
296
|
+
onChange={(event) => { handleStepConfigChange("stype", event.target.value) }}
|
|
297
|
+
>
|
|
298
|
+
<MenuItem value="stdstep">Step library</MenuItem>
|
|
299
|
+
<MenuItem value="file_uploader">File uploader</MenuItem>
|
|
300
|
+
<MenuItem value="http_trigger">Workflow trigger</MenuItem>
|
|
301
|
+
<MenuItem value="start_workflow_task_step">Multi-workflow trigger</MenuItem>
|
|
302
|
+
<MenuItem value="time_trigger">Time trigger</MenuItem>
|
|
303
|
+
<MenuItem value="wait_for_event">Wait for event</MenuItem>
|
|
304
|
+
</Select>
|
|
305
|
+
</FormControl>
|
|
306
|
+
<FormControl sx={{ marginTop: 1 }} fullWidth >
|
|
307
|
+
{(selectedStep?.stype == "time_trigger") && (
|
|
308
|
+
<TextField sx={{ marginTop: 1 }} id="step-config-time-config" fullWidth label="Time interval" size='small' variant="outlined" value={selectedStep?.params["interval"]} onChange={(event) => { handleStepConfigChange("time-interval", event.target.value) }} />
|
|
309
|
+
)}
|
|
310
|
+
{(selectedStep?.stype == "stdstep") && (
|
|
311
|
+
<Box>
|
|
312
|
+
<FormControl sx={{ marginTop: 2 }} fullWidth >
|
|
313
|
+
<Autocomplete
|
|
314
|
+
disablePortal
|
|
315
|
+
id="std-step-selector"
|
|
316
|
+
options={stepRegistry.steps.sort((a, b) => -b.category.localeCompare(a.category))}
|
|
317
|
+
value={selectedStepTemplate}
|
|
318
|
+
isOptionEqualToValue={(option, value) => option.name === value.name }
|
|
319
|
+
getOptionLabel={(option) => option.name}
|
|
320
|
+
sx={{ marginBottom: 2 }}
|
|
321
|
+
size='small'
|
|
322
|
+
groupBy={(option) => option.category}
|
|
323
|
+
renderGroup={(params) => (
|
|
324
|
+
<li key={params.key}>
|
|
325
|
+
<GroupHeader>{params.group}</GroupHeader>
|
|
326
|
+
<GroupItems>{params.children}</GroupItems>
|
|
327
|
+
</li>
|
|
328
|
+
)}
|
|
329
|
+
onChange={(event: React.SyntheticEvent, value, reason, details) => { handleStepConfigChange("method", value.name) }}
|
|
330
|
+
renderInput={(params) => <TextField {...params} label="Step name" />}
|
|
331
|
+
/>
|
|
332
|
+
</FormControl>
|
|
333
|
+
{selectedStepTemplate && (
|
|
334
|
+
<Box>
|
|
335
|
+
<Stack direction="row" spacing={2}>
|
|
336
|
+
<Typography sx={{marginRight:7}}>
|
|
337
|
+
Version : <span style={{ color: selectedStepTemplate?.version.toLowerCase().includes("legacy") ? "red" : "green", fontWeight: selectedStepTemplate?.version.toLowerCase().includes("private-beta") ? "bold" : "bold" }}>{selectedStepTemplate?.version}</span>
|
|
338
|
+
{selectedStepTemplate?.version.toLowerCase().includes("legacy") && (
|
|
339
|
+
<Tooltip title="Caution: This step is legacy step, meaning it can be only used with other legacy steps. We are not supporting it anymore.">
|
|
340
|
+
<WarningIcon sx={{ marginLeft: 1, marginBottom: -0.5, color: "orange" }} />
|
|
341
|
+
</Tooltip>
|
|
342
|
+
)}
|
|
343
|
+
</Typography>
|
|
344
|
+
<Link href={selectedStepTemplate?.docs_url} target="_blank"> Extended documentation </Link>
|
|
345
|
+
</Stack>
|
|
346
|
+
<Typography> Description : {selectedStepTemplate?.description} </Typography>
|
|
347
|
+
<Typography> Input : <ul> {selectedStepTemplate?.input.map((item,i)=> (<li> {workflowDefinitions?.isStepInputConfigured(selectedStep?.id,item, stepRegistry) && (<CheckCircleOutlineOutlinedIcon sx={{ marginBottom: -0.5 }} color="success"/>) } {item}</li>)) } </ul> </Typography>
|
|
348
|
+
<Typography> Output : <ul> {selectedStepTemplate?.output.map((item,i)=> (<li> {item} </li>))} </ul> </Typography>
|
|
349
|
+
<Typography> Configurations : </Typography>
|
|
350
|
+
<List sx={{ width: '100%', bgcolor: 'background.paper' }}>
|
|
351
|
+
{selectedStepTemplate?.configurables.map((item,i)=> (
|
|
352
|
+
<ListItem sx={{
|
|
353
|
+
backgroundColor: item.label.toLowerCase().includes("warning") ? "yellow" : "inherit"
|
|
354
|
+
}}>
|
|
355
|
+
<Box sx={{width:'50vw'}}>
|
|
356
|
+
|
|
357
|
+
<ListItemText
|
|
358
|
+
primary={item.name}
|
|
359
|
+
secondary={
|
|
360
|
+
<Box sx={{ display: "flex", alignItems: "center" }}>
|
|
361
|
+
{item.label.toLowerCase().includes("warning") && (
|
|
362
|
+
<WarningIcon sx={{ marginRight: 1, color: "orange" }} />
|
|
363
|
+
)}
|
|
364
|
+
{item.label}
|
|
365
|
+
</Box>
|
|
366
|
+
}
|
|
367
|
+
/>
|
|
368
|
+
</Box>
|
|
369
|
+
<Box sx={{width:'50vw'}}>
|
|
370
|
+
<FormControl fullWidth>
|
|
371
|
+
{item?.options && selectedStep?.configs[item.name] != undefined && item?.type != "multi_select" && (
|
|
372
|
+
<Select
|
|
373
|
+
value={ selectedStep?.configs[item.name]}
|
|
374
|
+
size='small'
|
|
375
|
+
variant="outlined"
|
|
376
|
+
onChange={(event) => { handleStepConfigurableChange(item.name, event.target.value) }}
|
|
377
|
+
sx={{ marginBottom: 0 }}
|
|
378
|
+
>
|
|
379
|
+
{
|
|
380
|
+
item?.options && item.options.map((option, i) => (
|
|
381
|
+
<MenuItem value={option} key={option}> {option} </MenuItem>
|
|
382
|
+
))
|
|
383
|
+
}
|
|
384
|
+
</Select> )}
|
|
385
|
+
{ item?.type == "multi_select" && (
|
|
386
|
+
<FormGroup
|
|
387
|
+
sx={{ marginBottom: 0 }}
|
|
388
|
+
>
|
|
389
|
+
{
|
|
390
|
+
item?.options && item.options.map((option, i) => (
|
|
391
|
+
<FormControlLabel
|
|
392
|
+
control={<Checkbox checked = {selectedStep?.complex_configs[item.name][option]} onChange={ (event: ChangeEvent<HTMLInputElement>, checkedv: boolean)=>{ checkboxHandler(item.name,option,checkedv) } } name={option} />}
|
|
393
|
+
label={option}
|
|
394
|
+
/>
|
|
395
|
+
))
|
|
396
|
+
}
|
|
397
|
+
</FormGroup>
|
|
398
|
+
)}
|
|
399
|
+
{!item?.options && selectedStep?.configs && selectedStep?.configs[item.name] != undefined && item?.type != "password" && (
|
|
400
|
+
<TextField sx={{ marginTop: 0 }} fullWidth size='small' variant="outlined" value={ selectedStep?.configs[item.name]} onChange={(event) => { handleStepConfigurableChange(item.name, event.target.value) }} />
|
|
401
|
+
)}
|
|
402
|
+
{!item?.options && selectedStep?.configs && selectedStep?.configs[item.name] != undefined && item?.type == "password" && (
|
|
403
|
+
<TextField sx={{ marginTop: 0 }} fullWidth size='small' type="password" variant="outlined" value={ selectedStep?.configs[item.name]} onChange={(event) => { handleStepConfigurableChange(item.name, event.target.value) }} />
|
|
404
|
+
)}
|
|
405
|
+
</FormControl>
|
|
406
|
+
</Box>
|
|
407
|
+
</ListItem>
|
|
408
|
+
))}
|
|
409
|
+
</List>
|
|
410
|
+
</Box>
|
|
411
|
+
)}
|
|
412
|
+
</Box>
|
|
413
|
+
)}
|
|
414
|
+
<TextField sx={{ marginTop: 1 }} id="step-config-descr" fullWidth label="Notes" size='small' variant="outlined" value={selectedStep?.description} onChange={(event) => { handleStepConfigChange("description", event.target.value) }} />
|
|
415
|
+
|
|
416
|
+
{(selectedStep?.stype == "pystep") && (
|
|
417
|
+
<TextField sx={{ marginTop: 1 }} id="step-pystep-method" fullWidth label="Override function name (optional)" size='small' variant="outlined" value={selectedStep?.method} onChange={(event) => { handleStepConfigChange("method", event.target.value) }} />
|
|
418
|
+
)}
|
|
419
|
+
{(selectedStep?.stype == "start_workflow_task_step") && (
|
|
420
|
+
<TextField sx={{ marginTop: 1 }} id="step-start_workflow_task_step" fullWidth label="Name of the workflow" size='small' variant="outlined" value={selectedStep?.params["workflow_name"]} onChange={(event) => { handleStepConfigChange("workflow_name", event.target.value) }} />
|
|
421
|
+
)}
|
|
422
|
+
{(selectedStep?.stype == "start_workflow_task_step" || selectedStep?.stype == "http_trigger") && (
|
|
423
|
+
<FormControlLabel control={<Checkbox checked={selectedStep?.params["sync"] == "true"} onChange={(event) => { handleStepConfigChange("workflow_sync_run_flag", event.target.checked) }} />} label="Synchronous execution" />
|
|
424
|
+
)}
|
|
425
|
+
<FormControlLabel control={<Checkbox checked={selectedStep?.enabled} onChange={(event) => { handleStepConfigChange("enabled", event.target.checked) }} />} label="Is step enabled" />
|
|
426
|
+
{(selectedStep?.stype == "file_uploader") && (
|
|
427
|
+
<Box>
|
|
428
|
+
<FormControl fullWidth sx={{ marginTop: 2 }}>
|
|
429
|
+
<InputLabel id="file_uploader_file_type_label">Select File Type</InputLabel>
|
|
430
|
+
<Select sx={{ marginTop: 1 }}
|
|
431
|
+
labelId="file_uploader_file_type_label"
|
|
432
|
+
id="file_uploader_file_type"
|
|
433
|
+
value={selectedStep?.params["file_type"]}
|
|
434
|
+
label="Select File Type"
|
|
435
|
+
size='small'
|
|
436
|
+
variant="outlined"
|
|
437
|
+
onChange={(event) => { handleStepConfigChange("file_upload_type", event.target.value) }}
|
|
438
|
+
>
|
|
439
|
+
<MenuItem value="rules">Rules (Data Model) File</MenuItem>
|
|
440
|
+
<MenuItem value="staging">Staging File: Data dump in json/xml/csv format or any other file</MenuItem>
|
|
441
|
+
<MenuItem value="source_graph"> Source graph file in RDF format</MenuItem>
|
|
442
|
+
</Select>
|
|
443
|
+
</FormControl>
|
|
444
|
+
<LocalUploader
|
|
445
|
+
fileType={selectedStep?.params["file_type"]}
|
|
446
|
+
action="start_workflow"
|
|
447
|
+
onUpload={onUpload}
|
|
448
|
+
stepId={selectedStep.id}
|
|
449
|
+
workflowName={props.workflowName}
|
|
450
|
+
/>
|
|
451
|
+
</Box>
|
|
452
|
+
)}
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
{(selectedStep?.trigger == false) && (
|
|
456
|
+
<TextField sx={{ marginTop: 1 }} id="step-config-max-retries" fullWidth label="Max retries on failure" size='small' type="number" variant="outlined" value={selectedStep?.max_retries} onChange={(event) => { handleStepConfigChange("max_retries", event.target.value) }} />
|
|
457
|
+
)}
|
|
458
|
+
{(selectedStep?.trigger == false) && (
|
|
459
|
+
<TextField sx={{ marginTop: 1 }} id="step-config-retry-delay" fullWidth label="Retry delay" size='small' variant="outlined" type="number" value={selectedStep?.retry_delay} onChange={(event) => { handleStepConfigChange("retry_delay", event.target.value) }} />
|
|
460
|
+
)}
|
|
461
|
+
</FormControl>
|
|
462
|
+
{(selectedStep?.stype == "http_trigger") && (
|
|
463
|
+
|
|
464
|
+
<FormControl fullWidth sx={{ marginTop: 2 }}>
|
|
465
|
+
<InputLabel id="workflow_start_method_label">Workflow instance start method</InputLabel>
|
|
466
|
+
<Select sx={{ marginTop: 1 }}
|
|
467
|
+
labelId="workflow_start_method_label"
|
|
468
|
+
id="workflow_start_method"
|
|
469
|
+
value={selectedStep?.params["workflow_start_method"]}
|
|
470
|
+
label="Workflow instance start method"
|
|
471
|
+
size='small'
|
|
472
|
+
variant="outlined"
|
|
473
|
+
onChange={(event) => { handleStepConfigChange("workflow_start_method", event.target.value) }}
|
|
474
|
+
>
|
|
475
|
+
<MenuItem value="persistent_blocking">Start single global workflow instance in blocking mode (default)</MenuItem>
|
|
476
|
+
<MenuItem value="persistent_non_blocking">Start single global workflow instance in non-blocking mode</MenuItem>
|
|
477
|
+
<MenuItem value="ephemeral_instance">Start ephemeral workflow instance per request</MenuItem>
|
|
478
|
+
</Select>
|
|
479
|
+
</FormControl>
|
|
480
|
+
)}
|
|
481
|
+
<FormControl fullWidth sx={{ marginTop: 2 }}>
|
|
482
|
+
{(selectedStep?.stype == "http_trigger" || selectedStep?.stype == "wait_for_event") && (
|
|
483
|
+
<TextField sx={{ marginTop: 1 }} value={runPayload} label="Run payload" size='small' variant="outlined" onChange={(event)=>setRunPayload(event.target.value)} id="run_payload"> </TextField>
|
|
484
|
+
)}
|
|
485
|
+
{(selectedStep?.stype == "wait_for_event") && (
|
|
486
|
+
<TextField sx={{ marginTop: 1 }} value={selectedStep?.params["wait_timeout"]} label="Time (in seconds) the system will wait before it times out and proceeds to next step.Default is 1 month" size='small' variant="outlined" onChange={(event) => { handleStepConfigChange("wait_timeout", event.target.value) }} id="wait_timeout"> </TextField>
|
|
487
|
+
)}
|
|
488
|
+
{(selectedStep?.stype == "http_trigger" && selectedStep?.params["workflow_start_method"]=="persistent_blocking") && (
|
|
489
|
+
<TextField sx={{ marginTop: 1 }} value={selectedStep?.params["max_wait_time"]} size='small' variant="outlined" label="Max blocking wait time" onChange={(event) => { handleStepConfigChange("max_wait_time", event.target.value) }} id="max_wait_time"> </TextField>
|
|
490
|
+
)}
|
|
491
|
+
</FormControl>
|
|
492
|
+
|
|
493
|
+
{(selectedStep?.stype == "http_trigger") && (
|
|
494
|
+
<Button sx={{ marginTop: 5 , width: "100%" , alignItems: 'center',justifyContent: 'center' }} variant="outlined" size="small" color="success" onClick={handleRunCommand}> <PlayCircleOutlineIcon sx={{marginRight:2}}/> Start workflow </Button>
|
|
495
|
+
)}
|
|
496
|
+
{(selectedStep?.stype == "wait_for_event") && (
|
|
497
|
+
<Button sx={{ marginTop: 5, width: "100%" , alignItems: 'center',justifyContent: 'center' }} variant="outlined" size="small" color="success" onClick={handleResumeCommand}> <PlayCircleOutlineIcon sx={{marginRight:2}}/> Resume workflow execution </Button>
|
|
498
|
+
)}
|
|
499
|
+
|
|
500
|
+
<Typography> {statusText} </Typography>
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
</DialogContent>
|
|
504
|
+
<DialogActions>
|
|
505
|
+
<Button variant="outlined" size="small" disabled={!isConfigurationValid} onClick={handleDialogSave}>Save</Button>
|
|
506
|
+
<Button variant="outlined" size="small" onClick={handleDialogCancel}>Cancel</Button>
|
|
507
|
+
<Button variant="outlined" size="small" color="error" onClick={handleDelete} >Delete</Button>
|
|
508
|
+
</DialogActions>
|
|
509
|
+
</Dialog>
|
|
510
|
+
)
|
|
511
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Typography from '@mui/material/Typography';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
|
|
5
|
+
interface TabPanelProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
index: number;
|
|
8
|
+
value: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function TabPanel(props: TabPanelProps) {
|
|
12
|
+
const { children, value, index, ...other } = props;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div
|
|
16
|
+
role="tabpanel"
|
|
17
|
+
hidden={value !== index}
|
|
18
|
+
id={`simple-tabpanel-${index}`}
|
|
19
|
+
aria-labelledby={`simple-tab-${index}`}
|
|
20
|
+
{...other}
|
|
21
|
+
>
|
|
22
|
+
{value === index && (
|
|
23
|
+
<Box sx={{ p: 3 }}>
|
|
24
|
+
<Typography>{children}</Typography>
|
|
25
|
+
</Box>
|
|
26
|
+
)}
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function a11yProps(index: number) {
|
|
32
|
+
return {
|
|
33
|
+
id: `simple-tab-${index}`,
|
|
34
|
+
'aria-controls': `simple-tabpanel-${index}`,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export function getSelectedWorkflowName() {
|
|
4
|
+
let workflowName = localStorage.getItem("selectedWorkflowName");
|
|
5
|
+
return workflowName;
|
|
6
|
+
}
|
|
7
|
+
export function setSelectedWorkflowName(workflowName: string) {
|
|
8
|
+
localStorage.setItem("selectedWorkflowName", workflowName);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function getNeatApiRootUrl() {
|
|
12
|
+
let url = localStorage.getItem("neatApiRootUrl");
|
|
13
|
+
if (url == null) {
|
|
14
|
+
const protocol = window.location.protocol;
|
|
15
|
+
const domain = window.location.hostname;
|
|
16
|
+
const port = window.location.port;
|
|
17
|
+
url = protocol + "//" + domain + ":" + port;
|
|
18
|
+
if (url == "http://localhost:3000") {
|
|
19
|
+
url = "http://localhost:8000";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return url;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function convertMillisToStr(millis) {
|
|
26
|
+
const date = new Date(millis);
|
|
27
|
+
const isoString = date.toISOString();
|
|
28
|
+
return isoString;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function getShortenedString(str,len) {
|
|
32
|
+
str = RemoveNsPrefix(str);
|
|
33
|
+
if (str.length <= len) {
|
|
34
|
+
return str;
|
|
35
|
+
} else {
|
|
36
|
+
return str.slice(0,len)+"..."+ str.slice(-len);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default function RemoveNsPrefix(strWithPrefix: string) {
|
|
41
|
+
|
|
42
|
+
if (strWithPrefix.includes("#"))
|
|
43
|
+
{
|
|
44
|
+
const strPlit = strWithPrefix.split("#")
|
|
45
|
+
if (strPlit.length > 1) {
|
|
46
|
+
return strPlit[1]
|
|
47
|
+
}
|
|
48
|
+
}else if (strWithPrefix.includes("/")) {
|
|
49
|
+
const strPlit = strWithPrefix.split("/")
|
|
50
|
+
if (strPlit.length > 1) {
|
|
51
|
+
return strPlit[strPlit.length-1]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return strWithPrefix;
|
|
56
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import Button from "@mui/material/Button"
|
|
2
|
+
import Dialog from "@mui/material/Dialog"
|
|
3
|
+
import DialogActions from "@mui/material/DialogActions"
|
|
4
|
+
import DialogContent from "@mui/material/DialogContent"
|
|
5
|
+
import DialogTitle from "@mui/material/DialogTitle"
|
|
6
|
+
import FormControl from "@mui/material/FormControl"
|
|
7
|
+
import IconButton from "@mui/material/IconButton/IconButton"
|
|
8
|
+
import TextField from "@mui/material/TextField"
|
|
9
|
+
import React from "react"
|
|
10
|
+
import { useEffect, useState } from "react"
|
|
11
|
+
import { WorkflowDefinition } from "types/WorkflowTypes"
|
|
12
|
+
import RemoveCircleOutlineOutlinedIcon from '@mui/icons-material/RemoveCircleOutlineOutlined';
|
|
13
|
+
import { getNeatApiRootUrl, getSelectedWorkflowName } from "./Utils"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export default function WorkflowDeleteDialog(props: any)
|
|
17
|
+
{
|
|
18
|
+
const neatApiRootUrl = getNeatApiRootUrl();
|
|
19
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
20
|
+
const [component, setComponent] = useState<WorkflowDefinition>(null);
|
|
21
|
+
|
|
22
|
+
const handleDialogCancel = () => {
|
|
23
|
+
setDialogOpen(false);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const deleteWorkflow = () => {
|
|
27
|
+
const url = neatApiRootUrl + "/api/workflow/" + getSelectedWorkflowName();
|
|
28
|
+
fetch(url, {
|
|
29
|
+
method: "delete", headers: {
|
|
30
|
+
'Content-Type': 'application/json;charset=utf-8'
|
|
31
|
+
}
|
|
32
|
+
}).then((response) => response.json()).then((data) => {
|
|
33
|
+
|
|
34
|
+
props.onDelete();
|
|
35
|
+
setDialogOpen(false);
|
|
36
|
+
window.location.reload();
|
|
37
|
+
|
|
38
|
+
}).catch((error) => {
|
|
39
|
+
console.error('Error:', error);
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<React.Fragment >
|
|
45
|
+
<IconButton color="warning" aria-label="add new workflow" onClick={(event)=>{setDialogOpen(true)} }>
|
|
46
|
+
<RemoveCircleOutlineOutlinedIcon />
|
|
47
|
+
</IconButton>
|
|
48
|
+
<Dialog open={dialogOpen} onClose={handleDialogCancel}>
|
|
49
|
+
<DialogTitle>Delete confirmation</DialogTitle>
|
|
50
|
+
<DialogContent>
|
|
51
|
+
<p>Are you sure you want to delete workflow {getSelectedWorkflowName()}?</p>
|
|
52
|
+
</DialogContent>
|
|
53
|
+
<DialogActions>
|
|
54
|
+
<Button variant="outlined" size="small" onClick={deleteWorkflow}>Delete</Button>
|
|
55
|
+
<Button variant="outlined" size="small" onClick={handleDialogCancel}>Cancel</Button>
|
|
56
|
+
</DialogActions>
|
|
57
|
+
</Dialog>
|
|
58
|
+
</React.Fragment>
|
|
59
|
+
)
|
|
60
|
+
}
|