cognite-neat 0.92.3__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 +12 -8
- 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 +7 -7
- 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 +15 -6
- cognite/neat/{rules → _rules}/models/_base_rules.py +14 -2
- 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 +26 -23
- 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 +7 -4
- cognite/neat/{rules → _rules}/models/information/_rules.py +34 -22
- 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.3.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.3.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.3.dist-info/RECORD +0 -224
- cognite_neat-0.92.3.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.3.dist-info → cognite_neat-0.93.0.dist-info}/LICENSE +0 -0
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
|
+
import ReactFlow, {
|
|
3
|
+
MiniMap,
|
|
4
|
+
Controls,
|
|
5
|
+
Background,
|
|
6
|
+
useNodesState,
|
|
7
|
+
useEdgesState,
|
|
8
|
+
addEdge,
|
|
9
|
+
Node,
|
|
10
|
+
updateEdge,
|
|
11
|
+
Panel,
|
|
12
|
+
NodeChange,
|
|
13
|
+
EdgeChange,
|
|
14
|
+
} from 'reactflow';
|
|
15
|
+
// 👇 you need to import the reactflow styles
|
|
16
|
+
|
|
17
|
+
import LinearProgress from '@mui/material/LinearProgress';
|
|
18
|
+
import { Typography } from '@mui/material';
|
|
19
|
+
import Stack from '@mui/material/Stack';
|
|
20
|
+
import { styled } from '@mui/material/styles';
|
|
21
|
+
import Paper from '@mui/material/Paper';
|
|
22
|
+
import FormControl from '@mui/material/FormControl';
|
|
23
|
+
import InputLabel from '@mui/material/InputLabel';
|
|
24
|
+
import Select, { SelectChangeEvent } from '@mui/material/Select';
|
|
25
|
+
import { Box } from '@mui/system';
|
|
26
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
import 'reactflow/dist/style.css';
|
|
30
|
+
import Button from '@mui/material/Button';
|
|
31
|
+
import { useState, useEffect } from 'react';
|
|
32
|
+
|
|
33
|
+
import { StepRegistry, UIConfig, WorkflowDefinition, WorkflowStepDefinition, WorkflowSystemComponent} from 'types/WorkflowTypes';
|
|
34
|
+
import { getNeatApiRootUrl, getSelectedWorkflowName, setSelectedWorkflowName } from 'components/Utils';
|
|
35
|
+
import WorkflowExecutionReport from 'components/WorkflowExecutionReport';
|
|
36
|
+
import ConfigView from './ConfigView';
|
|
37
|
+
import OverviewComponentEditorDialog from 'components/OverviewComponentEditorDialog';
|
|
38
|
+
import StepEditorDialog from 'components/StepEditorDialog';
|
|
39
|
+
import WorkflowMetadataDialog from 'components/WorkflowMetadataDialog';
|
|
40
|
+
import WorkflowDeleteDialog from 'components/WorkflowDeleteDialog';
|
|
41
|
+
import WorkflowImportExportDialog from 'components/WorkflowImportExportDialog';
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
export interface ExecutionLog {
|
|
45
|
+
id: string;
|
|
46
|
+
label: string;
|
|
47
|
+
state: string;
|
|
48
|
+
elapsed_time: number;
|
|
49
|
+
timestamp: string;
|
|
50
|
+
error: string;
|
|
51
|
+
output_text: string;
|
|
52
|
+
data: any;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface WorkflowStats {
|
|
56
|
+
state: string;
|
|
57
|
+
elapsed_time: number;
|
|
58
|
+
last_error: string;
|
|
59
|
+
execution_log: ExecutionLog[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const Item = styled(Paper)(({ theme }) => ({
|
|
63
|
+
backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff',
|
|
64
|
+
...theme.typography.body2,
|
|
65
|
+
padding: theme.spacing(1),
|
|
66
|
+
textAlign: 'left',
|
|
67
|
+
color: theme.palette.text.secondary,
|
|
68
|
+
}));
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
export default function WorkflowView() {
|
|
73
|
+
const neatApiRootUrl = getNeatApiRootUrl();
|
|
74
|
+
const edgeUpdateSuccessful = useRef(true);
|
|
75
|
+
const [nodes, setNodes, onNodesChange] = useNodesState([]);
|
|
76
|
+
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
|
|
77
|
+
const [workflowStats, setWorkflowStats] = useState<WorkflowStats>();
|
|
78
|
+
const [timerInterval, setTimerInterval] = useState(null);
|
|
79
|
+
const [workflowDefinitions, setWorkflowDefinitions] = useState<WorkflowDefinition>();
|
|
80
|
+
const [selectedWorkflow, setSelectedWorkflow] = useState<string>(getSelectedWorkflowName());
|
|
81
|
+
const [listOfWorkflows, setListOfWorkflows] = useState<string[]>([]);
|
|
82
|
+
const [viewType, setViewType] = useState<string>("steps");
|
|
83
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
84
|
+
const [workflowMetadataDialogOpen, setWorkflowMetadataDialogOpen] = useState(false);
|
|
85
|
+
const [openOverviewComponentEditorDialog, setOpenOverviewComponentEditorDialog] = useState(false);
|
|
86
|
+
const [selectedStep, setSelectedStep] = useState<WorkflowStepDefinition>();
|
|
87
|
+
const [selectedComponent, setSelectedComponent] = useState<WorkflowSystemComponent>();
|
|
88
|
+
const [fileContent, setFileContent] = useState('');
|
|
89
|
+
const [stepRegistry, setStepRegistry] = useState<StepRegistry>();
|
|
90
|
+
const [editState, setEditState] = useState<string>("");
|
|
91
|
+
const [loading , setLoading] = useState<boolean>(false);
|
|
92
|
+
const [errorText, setErrorText] = useState<string>("");
|
|
93
|
+
const [packageLink, setPackageLink] = useState<string>("");
|
|
94
|
+
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
loadListOfWorkflows();
|
|
97
|
+
loadRegisteredSteps();
|
|
98
|
+
if (getSelectedWorkflowName())
|
|
99
|
+
loadWorkflowDefinitions(getSelectedWorkflowName());
|
|
100
|
+
else
|
|
101
|
+
setEditState("Please select one of provided workflows or create new one");
|
|
102
|
+
}, []);
|
|
103
|
+
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
syncWorkflowDefToNodesAndEdges(viewType);
|
|
106
|
+
|
|
107
|
+
console.dir(workflowDefinitions);
|
|
108
|
+
startStatePolling(selectedWorkflow);
|
|
109
|
+
}, [workflowDefinitions]);
|
|
110
|
+
|
|
111
|
+
const startStatePolling = (workflowName:string) => {
|
|
112
|
+
if (timerInterval) {
|
|
113
|
+
clearInterval(timerInterval);
|
|
114
|
+
}
|
|
115
|
+
let newTimerInterval = setInterval(() => {
|
|
116
|
+
loadWorkflowStats(workflowName);
|
|
117
|
+
}, 2000);
|
|
118
|
+
setTimerInterval(newTimerInterval);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const stopStatePolling = () => {
|
|
122
|
+
clearInterval(timerInterval);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const loadListOfWorkflows = () => {
|
|
126
|
+
const url = neatApiRootUrl + "/api/workflow/workflows";
|
|
127
|
+
fetch(url).then((response) => response.json()).then((data) => {
|
|
128
|
+
setListOfWorkflows(data.workflows);
|
|
129
|
+
}).catch((error) => {
|
|
130
|
+
console.error('Error:', error);
|
|
131
|
+
}).finally(() => { });
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const loadWorkflowDefinitions = (workflowName: string = "") => {
|
|
135
|
+
if (workflowName == "")
|
|
136
|
+
workflowName = selectedWorkflow;
|
|
137
|
+
const url = neatApiRootUrl + "/api/workflow/workflow-definition/" + workflowName;
|
|
138
|
+
fetch(url).then((response) => {
|
|
139
|
+
if(response.ok)
|
|
140
|
+
return response.json()
|
|
141
|
+
else
|
|
142
|
+
setErrorText("Workflow definition can't be loaded . Error:"+response.statusText+", code:"+response.status);
|
|
143
|
+
return null
|
|
144
|
+
}).then((data) => {
|
|
145
|
+
if (!data) {
|
|
146
|
+
return
|
|
147
|
+
}
|
|
148
|
+
const workflows = WorkflowDefinition.fromJSON(data.definition);
|
|
149
|
+
setWorkflowDefinitions(workflows);
|
|
150
|
+
setEditState("");
|
|
151
|
+
setErrorText("");
|
|
152
|
+
// loadWorkflowStats(workflowName);
|
|
153
|
+
}).catch ((error) => {
|
|
154
|
+
setErrorText(error.message);
|
|
155
|
+
}).finally(() => { });
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const loadRegisteredSteps = () => {
|
|
159
|
+
const url = neatApiRootUrl + "/api/workflow/registered-steps";
|
|
160
|
+
fetch(url).then((response) => response.json()).then((data) => {
|
|
161
|
+
const steps = StepRegistry.fromJSON(data.steps);
|
|
162
|
+
setStepRegistry(steps);
|
|
163
|
+
}).catch ((error) => {
|
|
164
|
+
console.error('Error:', error);
|
|
165
|
+
}).finally(() => { });
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
const filterStats = (stats: WorkflowStats) => {
|
|
171
|
+
|
|
172
|
+
console.dir(stats)
|
|
173
|
+
// detelete all log RUNNING entries that have both RUNNING and COMPLETED entries for the same step
|
|
174
|
+
if (stats.execution_log == null)
|
|
175
|
+
return stats;
|
|
176
|
+
|
|
177
|
+
const filteredLog = stats.execution_log!.filter((log, index) => {
|
|
178
|
+
if (log.state == "STARTED") {
|
|
179
|
+
const nextLog = stats.execution_log[index + 1];
|
|
180
|
+
if (nextLog && nextLog.state == "COMPLETED" && nextLog.id == log.id)
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
return true;
|
|
184
|
+
})
|
|
185
|
+
stats.execution_log = filteredLog;
|
|
186
|
+
return stats;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const enrichWorkflowStats = (stats: WorkflowStats) => {
|
|
190
|
+
|
|
191
|
+
// set labels from workflow definition
|
|
192
|
+
for (let i = 0; i < stats.execution_log.length; i++) {
|
|
193
|
+
const log = stats.execution_log[i];
|
|
194
|
+
if (workflowDefinitions != null){
|
|
195
|
+
const step = workflowDefinitions.getStepById(log.id);
|
|
196
|
+
if (step)
|
|
197
|
+
log.label = step.label;
|
|
198
|
+
}else {
|
|
199
|
+
log.label ="";
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return stats;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const loadWorkflowStats = (workflowName: string = "") => {
|
|
206
|
+
if (workflowName == "")
|
|
207
|
+
workflowName = selectedWorkflow;
|
|
208
|
+
const url = neatApiRootUrl + "/api/workflow/stats/" + workflowName;
|
|
209
|
+
setErrorText("");
|
|
210
|
+
fetch(url).then((response) => {
|
|
211
|
+
if (!response.ok) {
|
|
212
|
+
setErrorText("Workflow state can't be saved . Error code :"+response.status+", message :"+response.statusText);
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
return response.json()
|
|
216
|
+
}).then((data) => {
|
|
217
|
+
if(!data)
|
|
218
|
+
return;
|
|
219
|
+
const enrichedStats = enrichWorkflowStats(data);
|
|
220
|
+
setWorkflowStats(enrichedStats);
|
|
221
|
+
if (data.state == "RUNNING") {
|
|
222
|
+
// startStatePolling();
|
|
223
|
+
} else if (data.state == "COMPLETED" || data.state == "FAILED") {
|
|
224
|
+
// stopStatePolling();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
}).catch((error) => {
|
|
228
|
+
setErrorText("Workflow state can't be fetched from API , most likely backend is not running")
|
|
229
|
+
console.error('Error:', error);
|
|
230
|
+
})
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const startWorkflow = () => {
|
|
234
|
+
const url = neatApiRootUrl + "/api/workflow/start";
|
|
235
|
+
const params = { name: selectedWorkflow, config: "", start_step: "" };
|
|
236
|
+
fetch(url, {
|
|
237
|
+
method: "post", body: JSON.stringify(params), headers: {
|
|
238
|
+
'Content-Type': 'application/json;charset=utf-8'
|
|
239
|
+
}
|
|
240
|
+
}).then((response) => response.json()).then((data) => {
|
|
241
|
+
console.dir(data)
|
|
242
|
+
setWorkflowStats(data);
|
|
243
|
+
startStatePolling(selectedWorkflow);
|
|
244
|
+
loadWorkflowStats();
|
|
245
|
+
}).catch((error) => {
|
|
246
|
+
setErrorText(error.message);
|
|
247
|
+
console.error('Error:', error);
|
|
248
|
+
})
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const saveWorkflow = () => {
|
|
252
|
+
console.dir(nodes);
|
|
253
|
+
syncNodesAndEdgesToWorkflowDef();
|
|
254
|
+
let wdef = workflowDefinitions;
|
|
255
|
+
console.dir(wdef);
|
|
256
|
+
setLoading(true);
|
|
257
|
+
setErrorText("");
|
|
258
|
+
const url = neatApiRootUrl + "/api/workflow/workflow-definition/" + selectedWorkflow;
|
|
259
|
+
fetch(url, {
|
|
260
|
+
method: "post", body: wdef.serializeToJson(), headers: {
|
|
261
|
+
'Content-Type': 'application/json;charset=utf-8'
|
|
262
|
+
}
|
|
263
|
+
}).then((response) => {
|
|
264
|
+
if (!response.ok) {
|
|
265
|
+
setErrorText("Workflow can't be saved . Error code :"+response.status+", message :"+response.statusText);
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
return response.json()
|
|
269
|
+
}
|
|
270
|
+
).then((data) => {
|
|
271
|
+
if(!data)
|
|
272
|
+
return;
|
|
273
|
+
console.dir(data)
|
|
274
|
+
setLoading(false);
|
|
275
|
+
setEditState("");
|
|
276
|
+
}
|
|
277
|
+
).catch((error) => {
|
|
278
|
+
console.error('Error:', error);
|
|
279
|
+
setErrorText(error);
|
|
280
|
+
})
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const syncNodesAndEdgesToWorkflowDef = () => {
|
|
284
|
+
if (workflowDefinitions) {
|
|
285
|
+
workflowDefinitions.updatePositions(nodes);
|
|
286
|
+
if (viewType == "system")
|
|
287
|
+
workflowDefinitions.updateSystemComponentTransitions(edges);
|
|
288
|
+
else
|
|
289
|
+
workflowDefinitions.updateStepTransitions(edges);
|
|
290
|
+
} else {
|
|
291
|
+
console.error("workflowDefinitions is null");
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
const syncWorkflowDefToNodesAndEdges = (viewType:string) => {
|
|
297
|
+
if (!workflowDefinitions)
|
|
298
|
+
return;
|
|
299
|
+
switch (viewType) {
|
|
300
|
+
case 'steps':
|
|
301
|
+
setNodes(workflowDefinitions.convertStepsToNodes());
|
|
302
|
+
setEdges(workflowDefinitions.convertStepsToEdges());
|
|
303
|
+
break;
|
|
304
|
+
case 'system':
|
|
305
|
+
setNodes(workflowDefinitions.convertSystemComponentsToNodes());
|
|
306
|
+
setEdges(workflowDefinitions.convertSystemComponentsToEdges());
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
const reloadWorkflows = () => {
|
|
312
|
+
const url = neatApiRootUrl + "/api/workflow/reload-single-workflow/"+selectedWorkflow;
|
|
313
|
+
fetch(url, {
|
|
314
|
+
method: "post", body: "", headers: {
|
|
315
|
+
'Content-Type': 'application/json;charset=utf-8'
|
|
316
|
+
}
|
|
317
|
+
}).then((response) => response.json()).then((data) => {
|
|
318
|
+
loadWorkflowDefinitions();
|
|
319
|
+
loadListOfWorkflows();
|
|
320
|
+
}
|
|
321
|
+
).catch((error) => {
|
|
322
|
+
console.error('Error:', error);
|
|
323
|
+
})
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
const switchToWorkflow = (workflowName: string) => {
|
|
328
|
+
setSelectedWorkflowName(workflowName);
|
|
329
|
+
setSelectedWorkflow(workflowName);
|
|
330
|
+
loadWorkflowDefinitions(workflowName);
|
|
331
|
+
setViewType("steps");
|
|
332
|
+
syncWorkflowDefToNodesAndEdges("steps");
|
|
333
|
+
startStatePolling(workflowName);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const handleWorkflowSelectorChange = (event: SelectChangeEvent) => {
|
|
337
|
+
switchToWorkflow(event.target.value);
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
const handleViewTypeChange = (
|
|
341
|
+
event: React.MouseEvent<HTMLElement>,
|
|
342
|
+
newViewType: string,
|
|
343
|
+
) => {
|
|
344
|
+
|
|
345
|
+
setViewType(newViewType);
|
|
346
|
+
syncWorkflowDefToNodesAndEdges(newViewType);
|
|
347
|
+
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
const onConnect = useCallback((params) => {
|
|
351
|
+
|
|
352
|
+
setEdges((eds) => addEdge(params, eds))
|
|
353
|
+
syncNodesAndEdgesToWorkflowDef();
|
|
354
|
+
setEditState("Unsaved");
|
|
355
|
+
}, [setEdges]);
|
|
356
|
+
|
|
357
|
+
const onEdgeUpdateStart = useCallback(() => {
|
|
358
|
+
|
|
359
|
+
edgeUpdateSuccessful.current = false;
|
|
360
|
+
}, []);
|
|
361
|
+
|
|
362
|
+
const onEdgeUpdate = useCallback((oldEdge, newConnection) => {
|
|
363
|
+
|
|
364
|
+
edgeUpdateSuccessful.current = true;
|
|
365
|
+
setEdges((els) => updateEdge(oldEdge, newConnection, els));
|
|
366
|
+
setEditState("Unsaved");
|
|
367
|
+
}, [setEdges]);
|
|
368
|
+
|
|
369
|
+
const onEdgeUpdateEnd = useCallback((_, edge) => {
|
|
370
|
+
|
|
371
|
+
if (!edgeUpdateSuccessful.current) {
|
|
372
|
+
setEdges((eds) => eds.filter((e) => e.id !== edge.id));
|
|
373
|
+
syncNodesAndEdgesToWorkflowDef();
|
|
374
|
+
}
|
|
375
|
+
setEditState("Unsaved");
|
|
376
|
+
|
|
377
|
+
edgeUpdateSuccessful.current = true;
|
|
378
|
+
}, [setEdges]);
|
|
379
|
+
|
|
380
|
+
const onNodeClick = useCallback((event, node) => {
|
|
381
|
+
|
|
382
|
+
console.dir(node);
|
|
383
|
+
handleDialogClickOpen(node.id, viewType);
|
|
384
|
+
}, [workflowDefinitions, viewType]);
|
|
385
|
+
|
|
386
|
+
const onAddStep = (() => {
|
|
387
|
+
|
|
388
|
+
setEditState("Unsaved");
|
|
389
|
+
const ui_config = new UIConfig();
|
|
390
|
+
ui_config.pos_x = Math.round(window.innerWidth * 0.3);
|
|
391
|
+
ui_config.pos_y = Math.round(window.innerHeight * 0.3);
|
|
392
|
+
if (viewType == "steps") {
|
|
393
|
+
const step = new WorkflowStepDefinition();
|
|
394
|
+
step.id = "step_" + Math.floor(Math.random() * 1000000);
|
|
395
|
+
step.label = "New step";
|
|
396
|
+
step.ui_config = ui_config;
|
|
397
|
+
step.stype = "stdstep";
|
|
398
|
+
workflowDefinitions.steps.push(step);
|
|
399
|
+
} else {
|
|
400
|
+
const systemComponent = new WorkflowSystemComponent();
|
|
401
|
+
systemComponent.id = "system_comp_" + Math.floor(Math.random() * 1000000);
|
|
402
|
+
systemComponent.label = "New component";
|
|
403
|
+
systemComponent.ui_config = ui_config;
|
|
404
|
+
if (workflowDefinitions.system_components == null)
|
|
405
|
+
workflowDefinitions.system_components = [];
|
|
406
|
+
workflowDefinitions.system_components.push(systemComponent);
|
|
407
|
+
}
|
|
408
|
+
syncWorkflowDefToNodesAndEdges(viewType);
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
const handleDialogClickOpen = (id: string, viewType: string) => {
|
|
412
|
+
|
|
413
|
+
if (viewType == "steps") {
|
|
414
|
+
setSelectedStep(workflowDefinitions.getStepById(id));
|
|
415
|
+
setDialogOpen(true);
|
|
416
|
+
} else {
|
|
417
|
+
setSelectedComponent(workflowDefinitions.getSystemComponentById(id));
|
|
418
|
+
setOpenOverviewComponentEditorDialog(true);
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
const handleDialogClose = (step:WorkflowStepDefinition,action:string) => {
|
|
423
|
+
setDialogOpen(false);
|
|
424
|
+
switch (action) {
|
|
425
|
+
case "delete":
|
|
426
|
+
workflowDefinitions.deleteStep(selectedStep.id);
|
|
427
|
+
syncWorkflowDefToNodesAndEdges(viewType);
|
|
428
|
+
setEditState("Unsaved");
|
|
429
|
+
break;
|
|
430
|
+
case "save":
|
|
431
|
+
workflowDefinitions.updateStep(selectedStep.id, step);
|
|
432
|
+
setSelectedStep(step);
|
|
433
|
+
syncWorkflowDefToNodesAndEdges(viewType);
|
|
434
|
+
setEditState("Unsaved");
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
const solutionComponentEditorDialogHandler = (component: WorkflowSystemComponent,action: string) => {
|
|
440
|
+
|
|
441
|
+
console.dir(component)
|
|
442
|
+
switch (action) {
|
|
443
|
+
case "save":
|
|
444
|
+
workflowDefinitions.updateSystemComponent(selectedComponent.id, component);
|
|
445
|
+
setSelectedComponent(component);
|
|
446
|
+
syncWorkflowDefToNodesAndEdges(viewType);
|
|
447
|
+
break;
|
|
448
|
+
case "delete":
|
|
449
|
+
workflowDefinitions.deleteSystemComponent(component.id);
|
|
450
|
+
syncWorkflowDefToNodesAndEdges(viewType);
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
453
|
+
setEditState("Unsaved");
|
|
454
|
+
setOpenOverviewComponentEditorDialog(false);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
const handleCreateWorkflow = (wdef:WorkflowDefinition,action: string) => {
|
|
458
|
+
// send workflowMeta to backend
|
|
459
|
+
console.dir(wdef);
|
|
460
|
+
if (action != "save")
|
|
461
|
+
return;
|
|
462
|
+
|
|
463
|
+
const url = neatApiRootUrl + "/api/workflow/create";
|
|
464
|
+
fetch(url, {
|
|
465
|
+
method: "post", body: wdef.serializeToJson(), headers: {
|
|
466
|
+
'Content-Type': 'application/json;charset=utf-8'
|
|
467
|
+
}
|
|
468
|
+
}).then((response) => response.json()).then((data) => {
|
|
469
|
+
switchToWorkflow(wdef.name);
|
|
470
|
+
window.location.reload();
|
|
471
|
+
}
|
|
472
|
+
).catch((error) => {
|
|
473
|
+
console.error('Error:', error);
|
|
474
|
+
})
|
|
475
|
+
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
const onNodesChangeN = useCallback((nodeChanges: NodeChange[]) => {
|
|
479
|
+
|
|
480
|
+
// console.dir(nodeChanges);
|
|
481
|
+
onNodesChange(nodeChanges);
|
|
482
|
+
syncNodesAndEdgesToWorkflowDef();
|
|
483
|
+
// setEditState("Unsaved");
|
|
484
|
+
}, [workflowDefinitions,nodes,edges]);
|
|
485
|
+
|
|
486
|
+
const onEdgesChangeN = useCallback((edgeChanges: EdgeChange[]) => {
|
|
487
|
+
|
|
488
|
+
console.dir(edgeChanges);
|
|
489
|
+
onEdgesChange(edgeChanges);
|
|
490
|
+
syncNodesAndEdgesToWorkflowDef();
|
|
491
|
+
// setEditState("Unsaved");
|
|
492
|
+
}, [workflowDefinitions,nodes,edges]);
|
|
493
|
+
|
|
494
|
+
return (
|
|
495
|
+
<div style={{ height: '85vh', width: '97vw' }}>
|
|
496
|
+
<Box>
|
|
497
|
+
<FormControl sx={{ width: 300, marginBottom: 2 }}>
|
|
498
|
+
<InputLabel id="workflowSelectorLabel">Selector</InputLabel>
|
|
499
|
+
<Select
|
|
500
|
+
labelId="workflowSelectorLabel"
|
|
501
|
+
id="workflowSelector"
|
|
502
|
+
value={selectedWorkflow}
|
|
503
|
+
size='small'
|
|
504
|
+
label="Query template"
|
|
505
|
+
onChange={handleWorkflowSelectorChange}
|
|
506
|
+
>
|
|
507
|
+
{
|
|
508
|
+
listOfWorkflows && listOfWorkflows.map((item, i) => (
|
|
509
|
+
<MenuItem value={item} key={item}>{item} </MenuItem>
|
|
510
|
+
))
|
|
511
|
+
}
|
|
512
|
+
</Select>
|
|
513
|
+
</FormControl>
|
|
514
|
+
<WorkflowMetadataDialog open = {workflowMetadataDialogOpen} onClose={handleCreateWorkflow}/>
|
|
515
|
+
<WorkflowDeleteDialog name={selectedWorkflow} onDelete = {()=> loadListOfWorkflows()}/>
|
|
516
|
+
|
|
517
|
+
</Box>
|
|
518
|
+
{ editState && (<Typography color={"red"} variant="overline"> {editState} </Typography> ) }
|
|
519
|
+
{ errorText && (<Typography color={"red"} variant="caption"> Error messages : {errorText} </Typography> ) }
|
|
520
|
+
{ loading &&( <LinearProgress />) }
|
|
521
|
+
{(viewType == "system" || viewType == "steps") && (
|
|
522
|
+
<Stack direction="row" spacing={1} justifyContent="left"
|
|
523
|
+
alignItems="left">
|
|
524
|
+
<Item>
|
|
525
|
+
<OverviewComponentEditorDialog open={openOverviewComponentEditorDialog} component={selectedComponent} onClose={solutionComponentEditorDialogHandler} />
|
|
526
|
+
<StepEditorDialog open={dialogOpen} step={selectedStep} workflowName={selectedWorkflow} stepRegistry={stepRegistry} workflowDefinitions={workflowDefinitions} onClose={handleDialogClose} />
|
|
527
|
+
|
|
528
|
+
<div style={{ height: '75vh', width: '70vw' }}>
|
|
529
|
+
<ReactFlow
|
|
530
|
+
nodes={nodes}
|
|
531
|
+
edges={edges}
|
|
532
|
+
onNodeClick={onNodeClick}
|
|
533
|
+
onNodesChange={onNodesChangeN}
|
|
534
|
+
onEdgesChange={onEdgesChangeN}
|
|
535
|
+
onEdgeUpdate={onEdgeUpdate}
|
|
536
|
+
onEdgeUpdateStart={onEdgeUpdateStart}
|
|
537
|
+
onEdgeUpdateEnd={onEdgeUpdateEnd}
|
|
538
|
+
onConnect={onConnect}
|
|
539
|
+
>
|
|
540
|
+
<MiniMap />
|
|
541
|
+
<Controls />
|
|
542
|
+
<Background />
|
|
543
|
+
<Panel position="bottom-center">
|
|
544
|
+
{viewType == "system" && (<Button variant="outlined" onClick={onAddStep}>Add solution component</Button>)}
|
|
545
|
+
{viewType == "steps" && (<Button variant="outlined" onClick={onAddStep}>Add workflow step</Button>)}
|
|
546
|
+
</Panel>
|
|
547
|
+
</ReactFlow>
|
|
548
|
+
|
|
549
|
+
<Button variant="outlined" onClick={ () => {saveWorkflow(); startWorkflow()} } sx={{ marginTop: 2, marginRight: 1 }}>Start workflow</Button>
|
|
550
|
+
<Button variant="outlined" onClick={saveWorkflow} sx={{ marginTop: 2, marginRight: 1 }}>Save workflow</Button>
|
|
551
|
+
<Button variant="outlined" onClick={reloadWorkflows} sx={{ marginTop: 2, marginRight: 1 }} >Reload</Button>
|
|
552
|
+
<WorkflowImportExportDialog onDownloaded = {()=> reloadWorkflows()} />
|
|
553
|
+
|
|
554
|
+
</div>
|
|
555
|
+
|
|
556
|
+
</Item>
|
|
557
|
+
<Item >
|
|
558
|
+
<WorkflowExecutionReport report={workflowStats} />
|
|
559
|
+
</Item>
|
|
560
|
+
</Stack>
|
|
561
|
+
)}
|
|
562
|
+
{viewType == "configurations" && (
|
|
563
|
+
<ConfigView></ConfigView>
|
|
564
|
+
)}
|
|
565
|
+
|
|
566
|
+
</div>
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
);
|
|
570
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"display": "Create React App",
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
"compilerOptions": {
|
|
7
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
8
|
+
"module": "esnext",
|
|
9
|
+
"target": "es2015",
|
|
10
|
+
|
|
11
|
+
"baseUrl": "src",
|
|
12
|
+
"allowJs": true,
|
|
13
|
+
"allowSyntheticDefaultImports": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"forceConsistentCasingInFileNames": true,
|
|
16
|
+
"isolatedModules": true,
|
|
17
|
+
"jsx": "react-jsx",
|
|
18
|
+
"moduleResolution": "node",
|
|
19
|
+
"noEmit": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"resolveJsonModule": true,
|
|
22
|
+
"skipLibCheck": true,
|
|
23
|
+
"strict": false
|
|
24
|
+
},
|
|
25
|
+
"include": ["src"]
|
|
26
|
+
|
|
27
|
+
}
|
|
@@ -10,8 +10,8 @@ import yaml
|
|
|
10
10
|
from pydantic import BaseModel, Field, model_validator
|
|
11
11
|
from yaml import safe_load
|
|
12
12
|
|
|
13
|
-
from cognite.neat.
|
|
14
|
-
from cognite.neat.
|
|
13
|
+
from cognite.neat._constants import EXAMPLE_GRAPHS, EXAMPLE_RULES, EXAMPLE_WORKFLOWS
|
|
14
|
+
from cognite.neat._utils.auth import EnvironmentVariables
|
|
15
15
|
|
|
16
16
|
if sys.version_info >= (3, 11):
|
|
17
17
|
from enum import StrEnum
|
|
@@ -203,7 +203,7 @@ class Config(BaseModel, arbitrary_types_allowed=True):
|
|
|
203
203
|
workflows_store_type=os.environ.get( # type: ignore[arg-type]
|
|
204
204
|
"NEAT_WORKFLOWS_STORE_TYPE", WorkflowsStoreType.FILE
|
|
205
205
|
),
|
|
206
|
-
data_store_path=Path(os.environ.get("NEAT_DATA_PATH", "/
|
|
206
|
+
data_store_path=Path(os.environ.get("NEAT_DATA_PATH", "_app/data")),
|
|
207
207
|
cdf_default_dataset_id=int(os.environ.get("NEAT_CDF_DEFAULT_DATASET_ID", 6476640149881990)),
|
|
208
208
|
log_level=cast(
|
|
209
209
|
Literal["ERROR", "WARNING", "INFO", "DEBUG"],
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from cognite.client.data_classes.data_modeling.ids import DataModelId
|
|
4
|
+
from rdflib import DCTERMS, OWL, RDF, RDFS, SKOS, XSD, Namespace, URIRef
|
|
4
5
|
|
|
5
6
|
from cognite import neat
|
|
6
7
|
|
|
7
8
|
PACKAGE_DIRECTORY = Path(neat.__file__).parent
|
|
9
|
+
COGNITE_MODELS = (
|
|
10
|
+
DataModelId("cdf_cdm", "CogniteCore", "v1"),
|
|
11
|
+
DataModelId("cdf_idm", "CogniteProcessIndustries", "v1"),
|
|
12
|
+
)
|
|
13
|
+
DMS_LISTABLE_PROPERTY_LIMIT = 1000
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
EXAMPLE_WORKFLOWS = PACKAGE_DIRECTORY / "workflows" / "examples"
|
|
15
|
+
EXAMPLE_RULES = PACKAGE_DIRECTORY / "_rules" / "examples"
|
|
16
|
+
EXAMPLE_GRAPHS = PACKAGE_DIRECTORY / "_graph" / "examples"
|
|
17
|
+
EXAMPLE_WORKFLOWS = PACKAGE_DIRECTORY / "_workflows" / "examples"
|
|
13
18
|
|
|
14
19
|
DEFAULT_SPACE_URI = "http://purl.org/cognite/{space}#"
|
|
15
20
|
DEFAULT_NAMESPACE = Namespace("http://purl.org/cognite/neat#")
|
|
21
|
+
DEFAULT_BASE_URI = URIRef(DEFAULT_NAMESPACE)
|
|
22
|
+
CLASSIC_CDF_NAMESPACE = Namespace("http://purl.org/cognite/cdf-classic#")
|
|
23
|
+
UNKNOWN_TYPE = DEFAULT_NAMESPACE.UnknownType
|
|
16
24
|
|
|
17
25
|
|
|
18
26
|
def get_default_prefixes() -> dict[str, Namespace]:
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from typing import Literal, TypeAlias
|
|
2
|
+
|
|
3
|
+
MIMETypes: TypeAlias = Literal[
|
|
4
|
+
"application/rdf+xml", "text/turtle", "application/n-triple", "application/n-quads", "application/trig"
|
|
5
|
+
]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def rdflib_to_mime_types(rdflib_format: str) -> str | None:
|
|
9
|
+
"""Convert an RDFlib format to a MIME type.
|
|
10
|
+
|
|
11
|
+
Args:
|
|
12
|
+
rdflib_format (str): The RDFlib format.
|
|
13
|
+
|
|
14
|
+
Returns:
|
|
15
|
+
MIMETypes: The MIME type.
|
|
16
|
+
|
|
17
|
+
!!! note
|
|
18
|
+
This will be replaced once new version of oxrdflib is released.
|
|
19
|
+
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
mapping = {
|
|
23
|
+
"xml": "application/rdf+xml",
|
|
24
|
+
"rdf": "application/rdf+xml",
|
|
25
|
+
"owl": "application/rdf+xml",
|
|
26
|
+
"n3": "application/n-triple",
|
|
27
|
+
"ttl": "text/turtle",
|
|
28
|
+
"turtle": "text/turtle",
|
|
29
|
+
"nt": "application/n-triple",
|
|
30
|
+
"nq": "application/n-quads",
|
|
31
|
+
"nquads": "application/n-quads",
|
|
32
|
+
"trig": "application/trig",
|
|
33
|
+
}
|
|
34
|
+
return mapping.get(rdflib_format, None)
|