@geode/opengeodeweb-front 10.6.2 → 10.6.3-rc.1
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.
- package/.eslintrc.cjs +1 -1
- package/.oxlintrc.json +3 -22
- package/app/assets/geode_objects.js +26 -26
- package/app/components/Carousel.vue +62 -66
- package/app/components/CrsSelector.vue +48 -52
- package/app/components/DeleteDialog.vue +21 -37
- package/app/components/DragAndDrop.vue +35 -41
- package/app/components/ExtensionSelector.vue +50 -63
- package/app/components/FeedBack/ErrorBanner.vue +7 -10
- package/app/components/FeedBack/Snackers.vue +12 -14
- package/app/components/FetchingData.vue +1 -6
- package/app/components/FileSelector.vue +41 -47
- package/app/components/FileUploader.vue +62 -79
- package/app/components/GlassCard.vue +19 -19
- package/app/components/HybridRenderingView.vue +37 -38
- package/app/components/InfraConnected.vue +3 -3
- package/app/components/Inspector/InspectionButton.vue +27 -31
- package/app/components/Inspector/ResultPanel.vue +13 -24
- package/app/components/Launcher.vue +13 -13
- package/app/components/Loading.vue +63 -69
- package/app/components/MissingFilesSelector.vue +53 -73
- package/app/components/ObjectSelector.vue +81 -99
- package/app/components/PackagesVersions.vue +27 -30
- package/app/components/Recaptcha.vue +60 -71
- package/app/components/RemoteRenderingView.vue +102 -108
- package/app/components/Screenshot.vue +36 -42
- package/app/components/SearchBar.vue +5 -5
- package/app/components/Step.vue +37 -44
- package/app/components/Stepper.vue +29 -35
- package/app/components/VeaseViewToolbar.vue +69 -78
- package/app/components/ViewToolbar.vue +41 -45
- package/app/components/Viewer/BreadCrumb.vue +18 -30
- package/app/components/Viewer/ContextMenu.vue +176 -179
- package/app/components/Viewer/ContextMenuItem.vue +105 -117
- package/app/components/Viewer/EdgedCurve/PointsOptions.vue +6 -9
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +82 -93
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +84 -99
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +83 -98
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +62 -73
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +84 -108
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +82 -105
- package/app/components/Viewer/Generic/Model/EdgesOptions.vue +19 -23
- package/app/components/Viewer/Generic/Model/PointsOptions.vue +26 -30
- package/app/components/Viewer/Grid/2D/CellsOptions.vue +5 -5
- package/app/components/Viewer/Grid/2D/EdgesOptions.vue +6 -9
- package/app/components/Viewer/Grid/2D/PointsOptions.vue +6 -9
- package/app/components/Viewer/Grid/3D/CellsOptions.vue +5 -5
- package/app/components/Viewer/Grid/3D/EdgesOptions.vue +6 -9
- package/app/components/Viewer/Grid/3D/FacetsOptions.vue +5 -5
- package/app/components/Viewer/Grid/3D/PointsOptions.vue +6 -9
- package/app/components/Viewer/HybridSolid/EdgesOptions.vue +6 -9
- package/app/components/Viewer/HybridSolid/PointsOptions.vue +6 -9
- package/app/components/Viewer/HybridSolid/PolygonsOptions.vue +6 -9
- package/app/components/Viewer/HybridSolid/PolyhedraOptions.vue +6 -9
- package/app/components/Viewer/Options/AttributeColorBar.vue +8 -8
- package/app/components/Viewer/Options/AttributeSelector.vue +73 -78
- package/app/components/Viewer/Options/ColorMapList.vue +115 -140
- package/app/components/Viewer/Options/ColorMapPicker.vue +128 -142
- package/app/components/Viewer/Options/ColorPicker.vue +9 -9
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +77 -91
- package/app/components/Viewer/Options/TextureItem.vue +54 -58
- package/app/components/Viewer/Options/TexturesSelector.vue +22 -26
- package/app/components/Viewer/Options/VisibilitySwitch.vue +1 -1
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +61 -68
- package/app/components/Viewer/PolygonalSurface/EdgesOptions.vue +6 -9
- package/app/components/Viewer/PolygonalSurface/PointsOptions.vue +6 -9
- package/app/components/Viewer/PolygonalSurface/SpecificPolygonsOptions.vue +83 -103
- package/app/components/Viewer/Solid/EdgesOptions.vue +6 -9
- package/app/components/Viewer/Solid/PointsOptions.vue +6 -9
- package/app/components/Viewer/Solid/PolygonsOptions.vue +6 -9
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +82 -105
- package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +5 -5
- package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +5 -5
- package/app/components/Viewer/Tree/ObjectTree.vue +80 -89
- package/app/components/Viewer/TreeComponent.vue +43 -49
- package/app/components/Viewer/TreeObject.vue +48 -50
- package/app/components/Viewer/TriangulatedSurface/EdgesOptions.vue +6 -9
- package/app/components/Viewer/TriangulatedSurface/PointsOptions.vue +5 -5
- package/app/components/Viewer/TriangulatedSurface/TrianglesOptions.vue +5 -5
- package/app/components/Wrapper.vue +8 -8
- package/app/components/ZScaling.vue +18 -27
- package/app/composables/project_manager.js +57 -67
- package/app/composables/run_function_when_microservices_connected.js +8 -8
- package/app/plugins/auto_store_register.js +11 -13
- package/app/stores/app.js +118 -138
- package/app/stores/data.js +52 -68
- package/app/stores/data_style.js +36 -36
- package/app/stores/feedback.js +17 -20
- package/app/stores/geode.js +54 -55
- package/app/stores/hybrid_viewer.js +164 -177
- package/app/stores/infra.js +45 -55
- package/app/stores/lambda.js +26 -26
- package/app/stores/menu.js +78 -85
- package/app/stores/treeview.js +57 -65
- package/app/stores/viewer.js +92 -104
- package/app/utils/colormap.js +3 -3
- package/app/utils/config.js +16 -22
- package/app/utils/default_styles.js +50 -62
- package/app/utils/extension.js +44 -44
- package/app/utils/file_import_workflow.js +50 -64
- package/app/utils/local/app_mode.js +2 -2
- package/app/utils/local/cleanup.js +66 -72
- package/app/utils/local/microservices.js +61 -71
- package/app/utils/local/path.js +16 -19
- package/app/utils/local/scripts.js +22 -22
- package/app/utils/recaptcha.js +6 -6
- package/app/utils/server.js +21 -24
- package/app/utils/status.js +2 -2
- package/app/utils/treeview.js +4 -4
- package/app/utils/validate_schema.js +7 -7
- package/commitlint.config.js +2 -2
- package/eslint.config.js +4 -4
- package/internal/database/database.js +38 -46
- package/internal/database/extended_database.js +9 -10
- package/internal/database/tables/data.js +2 -3
- package/internal/database/tables/model_components.js +1 -1
- package/internal/database/tables/model_components_relation.js +1 -1
- package/internal/stores/data_style/mesh/cells/cell.js +47 -63
- package/internal/stores/data_style/mesh/cells/color.js +11 -16
- package/internal/stores/data_style/mesh/cells/common.js +6 -6
- package/internal/stores/data_style/mesh/cells/index.js +37 -47
- package/internal/stores/data_style/mesh/cells/textures.js +11 -12
- package/internal/stores/data_style/mesh/cells/vertex.js +47 -58
- package/internal/stores/data_style/mesh/cells/visibility.js +11 -16
- package/internal/stores/data_style/mesh/edges/color.js +11 -16
- package/internal/stores/data_style/mesh/edges/common.js +6 -6
- package/internal/stores/data_style/mesh/edges/edge.js +47 -63
- package/internal/stores/data_style/mesh/edges/index.js +38 -52
- package/internal/stores/data_style/mesh/edges/vertex.js +47 -58
- package/internal/stores/data_style/mesh/edges/visibility.js +11 -16
- package/internal/stores/data_style/mesh/edges/width.js +11 -16
- package/internal/stores/data_style/mesh/index.js +34 -34
- package/internal/stores/data_style/mesh/points/color.js +11 -16
- package/internal/stores/data_style/mesh/points/common.js +6 -6
- package/internal/stores/data_style/mesh/points/index.js +35 -49
- package/internal/stores/data_style/mesh/points/size.js +11 -16
- package/internal/stores/data_style/mesh/points/vertex.js +47 -58
- package/internal/stores/data_style/mesh/points/visibility.js +11 -16
- package/internal/stores/data_style/mesh/polygons/color.js +11 -16
- package/internal/stores/data_style/mesh/polygons/common.js +6 -6
- package/internal/stores/data_style/mesh/polygons/index.js +36 -45
- package/internal/stores/data_style/mesh/polygons/polygon.js +45 -56
- package/internal/stores/data_style/mesh/polygons/textures.js +11 -16
- package/internal/stores/data_style/mesh/polygons/vertex.js +47 -58
- package/internal/stores/data_style/mesh/polygons/visibility.js +11 -16
- package/internal/stores/data_style/mesh/polyhedra/color.js +11 -16
- package/internal/stores/data_style/mesh/polyhedra/common.js +6 -6
- package/internal/stores/data_style/mesh/polyhedra/index.js +29 -42
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +43 -47
- package/internal/stores/data_style/mesh/polyhedra/vertex.js +47 -58
- package/internal/stores/data_style/mesh/polyhedra/visibility.js +11 -17
- package/internal/stores/data_style/model/blocks/color.js +21 -24
- package/internal/stores/data_style/model/blocks/common.js +6 -6
- package/internal/stores/data_style/model/blocks/index.js +13 -17
- package/internal/stores/data_style/model/blocks/visibility.js +21 -24
- package/internal/stores/data_style/model/corners/color.js +21 -24
- package/internal/stores/data_style/model/corners/common.js +6 -6
- package/internal/stores/data_style/model/corners/index.js +14 -18
- package/internal/stores/data_style/model/corners/visibility.js +21 -25
- package/internal/stores/data_style/model/edges/common.js +4 -4
- package/internal/stores/data_style/model/edges/index.js +7 -7
- package/internal/stores/data_style/model/edges/visibility.js +11 -15
- package/internal/stores/data_style/model/index.js +84 -100
- package/internal/stores/data_style/model/lines/color.js +21 -24
- package/internal/stores/data_style/model/lines/common.js +6 -6
- package/internal/stores/data_style/model/lines/index.js +13 -17
- package/internal/stores/data_style/model/lines/visibility.js +21 -24
- package/internal/stores/data_style/model/points/common.js +4 -4
- package/internal/stores/data_style/model/points/index.js +9 -9
- package/internal/stores/data_style/model/points/size.js +11 -11
- package/internal/stores/data_style/model/points/visibility.js +11 -15
- package/internal/stores/data_style/model/surfaces/color.js +21 -24
- package/internal/stores/data_style/model/surfaces/common.js +6 -6
- package/internal/stores/data_style/model/surfaces/index.js +14 -22
- package/internal/stores/data_style/model/surfaces/visibility.js +18 -22
- package/internal/stores/data_style/state.js +11 -11
- package/internal/utils/api_fetch.js +24 -34
- package/internal/utils/upload_file.js +19 -24
- package/internal/utils/viewer_call.js +23 -36
- package/nuxt.config.js +7 -11
- package/package.json +3 -3
- package/scripts/generate_geode_objects.js +14 -16
- package/server/api/app/kill.post.js +4 -4
- package/server/api/app/project_folder_path.post.js +11 -11
- package/server/api/app/run_back.post.js +12 -12
- package/server/api/app/run_viewer.post.js +12 -12
- package/server/api/extensions/run.post.js +34 -41
- package/server/api/extensions/upload.put.js +48 -62
- package/tests/integration/setup.js +43 -53
- package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +90 -116
- package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +81 -107
- package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +38 -41
- package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +85 -101
- package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +89 -113
- package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +81 -105
- package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +56 -73
- package/tests/integration/stores/data_style/model/corners.nuxt.test.js +59 -76
- package/tests/integration/stores/data_style/model/edges.nuxt.test.js +39 -42
- package/tests/integration/stores/data_style/model/index.nuxt.test.js +31 -34
- package/tests/integration/stores/data_style/model/lines.nuxt.test.js +60 -73
- package/tests/integration/stores/data_style/model/points.nuxt.test.js +52 -55
- package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +59 -80
- package/tests/integration/stores/viewer.nuxt.test.js +35 -38
- package/tests/setup_indexeddb.js +2 -2
- package/tests/unit/components/CrsSelector.nuxt.test.js +28 -28
- package/tests/unit/components/ExtensionSelector.nuxt.test.js +33 -35
- package/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js +23 -23
- package/tests/unit/components/FeedBack/Snackers.nuxt.test.js +18 -18
- package/tests/unit/components/FileSelector.nuxt.test.js +57 -59
- package/tests/unit/components/FileUploader.nuxt.test.js +35 -39
- package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +28 -28
- package/tests/unit/components/Inspector/ResultPanel.nuxt.test.js +22 -27
- package/tests/unit/components/Launcher.nuxt.test.js +20 -22
- package/tests/unit/components/MissingFilesSelector.nuxt.test.js +37 -37
- package/tests/unit/components/ObjectSelector.nuxt.test.js +62 -62
- package/tests/unit/components/PackagesVersions.nuxt.test.js +16 -16
- package/tests/unit/components/Step.nuxt.test.js +18 -19
- package/tests/unit/components/Stepper.nuxt.test.js +18 -18
- package/tests/unit/composables/api_fetch.nuxt.test.js +34 -36
- package/tests/unit/composables/project_manager.nuxt.test.js +93 -112
- package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +36 -36
- package/tests/unit/composables/upload_file.nuxt.test.js +27 -29
- package/tests/unit/plugins/project_load.nuxt.test.js +31 -33
- package/tests/unit/stores/app.nuxt.test.js +90 -92
- package/tests/unit/stores/feedback.nuxt.test.js +47 -57
- package/tests/unit/stores/geode.nuxt.test.js +111 -115
- package/tests/unit/stores/infra.nuxt.test.js +148 -148
- package/tests/unit/stores/lambda.nuxt.test.js +72 -74
- package/tests/unit/stores/treeview.nuxt.test.js +19 -21
- package/tests/unit/stores/viewer.nuxt.test.js +109 -122
- package/tests/unit/utils/recaptcha.nuxt.test.js +25 -29
- package/tests/unit/utils/validate_schema.nuxt.test.js +17 -17
- package/tests/utils.js +11 -11
- package/tests/vitest.config.js +9 -9
- package/vuetify_config.js +2 -2
|
@@ -1,35 +1,27 @@
|
|
|
1
1
|
// Node imports
|
|
2
|
-
import { finished, pipeline } from "node:stream/promises"
|
|
3
|
-
import { Readable } from "node:stream"
|
|
4
|
-
import fs from "node:fs"
|
|
5
|
-
import path from "node:path"
|
|
2
|
+
import { finished, pipeline } from "node:stream/promises";
|
|
3
|
+
import { Readable } from "node:stream";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
6
|
|
|
7
7
|
// Third party imports
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
getRequestWebStream,
|
|
13
|
-
} from "h3"
|
|
14
|
-
import StreamZip from "node-stream-zip"
|
|
15
|
-
import busboy from "busboy"
|
|
16
|
-
import sanitize from "sanitize-filename"
|
|
8
|
+
import { createError, defineEventHandler, getRequestHeaders, getRequestWebStream } from "h3";
|
|
9
|
+
import StreamZip from "node-stream-zip";
|
|
10
|
+
import busboy from "busboy";
|
|
11
|
+
import sanitize from "sanitize-filename";
|
|
17
12
|
|
|
18
13
|
// Local imports
|
|
19
|
-
import {
|
|
20
|
-
addExtensionToConf,
|
|
21
|
-
confFolderPath,
|
|
22
|
-
} from "@geode/opengeodeweb-front/app/utils/config.js"
|
|
14
|
+
import { addExtensionToConf, confFolderPath } from "@geode/opengeodeweb-front/app/utils/config.js";
|
|
23
15
|
|
|
24
|
-
const CODE_201 = 201
|
|
25
|
-
const FILE_SIZE_LIMIT = 107_374_182
|
|
16
|
+
const CODE_201 = 201;
|
|
17
|
+
const FILE_SIZE_LIMIT = 107_374_182;
|
|
26
18
|
|
|
27
19
|
export default defineEventHandler(async (event) => {
|
|
28
|
-
const projectName = "vease"
|
|
29
|
-
const writePromises = []
|
|
30
|
-
const savedFiles = []
|
|
20
|
+
const projectName = "vease";
|
|
21
|
+
const writePromises = [];
|
|
22
|
+
const savedFiles = [];
|
|
31
23
|
|
|
32
|
-
const configFolderPath = confFolderPath(projectName)
|
|
24
|
+
const configFolderPath = confFolderPath(projectName);
|
|
33
25
|
|
|
34
26
|
const busboyInstance = busboy({
|
|
35
27
|
headers: getRequestHeaders(event),
|
|
@@ -37,71 +29,65 @@ export default defineEventHandler(async (event) => {
|
|
|
37
29
|
fileSize: FILE_SIZE_LIMIT,
|
|
38
30
|
files: 1,
|
|
39
31
|
},
|
|
40
|
-
})
|
|
32
|
+
});
|
|
41
33
|
|
|
42
34
|
busboyInstance.on("file", (fieldname, fileStream, info) => {
|
|
43
35
|
if (fieldname !== "file") {
|
|
44
36
|
// Drain & ignore unwanted fields
|
|
45
|
-
fileStream.resume()
|
|
46
|
-
return
|
|
37
|
+
fileStream.resume();
|
|
38
|
+
return;
|
|
47
39
|
}
|
|
48
40
|
|
|
49
|
-
const safeFilename = sanitize(info.filename)
|
|
50
|
-
const targetPath = path.join(configFolderPath, safeFilename)
|
|
41
|
+
const safeFilename = sanitize(info.filename);
|
|
42
|
+
const targetPath = path.join(configFolderPath, safeFilename);
|
|
51
43
|
|
|
52
44
|
const writePromise = (async () => {
|
|
53
|
-
const writeStream = fs.createWriteStream(targetPath)
|
|
54
|
-
await pipeline(fileStream, writeStream)
|
|
55
|
-
savedFiles.push(targetPath)
|
|
56
|
-
console.log("File written:", targetPath)
|
|
57
|
-
})()
|
|
58
|
-
|
|
59
|
-
writePromises.push(writePromise)
|
|
60
|
-
fileStream.on("limit", () =>
|
|
61
|
-
|
|
62
|
-
)
|
|
63
|
-
})
|
|
45
|
+
const writeStream = fs.createWriteStream(targetPath);
|
|
46
|
+
await pipeline(fileStream, writeStream);
|
|
47
|
+
savedFiles.push(targetPath);
|
|
48
|
+
console.log("File written:", targetPath);
|
|
49
|
+
})();
|
|
50
|
+
|
|
51
|
+
writePromises.push(writePromise);
|
|
52
|
+
fileStream.on("limit", () => busboyInstance.destroy(new Error("File too large")));
|
|
53
|
+
});
|
|
64
54
|
|
|
65
55
|
busboyInstance.on("field", (name, value) => {
|
|
66
|
-
console.log(`Field ${name}: ${value}`)
|
|
67
|
-
})
|
|
56
|
+
console.log(`Field ${name}: ${value}`);
|
|
57
|
+
});
|
|
68
58
|
|
|
69
|
-
busboyInstance.on("filesLimit", () =>
|
|
70
|
-
|
|
71
|
-
)
|
|
72
|
-
busboyInstance.on("partsLimit", () =>
|
|
73
|
-
busboyInstance.destroy(new Error("Too many parts")),
|
|
74
|
-
)
|
|
59
|
+
busboyInstance.on("filesLimit", () => busboyInstance.destroy(new Error("Too many files")));
|
|
60
|
+
busboyInstance.on("partsLimit", () => busboyInstance.destroy(new Error("Too many parts")));
|
|
75
61
|
|
|
76
|
-
const webStream = getRequestWebStream(event)
|
|
77
|
-
Readable.fromWeb(webStream).pipe(busboyInstance)
|
|
78
|
-
await finished(busboyInstance)
|
|
62
|
+
const webStream = getRequestWebStream(event);
|
|
63
|
+
Readable.fromWeb(webStream).pipe(busboyInstance);
|
|
64
|
+
await finished(busboyInstance);
|
|
79
65
|
|
|
80
66
|
if (writePromises.length > 0) {
|
|
81
|
-
await Promise.all(writePromises)
|
|
82
|
-
console.log("All disk writes completed")
|
|
67
|
+
await Promise.all(writePromises);
|
|
68
|
+
console.log("All disk writes completed");
|
|
83
69
|
}
|
|
84
70
|
|
|
85
71
|
if (savedFiles.length === 0) {
|
|
86
|
-
throw createError({ statusCode: 400, message: "No file received" })
|
|
72
|
+
throw createError({ statusCode: 400, message: "No file received" });
|
|
87
73
|
}
|
|
88
74
|
|
|
89
75
|
await Promise.all(
|
|
90
76
|
savedFiles.map(async (file) => {
|
|
91
|
-
const StreamZipAsync = StreamZip.async
|
|
77
|
+
const StreamZipAsync = StreamZip.async;
|
|
92
78
|
const zip = new StreamZipAsync({
|
|
93
79
|
file,
|
|
94
80
|
storeEntries: true,
|
|
95
|
-
})
|
|
96
|
-
const metadataJson = await zip.entryData("metadata.json")
|
|
97
|
-
const metadata = JSON.parse(metadataJson)
|
|
98
|
-
const { id } = metadata
|
|
81
|
+
});
|
|
82
|
+
const metadataJson = await zip.entryData("metadata.json");
|
|
83
|
+
const metadata = JSON.parse(metadataJson);
|
|
84
|
+
const { id } = metadata;
|
|
99
85
|
await addExtensionToConf(projectName, {
|
|
100
86
|
extensionID: id,
|
|
101
87
|
extensionPath: file,
|
|
102
|
-
})
|
|
88
|
+
});
|
|
103
89
|
}),
|
|
104
|
-
)
|
|
90
|
+
);
|
|
105
91
|
|
|
106
|
-
return { statusCode: CODE_201 }
|
|
107
|
-
})
|
|
92
|
+
return { statusCode: CODE_201 };
|
|
93
|
+
});
|
|
@@ -1,40 +1,32 @@
|
|
|
1
1
|
// Node.js imports
|
|
2
|
-
import { WebSocket } from "ws"
|
|
3
|
-
import path from "node:path"
|
|
2
|
+
import { WebSocket } from "ws";
|
|
3
|
+
import path from "node:path";
|
|
4
4
|
|
|
5
5
|
// Third party imports
|
|
6
|
-
import { afterAll, beforeAll, expect, vi } from "vitest"
|
|
6
|
+
import { afterAll, beforeAll, expect, vi } from "vitest";
|
|
7
7
|
|
|
8
8
|
// Local imports
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from "@ogw_front/utils/
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from "@ogw_front/
|
|
18
|
-
import { Status } from "@ogw_front/utils/status"
|
|
19
|
-
import { appMode } from "@ogw_front/utils/local/app_mode"
|
|
20
|
-
import { importFile } from "@ogw_front/utils/file_import_workflow"
|
|
21
|
-
import { setupActivePinia } from "@ogw_tests/utils"
|
|
22
|
-
import { useGeodeStore } from "@ogw_front/stores/geode"
|
|
23
|
-
import { useInfraStore } from "@ogw_front/stores/infra"
|
|
24
|
-
import { useViewerStore } from "@ogw_front/stores/viewer"
|
|
9
|
+
import { addMicroserviceMetadatas, runBack, runViewer } from "@ogw_front/utils/local/microservices";
|
|
10
|
+
import { createPath, generateProjectFolderPath } from "@ogw_front/utils/local/path";
|
|
11
|
+
import { Status } from "@ogw_front/utils/status";
|
|
12
|
+
import { appMode } from "@ogw_front/utils/local/app_mode";
|
|
13
|
+
import { importFile } from "@ogw_front/utils/file_import_workflow";
|
|
14
|
+
import { setupActivePinia } from "@ogw_tests/utils";
|
|
15
|
+
import { useGeodeStore } from "@ogw_front/stores/geode";
|
|
16
|
+
import { useInfraStore } from "@ogw_front/stores/infra";
|
|
17
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
25
18
|
|
|
26
19
|
// Local constants
|
|
27
|
-
const data_folder = path.join("tests", "integration", "data", "uploads")
|
|
20
|
+
const data_folder = path.join("tests", "integration", "data", "uploads");
|
|
28
21
|
|
|
29
22
|
async function runMicroservices() {
|
|
30
|
-
const geodeStore = useGeodeStore()
|
|
31
|
-
const infraStore = useInfraStore()
|
|
32
|
-
const viewerStore = useViewerStore()
|
|
33
|
-
infraStore.app_mode = appMode.BROWSER
|
|
34
|
-
const { COMMAND_BACK, PROJECT, COMMAND_VIEWER, NUXT_ROOT_PATH } =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
await createPath(projectFolderPath)
|
|
23
|
+
const geodeStore = useGeodeStore();
|
|
24
|
+
const infraStore = useInfraStore();
|
|
25
|
+
const viewerStore = useViewerStore();
|
|
26
|
+
infraStore.app_mode = appMode.BROWSER;
|
|
27
|
+
const { COMMAND_BACK, PROJECT, COMMAND_VIEWER, NUXT_ROOT_PATH } = useRuntimeConfig().public;
|
|
28
|
+
const projectFolderPath = generateProjectFolderPath(PROJECT);
|
|
29
|
+
await createPath(projectFolderPath);
|
|
38
30
|
|
|
39
31
|
const [back_port, viewer_port] = await Promise.all([
|
|
40
32
|
runBack(COMMAND_BACK, NUXT_ROOT_PATH, {
|
|
@@ -42,58 +34,56 @@ async function runMicroservices() {
|
|
|
42
34
|
uploadFolderPath: data_folder,
|
|
43
35
|
}),
|
|
44
36
|
runViewer(COMMAND_VIEWER, NUXT_ROOT_PATH, { projectFolderPath }),
|
|
45
|
-
])
|
|
37
|
+
]);
|
|
46
38
|
|
|
47
|
-
console.log("back_port", back_port)
|
|
48
|
-
console.log("viewer_port", viewer_port)
|
|
39
|
+
console.log("back_port", back_port);
|
|
40
|
+
console.log("viewer_port", viewer_port);
|
|
49
41
|
|
|
50
42
|
await addMicroserviceMetadatas(projectFolderPath, {
|
|
51
43
|
type: "back",
|
|
52
44
|
name: COMMAND_BACK,
|
|
53
45
|
port: back_port,
|
|
54
|
-
})
|
|
46
|
+
});
|
|
55
47
|
await addMicroserviceMetadatas(projectFolderPath, {
|
|
56
48
|
type: "viewer",
|
|
57
49
|
name: COMMAND_VIEWER,
|
|
58
50
|
port: viewer_port,
|
|
59
|
-
})
|
|
51
|
+
});
|
|
60
52
|
|
|
61
|
-
geodeStore.default_local_port = back_port
|
|
62
|
-
viewerStore.default_local_port = viewer_port
|
|
53
|
+
geodeStore.default_local_port = back_port;
|
|
54
|
+
viewerStore.default_local_port = viewer_port;
|
|
63
55
|
|
|
64
56
|
return {
|
|
65
57
|
projectFolderPath,
|
|
66
|
-
}
|
|
58
|
+
};
|
|
67
59
|
}
|
|
68
60
|
|
|
69
61
|
async function setupIntegrationTests(file_name, geode_object) {
|
|
70
|
-
setupActivePinia()
|
|
71
|
-
const viewerStore = useViewerStore()
|
|
72
|
-
const { projectFolderPath } = await runMicroservices()
|
|
73
|
-
await viewerStore.ws_connect()
|
|
74
|
-
const id = await importFile(file_name, geode_object)
|
|
75
|
-
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
76
|
-
console.log("end of setupIntegrationTests", { id, projectFolderPath })
|
|
77
|
-
return { id, projectFolderPath }
|
|
62
|
+
setupActivePinia();
|
|
63
|
+
const viewerStore = useViewerStore();
|
|
64
|
+
const { projectFolderPath } = await runMicroservices();
|
|
65
|
+
await viewerStore.ws_connect();
|
|
66
|
+
const id = await importFile(file_name, geode_object);
|
|
67
|
+
expect(viewerStore.status).toBe(Status.CONNECTED);
|
|
68
|
+
console.log("end of setupIntegrationTests", { id, projectFolderPath });
|
|
69
|
+
return { id, projectFolderPath };
|
|
78
70
|
}
|
|
79
71
|
|
|
80
|
-
const mockLockRequest = vi
|
|
81
|
-
.fn()
|
|
82
|
-
.mockImplementation(async (name, task) => await task({ name }))
|
|
72
|
+
const mockLockRequest = vi.fn().mockImplementation(async (name, task) => await task({ name }));
|
|
83
73
|
|
|
84
74
|
vi.stubGlobal("navigator", {
|
|
85
75
|
...navigator,
|
|
86
76
|
locks: {
|
|
87
77
|
request: mockLockRequest,
|
|
88
78
|
},
|
|
89
|
-
})
|
|
79
|
+
});
|
|
90
80
|
|
|
91
81
|
beforeAll(() => {
|
|
92
|
-
globalThis.WebSocket = WebSocket
|
|
93
|
-
})
|
|
82
|
+
globalThis.WebSocket = WebSocket;
|
|
83
|
+
});
|
|
94
84
|
|
|
95
85
|
afterAll(() => {
|
|
96
|
-
delete globalThis.WebSocket
|
|
97
|
-
})
|
|
86
|
+
delete globalThis.WebSocket;
|
|
87
|
+
});
|
|
98
88
|
|
|
99
|
-
export { runMicroservices, setupIntegrationTests }
|
|
89
|
+
export { runMicroservices, setupIntegrationTests };
|
|
@@ -1,181 +1,155 @@
|
|
|
1
1
|
// Third party imports
|
|
2
|
-
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"
|
|
3
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json" with { type: "json" }
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
|
|
3
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json" with { type: "json" };
|
|
4
4
|
|
|
5
5
|
// Local imports
|
|
6
|
-
import { Status } from "@ogw_front/utils/status"
|
|
7
|
-
import { cleanupBackend } from "@ogw_front/utils/local/cleanup"
|
|
8
|
-
import { setupIntegrationTests } from "@ogw_tests/integration/setup"
|
|
9
|
-
import { useDataStyleStore } from "@ogw_front/stores/data_style"
|
|
10
|
-
import { useViewerStore } from "@ogw_front/stores/viewer"
|
|
6
|
+
import { Status } from "@ogw_front/utils/status";
|
|
7
|
+
import { cleanupBackend } from "@ogw_front/utils/local/cleanup";
|
|
8
|
+
import { setupIntegrationTests } from "@ogw_tests/integration/setup";
|
|
9
|
+
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
10
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
11
11
|
|
|
12
12
|
// Local constants
|
|
13
|
-
const INTERVAL_TIMEOUT = 20_000
|
|
14
|
-
const mesh_cells_schemas = viewer_schemas.opengeodeweb_viewer.mesh.cells
|
|
15
|
-
const file_name = "test.og_rgd2d"
|
|
16
|
-
const geode_object = "RegularGrid2D"
|
|
17
|
-
const vertex_attribute = { name: "points" }
|
|
18
|
-
const cell_attribute = { name: "RGB_data" }
|
|
13
|
+
const INTERVAL_TIMEOUT = 20_000;
|
|
14
|
+
const mesh_cells_schemas = viewer_schemas.opengeodeweb_viewer.mesh.cells;
|
|
15
|
+
const file_name = "test.og_rgd2d";
|
|
16
|
+
const geode_object = "RegularGrid2D";
|
|
17
|
+
const vertex_attribute = { name: "points" };
|
|
18
|
+
const cell_attribute = { name: "RGB_data" };
|
|
19
19
|
|
|
20
20
|
let id = "",
|
|
21
|
-
projectFolderPath = ""
|
|
21
|
+
projectFolderPath = "";
|
|
22
22
|
|
|
23
23
|
beforeEach(async () => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
geode_object,
|
|
27
|
-
))
|
|
28
|
-
}, INTERVAL_TIMEOUT)
|
|
24
|
+
({ id, projectFolderPath } = await setupIntegrationTests(file_name, geode_object));
|
|
25
|
+
}, INTERVAL_TIMEOUT);
|
|
29
26
|
|
|
30
27
|
afterEach(async () => {
|
|
31
|
-
console.log("afterEach mesh cells kill", projectFolderPath)
|
|
32
|
-
await cleanupBackend(projectFolderPath)
|
|
33
|
-
})
|
|
28
|
+
console.log("afterEach mesh cells kill", projectFolderPath);
|
|
29
|
+
await cleanupBackend(projectFolderPath);
|
|
30
|
+
});
|
|
34
31
|
|
|
35
|
-
describe("Mesh cells",
|
|
32
|
+
describe("Mesh cells", () => {
|
|
36
33
|
describe("Cells visibility", () => {
|
|
37
34
|
test("Visibility true", async () => {
|
|
38
|
-
const dataStyleStore = useDataStyleStore()
|
|
39
|
-
const viewerStore = useViewerStore()
|
|
40
|
-
const visibility = true
|
|
41
|
-
const spy = vi.spyOn(viewerStore, "request")
|
|
42
|
-
const result = dataStyleStore.setMeshCellsVisibility(id, visibility)
|
|
43
|
-
expect(result).toBeInstanceOf(Promise)
|
|
44
|
-
await result
|
|
35
|
+
const dataStyleStore = useDataStyleStore();
|
|
36
|
+
const viewerStore = useViewerStore();
|
|
37
|
+
const visibility = true;
|
|
38
|
+
const spy = vi.spyOn(viewerStore, "request");
|
|
39
|
+
const result = dataStyleStore.setMeshCellsVisibility(id, visibility);
|
|
40
|
+
expect(result).toBeInstanceOf(Promise);
|
|
41
|
+
await result;
|
|
45
42
|
expect(spy).toHaveBeenCalledWith(
|
|
46
43
|
mesh_cells_schemas.visibility,
|
|
47
44
|
{ id, visibility },
|
|
48
45
|
{
|
|
49
46
|
response_function: expect.any(Function),
|
|
50
47
|
},
|
|
51
|
-
)
|
|
52
|
-
expect(dataStyleStore.meshCellsVisibility(id)).toBe(visibility)
|
|
53
|
-
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
54
|
-
})
|
|
55
|
-
})
|
|
48
|
+
);
|
|
49
|
+
expect(dataStyleStore.meshCellsVisibility(id)).toBe(visibility);
|
|
50
|
+
expect(viewerStore.status).toBe(Status.CONNECTED);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
56
53
|
|
|
57
54
|
describe("Cells color", () => {
|
|
58
55
|
test("Color red", async () => {
|
|
59
|
-
const dataStyleStore = useDataStyleStore()
|
|
60
|
-
const viewerStore = useViewerStore()
|
|
61
|
-
const color = { r: 255, g: 0, b: 0 }
|
|
62
|
-
const spy = vi.spyOn(viewerStore, "request")
|
|
63
|
-
const result = dataStyleStore.setMeshCellsColor(id, color)
|
|
64
|
-
expect(result).toBeInstanceOf(Promise)
|
|
65
|
-
await result
|
|
56
|
+
const dataStyleStore = useDataStyleStore();
|
|
57
|
+
const viewerStore = useViewerStore();
|
|
58
|
+
const color = { r: 255, g: 0, b: 0 };
|
|
59
|
+
const spy = vi.spyOn(viewerStore, "request");
|
|
60
|
+
const result = dataStyleStore.setMeshCellsColor(id, color);
|
|
61
|
+
expect(result).toBeInstanceOf(Promise);
|
|
62
|
+
await result;
|
|
66
63
|
expect(spy).toHaveBeenCalledWith(
|
|
67
64
|
mesh_cells_schemas.color,
|
|
68
65
|
{ id, color },
|
|
69
66
|
{
|
|
70
67
|
response_function: expect.any(Function),
|
|
71
68
|
},
|
|
72
|
-
)
|
|
73
|
-
expect(dataStyleStore.meshCellsColor(id)).toStrictEqual(color)
|
|
74
|
-
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
75
|
-
})
|
|
76
|
-
})
|
|
69
|
+
);
|
|
70
|
+
expect(dataStyleStore.meshCellsColor(id)).toStrictEqual(color);
|
|
71
|
+
expect(viewerStore.status).toBe(Status.CONNECTED);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
77
74
|
|
|
78
75
|
describe("Cells vertex attribute", () => {
|
|
79
76
|
test("Coloring vertex attribute", async () => {
|
|
80
|
-
const dataStyleStore = useDataStyleStore()
|
|
81
|
-
const viewerStore = useViewerStore()
|
|
82
|
-
const spy = vi.spyOn(viewerStore, "request")
|
|
83
|
-
const result = dataStyleStore.setMeshCellsVertexAttributeName(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
)
|
|
87
|
-
expect(result).toBeInstanceOf(Promise)
|
|
88
|
-
await result
|
|
77
|
+
const dataStyleStore = useDataStyleStore();
|
|
78
|
+
const viewerStore = useViewerStore();
|
|
79
|
+
const spy = vi.spyOn(viewerStore, "request");
|
|
80
|
+
const result = dataStyleStore.setMeshCellsVertexAttributeName(id, vertex_attribute.name);
|
|
81
|
+
expect(result).toBeInstanceOf(Promise);
|
|
82
|
+
await result;
|
|
89
83
|
expect(spy).toHaveBeenCalledWith(
|
|
90
84
|
mesh_cells_schemas.attribute.vertex.name,
|
|
91
85
|
{ id, ...vertex_attribute },
|
|
92
86
|
{
|
|
93
87
|
response_function: expect.any(Function),
|
|
94
88
|
},
|
|
95
|
-
)
|
|
96
|
-
expect(dataStyleStore.meshCellsVertexAttributeName(id)).toBe(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
})
|
|
101
|
-
})
|
|
89
|
+
);
|
|
90
|
+
expect(dataStyleStore.meshCellsVertexAttributeName(id)).toBe(vertex_attribute.name);
|
|
91
|
+
expect(viewerStore.status).toBe(Status.CONNECTED);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
102
94
|
|
|
103
95
|
describe("Cells cell attribute", () => {
|
|
104
96
|
test("Coloring cell attribute", async () => {
|
|
105
|
-
const dataStyleStore = useDataStyleStore()
|
|
106
|
-
const viewerStore = useViewerStore()
|
|
107
|
-
const spy = vi.spyOn(viewerStore, "request")
|
|
108
|
-
const result = dataStyleStore.setMeshCellsCellAttributeName(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
)
|
|
112
|
-
expect(result).toBeInstanceOf(Promise)
|
|
113
|
-
await result
|
|
97
|
+
const dataStyleStore = useDataStyleStore();
|
|
98
|
+
const viewerStore = useViewerStore();
|
|
99
|
+
const spy = vi.spyOn(viewerStore, "request");
|
|
100
|
+
const result = dataStyleStore.setMeshCellsCellAttributeName(id, cell_attribute.name);
|
|
101
|
+
expect(result).toBeInstanceOf(Promise);
|
|
102
|
+
await result;
|
|
114
103
|
expect(spy).toHaveBeenCalledWith(
|
|
115
104
|
mesh_cells_schemas.attribute.cell.name,
|
|
116
105
|
{ id, ...cell_attribute },
|
|
117
106
|
{
|
|
118
107
|
response_function: expect.any(Function),
|
|
119
108
|
},
|
|
120
|
-
)
|
|
121
|
-
expect(dataStyleStore.meshCellsCellAttributeName(id)).toBe(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
})
|
|
126
|
-
})
|
|
109
|
+
);
|
|
110
|
+
expect(dataStyleStore.meshCellsCellAttributeName(id)).toBe(cell_attribute.name);
|
|
111
|
+
expect(viewerStore.status).toBe(Status.CONNECTED);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
127
114
|
|
|
128
115
|
describe("Cells active coloring", () => {
|
|
129
116
|
test("test coloring", async () => {
|
|
130
|
-
const dataStyleStore = useDataStyleStore()
|
|
131
|
-
const viewerStore = useViewerStore()
|
|
117
|
+
const dataStyleStore = useDataStyleStore();
|
|
118
|
+
const viewerStore = useViewerStore();
|
|
132
119
|
const coloringTypes = [
|
|
133
120
|
{ name: "color" },
|
|
134
121
|
{
|
|
135
122
|
name: "vertex",
|
|
136
|
-
function: () =>
|
|
137
|
-
dataStyleStore.setMeshCellsVertexAttributeName(
|
|
138
|
-
id,
|
|
139
|
-
vertex_attribute.name,
|
|
140
|
-
),
|
|
123
|
+
function: () => dataStyleStore.setMeshCellsVertexAttributeName(id, vertex_attribute.name),
|
|
141
124
|
},
|
|
142
125
|
{
|
|
143
126
|
name: "cell",
|
|
144
|
-
function: () =>
|
|
145
|
-
dataStyleStore.setMeshCellsCellAttributeName(
|
|
146
|
-
id,
|
|
147
|
-
cell_attribute.name,
|
|
148
|
-
),
|
|
127
|
+
function: () => dataStyleStore.setMeshCellsCellAttributeName(id, cell_attribute.name),
|
|
149
128
|
},
|
|
150
|
-
]
|
|
129
|
+
];
|
|
151
130
|
async function testColoring(coloringType, expectedColoringType) {
|
|
152
131
|
if (coloringType.function) {
|
|
153
|
-
await coloringType.function()
|
|
132
|
+
await coloringType.function();
|
|
154
133
|
}
|
|
155
|
-
const result = dataStyleStore.setMeshCellsActiveColoring(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
)
|
|
159
|
-
expect(
|
|
160
|
-
await result
|
|
161
|
-
expect(dataStyleStore.meshCellsActiveColoring(id)).toBe(
|
|
162
|
-
expectedColoringType,
|
|
163
|
-
)
|
|
164
|
-
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
134
|
+
const result = dataStyleStore.setMeshCellsActiveColoring(id, coloringType.name);
|
|
135
|
+
expect(result).toBeInstanceOf(Promise);
|
|
136
|
+
await result;
|
|
137
|
+
expect(dataStyleStore.meshCellsActiveColoring(id)).toBe(expectedColoringType);
|
|
138
|
+
expect(viewerStore.status).toBe(Status.CONNECTED);
|
|
165
139
|
}
|
|
166
140
|
|
|
167
|
-
await testColoring(coloringTypes[0], "color")
|
|
168
|
-
await testColoring(coloringTypes[1], "vertex")
|
|
169
|
-
await testColoring(coloringTypes[2], "cell")
|
|
170
|
-
})
|
|
171
|
-
})
|
|
141
|
+
await testColoring(coloringTypes[0], "color");
|
|
142
|
+
await testColoring(coloringTypes[1], "vertex");
|
|
143
|
+
await testColoring(coloringTypes[2], "cell");
|
|
144
|
+
});
|
|
145
|
+
});
|
|
172
146
|
|
|
173
147
|
test("Cells apply default style", async () => {
|
|
174
|
-
const dataStyleStore = useDataStyleStore()
|
|
175
|
-
const viewerStore = useViewerStore()
|
|
176
|
-
const result = dataStyleStore.applyMeshCellsStyle(id)
|
|
177
|
-
expect(result).toBeInstanceOf(Promise)
|
|
178
|
-
await result
|
|
179
|
-
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
180
|
-
})
|
|
181
|
-
})
|
|
148
|
+
const dataStyleStore = useDataStyleStore();
|
|
149
|
+
const viewerStore = useViewerStore();
|
|
150
|
+
const result = dataStyleStore.applyMeshCellsStyle(id);
|
|
151
|
+
expect(result).toBeInstanceOf(Promise);
|
|
152
|
+
await result;
|
|
153
|
+
expect(viewerStore.status).toBe(Status.CONNECTED);
|
|
154
|
+
});
|
|
155
|
+
});
|