Skip to content

Commit 8608a5b

Browse files
Merge pull request #100 from Geode-solutions/next
Next
2 parents db279ae + 9501c80 commit 8608a5b

File tree

10 files changed

+265
-18
lines changed

10 files changed

+265
-18
lines changed

.github/workflows/CICD.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: cycjimmy/semantic-release-action@v3
2626
id: semantic
2727
env:
28-
GITHUB_TOKEN: ${{ github.token }}
28+
GITHUB_TOKEN: ${{ secrets.TOKEN }}
2929
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3030
- name: Merge master -> next
3131
if: github.ref == 'refs/heads/master'

components/ExtensionSelector.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
:color="extension.is_saveable ? 'primary' : 'grey'"
4040
hover
4141
@click="
42-
set_variables(output_geode_object, output_extension)
42+
update_values(output_geode_object, output_extension)
4343
"
4444
:disabled="!extension.is_saveable"
4545
>
@@ -123,13 +123,12 @@
123123
toggle_loading()
124124
}
125125
126-
function set_variables(output_geode_object, output_extension) {
126+
function update_values(output_geode_object, output_extension) {
127127
if (output_geode_object != "" && output_extension != "") {
128-
const keys_values_object = {
128+
emit("update_values", {
129129
output_geode_object,
130130
output_extension,
131-
}
132-
emit("update_values", keys_values_object)
131+
})
133132
emit("increment_step")
134133
}
135134
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"version": "0.0.0-semantically-released",
3939
"main": "./nuxt.config.js",
4040
"dependencies": {
41-
"@geode/opengeodeweb-back": "4.0.0",
41+
"@geode/opengeodeweb-back": "4.1.0",
4242
"@geode/opengeodeweb-viewer": "0.1.1",
4343
"@kitware/vtk.js": "^30.3.1",
4444
"@mdi/font": "^7.4.47",
@@ -52,7 +52,7 @@
5252
"semver": "^7.6.0",
5353
"vue-recaptcha": "^2.0.3",
5454
"vue3-carousel": "^0.3.3",
55-
"vuetify": "^3.5.14"
55+
"vuetify": "^3.6.3"
5656
},
5757
"repository": {
5858
"type": "git",

test/components/ErrorsSnackers.nuxt.test.js renamed to test/components/Errors/ErrorsSnackers.nuxt.test.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,20 @@ const vuetify = createVuetify({
1515

1616
describe("ErrorsSnackers.vue", async () => {
1717
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>",
2121
},
22-
})
22+
{
23+
props: {},
24+
global: {
25+
components: {
26+
ErrorsSnackers,
27+
},
28+
plugins: [vuetify],
29+
},
30+
},
31+
)
2332

2433
const errors_store = use_errors_store()
2534
const error = {
@@ -30,7 +39,7 @@ describe("ErrorsSnackers.vue", async () => {
3039
}
3140
await errors_store.add_error(error)
3241
expect(errors_store.errors.length).toBe(1)
33-
const v_btn = wrapper.findComponent(components.VBtn)
42+
const v_btn = await wrapper.findComponent(components.VBtn)
3443
await v_btn.trigger("click")
3544
expect(errors_store.errors.length).toBe(0)
3645
})

test/components/ExtensionSelector.nuxt.test.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import ExtensionSelector from "@/components/ExtensionSelector.vue"
1111

1212
import schemas from "@geode/opengeodeweb-back/schemas.json"
1313

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
1615

1716
const vuetify = createVuetify({
1817
components,
@@ -24,8 +23,8 @@ describe("ExtensionSelector.vue", async () => {
2423
const output_geode_object = "BRep"
2524
const output_extension = "msh"
2625

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],
2928
handler: () => ({
3029
geode_objects_and_output_extensions: {
3130
BRep: { msh: { is_saveable: true } },
@@ -44,7 +43,7 @@ describe("ExtensionSelector.vue", async () => {
4443
// await v_card[1].trigger("click")
4544
// expect(wrapper.emitted()).toHaveProperty("update_values")
4645
// 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({
4847
// output_geode_object,
4948
// output_extension,
5049
// })
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
})
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
})

0 commit comments

Comments
 (0)