cognite-neat 0.104.0__py3-none-any.whl → 0.105.1__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.

Files changed (143) hide show
  1. cognite/neat/_client/_api/data_modeling_loaders.py +83 -23
  2. cognite/neat/_client/_api/schema.py +2 -1
  3. cognite/neat/_client/data_classes/neat_sequence.py +261 -0
  4. cognite/neat/_client/data_classes/schema.py +5 -1
  5. cognite/neat/_client/testing.py +33 -0
  6. cognite/neat/_constants.py +57 -0
  7. cognite/neat/_graph/extractors/_classic_cdf/_base.py +6 -5
  8. cognite/neat/_graph/extractors/_classic_cdf/_sequences.py +225 -11
  9. cognite/neat/_graph/extractors/_mock_graph_generator.py +1 -1
  10. cognite/neat/_graph/loaders/_rdf2dms.py +31 -5
  11. cognite/neat/_graph/transformers/__init__.py +3 -1
  12. cognite/neat/_graph/transformers/_classic_cdf.py +39 -51
  13. cognite/neat/_graph/transformers/_rdfpath.py +14 -15
  14. cognite/neat/_graph/transformers/_value_type.py +72 -0
  15. cognite/neat/_issues/__init__.py +0 -2
  16. cognite/neat/_issues/_base.py +19 -35
  17. cognite/neat/_issues/warnings/__init__.py +6 -1
  18. cognite/neat/_issues/warnings/_general.py +7 -0
  19. cognite/neat/_issues/warnings/_properties.py +11 -0
  20. cognite/neat/_issues/warnings/_resources.py +11 -0
  21. cognite/neat/_rules/exporters/_rules2dms.py +35 -1
  22. cognite/neat/_rules/exporters/_rules2excel.py +2 -2
  23. cognite/neat/_rules/importers/_dms2rules.py +66 -55
  24. cognite/neat/_rules/models/_base_rules.py +4 -1
  25. cognite/neat/_rules/models/entities/_wrapped.py +10 -5
  26. cognite/neat/_rules/models/mapping/_classic2core.yaml +239 -38
  27. cognite/neat/_rules/transformers/__init__.py +8 -2
  28. cognite/neat/_rules/transformers/_converters.py +271 -188
  29. cognite/neat/_rules/transformers/_mapping.py +75 -59
  30. cognite/neat/_rules/transformers/_verification.py +2 -3
  31. cognite/neat/_session/_inspect.py +3 -1
  32. cognite/neat/_session/_prepare.py +112 -24
  33. cognite/neat/_session/_read.py +33 -70
  34. cognite/neat/_session/_state.py +2 -2
  35. cognite/neat/_session/_to.py +2 -2
  36. cognite/neat/_store/_rules_store.py +4 -8
  37. cognite/neat/_utils/reader/_base.py +27 -0
  38. cognite/neat/_version.py +1 -1
  39. {cognite_neat-0.104.0.dist-info → cognite_neat-0.105.1.dist-info}/METADATA +4 -3
  40. cognite_neat-0.105.1.dist-info/RECORD +179 -0
  41. {cognite_neat-0.104.0.dist-info → cognite_neat-0.105.1.dist-info}/WHEEL +1 -1
  42. cognite/neat/_app/api/__init__.py +0 -0
  43. cognite/neat/_app/api/asgi/metrics.py +0 -4
  44. cognite/neat/_app/api/configuration.py +0 -98
  45. cognite/neat/_app/api/context_manager/__init__.py +0 -3
  46. cognite/neat/_app/api/context_manager/manager.py +0 -16
  47. cognite/neat/_app/api/data_classes/__init__.py +0 -0
  48. cognite/neat/_app/api/data_classes/rest.py +0 -59
  49. cognite/neat/_app/api/explorer.py +0 -66
  50. cognite/neat/_app/api/routers/configuration.py +0 -25
  51. cognite/neat/_app/api/routers/crud.py +0 -102
  52. cognite/neat/_app/api/routers/metrics.py +0 -10
  53. cognite/neat/_app/api/routers/workflows.py +0 -224
  54. cognite/neat/_app/api/utils/__init__.py +0 -0
  55. cognite/neat/_app/api/utils/data_mapping.py +0 -17
  56. cognite/neat/_app/api/utils/logging.py +0 -26
  57. cognite/neat/_app/api/utils/query_templates.py +0 -92
  58. cognite/neat/_app/main.py +0 -17
  59. cognite/neat/_app/monitoring/__init__.py +0 -0
  60. cognite/neat/_app/monitoring/metrics.py +0 -69
  61. cognite/neat/_app/ui/index.html +0 -1
  62. cognite/neat/_app/ui/neat-app/.gitignore +0 -23
  63. cognite/neat/_app/ui/neat-app/README.md +0 -70
  64. cognite/neat/_app/ui/neat-app/build/asset-manifest.json +0 -14
  65. cognite/neat/_app/ui/neat-app/build/favicon.ico +0 -0
  66. cognite/neat/_app/ui/neat-app/build/img/architect-icon.svg +0 -116
  67. cognite/neat/_app/ui/neat-app/build/img/developer-icon.svg +0 -112
  68. cognite/neat/_app/ui/neat-app/build/img/sme-icon.svg +0 -34
  69. cognite/neat/_app/ui/neat-app/build/index.html +0 -1
  70. cognite/neat/_app/ui/neat-app/build/logo192.png +0 -0
  71. cognite/neat/_app/ui/neat-app/build/manifest.json +0 -25
  72. cognite/neat/_app/ui/neat-app/build/robots.txt +0 -3
  73. cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -2
  74. cognite/neat/_app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -1
  75. cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -3
  76. cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -88
  77. cognite/neat/_app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -1
  78. cognite/neat/_app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -1
  79. cognite/neat/_app/ui/neat-app/package-lock.json +0 -18306
  80. cognite/neat/_app/ui/neat-app/package.json +0 -62
  81. cognite/neat/_app/ui/neat-app/public/favicon.ico +0 -0
  82. cognite/neat/_app/ui/neat-app/public/img/architect-icon.svg +0 -116
  83. cognite/neat/_app/ui/neat-app/public/img/developer-icon.svg +0 -112
  84. cognite/neat/_app/ui/neat-app/public/img/sme-icon.svg +0 -34
  85. cognite/neat/_app/ui/neat-app/public/index.html +0 -43
  86. cognite/neat/_app/ui/neat-app/public/logo192.png +0 -0
  87. cognite/neat/_app/ui/neat-app/public/manifest.json +0 -25
  88. cognite/neat/_app/ui/neat-app/public/robots.txt +0 -3
  89. cognite/neat/_app/ui/neat-app/src/App.css +0 -38
  90. cognite/neat/_app/ui/neat-app/src/App.js +0 -17
  91. cognite/neat/_app/ui/neat-app/src/App.test.js +0 -8
  92. cognite/neat/_app/ui/neat-app/src/MainContainer.tsx +0 -70
  93. cognite/neat/_app/ui/neat-app/src/components/JsonViewer.tsx +0 -43
  94. cognite/neat/_app/ui/neat-app/src/components/LocalUploader.tsx +0 -124
  95. cognite/neat/_app/ui/neat-app/src/components/OverviewComponentEditorDialog.tsx +0 -63
  96. cognite/neat/_app/ui/neat-app/src/components/StepEditorDialog.tsx +0 -511
  97. cognite/neat/_app/ui/neat-app/src/components/TabPanel.tsx +0 -36
  98. cognite/neat/_app/ui/neat-app/src/components/Utils.tsx +0 -56
  99. cognite/neat/_app/ui/neat-app/src/components/WorkflowDeleteDialog.tsx +0 -60
  100. cognite/neat/_app/ui/neat-app/src/components/WorkflowExecutionReport.tsx +0 -112
  101. cognite/neat/_app/ui/neat-app/src/components/WorkflowImportExportDialog.tsx +0 -67
  102. cognite/neat/_app/ui/neat-app/src/components/WorkflowMetadataDialog.tsx +0 -79
  103. cognite/neat/_app/ui/neat-app/src/index.css +0 -13
  104. cognite/neat/_app/ui/neat-app/src/index.js +0 -13
  105. cognite/neat/_app/ui/neat-app/src/logo.svg +0 -1
  106. cognite/neat/_app/ui/neat-app/src/reportWebVitals.js +0 -13
  107. cognite/neat/_app/ui/neat-app/src/setupTests.js +0 -5
  108. cognite/neat/_app/ui/neat-app/src/types/WorkflowTypes.ts +0 -388
  109. cognite/neat/_app/ui/neat-app/src/views/AboutView.tsx +0 -61
  110. cognite/neat/_app/ui/neat-app/src/views/ConfigView.tsx +0 -184
  111. cognite/neat/_app/ui/neat-app/src/views/GlobalConfigView.tsx +0 -180
  112. cognite/neat/_app/ui/neat-app/src/views/WorkflowView.tsx +0 -570
  113. cognite/neat/_app/ui/neat-app/tsconfig.json +0 -27
  114. cognite/neat/_workflows/__init__.py +0 -17
  115. cognite/neat/_workflows/base.py +0 -590
  116. cognite/neat/_workflows/cdf_store.py +0 -393
  117. cognite/neat/_workflows/examples/Export_DMS/workflow.yaml +0 -89
  118. cognite/neat/_workflows/examples/Export_Semantic_Data_Model/workflow.yaml +0 -66
  119. cognite/neat/_workflows/examples/Import_DMS/workflow.yaml +0 -65
  120. cognite/neat/_workflows/examples/Validate_Rules/workflow.yaml +0 -67
  121. cognite/neat/_workflows/examples/Validate_Solution_Model/workflow.yaml +0 -64
  122. cognite/neat/_workflows/manager.py +0 -292
  123. cognite/neat/_workflows/model.py +0 -203
  124. cognite/neat/_workflows/steps/__init__.py +0 -0
  125. cognite/neat/_workflows/steps/data_contracts.py +0 -109
  126. cognite/neat/_workflows/steps/lib/__init__.py +0 -0
  127. cognite/neat/_workflows/steps/lib/current/__init__.py +0 -6
  128. cognite/neat/_workflows/steps/lib/current/graph_extractor.py +0 -100
  129. cognite/neat/_workflows/steps/lib/current/graph_loader.py +0 -51
  130. cognite/neat/_workflows/steps/lib/current/graph_store.py +0 -48
  131. cognite/neat/_workflows/steps/lib/current/rules_exporter.py +0 -537
  132. cognite/neat/_workflows/steps/lib/current/rules_importer.py +0 -323
  133. cognite/neat/_workflows/steps/lib/current/rules_validator.py +0 -106
  134. cognite/neat/_workflows/steps/lib/io/__init__.py +0 -1
  135. cognite/neat/_workflows/steps/lib/io/io_steps.py +0 -393
  136. cognite/neat/_workflows/steps/step_model.py +0 -79
  137. cognite/neat/_workflows/steps_registry.py +0 -218
  138. cognite/neat/_workflows/tasks.py +0 -18
  139. cognite/neat/_workflows/triggers.py +0 -169
  140. cognite/neat/_workflows/utils.py +0 -19
  141. cognite_neat-0.104.0.dist-info/RECORD +0 -276
  142. {cognite_neat-0.104.0.dist-info → cognite_neat-0.105.1.dist-info}/LICENSE +0 -0
  143. {cognite_neat-0.104.0.dist-info → cognite_neat-0.105.1.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
- }