@geode/opengeodeweb-front 7.0.3 → 7.1.0-rc.2

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.
@@ -34,4 +34,4 @@ jobs:
34
34
  type: now
35
35
  from_branch: master
36
36
  target_branch: next
37
- github_token: ${{ secrets.TOKEN }}
37
+ github_token: ${{ github.token }}
@@ -39,7 +39,7 @@
39
39
  :color="extension.is_saveable ? 'primary' : 'grey'"
40
40
  hover
41
41
  @click="
42
- set_variables(output_geode_object, output_extension)
42
+ update_values(output_geode_object, output_extension)
43
43
  "
44
44
  :disabled="!extension.is_saveable"
45
45
  >
@@ -123,13 +123,12 @@
123
123
  toggle_loading()
124
124
  }
125
125
 
126
- function set_variables(output_geode_object, output_extension) {
126
+ function update_values(output_geode_object, output_extension) {
127
127
  if (output_geode_object != "" && output_extension != "") {
128
- const keys_values_object = {
128
+ emit("update_values", {
129
129
  output_geode_object,
130
130
  output_extension,
131
- }
132
- emit("update_values", keys_values_object)
131
+ })
133
132
  emit("increment_step")
134
133
  }
135
134
  }
@@ -0,0 +1,50 @@
1
+ <template>
2
+ <div class="pa-0">
3
+ <v-btn
4
+ :loading="loading"
5
+ color="primary"
6
+ @click="get_inspection_results(props.input_geode_object, props.filename)"
7
+ >
8
+ Inspect
9
+ <template #loader>
10
+ <v-progress-circular indeterminate size="20" color="white" width="3" />
11
+ </template>
12
+ </v-btn>
13
+ <v-btn variant="text" @click="emit('decrement_step')">Cancel</v-btn>
14
+ </div>
15
+ </template>
16
+
17
+ <script setup>
18
+ import schemas from "@geode/opengeodeweb-back/schemas.json"
19
+ const schema = schemas.opengeodeweb_back.inspect_file
20
+
21
+ const emit = defineEmits([
22
+ "update_values",
23
+ "increment_step",
24
+ "decrement_step",
25
+ ])
26
+ const props = defineProps({
27
+ input_geode_object: { type: String, required: true },
28
+ filename: { type: String, required: true },
29
+ })
30
+ const loading = ref(false)
31
+ const toggle_loading = useToggle(loading)
32
+
33
+ async function get_inspection_results(input_geode_object, filename) {
34
+ toggle_loading()
35
+ const params = { input_geode_object, filename }
36
+
37
+ await api_fetch(
38
+ { schema, params },
39
+ {
40
+ response_function: (response) => {
41
+ emit("update_values", {
42
+ inspection_result: [response._data.inspection_result],
43
+ })
44
+ emit("increment_step")
45
+ },
46
+ },
47
+ )
48
+ toggle_loading()
49
+ }
50
+ </script>
@@ -0,0 +1,55 @@
1
+ <template>
2
+ <v-container class="pa-2">
3
+ <v-expansion-panels v-model="opened_panels" multiple elevation="5">
4
+ <v-expansion-panel
5
+ v-for="(result, index) in props.inspection_result"
6
+ :key="index"
7
+ class="card"
8
+ >
9
+ <v-expansion-panel-title>
10
+ <v-row align="center">
11
+ <v-col cols="auto">
12
+ <v-icon v-if="result.nb_issues == 0" color="primary" size="25">
13
+ mdi-check-circle-outline
14
+ </v-icon>
15
+ <v-icon v-else color="error" size="25"> mdi-close-circle </v-icon>
16
+ </v-col>
17
+ <v-col>
18
+ {{ result.title }}
19
+ </v-col>
20
+ </v-row>
21
+ </v-expansion-panel-title>
22
+ <v-expansion-panel-text>
23
+ <InspectorResultPanel
24
+ v-if="result.children"
25
+ :inspection_result="result.children"
26
+ />
27
+ <v-container v-if="result.issues">
28
+ <v-col>
29
+ <v-row
30
+ v-for="(issue, index) in result.issues"
31
+ :key="index"
32
+ class="pa-0"
33
+ >
34
+ {{ issue }}
35
+ </v-row>
36
+ </v-col>
37
+ </v-container>
38
+ </v-expansion-panel-text>
39
+ </v-expansion-panel>
40
+ </v-expansion-panels>
41
+ </v-container>
42
+ </template>
43
+
44
+ <script setup>
45
+ const props = defineProps({
46
+ inspection_result: { type: Array, required: true },
47
+ })
48
+ const opened_panels = ref([])
49
+
50
+ onMounted(async () => {
51
+ opened_panels.value = props.inspection_result
52
+ .map((result, i) => (result.nb_issues > 0 ? i : -1))
53
+ .filter((index) => index !== -1)
54
+ })
55
+ </script>
package/package.json CHANGED
@@ -35,10 +35,10 @@
35
35
  },
36
36
  "description": "OpenSource Vue/Vuetify framework for web applications",
37
37
  "type": "module",
38
- "version": "7.0.3",
38
+ "version": "7.1.0-rc.2",
39
39
  "main": "./nuxt.config.js",
40
40
  "dependencies": {
41
- "@geode/opengeodeweb-back": "4.0.0",
41
+ "@geode/opengeodeweb-back": "4.1.0",
42
42
  "@geode/opengeodeweb-viewer": "0.1.1",
43
43
  "@kitware/vtk.js": "^30.3.1",
44
44
  "@mdi/font": "^7.4.47",
@@ -52,7 +52,7 @@
52
52
  "semver": "^7.6.0",
53
53
  "vue-recaptcha": "^2.0.3",
54
54
  "vue3-carousel": "^0.3.3",
55
- "vuetify": "^3.5.14"
55
+ "vuetify": "^3.6.3"
56
56
  },
57
57
  "repository": {
58
58
  "type": "git",
@@ -15,11 +15,20 @@ const vuetify = createVuetify({
15
15
 
16
16
  describe("ErrorsSnackers.vue", async () => {
17
17
  test(`Test delete error`, async () => {
18
- const wrapper = await mount(ErrorsSnackers, {
19
- global: {
20
- plugins: [vuetify],
18
+ const wrapper = mount(
19
+ {
20
+ template: "<v-layout><ErrorsSnackers/></v-layout>",
21
21
  },
22
- })
22
+ {
23
+ props: {},
24
+ global: {
25
+ components: {
26
+ ErrorsSnackers,
27
+ },
28
+ plugins: [vuetify],
29
+ },
30
+ },
31
+ )
23
32
 
24
33
  const errors_store = use_errors_store()
25
34
  const error = {
@@ -30,7 +39,7 @@ describe("ErrorsSnackers.vue", async () => {
30
39
  }
31
40
  await errors_store.add_error(error)
32
41
  expect(errors_store.errors.length).toBe(1)
33
- const v_btn = wrapper.findComponent(components.VBtn)
42
+ const v_btn = await wrapper.findComponent(components.VBtn)
34
43
  await v_btn.trigger("click")
35
44
  expect(errors_store.errors.length).toBe(0)
36
45
  })
@@ -11,8 +11,7 @@ import ExtensionSelector from "@/components/ExtensionSelector.vue"
11
11
 
12
12
  import schemas from "@geode/opengeodeweb-back/schemas.json"
13
13
 
14
- const geode_objects_and_output_extensions =
15
- schemas.opengeodeweb_back.geode_objects_and_output_extensions
14
+ const schema = schemas.opengeodeweb_back.geode_objects_and_output_extensions
16
15
 
17
16
  const vuetify = createVuetify({
18
17
  components,
@@ -24,8 +23,8 @@ describe("ExtensionSelector.vue", async () => {
24
23
  const output_geode_object = "BRep"
25
24
  const output_extension = "msh"
26
25
 
27
- registerEndpoint(geode_objects_and_output_extensions.$id, {
28
- method: geode_objects_and_output_extensions.methods[0],
26
+ registerEndpoint(schema.$id, {
27
+ method: schema.methods[0],
29
28
  handler: () => ({
30
29
  geode_objects_and_output_extensions: {
31
30
  BRep: { msh: { is_saveable: true } },
@@ -44,7 +43,7 @@ describe("ExtensionSelector.vue", async () => {
44
43
  // await v_card[1].trigger("click")
45
44
  // expect(wrapper.emitted()).toHaveProperty("update_values")
46
45
  // expect(wrapper.emitted().update_values).toHaveLength(1)
47
- // expect(wrapper.emitted().update_values[0][0]).toEqual({
46
+ // expect(wrapper.emitted().update_values[0][0]).toStrictEqual({
48
47
  // output_geode_object,
49
48
  // output_extension,
50
49
  // })
@@ -0,0 +1,67 @@
1
+ // @vitest-environment nuxt
2
+
3
+ import { describe, expect, test } from "vitest"
4
+ import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
5
+ import { flushPromises } from "@vue/test-utils"
6
+
7
+ import { createVuetify } from "vuetify"
8
+ import * as components from "vuetify/components"
9
+ import * as directives from "vuetify/directives"
10
+
11
+ import InspectorInspectionButton from "@/components/Inspector/InspectionButton.vue"
12
+ import schemas from "@geode/opengeodeweb-back/schemas.json"
13
+ const schema = schemas.opengeodeweb_back.inspect_file
14
+
15
+ const vuetify = createVuetify({
16
+ components,
17
+ directives,
18
+ })
19
+
20
+ describe("Inspector/InspectionButton.vue", async () => {
21
+ test(`Test with issues`, async () => {
22
+ var inspection_result = {
23
+ title: "Brep inspection",
24
+ nb_issues: 3,
25
+ children: [
26
+ {
27
+ title: "Brep inspection",
28
+ nb_issues: 2,
29
+ issues: ["issue 1", "issue 2"],
30
+ },
31
+ {
32
+ title: "Brep inspection",
33
+ nb_issues: 1,
34
+ issues: ["issue 1"],
35
+ },
36
+ ],
37
+ }
38
+
39
+ registerEndpoint(schema.$id, {
40
+ method: schema.methods[0],
41
+ handler: () => ({
42
+ inspection_result,
43
+ }),
44
+ })
45
+ const input_geode_object = "BRep"
46
+ const filename = "test.txt"
47
+
48
+ const wrapper = await mountSuspended(InspectorInspectionButton, {
49
+ global: {
50
+ plugins: [vuetify],
51
+ },
52
+ props: { input_geode_object, filename },
53
+ })
54
+
55
+ expect(wrapper.exists()).toBe(true)
56
+ const v_btn = await wrapper.findComponent(components.VBtn)
57
+ await v_btn.trigger("click")
58
+ await flushPromises()
59
+
60
+ expect(wrapper.emitted()).toHaveProperty("update_values")
61
+ expect(wrapper.emitted().update_values).toHaveLength(1)
62
+ expect(wrapper.emitted().update_values[0][0]).toStrictEqual({
63
+ inspection_result: [inspection_result],
64
+ })
65
+ expect(wrapper.emitted()).toHaveProperty("increment_step")
66
+ })
67
+ })
@@ -0,0 +1,68 @@
1
+ // @vitest-environment nuxt
2
+
3
+ import { describe, expect, test } from "vitest"
4
+ import { 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 InspectorResultPanel from "@/components/Inspector/ResultPanel.vue"
11
+
12
+ const vuetify = createVuetify({
13
+ components,
14
+ directives,
15
+ })
16
+
17
+ describe("Inspector/ResultPanel.vue", async () => {
18
+ test(`Test with issues`, async () => {
19
+ const inspection_result = [
20
+ {
21
+ title: "Brep inspection",
22
+ nb_issues: 26,
23
+ children: [],
24
+ },
25
+ ]
26
+
27
+ const wrapper = await mountSuspended(InspectorResultPanel, {
28
+ global: {
29
+ plugins: [vuetify],
30
+ },
31
+ props: { inspection_result },
32
+ })
33
+
34
+ expect(wrapper.exists()).toBe(true)
35
+ expect(wrapper.componentVM.opened_panels._value).toStrictEqual([0])
36
+ expect(wrapper.componentVM.props.inspection_result).toStrictEqual(
37
+ inspection_result,
38
+ )
39
+
40
+ const child_result_panel_wrapper =
41
+ await wrapper.findComponent(InspectorResultPanel)
42
+ expect(child_result_panel_wrapper.exists()).toBe(true)
43
+ expect(
44
+ child_result_panel_wrapper.componentVM.props.inspection_result,
45
+ ).toStrictEqual(inspection_result[0].children)
46
+ })
47
+
48
+ test(`Test without issues`, async () => {
49
+ const inspection_result = [
50
+ {
51
+ title: "Brep inspection",
52
+ nb_issues: 0,
53
+ },
54
+ ]
55
+ const wrapper = await mountSuspended(InspectorResultPanel, {
56
+ global: {
57
+ plugins: [vuetify],
58
+ },
59
+ props: { inspection_result },
60
+ })
61
+
62
+ expect(wrapper.exists()).toBe(true)
63
+ expect(wrapper.componentVM.opened_panels._value).toStrictEqual([])
64
+ expect(wrapper.componentVM.props.inspection_result).toStrictEqual(
65
+ inspection_result,
66
+ )
67
+ })
68
+ })