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,388 @@
|
|
|
1
|
+
export enum WorkflowState {
|
|
2
|
+
CREATED = "CREATED",
|
|
3
|
+
RUNNING = "RUNNING",
|
|
4
|
+
COMPLETED = "COMPLETED",
|
|
5
|
+
FAILED = "FAILED"
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export enum StepExecutionStatus {
|
|
9
|
+
SUCCESS = "COMPLETED",
|
|
10
|
+
FAILED = "FAILED",
|
|
11
|
+
SKIPPED = "SKIPPED",
|
|
12
|
+
STARTED = "STARTED",
|
|
13
|
+
UNKNOWN = "UNKNOWN"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class UIConfig {
|
|
17
|
+
pos_x: number = 0;
|
|
18
|
+
pos_y: number = 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class WorkflowConfigItem {
|
|
22
|
+
name: string;
|
|
23
|
+
value: string;
|
|
24
|
+
label?: string;
|
|
25
|
+
type?: string;
|
|
26
|
+
required: boolean = false;
|
|
27
|
+
options?: string[];
|
|
28
|
+
group?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
class StepConfigurable {
|
|
32
|
+
name: string;
|
|
33
|
+
value?: string | null;
|
|
34
|
+
label?: string | null;
|
|
35
|
+
type?: string | null; // string , secret , number , boolean , json
|
|
36
|
+
required: boolean = false;
|
|
37
|
+
options?: string[] | null;
|
|
38
|
+
|
|
39
|
+
constructor(
|
|
40
|
+
name: string,
|
|
41
|
+
value: string | null = null,
|
|
42
|
+
label: string | null = null,
|
|
43
|
+
type: string | null = null,
|
|
44
|
+
required: boolean = false,
|
|
45
|
+
options: string[] | null = null
|
|
46
|
+
) {
|
|
47
|
+
this.name = name;
|
|
48
|
+
this.value = value;
|
|
49
|
+
this.label = label;
|
|
50
|
+
this.type = type;
|
|
51
|
+
this.required = required;
|
|
52
|
+
this.options = options;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
export class StepMetadata {
|
|
58
|
+
name: string;
|
|
59
|
+
category: string = "";
|
|
60
|
+
description: string = "";
|
|
61
|
+
input: string[];
|
|
62
|
+
output: string[];
|
|
63
|
+
configurables: StepConfigurable[] = [];
|
|
64
|
+
type: string = "";
|
|
65
|
+
version: string = "";
|
|
66
|
+
docs_url: string = "";
|
|
67
|
+
|
|
68
|
+
constructor(name: string, input: string[], output: string[]) {
|
|
69
|
+
this.name = name;
|
|
70
|
+
this.input = input;
|
|
71
|
+
this.output = output;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export class StepRegistry {
|
|
76
|
+
steps: StepMetadata[] = [];
|
|
77
|
+
static fromJSON(json: any): StepRegistry {
|
|
78
|
+
let stepRegistry = new StepRegistry();
|
|
79
|
+
Object.assign(stepRegistry.steps, json);
|
|
80
|
+
return stepRegistry;
|
|
81
|
+
}
|
|
82
|
+
getStepByName(name: string): StepMetadata {
|
|
83
|
+
let step = this.steps.find(step => step.name == name);
|
|
84
|
+
return step;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
export class WorkflowStepDefinition {
|
|
90
|
+
id: string;
|
|
91
|
+
label?: string;
|
|
92
|
+
stype?: string;
|
|
93
|
+
description?: string;
|
|
94
|
+
method?: string;
|
|
95
|
+
enabled?: boolean = true;
|
|
96
|
+
system_component_id?: string;
|
|
97
|
+
trigger?: boolean = false;
|
|
98
|
+
max_retries?: number = 0;
|
|
99
|
+
retry_delay?: number = 3;
|
|
100
|
+
transition_to?: string[];
|
|
101
|
+
params?:any = {}
|
|
102
|
+
ui_config?: UIConfig = new UIConfig();
|
|
103
|
+
configs?: Map<string, any> = new Map<string, any>();
|
|
104
|
+
complex_configs?: Map<string, any> = new Map<string, any>();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
export class WorkflowSystemComponent {
|
|
109
|
+
id: string;
|
|
110
|
+
label: string;
|
|
111
|
+
transition_to?: string[];
|
|
112
|
+
description?: string;
|
|
113
|
+
ui_config?: UIConfig = new UIConfig();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export class WorkflowDefinition {
|
|
117
|
+
name: string;
|
|
118
|
+
description?: string;
|
|
119
|
+
steps: WorkflowStepDefinition[];
|
|
120
|
+
system_components: WorkflowSystemComponent[];
|
|
121
|
+
configs?: WorkflowConfigItem[];
|
|
122
|
+
static fromJSON(json: any): WorkflowDefinition {
|
|
123
|
+
let workflow = new WorkflowDefinition();
|
|
124
|
+
Object.assign(workflow, json);
|
|
125
|
+
return workflow;
|
|
126
|
+
}
|
|
127
|
+
serializeToJson(): any {
|
|
128
|
+
let json = JSON.stringify(this);
|
|
129
|
+
return json;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
toJSON() {
|
|
133
|
+
return {
|
|
134
|
+
name: this.name,
|
|
135
|
+
description: this.description,
|
|
136
|
+
configs: this.configs,
|
|
137
|
+
steps: this.steps,
|
|
138
|
+
system_components: this.system_components
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
isNewIdUnique(id: string): boolean {
|
|
143
|
+
let step = this.steps.find(step => step.id == id);
|
|
144
|
+
if (step == null)
|
|
145
|
+
return true;
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
isStepInputConfigured(stepId: string,inputParamName: string ,stepRegistry: StepRegistry): boolean {
|
|
150
|
+
let step = this.steps.find(step => step.id == stepId);
|
|
151
|
+
if (step == null)
|
|
152
|
+
return false;
|
|
153
|
+
if (step.stype != "stdstep")
|
|
154
|
+
return false;
|
|
155
|
+
if (!stepRegistry)
|
|
156
|
+
return false;
|
|
157
|
+
let listOfAllOutputs = ["WorkflowConfigs","CdfStore","CogniteClient"];
|
|
158
|
+
this.steps?.forEach(step => {
|
|
159
|
+
let outputs = stepRegistry.getStepByName(step.method)?.output;
|
|
160
|
+
listOfAllOutputs = listOfAllOutputs.concat(outputs);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
return listOfAllOutputs.includes(inputParamName)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
upsertConfigItem(config: WorkflowConfigItem) {
|
|
168
|
+
let index = this.configs.findIndex(c => c.name == config.name);
|
|
169
|
+
if (index >= 0) {
|
|
170
|
+
this.configs[index] = config;
|
|
171
|
+
}else {
|
|
172
|
+
this.configs.push(config);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// insertConfigItemFromTemplate(stepName : string,stepRegistry: StepRegistry) {
|
|
177
|
+
// let step_template = stepRegistry.getStepByName(stepName);
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
// console.dir(step_template)
|
|
181
|
+
// console.dir(this.configs)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
// for (let config of step_template.configurables) {
|
|
185
|
+
// let index = this.configs.findIndex(c => c.name == config.name);
|
|
186
|
+
// if (index >= 0) {
|
|
187
|
+
// continue;
|
|
188
|
+
// }else {
|
|
189
|
+
// config.group = step_template.name;
|
|
190
|
+
// this.configs.push(config);
|
|
191
|
+
// }
|
|
192
|
+
// }
|
|
193
|
+
// }
|
|
194
|
+
|
|
195
|
+
addConfigItem(config: WorkflowConfigItem) {
|
|
196
|
+
this.configs.push(config);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
deleteConfigItem(name: string) {
|
|
200
|
+
let index = this.configs.findIndex(c => c.name == name);
|
|
201
|
+
if (index >= 0) {
|
|
202
|
+
this.configs.splice(index, 1);
|
|
203
|
+
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
getStepById(id: string): WorkflowStepDefinition {
|
|
208
|
+
let step = this.steps.find(step => step.id == id);
|
|
209
|
+
return step;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
getSystemComponentById(id: string): WorkflowSystemComponent {
|
|
213
|
+
let systemComponent = this.system_components.find(systemComponent => systemComponent.id == id);
|
|
214
|
+
return systemComponent;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
updateStep(id:string,step: WorkflowStepDefinition) {
|
|
218
|
+
let index = this.steps.findIndex(s => s.id == id);
|
|
219
|
+
if (index >= 0) {
|
|
220
|
+
this.steps[index] = step;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
updateSystemComponent(id:string,systemComponent: WorkflowSystemComponent) {
|
|
225
|
+
let index = this.system_components.findIndex(g => g.id == id);
|
|
226
|
+
if (index >= 0) {
|
|
227
|
+
this.system_components[index] = systemComponent;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
convertStepsToNodes():any {
|
|
232
|
+
let nodes = [];
|
|
233
|
+
this.steps?.forEach(step => {
|
|
234
|
+
let style = {};
|
|
235
|
+
if (step.enabled == false) {
|
|
236
|
+
style = { borderColor: 'red'};
|
|
237
|
+
}
|
|
238
|
+
let node = {
|
|
239
|
+
id: step.id,
|
|
240
|
+
position: {
|
|
241
|
+
x: step.ui_config.pos_x,
|
|
242
|
+
y: step.ui_config.pos_y
|
|
243
|
+
},
|
|
244
|
+
data: {
|
|
245
|
+
label: step.label
|
|
246
|
+
},
|
|
247
|
+
width: 150,
|
|
248
|
+
height: 40,
|
|
249
|
+
style : style,
|
|
250
|
+
selected: false,
|
|
251
|
+
positionAbsolute: {
|
|
252
|
+
x: step.ui_config.pos_x,
|
|
253
|
+
y: step.ui_config.pos_y
|
|
254
|
+
},
|
|
255
|
+
dragging: false
|
|
256
|
+
}
|
|
257
|
+
nodes.push(node);
|
|
258
|
+
});
|
|
259
|
+
return nodes;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
convertSystemComponentsToNodes():any {
|
|
264
|
+
let nodes = [];
|
|
265
|
+
this.system_components?.forEach(step => {
|
|
266
|
+
let style = {};
|
|
267
|
+
let node = {
|
|
268
|
+
id: step.id,
|
|
269
|
+
position: {
|
|
270
|
+
x: step.ui_config.pos_x,
|
|
271
|
+
y: step.ui_config.pos_y
|
|
272
|
+
},
|
|
273
|
+
data: {
|
|
274
|
+
label: step.label
|
|
275
|
+
},
|
|
276
|
+
width: 150,
|
|
277
|
+
height: 40,
|
|
278
|
+
style : style,
|
|
279
|
+
selected: false,
|
|
280
|
+
positionAbsolute: {
|
|
281
|
+
x: step.ui_config.pos_x,
|
|
282
|
+
y: step.ui_config.pos_y
|
|
283
|
+
},
|
|
284
|
+
dragging: false
|
|
285
|
+
}
|
|
286
|
+
nodes.push(node);
|
|
287
|
+
});
|
|
288
|
+
return nodes;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
convertStepsToEdges():any {
|
|
292
|
+
let edges = [];
|
|
293
|
+
this.steps?.forEach(step => {
|
|
294
|
+
if (step.transition_to) {
|
|
295
|
+
step.transition_to.forEach(transition => {
|
|
296
|
+
let edge = {
|
|
297
|
+
id: step.id + "_" + transition,
|
|
298
|
+
source: step.id,
|
|
299
|
+
target: transition,
|
|
300
|
+
animated: true,
|
|
301
|
+
label: "",
|
|
302
|
+
arrowHeadType: "arrowclosed"
|
|
303
|
+
}
|
|
304
|
+
edges.push(edge);
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
return edges;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
convertSystemComponentsToEdges():any {
|
|
312
|
+
let edges = [];
|
|
313
|
+
this.system_components?.forEach(step => {
|
|
314
|
+
if (step.transition_to) {
|
|
315
|
+
step.transition_to.forEach(transition => {
|
|
316
|
+
let edge = {
|
|
317
|
+
id: step.id + "_" + transition,
|
|
318
|
+
source: step.id,
|
|
319
|
+
target: transition,
|
|
320
|
+
animated: true,
|
|
321
|
+
label: "",
|
|
322
|
+
arrowHeadType: "arrowclosed"
|
|
323
|
+
}
|
|
324
|
+
edges.push(edge);
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
console.dir(edges)
|
|
330
|
+
return edges;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
updatePositions(nodes:any) {
|
|
334
|
+
nodes.forEach(node => {
|
|
335
|
+
let step = this.steps.find(step => step.id == node.id);
|
|
336
|
+
if (step) {
|
|
337
|
+
step.ui_config.pos_x = Math.round(node.position.x);
|
|
338
|
+
step.ui_config.pos_y = Math.round(node.position.y);
|
|
339
|
+
}else {
|
|
340
|
+
let systemComponent = this.system_components.find(systemComponent => systemComponent.id == node.id);
|
|
341
|
+
if (systemComponent) {
|
|
342
|
+
systemComponent.ui_config.pos_x = Math.round(node.position.x);
|
|
343
|
+
systemComponent.ui_config.pos_y = Math.round(node.position.y);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
// Update step transitions from edges
|
|
349
|
+
updateStepTransitions(edges:any) {
|
|
350
|
+
this.steps.forEach(step => {
|
|
351
|
+
step.transition_to = [];
|
|
352
|
+
});
|
|
353
|
+
edges.forEach(edge => {
|
|
354
|
+
let source = this.steps.find(step => step.id == edge.source);
|
|
355
|
+
if (source) {
|
|
356
|
+
source.transition_to.push(edge.target);
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
// Update systemComponent transitions from edges
|
|
361
|
+
updateSystemComponentTransitions(edges:any) {
|
|
362
|
+
this.system_components.forEach(systemComponent => {
|
|
363
|
+
systemComponent.transition_to = [];
|
|
364
|
+
});
|
|
365
|
+
edges.forEach(edge => {
|
|
366
|
+
let source = this.system_components.find(systemComponent => systemComponent.id == edge.source);
|
|
367
|
+
if (source) {
|
|
368
|
+
source.transition_to.push(edge.target);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
deleteStep(id:string) {
|
|
374
|
+
let index = this.steps.findIndex(s => s.id == id);
|
|
375
|
+
if (index >= 0) {
|
|
376
|
+
this.steps.splice(index,1);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
deleteSystemComponent(id:string) {
|
|
381
|
+
let index = this.system_components.findIndex(g => g.id == id);
|
|
382
|
+
if (index >= 0) {
|
|
383
|
+
this.system_components.splice(index,1);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Typography, List, ListItem, ListItemText } from '@mui/material';
|
|
3
|
+
import { getNeatApiRootUrl } from 'components/Utils';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const AboutView = () => {
|
|
7
|
+
const [structure, setStructure] = useState(null);
|
|
8
|
+
const [neatApiRootUrl, setNeatApiRootUrl] = useState(getNeatApiRootUrl());
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const fetchData = async () => {
|
|
11
|
+
try {
|
|
12
|
+
const response = await fetch(neatApiRootUrl+'/api/about');
|
|
13
|
+
const data = await response.json();
|
|
14
|
+
setStructure(data);
|
|
15
|
+
} catch (error) {
|
|
16
|
+
console.error('Error fetching data:', error);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
fetchData();
|
|
21
|
+
}, []);
|
|
22
|
+
|
|
23
|
+
if (!structure) {
|
|
24
|
+
return <div>Loading...</div>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div >
|
|
29
|
+
<Typography variant="h5" >
|
|
30
|
+
NEAT Version: {structure.version}
|
|
31
|
+
</Typography>
|
|
32
|
+
<Typography variant="h6" >
|
|
33
|
+
Docs URL: <a href='https://thisisneat.io'>https://thisisneat.io</a>
|
|
34
|
+
</Typography>
|
|
35
|
+
<Typography variant="h6" >
|
|
36
|
+
Docs URL: <a href='https://cognite-neat.readthedocs-hosted.com/en/latest/'>https://cognite-neat.readthedocs-hosted.com/en/latest/</a>
|
|
37
|
+
</Typography>
|
|
38
|
+
<Typography variant="h6" >
|
|
39
|
+
Github: <a href='https://github.com/cognitedata/neat'>https://github.com/cognitedata/neat</a>
|
|
40
|
+
</Typography>
|
|
41
|
+
<Typography variant="h6" >
|
|
42
|
+
Issues tracker (Github): <a href='https://github.com/cognitedata/neat/issues'> https://github.com/cognitedata/neat/issues </a>
|
|
43
|
+
</Typography>
|
|
44
|
+
<Typography variant="h6" >
|
|
45
|
+
License (Apache 2.0): <a href='https://github.com/cognitedata/neat/blob/main/LICENSE'> https://github.com/cognitedata/neat/blob/main/LICENSE </a>
|
|
46
|
+
</Typography>
|
|
47
|
+
<Typography variant="h5">
|
|
48
|
+
3rd party packages :
|
|
49
|
+
</Typography>
|
|
50
|
+
<List dense={true}>
|
|
51
|
+
{structure.packages.map((spackage, index) => (
|
|
52
|
+
<ListItem key={index}>
|
|
53
|
+
<ListItemText primary={spackage} />
|
|
54
|
+
</ListItem>
|
|
55
|
+
))}
|
|
56
|
+
</List>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default AboutView;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Paper from '@mui/material/Paper';
|
|
4
|
+
import Stack from '@mui/material/Stack';
|
|
5
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
6
|
+
import EditIcon from '@mui/icons-material/Edit';
|
|
7
|
+
import { styled } from '@mui/material/styles';
|
|
8
|
+
import { SelectChangeEvent } from '@mui/material/Select';
|
|
9
|
+
import Button from '@mui/material/Button';
|
|
10
|
+
import TextField from '@mui/material/TextField';
|
|
11
|
+
import LinearProgress from '@mui/material/LinearProgress';
|
|
12
|
+
import { useState, useEffect } from 'react';
|
|
13
|
+
import { getNeatApiRootUrl, getSelectedWorkflowName } from 'components/Utils';
|
|
14
|
+
import { WorkflowConfigItem, WorkflowDefinition } from 'types/WorkflowTypes';
|
|
15
|
+
import { Dialog, DialogActions, DialogContent, DialogTitle, FormControl, IconButton, List, ListItem, ListItemText, Table, TableBody, TableCell, TableContainer, TableHead, TableRow } from '@mui/material';
|
|
16
|
+
|
|
17
|
+
const Item = styled(Paper)(({ theme }) => ({
|
|
18
|
+
backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff',
|
|
19
|
+
...theme.typography.body2,
|
|
20
|
+
padding: theme.spacing(1),
|
|
21
|
+
textAlign: 'left',
|
|
22
|
+
color: theme.palette.text.secondary,
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
export default function ConfigView() {
|
|
26
|
+
const [graphSourceName, setGraphSourceName] = React.useState('');
|
|
27
|
+
const [workflowName, setWorkflowName] = React.useState(getSelectedWorkflowName());
|
|
28
|
+
const [loading, setLoading] = React.useState(false);
|
|
29
|
+
const [dialogOpen, setDialogOpen ] = useState(false);
|
|
30
|
+
const [workflowDefinition, setWorkflowDefinition] = useState<WorkflowDefinition>(new WorkflowDefinition());
|
|
31
|
+
const [workflowConfigItems, setWorkflowConfigItems] = useState<WorkflowConfigItem[]>([]);
|
|
32
|
+
const [selectedConfigItem, setSelectedConfigItem] = useState<WorkflowConfigItem>(new WorkflowConfigItem());
|
|
33
|
+
|
|
34
|
+
const handleGraphSourceNameChange = (event: SelectChangeEvent) => {
|
|
35
|
+
setGraphSourceName(event.target.value as string);
|
|
36
|
+
};
|
|
37
|
+
const [neatApiRootUrl, setNeatApiRootUrl] = useState(getNeatApiRootUrl());
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
loadWorkflowConfigs();
|
|
41
|
+
}, []);
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
const loadWorkflowConfigs = () => {
|
|
45
|
+
const workflowName = getSelectedWorkflowName();
|
|
46
|
+
const url = neatApiRootUrl+"/api/workflow/workflow-definition/" + workflowName;
|
|
47
|
+
fetch(url).then((response) => response.json()).then((data) => {
|
|
48
|
+
const workflow = WorkflowDefinition.fromJSON(data.definition);
|
|
49
|
+
setWorkflowDefinition(workflow);
|
|
50
|
+
setWorkflowConfigItems(workflow.configs);
|
|
51
|
+
|
|
52
|
+
}).catch((error) => {
|
|
53
|
+
console.error('Error:', error);
|
|
54
|
+
}).finally(() => { });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const saveWorkflow = () => {
|
|
58
|
+
let wdef = workflowDefinition;
|
|
59
|
+
wdef.configs = workflowConfigItems;
|
|
60
|
+
const url = neatApiRootUrl+"/api/workflow/workflow-definition/"+workflowName;
|
|
61
|
+
fetch(url,{ method:"post",body:wdef.serializeToJson(),headers: {
|
|
62
|
+
'Content-Type': 'application/json;charset=utf-8'
|
|
63
|
+
}}).then((response) => response.json()).then((data) => {
|
|
64
|
+
window.location.reload();
|
|
65
|
+
}
|
|
66
|
+
).catch((error) => {
|
|
67
|
+
console.error('Error:', error);
|
|
68
|
+
})
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const configEditorDialogHandler = (configItem: WorkflowConfigItem,action: string) => {
|
|
72
|
+
console.dir(configItem)
|
|
73
|
+
switch (action) {
|
|
74
|
+
case "save":
|
|
75
|
+
workflowDefinition.upsertConfigItem(configItem);
|
|
76
|
+
break;
|
|
77
|
+
case "delete":
|
|
78
|
+
workflowDefinition.deleteConfigItem(configItem.name)
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
setDialogOpen(false);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const openItemEditorDialog = (selectedConfigItem: WorkflowConfigItem) => {
|
|
85
|
+
if (selectedConfigItem) {
|
|
86
|
+
setSelectedConfigItem(selectedConfigItem);
|
|
87
|
+
}else{
|
|
88
|
+
setSelectedConfigItem(new WorkflowConfigItem());
|
|
89
|
+
}
|
|
90
|
+
setDialogOpen(true);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<Box sx={{ width: 1200 }}>
|
|
95
|
+
<TableContainer component={Paper}>
|
|
96
|
+
<Table sx={{ minWidth: 650 }} size="small" aria-label="simple table">
|
|
97
|
+
<TableHead>
|
|
98
|
+
<TableRow>
|
|
99
|
+
<TableCell>Name</TableCell>
|
|
100
|
+
<TableCell align="right">Config group</TableCell>
|
|
101
|
+
<TableCell align="right">Value</TableCell>
|
|
102
|
+
<TableCell align="right">Label</TableCell>
|
|
103
|
+
<TableCell align="right">Action</TableCell>
|
|
104
|
+
|
|
105
|
+
</TableRow>
|
|
106
|
+
</TableHead>
|
|
107
|
+
<TableBody>
|
|
108
|
+
{workflowConfigItems?.map((row) => (
|
|
109
|
+
<TableRow
|
|
110
|
+
key={row.name}
|
|
111
|
+
sx={{ '&:last-child td, &:last-child th': { border: 0 } }}
|
|
112
|
+
>
|
|
113
|
+
<TableCell component="th" scope="row">
|
|
114
|
+
<b> {row.name} </b>
|
|
115
|
+
</TableCell>
|
|
116
|
+
<TableCell align="right">{row.group}</TableCell>
|
|
117
|
+
<TableCell align="right">{row.value}</TableCell>
|
|
118
|
+
<TableCell align="right">{row.label}</TableCell>
|
|
119
|
+
<TableCell align="right">
|
|
120
|
+
<IconButton aria-label="edit" size="small" onClick={ () => openItemEditorDialog(row) } > <EditIcon fontSize="small" /> </IconButton>
|
|
121
|
+
<IconButton aria-label="delete" size="small" onClick={ ()=> configEditorDialogHandler(row,"delete")}> <DeleteIcon fontSize="small" /> </IconButton>
|
|
122
|
+
</TableCell>
|
|
123
|
+
</TableRow>
|
|
124
|
+
))}
|
|
125
|
+
</TableBody>
|
|
126
|
+
</Table>
|
|
127
|
+
|
|
128
|
+
</TableContainer>
|
|
129
|
+
<Button variant="outlined" size="small" sx={{marginRight:2,marginTop:2}} onClick={saveWorkflow} >Save</Button>
|
|
130
|
+
<Button variant="outlined" size="small" sx={{marginRight:2,marginTop:2}} onClick={()=>openItemEditorDialog(null)} >Add</Button>
|
|
131
|
+
<ConfigEditorDialog open={dialogOpen} onClose={configEditorDialogHandler} configItem={selectedConfigItem} />
|
|
132
|
+
{loading && (<LinearProgress />)}
|
|
133
|
+
</Box>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
export function ConfigEditorDialog(props: any)
|
|
139
|
+
{
|
|
140
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
141
|
+
const [configItem, setConfigItem] = useState<WorkflowConfigItem>(null);
|
|
142
|
+
const handleDialogSave = () => {
|
|
143
|
+
setDialogOpen(false);
|
|
144
|
+
props.onClose(configItem,"save");
|
|
145
|
+
};
|
|
146
|
+
const handleDialogCancel = () => {
|
|
147
|
+
setDialogOpen(false);
|
|
148
|
+
props.onClose(configItem,"cancel");
|
|
149
|
+
};
|
|
150
|
+
const handleConfigItemChange = (name: string, value: any) => {
|
|
151
|
+
|
|
152
|
+
console.dir(configItem);
|
|
153
|
+
let updConfigItem = Object.assign({},configItem);
|
|
154
|
+
updConfigItem[name] = value;
|
|
155
|
+
|
|
156
|
+
console.dir(updConfigItem);
|
|
157
|
+
setConfigItem(updConfigItem);
|
|
158
|
+
}
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
if (props.open){
|
|
161
|
+
setDialogOpen(true);
|
|
162
|
+
setConfigItem(props.configItem);
|
|
163
|
+
console.dir(props.configItem);
|
|
164
|
+
}
|
|
165
|
+
}, [props.open]);
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<Dialog open={dialogOpen} onClose={handleDialogCancel}>
|
|
169
|
+
<DialogTitle>Configuration editor</DialogTitle>
|
|
170
|
+
<DialogContent >
|
|
171
|
+
<FormControl sx={{ width: 500 }} >
|
|
172
|
+
<TextField sx={{ marginTop: 1 }} id="step-config-id" fullWidth label="Name" size='small' variant="outlined" value={configItem?.name} onChange={(event) => { handleConfigItemChange("name", event.target.value) }} />
|
|
173
|
+
<TextField sx={{ marginTop: 1 }} id="step-config-descr" fullWidth label="Value" size='small' variant="outlined" value={configItem?.value} onChange={(event) => { handleConfigItemChange("value", event.target.value) }} />
|
|
174
|
+
<TextField sx={{ marginTop: 1 }} id="step-config-label" fullWidth label="Label" size='small' variant="outlined" value={configItem?.label} onChange={(event) => { handleConfigItemChange("label", event.target.value) }} />
|
|
175
|
+
<TextField sx={{ marginTop: 1 }} id="step-config-label" fullWidth label="Config group" size='small' variant="outlined" value={configItem?.group} onChange={(event) => { handleConfigItemChange("group", event.target.value) }} />
|
|
176
|
+
</FormControl>
|
|
177
|
+
</DialogContent>
|
|
178
|
+
<DialogActions>
|
|
179
|
+
<Button variant="outlined" size="small" onClick={handleDialogSave}>Save</Button>
|
|
180
|
+
<Button variant="outlined" size="small" onClick={handleDialogCancel}>Cancel</Button>
|
|
181
|
+
</DialogActions>
|
|
182
|
+
</Dialog>
|
|
183
|
+
)
|
|
184
|
+
}
|