@geode/opengeodeweb-front 6.2.1 → 6.3.0

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.
Files changed (87) hide show
  1. package/.github/workflows/CD.yml +6 -0
  2. package/assets/geode_objects.js +46 -46
  3. package/assets/img/geode_objects/{section.svg → Section.svg} +1 -1
  4. package/components/Carousel.vue +1 -5
  5. package/components/CrsSelector.vue +6 -4
  6. package/components/ExtensionSelector.vue +78 -77
  7. package/components/FileSelector.vue +6 -7
  8. package/components/FileUploader.vue +7 -6
  9. package/components/MissingFilesSelector.vue +25 -23
  10. package/components/ObjectSelector.vue +24 -18
  11. package/components/PackagesVersions.vue +24 -23
  12. package/components/Wrapper.vue +1 -8
  13. package/composables/api_fetch.js +8 -10
  14. package/composables/runFunctionIfCloudRunning.js +1 -2
  15. package/composables/upload_file.js +4 -1
  16. package/nuxt.config.js +29 -1
  17. package/package.json +30 -14
  18. package/stores/cloud.js +19 -8
  19. package/stores/geode.js +7 -5
  20. package/test/components/CrsSelector.nuxt.test.js +54 -0
  21. package/test/components/ErrorsBanner.nuxt.test.js +46 -0
  22. package/test/components/ErrorsSnackers.nuxt.test.js +37 -0
  23. package/test/components/ExtensionSelector.nuxt.test.js +52 -0
  24. package/test/components/FileSelector.nuxt.test.js +60 -0
  25. package/test/components/FileUploader.nuxt.test.js +50 -0
  26. package/test/components/Launcher.nuxt.test.js +34 -0
  27. package/test/components/MissingFilesSelector.nuxt.test.js +67 -0
  28. package/test/components/ObjectSelector.nuxt.test.js +49 -0
  29. package/test/components/PackagesVersions.nuxt.test.js +45 -0
  30. package/test/components/Step.nuxt.test.js +58 -0
  31. package/test/components/Stepper.nuxt.test.js +58 -0
  32. package/test/components/Wrapper.nuxt.test.js +58 -0
  33. package/test/composables/api_fetch.nuxt.test.js +89 -0
  34. package/test/composables/runFunctionIfCloudRunning.nuxt.test.js +30 -0
  35. package/test/composables/upload_file.nuxt.test.js +51 -0
  36. package/test/stores/Cloud.nuxt.test.js +48 -0
  37. package/test/stores/Errors.test.js +36 -0
  38. package/test/stores/Geode.test.js +60 -0
  39. package/vitest.config.js +13 -0
  40. package/vuetify_config.js +22 -0
  41. package/assets/img/geode_objects/regular_grid.svg +0 -107
  42. package/assets/img/logos/LOGOMOSART-PME.png +0 -0
  43. package/assets/img/logos/logo-avenia.svg +0 -182
  44. package/assets/img/logos/logo_BSC.png +0 -0
  45. package/assets/img/logos/logo_DHI.png +0 -0
  46. package/assets/img/logos/logo_GSC.png +0 -0
  47. package/assets/img/logos/logo_NAOS.png +0 -0
  48. package/assets/img/logos/logo_UL.png +0 -0
  49. package/assets/img/logos/logo_arxitek.png +0 -0
  50. package/assets/img/logos/logo_banquiz.png +0 -0
  51. package/assets/img/logos/logo_cnrs.jpg +0 -0
  52. package/assets/img/logos/logo_earth_quick.jpg +0 -0
  53. package/assets/img/logos/logo_enerex.png +0 -0
  54. package/assets/img/logos/logo_geoliens.png +0 -0
  55. package/assets/img/logos/logo_georessources.jpg +0 -0
  56. package/assets/img/logos/logo_helioparc.svg +0 -182
  57. package/assets/img/logos/logo_pole_avenia.png +0 -0
  58. package/assets/img/logos/logo_region.png +0 -0
  59. package/assets/img/logos/logo_ring.png +0 -0
  60. package/assets/img/logos/logo_totalenergies.png +0 -0
  61. package/assets/schemas/CrsSelector.json +0 -12
  62. package/assets/schemas/ExtensionSelector.json +0 -15
  63. package/assets/schemas/FileSelector.json +0 -12
  64. package/assets/schemas/MissingFilesSelector.json +0 -15
  65. package/assets/schemas/ObjectSelector.json +0 -15
  66. package/components/Header.vue +0 -39
  67. /package/assets/img/geode_objects/{cross_section.svg → CrossSection.svg} +0 -0
  68. /package/assets/img/geode_objects/{edged_curve2d.svg → EdgedCurve2D.svg} +0 -0
  69. /package/assets/img/geode_objects/{edged_curve3d.svg → EdgedCurve3D.svg} +0 -0
  70. /package/assets/img/geode_objects/{edged_curve.svg → Graph.svg} +0 -0
  71. /package/assets/img/geode_objects/{hybrid_solid.svg → HybridSolid3D.svg} +0 -0
  72. /package/assets/img/geode_objects/{light_regular_grid2d.svg → LightRegularGrid2D.svg} +0 -0
  73. /package/assets/img/geode_objects/{light_regular_grid3d.svg → LightRegularGrid3D.svg} +0 -0
  74. /package/assets/img/geode_objects/{point_set2d.svg → PointSet2D.svg} +0 -0
  75. /package/assets/img/geode_objects/{point_set3d.svg → PointSet3D.svg} +0 -0
  76. /package/assets/img/geode_objects/{polygonal_surface2d.svg → PolygonalSurface2D.svg} +0 -0
  77. /package/assets/img/geode_objects/{polygonal_surface3d.svg → PolygonalSurface3D.svg} +0 -0
  78. /package/assets/img/geode_objects/{polyhedral_solid.svg → PolyhedralSolid3D.svg} +0 -0
  79. /package/assets/img/geode_objects/{raster_image2d.svg → RasterImage2D.svg} +0 -0
  80. /package/assets/img/geode_objects/{raster_image3d.svg → RasterImage3D.svg} +0 -0
  81. /package/assets/img/geode_objects/{regular_grid2d.svg → RegularGrid2D.svg} +0 -0
  82. /package/assets/img/geode_objects/{regular_grid3d.svg → RegularGrid3D.svg} +0 -0
  83. /package/assets/img/geode_objects/{structural_model.svg → StructuralModel.svg} +0 -0
  84. /package/assets/img/geode_objects/{tetrahedral_solid.svg → TetrahedralSolid3D.svg} +0 -0
  85. /package/assets/img/geode_objects/{triangulated_surface2d.svg → TriangulatedSurface2D.svg} +0 -0
  86. /package/assets/img/geode_objects/{triangulated_surface3d.svg → TriangulatedSurface3D.svg} +0 -0
  87. /package/assets/img/geode_objects/{vertex_set.svg → VertexSet.svg} +0 -0
@@ -3,7 +3,6 @@
3
3
  <v-row v-else-if="Object.keys(allowed_objects).length" class="justify-left">
4
4
  <v-col v-for="(value, key) in allowed_objects" :key="key" cols="2" md="2">
5
5
  <v-tooltip
6
- :disabled="value.is_saveable"
7
6
  :text="
8
7
  value['is_loadable']
9
8
  ? geode_objects[key].tooltip
@@ -18,13 +17,13 @@
18
17
  class="card ma-2"
19
18
  hover
20
19
  rounded
20
+ @click="set_geode_object(key)"
21
21
  :disabled="!value['is_loadable']"
22
22
  :elevation="value['is_loadable'] ? 5 : 3"
23
23
  >
24
24
  <v-img
25
25
  :src="geode_objects[key].image"
26
26
  cover
27
- @click="set_geode_object(key)"
28
27
  :class="!value['is_loadable'] ? 'disabled' : ''"
29
28
  />
30
29
  </v-card>
@@ -50,9 +49,10 @@
50
49
  </template>
51
50
 
52
51
  <script setup>
53
- import { toRaw } from "vue"
54
52
  import geode_objects from "@/assets/geode_objects"
55
- import schema from "@/assets/schemas/ObjectSelector.json"
53
+ import schemas from "@geode/opengeodeweb-back/schemas.json"
54
+
55
+ const schema = schemas.opengeodeweb_back.allowed_objects
56
56
 
57
57
  const emit = defineEmits(["update_values", "increment_step"])
58
58
 
@@ -60,7 +60,6 @@
60
60
  filenames: { type: Array, required: true },
61
61
  key: { type: String, required: false, default: null },
62
62
  })
63
-
64
63
  const { filenames, key } = props
65
64
 
66
65
  const loading = ref(false)
@@ -69,7 +68,7 @@
69
68
 
70
69
  async function get_allowed_objects() {
71
70
  toggle_loading()
72
- allowed_objects.value = []
71
+ allowed_objects.value = {}
73
72
  var promise_array = []
74
73
  for (const filename of filenames) {
75
74
  const params = { filename, key }
@@ -81,14 +80,7 @@
81
80
  reject()
82
81
  },
83
82
  response_function: (response) => {
84
- if (toRaw(allowed_objects.value).length == 0) {
85
- allowed_objects.value = response._data.allowed_objects
86
- } else {
87
- allowed_objects.value = toRaw(allowed_objects.value).filter(
88
- (value) => response._data.allowed_objects.includes(value),
89
- )
90
- }
91
- resolve()
83
+ resolve(response._data.allowed_objects)
92
84
  },
93
85
  response_error_function: () => {
94
86
  reject()
@@ -98,7 +90,23 @@
98
90
  })
99
91
  promise_array.push(promise)
100
92
  }
101
- await Promise.all(promise_array)
93
+ const values = await Promise.all(promise_array)
94
+ const all_keys = [...new Set(values.flatMap((value) => Object.keys(value)))]
95
+ const common_keys = all_keys.filter(
96
+ (i) => !values.some((j) => !Object.keys(j).includes(i)),
97
+ )
98
+ var final_object = {}
99
+ for (const key of common_keys) {
100
+ for (const value of values) {
101
+ if (value[key].is_loadable == false) {
102
+ final_object[key] = { is_loadable: false }
103
+ } else {
104
+ final_object[key] = { is_loadable: true }
105
+ }
106
+ }
107
+ }
108
+
109
+ allowed_objects.value = final_object
102
110
  toggle_loading()
103
111
  }
104
112
 
@@ -109,9 +117,7 @@
109
117
  }
110
118
  }
111
119
 
112
- onMounted(() => {
113
- get_allowed_objects()
114
- })
120
+ await get_allowed_objects()
115
121
  </script>
116
122
 
117
123
  <style scoped>
@@ -29,32 +29,33 @@
29
29
 
30
30
  const packages_versions = ref([])
31
31
 
32
- function get_packages_versions() {
33
- api_fetch(
34
- { schema },
35
- {
36
- response_function: (response) => {
37
- packages_versions.value = response._data.versions
32
+ async function get_packages_versions() {
33
+ const array_promise = []
34
+
35
+ const promise = new Promise((resolve, reject) => {
36
+ api_fetch(
37
+ { schema },
38
+ {
39
+ request_error_function: () => {
40
+ reject()
41
+ },
42
+ response_function: (response) => {
43
+ packages_versions.value = response._data.versions
44
+ resolve()
45
+ },
46
+ response_error_function: () => {
47
+ reject()
48
+ },
38
49
  },
39
- },
40
- )
50
+ )
51
+ })
52
+ array_promise.push(promise)
53
+ await Promise.all(array_promise)
41
54
  }
42
55
 
43
- watch(is_running, (value) => {
44
- if (value === true) {
45
- get_packages_versions()
46
- }
47
- })
48
-
49
- onMounted(() => {
50
- if (is_running.value) {
51
- get_packages_versions()
52
- }
56
+ watch(is_running, () => {
57
+ get_packages_versions()
53
58
  })
54
59
 
55
- onActivated(() => {
56
- if (is_running.value === true) {
57
- get_packages_versions()
58
- }
59
- })
60
+ await get_packages_versions()
60
61
  </script>
@@ -1,9 +1,6 @@
1
1
  <template>
2
2
  <v-container>
3
3
  <v-row class="flex-column">
4
- <v-col>
5
- <Header :tool_name="tool_name" :cards_list="cards_list" />
6
- </v-col>
7
4
  <v-col v-if="!is_running">
8
5
  <Launcher />
9
6
  </v-col>
@@ -23,10 +20,6 @@
23
20
 
24
21
  const props = defineProps({
25
22
  versions_schema: { type: Object, required: true },
26
- cards_list: { type: Array, required: true },
27
23
  })
28
- const { cards_list, versions_schema } = props
29
-
30
- const stepper_tree = inject("stepper_tree")
31
- const { tool_name } = stepper_tree
24
+ const { versions_schema } = props
32
25
  </script>
@@ -12,22 +12,24 @@ export function api_fetch(
12
12
 
13
13
  const ajv = new Ajv()
14
14
 
15
- ajv.addKeyword("method")
15
+ ajv.addKeyword("methods")
16
+ ajv.addKeyword("route")
16
17
  ajv.addKeyword("max_retry")
17
18
  const valid = ajv.validate(schema, body)
18
19
  if (!valid) {
19
20
  errors_store.add_error({
20
- code: "400",
21
+ code: 400,
21
22
  route: schema.$id,
22
23
  name: "Bad request",
23
24
  description: ajv.errorsText(),
24
25
  })
25
- return
26
+ throw new Error(schema.$id.concat(": ", ajv.errorsText()))
26
27
  }
27
-
28
28
  geode_store.start_request()
29
-
30
- const request_options = { method: schema["method"] }
29
+ const method = schema.methods.filter((m) => m !== "OPTIONS")[0]
30
+ const request_options = {
31
+ method: method,
32
+ }
31
33
  if (!_.isEmpty(body)) {
32
34
  request_options.body = body
33
35
  }
@@ -35,12 +37,10 @@ export function api_fetch(
35
37
  if (schema.max_retry) {
36
38
  request_options.max_retry = schema.max_retry
37
39
  }
38
-
39
40
  return useFetch(schema.$id, {
40
41
  baseURL: geode_store.base_url,
41
42
  ...request_options,
42
43
  onRequestError({ error }) {
43
- // console.log("onRequestError", error)
44
44
  geode_store.stop_request()
45
45
  errors_store.add_error({
46
46
  code: error.code,
@@ -53,7 +53,6 @@ export function api_fetch(
53
53
  }
54
54
  },
55
55
  onResponse({ response }) {
56
- // console.log(response)
57
56
  if (response.ok) {
58
57
  geode_store.stop_request()
59
58
  if (response_function) {
@@ -62,7 +61,6 @@ export function api_fetch(
62
61
  }
63
62
  },
64
63
  onResponseError({ response }) {
65
- // console.log(response)
66
64
  geode_store.stop_request()
67
65
  errors_store.add_error({
68
66
  code: response.status,
@@ -1,7 +1,6 @@
1
- export default function (function_to_run) {
1
+ export default async function (function_to_run) {
2
2
  const cloud_store = use_cloud_store()
3
3
  const { is_running } = storeToRefs(cloud_store)
4
-
5
4
  if (is_running.value) {
6
5
  function_to_run()
7
6
  } else {
@@ -1,9 +1,12 @@
1
- export function upload_file(
1
+ export async function upload_file(
2
2
  { route, file },
3
3
  { request_error_function, response_function, response_error_function } = {},
4
4
  ) {
5
5
  const errors_store = use_errors_store()
6
6
  const geode_store = use_geode_store()
7
+ if (!(file instanceof File)) {
8
+ throw new Error("file must be a instance of File")
9
+ }
7
10
 
8
11
  const body = new FormData()
9
12
  body.append("file", file)
package/nuxt.config.js CHANGED
@@ -1,7 +1,35 @@
1
1
  export default defineNuxtConfig({
2
+ runtimeConfig: {
3
+ public: {
4
+ VIEWER_PROTOCOL: process.env.NODE_ENV === "production" ? "wss" : "ws",
5
+ GEODE_PROTOCOL: process.env.NODE_ENV === "production" ? "https" : "http",
6
+ VIEWER_PORT: process.env.NODE_ENV === "production" ? "443" : "1234",
7
+ GEODE_PORT: process.env.NODE_ENV === "production" ? "443" : "5000",
8
+ SITE_BRANCH:
9
+ process.env.NODE_ENV === "production" ? process.env.SITE_BRANCH : "",
10
+ PROJECT: process.env.NODE_ENV === "production" ? process.env.PROJECT : "",
11
+ NODE_ENV: process.env.NODE_ENV,
12
+ },
13
+ },
14
+
15
+ modules: [["@pinia/nuxt", { autoImports: ["defineStore"] }], "@vueuse/nuxt"],
2
16
  imports: {
3
17
  dirs: ["stores"],
4
18
  },
5
19
 
6
- modules: [["@pinia/nuxt", { autoImports: ["defineStore"] }], "@vueuse/nuxt"],
20
+ // ** Global CSS
21
+ css: ["vuetify/lib/styles/main.sass"],
22
+
23
+ // ** Build configuration
24
+ build: {
25
+ transpile: ["vuetify"],
26
+ },
27
+
28
+ vue: {
29
+ compilerOptions: {
30
+ isCustomElement: (tag) => ["md-linedivider"].includes(tag),
31
+ },
32
+ },
33
+
34
+ testUtils: {},
7
35
  })
package/package.json CHANGED
@@ -1,40 +1,56 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
3
  "scripts": {
4
- "lint": "eslint --fix --ext .js,.vue --ignore-path .gitignore ."
4
+ "lint": "eslint --fix --ext .js,.vue --ignore-path .gitignore .",
5
+ "test": "vitest",
6
+ "coverage": "vitest run --coverage"
5
7
  },
6
8
  "devDependencies": {
9
+ "@nuxt/test-utils": "^3.11.0",
10
+ "@vitejs/plugin-vue": "^5.0.3",
11
+ "@vitest/coverage-v8": "^1.2.2",
12
+ "@vue/test-utils": "^2.4.4",
7
13
  "eslint": "^8.56.0",
8
14
  "eslint-plugin-import": "^2.29.1",
9
15
  "eslint-plugin-nuxt": "^4.0.0",
10
- "eslint-plugin-prettier": "^5.0.1",
16
+ "eslint-plugin-prettier": "^5.1.3",
11
17
  "eslint-plugin-prettier-vue": "^5.0.0",
12
- "eslint-plugin-vue": "^9.19.2",
18
+ "eslint-plugin-vue": "^9.21.0",
13
19
  "eslint-plugin-vuetify": "^2.1.1",
14
- "nuxt": "^3.8.2",
15
- "prettier": "3.1.1"
20
+ "happy-dom": "^13.3.8",
21
+ "jsdom": "^24.0.0",
22
+ "nuxt": "^3.10.0",
23
+ "playwright-core": "^1.41.1",
24
+ "prettier": "3.2.4",
25
+ "resize-observer-polyfill": "^1.5.1",
26
+ "vite": "^5.0.12",
27
+ "vite-plugin-vuetify": "^2.0.1",
28
+ "vitest": "^1.2.2",
29
+ "vitest-environment-nuxt": "^1.0.0"
16
30
  },
17
31
  "overrides": {
18
32
  "vue": "latest"
19
33
  },
20
34
  "description": "OpenSource Vue/Vuetify framework for web applications",
21
35
  "type": "module",
22
- "version": "6.2.1",
36
+ "version": "6.3.0",
23
37
  "main": "./nuxt.config.js",
24
38
  "dependencies": {
25
- "@kitware/vtk.js": "^29.2.0",
26
- "@mdi/font": "^7.3.67",
39
+ "@geode/opengeodeweb-back": "3.3.2",
40
+ "@kitware/vtk.js": "^29.4.6",
41
+ "@mdi/font": "^7.4.47",
27
42
  "@pinia/nuxt": "^0.5.1",
28
- "@types/node": "^20.10.5",
29
- "@vueuse/components": "^10.7.0",
30
- "@vueuse/core": "^10.7.0",
43
+ "@types/node": "^20.11.13",
44
+ "@vueuse/components": "^10.7.2",
45
+ "@vueuse/core": "^10.7.2",
46
+ "@vueuse/nuxt": "^10.7.2",
31
47
  "ajv": "^8.12.0",
32
- "lodash": "^4.17.21",
33
48
  "pinia": "^2.1.7",
34
- "sass": "^1.69.5",
49
+ "sass": "^1.70.0",
35
50
  "semver": "^7.5.4",
36
51
  "vue-recaptcha": "^2.0.3",
37
- "vuetify": "^3.4.7",
52
+ "vue3-carousel": "^0.3.1",
53
+ "vuetify": "^3.5.1",
38
54
  "wslink": "^1.12.4"
39
55
  },
40
56
  "repository": {
package/stores/cloud.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useStorage } from "@vueuse/core"
1
+ import { useFetch, useStorage } from "@vueuse/core"
2
2
 
3
3
  export const use_cloud_store = defineStore("cloud", {
4
4
  state: () => ({
@@ -7,6 +7,14 @@ export const use_cloud_store = defineStore("cloud", {
7
7
  is_connexion_launched: false,
8
8
  }),
9
9
  getters: {
10
+ api_url: () => {
11
+ const public_runtime_config = useRuntimeConfig().public
12
+ if (public_runtime_config.NODE_ENV == "test") {
13
+ return ""
14
+ }
15
+ var api_url = `${public_runtime_config.GEODE_PROTOCOL}://${public_runtime_config.API_URL}:${public_runtime_config.GEODE_PORT}`
16
+ return api_url
17
+ },
10
18
  is_running: () => {
11
19
  return use_geode_store().is_running && use_websocket_store().is_running
12
20
  },
@@ -31,7 +39,6 @@ export const use_cloud_store = defineStore("cloud", {
31
39
  const { data, error } = await useFetch(`${geode_store.base_url}/ping`, {
32
40
  method: "POST",
33
41
  })
34
- console.log("error", error)
35
42
  if (data.value !== null) {
36
43
  geode_store.is_running = true
37
44
  return geode_store.ping_task()
@@ -43,16 +50,20 @@ export const use_cloud_store = defineStore("cloud", {
43
50
  async create_backend() {
44
51
  const geode_store = use_geode_store()
45
52
  const errors_store = use_errors_store()
46
- const config = useRuntimeConfig()
47
- const public_runtime_config = config.public
48
- const { data, error } = await useFetch(
49
- `${public_runtime_config.GEODE_PROTOCOL}://${public_runtime_config.API_URL}:${public_runtime_config.GEODE_PORT}${public_runtime_config.SITE_BRANCH}/${public_runtime_config.PROJECT}/createbackend`,
50
- { method: "POST" },
53
+ const public_runtime_config = useRuntimeConfig().public
54
+ const url = this.api_url.concat(
55
+ public_runtime_config.PROJECT,
56
+ public_runtime_config.SITE_BRANCH,
57
+ "/createbackend",
51
58
  )
59
+ const { data, error } = await useFetch(url, {
60
+ method: "POST",
61
+ })
52
62
  if (data.value !== null) {
63
+ console.log("DATA", data)
53
64
  this.ID = data.value.ID
54
65
  localStorage.setItem("ID", data.value.ID)
55
- geode_store.is_running = true
66
+ geode_store.$patch({ is_running: true })
56
67
  return geode_store.ping_task()
57
68
  } else {
58
69
  console.log("error : ", error)
package/stores/geode.js CHANGED
@@ -6,9 +6,10 @@ export const use_geode_store = defineStore("geode", {
6
6
  getters: {
7
7
  base_url: () => {
8
8
  const cloud_store = use_cloud_store()
9
+ const api_url = cloud_store.api_url
10
+ var geode_url = `${api_url}`
9
11
  const public_runtime_config = useRuntimeConfig().public
10
- var geode_url = `${public_runtime_config.GEODE_PROTOCOL}://${public_runtime_config.API_URL}:${public_runtime_config.GEODE_PORT}`
11
- if (process.env.NODE_ENV == "production") {
12
+ if (public_runtime_config.NODE_ENV == "production") {
12
13
  geode_url += `/${cloud_store.ID}/geode`
13
14
  }
14
15
  return geode_url
@@ -23,14 +24,15 @@ export const use_geode_store = defineStore("geode", {
23
24
  },
24
25
  async do_ping() {
25
26
  const errors_store = use_errors_store()
26
- const { data, error } = await useFetch(`${this.base_url}/ping`, {
27
+ const { data } = await useFetch(`${this.base_url}/ping`, {
27
28
  method: "POST",
28
29
  })
29
30
  if (data.value !== null) {
30
31
  this.is_running = true
32
+ return
31
33
  } else {
32
- errors_store.server_error = true
33
- console.log("error : ", error)
34
+ errors_store.$patch({ server_error: true })
35
+ return
34
36
  }
35
37
  },
36
38
  start_request() {
@@ -0,0 +1,54 @@
1
+ // @vitest-environment nuxt
2
+
3
+ import { describe, expect, test } from "vitest"
4
+ import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
5
+
6
+ import { createVuetify } from "vuetify"
7
+ import * as components from "vuetify/components"
8
+ import * as directives from "vuetify/directives"
9
+
10
+ import CrsSelector from "@/components/CrsSelector.vue"
11
+ import schemas from "@geode/opengeodeweb-back/schemas.json"
12
+
13
+ const crs_selector_schema =
14
+ schemas.opengeodeweb_back.geographic_coordinate_systems
15
+
16
+ const vuetify = createVuetify({
17
+ components,
18
+ directives,
19
+ })
20
+
21
+ describe("CrsSelector.vue", async () => {
22
+ test(`BRep`, async () => {
23
+ const crs_list = [
24
+ {
25
+ authority: "EPSG",
26
+ code: "2000",
27
+ name: "Anguilla 1957 / British West Indies Grid",
28
+ },
29
+ ]
30
+ registerEndpoint(crs_selector_schema.$id, {
31
+ method: crs_selector_schema.methods.filter((m) => m !== "OPTIONS")[0],
32
+ handler: () => ({
33
+ crs_list,
34
+ }),
35
+ })
36
+ const key_to_update = "key"
37
+ const wrapper = await mountSuspended(CrsSelector, {
38
+ global: {
39
+ plugins: [vuetify],
40
+ },
41
+ props: { input_geode_object: "BRep", key_to_update },
42
+ })
43
+ const td = await wrapper.find("td")
44
+ await wrapper.vm.$nextTick()
45
+ const input = await td.find("input")
46
+ console.log("toto", input)
47
+ await input.trigger("click")
48
+ expect(wrapper.emitted()).toHaveProperty("update_values")
49
+ expect(wrapper.emitted().update_values).toHaveLength(1)
50
+ expect(wrapper.emitted().update_values[0][0]).toEqual({
51
+ [key_to_update]: crs_list[0],
52
+ })
53
+ })
54
+ })
@@ -0,0 +1,46 @@
1
+ // @vitest-environment nuxt
2
+
3
+ import { describe, expect, test, vi } from "vitest"
4
+ import { mount } from "@vue/test-utils"
5
+ import { createVuetify } from "vuetify"
6
+ import * as components from "vuetify/components"
7
+ import * as directives from "vuetify/directives"
8
+
9
+ import ErrorsBanner from "@/components/Errors/Banner.vue"
10
+
11
+ const vuetify = createVuetify({
12
+ components,
13
+ directives,
14
+ })
15
+
16
+ describe("ErrorsBanner.vue", async () => {
17
+ test(`Test reload`, async () => {
18
+ const wrapper = mount(ErrorsBanner, {
19
+ global: {
20
+ plugins: [vuetify],
21
+ },
22
+ })
23
+ const reload_spy = vi.spyOn(wrapper.vm, "reload")
24
+ const errors_store = use_errors_store()
25
+ await errors_store.$patch({ server_error: true })
26
+ expect(errors_store.server_error).toBe(true)
27
+ const v_btn = wrapper.findAll(".v-btn")
28
+ await v_btn[0].trigger("click")
29
+
30
+ expect(reload_spy).toHaveBeenCalledTimes(1)
31
+ }),
32
+ test(`Test delete error`, async () => {
33
+ const wrapper = mount(ErrorsBanner, {
34
+ global: {
35
+ plugins: [vuetify],
36
+ },
37
+ })
38
+
39
+ const errors_store = use_errors_store()
40
+ await errors_store.$patch({ server_error: true })
41
+ expect(errors_store.server_error).toBe(true)
42
+ const v_btn = wrapper.findAll(".v-btn")
43
+ await v_btn[1].trigger("click")
44
+ expect(errors_store.server_error).toBe(false)
45
+ })
46
+ })
@@ -0,0 +1,37 @@
1
+ // @vitest-environment nuxt
2
+
3
+ import { describe, expect, test } from "vitest"
4
+ import { mount } from "@vue/test-utils"
5
+ import { createVuetify } from "vuetify"
6
+ import * as components from "vuetify/components"
7
+ import * as directives from "vuetify/directives"
8
+
9
+ import ErrorsSnackers from "@/components/Errors/Snackers.vue"
10
+
11
+ const vuetify = createVuetify({
12
+ components,
13
+ directives,
14
+ })
15
+
16
+ describe("ErrorsSnackers.vue", async () => {
17
+ test(`Test delete error`, async () => {
18
+ const wrapper = await mount(ErrorsSnackers, {
19
+ global: {
20
+ plugins: [vuetify],
21
+ },
22
+ })
23
+
24
+ const errors_store = use_errors_store()
25
+ const error = {
26
+ code: 404,
27
+ route: "/test",
28
+ name: "Test message",
29
+ description: "Test desription",
30
+ }
31
+ await errors_store.add_error(error)
32
+ expect(errors_store.errors.length).toBe(1)
33
+ const v_btn = wrapper.findComponent(components.VBtn)
34
+ await v_btn.trigger("click")
35
+ expect(errors_store.errors.length).toBe(0)
36
+ })
37
+ })
@@ -0,0 +1,52 @@
1
+ // @vitest-environment nuxt
2
+
3
+ import { describe, expect, test } from "vitest"
4
+ import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
5
+
6
+ import { createVuetify } from "vuetify"
7
+ import * as components from "vuetify/components"
8
+ import * as directives from "vuetify/directives"
9
+
10
+ import ExtensionSelector from "@/components/ExtensionSelector.vue"
11
+
12
+ import schemas from "@geode/opengeodeweb-back/schemas.json"
13
+
14
+ const geode_objects_and_output_extensions =
15
+ schemas.opengeodeweb_back.geode_objects_and_output_extensions
16
+
17
+ const vuetify = createVuetify({
18
+ components,
19
+ directives,
20
+ })
21
+
22
+ describe("ExtensionSelector.vue", async () => {
23
+ test(`Select geode_object & extension`, async () => {
24
+ const output_geode_object = "BRep"
25
+ const output_extension = "msh"
26
+
27
+ registerEndpoint(geode_objects_and_output_extensions.$id, {
28
+ method: geode_objects_and_output_extensions.methods[0],
29
+ handler: () => ({
30
+ geode_objects_and_output_extensions: {
31
+ BRep: { msh: { is_saveable: true } },
32
+ },
33
+ }),
34
+ })
35
+ const wrapper = await mountSuspended(ExtensionSelector, {
36
+ global: {
37
+ plugins: [vuetify],
38
+ },
39
+ props: { input_geode_object: "BRep", filenames: ["test.toto"] },
40
+ })
41
+ await nextTick()
42
+ expect(wrapper.exists()).toBe(true)
43
+ const v_card = await wrapper.findAllComponents(components.VCard)
44
+ await v_card[1].trigger("click")
45
+ expect(wrapper.emitted()).toHaveProperty("update_values")
46
+ expect(wrapper.emitted().update_values).toHaveLength(1)
47
+ expect(wrapper.emitted().update_values[0][0]).toEqual({
48
+ output_geode_object,
49
+ output_extension,
50
+ })
51
+ })
52
+ })