cognite-neat 0.103.1__py3-none-any.whl → 0.105.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/_client/_api/data_modeling_loaders.py +83 -23
- cognite/neat/_client/_api/schema.py +2 -1
- cognite/neat/_client/data_classes/neat_sequence.py +261 -0
- cognite/neat/_client/data_classes/schema.py +5 -1
- cognite/neat/_client/testing.py +33 -0
- cognite/neat/_constants.py +56 -0
- cognite/neat/_graph/extractors/_classic_cdf/_base.py +6 -5
- cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +225 -11
- cognite/neat/_graph/extractors/_mock_graph_generator.py +2 -2
- cognite/neat/_graph/loaders/_rdf2dms.py +13 -2
- cognite/neat/_graph/transformers/__init__.py +3 -1
- cognite/neat/_graph/transformers/_base.py +109 -1
- cognite/neat/_graph/transformers/_classic_cdf.py +6 -1
- cognite/neat/_graph/transformers/_prune_graph.py +103 -47
- cognite/neat/_graph/transformers/_rdfpath.py +41 -17
- cognite/neat/_graph/transformers/_value_type.py +188 -151
- cognite/neat/_issues/__init__.py +0 -2
- cognite/neat/_issues/_base.py +54 -43
- cognite/neat/_issues/warnings/__init__.py +4 -1
- cognite/neat/_issues/warnings/_general.py +7 -0
- cognite/neat/_issues/warnings/_resources.py +12 -1
- cognite/neat/_rules/_shared.py +18 -34
- cognite/neat/_rules/exporters/_base.py +28 -2
- cognite/neat/_rules/exporters/_rules2dms.py +39 -1
- cognite/neat/_rules/exporters/_rules2excel.py +13 -2
- cognite/neat/_rules/exporters/_rules2instance_template.py +4 -0
- cognite/neat/_rules/exporters/_rules2ontology.py +13 -1
- cognite/neat/_rules/exporters/_rules2yaml.py +4 -0
- cognite/neat/_rules/importers/_base.py +9 -0
- cognite/neat/_rules/importers/_dms2rules.py +80 -57
- cognite/neat/_rules/importers/_dtdl2rules/dtdl_importer.py +5 -2
- cognite/neat/_rules/importers/_rdf/_base.py +10 -8
- cognite/neat/_rules/importers/_rdf/_imf2rules.py +4 -0
- cognite/neat/_rules/importers/_rdf/_inference2rules.py +7 -0
- cognite/neat/_rules/importers/_rdf/_owl2rules.py +4 -0
- cognite/neat/_rules/importers/_spreadsheet2rules.py +17 -8
- cognite/neat/_rules/importers/_yaml2rules.py +21 -7
- cognite/neat/_rules/models/_base_input.py +1 -1
- cognite/neat/_rules/models/_base_rules.py +9 -1
- cognite/neat/_rules/models/dms/_rules.py +4 -0
- cognite/neat/_rules/models/dms/_rules_input.py +9 -0
- cognite/neat/_rules/models/entities/_wrapped.py +10 -5
- cognite/neat/_rules/models/information/_rules.py +4 -0
- cognite/neat/_rules/models/information/_rules_input.py +9 -0
- cognite/neat/_rules/models/mapping/_classic2core.py +2 -5
- cognite/neat/_rules/models/mapping/_classic2core.yaml +239 -38
- cognite/neat/_rules/transformers/__init__.py +13 -6
- cognite/neat/_rules/transformers/_base.py +41 -65
- cognite/neat/_rules/transformers/_converters.py +404 -234
- cognite/neat/_rules/transformers/_mapping.py +93 -72
- cognite/neat/_rules/transformers/_verification.py +50 -38
- cognite/neat/_session/_base.py +32 -121
- cognite/neat/_session/_inspect.py +5 -3
- cognite/neat/_session/_mapping.py +17 -105
- cognite/neat/_session/_prepare.py +138 -268
- cognite/neat/_session/_read.py +39 -195
- cognite/neat/_session/_set.py +6 -30
- cognite/neat/_session/_show.py +40 -21
- cognite/neat/_session/_state.py +49 -107
- cognite/neat/_session/_to.py +44 -33
- cognite/neat/_shared.py +23 -2
- cognite/neat/_store/_provenance.py +3 -82
- cognite/neat/_store/_rules_store.py +368 -10
- cognite/neat/_store/exceptions.py +23 -0
- cognite/neat/_utils/graph_transformations_report.py +36 -0
- cognite/neat/_utils/rdf_.py +8 -0
- cognite/neat/_utils/reader/_base.py +27 -0
- cognite/neat/_utils/spreadsheet.py +5 -4
- cognite/neat/_version.py +1 -1
- {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/METADATA +3 -2
- cognite_neat-0.105.0.dist-info/RECORD +179 -0
- {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/WHEEL +1 -1
- cognite/neat/_app/api/__init__.py +0 -0
- cognite/neat/_app/api/asgi/metrics.py +0 -4
- cognite/neat/_app/api/configuration.py +0 -98
- cognite/neat/_app/api/context_manager/__init__.py +0 -3
- cognite/neat/_app/api/context_manager/manager.py +0 -16
- cognite/neat/_app/api/data_classes/__init__.py +0 -0
- cognite/neat/_app/api/data_classes/rest.py +0 -59
- cognite/neat/_app/api/explorer.py +0 -66
- cognite/neat/_app/api/routers/configuration.py +0 -25
- cognite/neat/_app/api/routers/crud.py +0 -102
- cognite/neat/_app/api/routers/metrics.py +0 -10
- cognite/neat/_app/api/routers/workflows.py +0 -224
- cognite/neat/_app/api/utils/__init__.py +0 -0
- cognite/neat/_app/api/utils/data_mapping.py +0 -17
- cognite/neat/_app/api/utils/logging.py +0 -26
- cognite/neat/_app/api/utils/query_templates.py +0 -92
- cognite/neat/_app/main.py +0 -17
- cognite/neat/_app/monitoring/__init__.py +0 -0
- cognite/neat/_app/monitoring/metrics.py +0 -69
- cognite/neat/_app/ui/index.html +0 -1
- cognite/neat/_app/ui/neat-app/.gitignore +0 -23
- cognite/neat/_app/ui/neat-app/README.md +0 -70
- cognite/neat/_app/ui/neat-app/build/asset-manifest.json +0 -14
- cognite/neat/_app/ui/neat-app/build/favicon.ico +0 -0
- cognite/neat/_app/ui/neat-app/build/img/architect-icon.svg +0 -116
- cognite/neat/_app/ui/neat-app/build/img/developer-icon.svg +0 -112
- cognite/neat/_app/ui/neat-app/build/img/sme-icon.svg +0 -34
- cognite/neat/_app/ui/neat-app/build/index.html +0 -1
- cognite/neat/_app/ui/neat-app/build/logo192.png +0 -0
- cognite/neat/_app/ui/neat-app/build/manifest.json +0 -25
- cognite/neat/_app/ui/neat-app/build/robots.txt +0 -3
- cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -2
- cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -1
- cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -3
- cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -88
- cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -1
- cognite/neat/_app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -1
- cognite/neat/_app/ui/neat-app/package-lock.json +0 -18306
- cognite/neat/_app/ui/neat-app/package.json +0 -62
- cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
- cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +0 -116
- cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +0 -112
- cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +0 -34
- cognite/neat/_app/ui/neat-app/public/index.html +0 -43
- cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
- cognite/neat/_app/ui/neat-app/public/manifest.json +0 -25
- cognite/neat/_app/ui/neat-app/public/robots.txt +0 -3
- cognite/neat/_app/ui/neat-app/src/App.css +0 -38
- cognite/neat/_app/ui/neat-app/src/App.js +0 -17
- cognite/neat/_app/ui/neat-app/src/App.test.js +0 -8
- cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +0 -70
- cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +0 -43
- cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +0 -124
- cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +0 -63
- cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +0 -511
- cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +0 -36
- cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +0 -56
- cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +0 -60
- cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +0 -112
- cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +0 -67
- cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +0 -79
- cognite/neat/_app/ui/neat-app/src/index.css +0 -13
- cognite/neat/_app/ui/neat-app/src/index.js +0 -13
- cognite/neat/_app/ui/neat-app/src/logo.svg +0 -1
- cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +0 -13
- cognite/neat/_app/ui/neat-app/src/setupTests.js +0 -5
- cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +0 -388
- cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +0 -61
- cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +0 -184
- cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +0 -180
- cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +0 -570
- cognite/neat/_app/ui/neat-app/tsconfig.json +0 -27
- cognite/neat/_rules/transformers/_pipelines.py +0 -70
- cognite/neat/_workflows/__init__.py +0 -17
- cognite/neat/_workflows/base.py +0 -590
- cognite/neat/_workflows/cdf_store.py +0 -393
- cognite/neat/_workflows/examples/Export_DMS/workflow.yaml +0 -89
- cognite/neat/_workflows/examples/Export_Semantic_Data_Model/workflow.yaml +0 -66
- cognite/neat/_workflows/examples/Import_DMS/workflow.yaml +0 -65
- cognite/neat/_workflows/examples/Validate_Rules/workflow.yaml +0 -67
- cognite/neat/_workflows/examples/Validate_Solution_Model/workflow.yaml +0 -64
- cognite/neat/_workflows/manager.py +0 -292
- cognite/neat/_workflows/model.py +0 -203
- cognite/neat/_workflows/steps/__init__.py +0 -0
- cognite/neat/_workflows/steps/data_contracts.py +0 -109
- cognite/neat/_workflows/steps/lib/__init__.py +0 -0
- cognite/neat/_workflows/steps/lib/current/__init__.py +0 -6
- cognite/neat/_workflows/steps/lib/current/graph_extractor.py +0 -100
- cognite/neat/_workflows/steps/lib/current/graph_loader.py +0 -51
- cognite/neat/_workflows/steps/lib/current/graph_store.py +0 -48
- cognite/neat/_workflows/steps/lib/current/rules_exporter.py +0 -537
- cognite/neat/_workflows/steps/lib/current/rules_importer.py +0 -398
- cognite/neat/_workflows/steps/lib/current/rules_validator.py +0 -106
- cognite/neat/_workflows/steps/lib/io/__init__.py +0 -1
- cognite/neat/_workflows/steps/lib/io/io_steps.py +0 -393
- cognite/neat/_workflows/steps/step_model.py +0 -79
- cognite/neat/_workflows/steps_registry.py +0 -218
- cognite/neat/_workflows/tasks.py +0 -18
- cognite/neat/_workflows/triggers.py +0 -169
- cognite/neat/_workflows/utils.py +0 -19
- cognite_neat-0.103.1.dist-info/RECORD +0 -275
- {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/LICENSE +0 -0
- {cognite_neat-0.103.1.dist-info → cognite_neat-0.105.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,388 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
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;
|
|
@@ -1,184 +0,0 @@
|
|
|
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
|
-
}
|