@geode/opengeodeweb-front 9.10.0 → 9.11.0-rc.10
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/.github/workflows/deploy.yml +11 -0
- package/.github/workflows/merge_request.yml +9 -0
- package/.github/workflows/pr_update.yml +11 -0
- package/.github/workflows/prepare_deploy.yml +9 -0
- package/.github/workflows/test.yml +37 -0
- package/.github/workflows/test_pr.yml +12 -0
- package/.oxlintrc.json +11 -0
- package/.releaserc +1 -2
- package/commitlint.config.js +16 -0
- package/components/FeedBack/ErrorBanner.vue +1 -1
- package/components/FeedBack/Snackers.vue +1 -1
- package/components/HybridRenderingView.vue +38 -12
- package/components/Launcher.vue +1 -1
- package/components/ObjectSelector.vue +61 -24
- package/components/PackagesVersions.vue +1 -1
- package/components/Recaptcha.vue +1 -1
- package/components/RemoteRenderingView.vue +1 -1
- package/components/Viewer/BreadCrumb.vue +1 -1
- package/components/Viewer/Options/PolygonAttributeSelector.vue +1 -8
- package/components/Viewer/Options/PolyhedronAttributeSelector.vue +1 -7
- package/components/Viewer/Options/TextureItem.vue +1 -8
- package/components/Viewer/Options/VertexAttributeSelector.vue +1 -5
- package/components/Viewer/Tree/ObjectTree.vue +1 -1
- package/components/Viewer/TreeObject.vue +1 -1
- package/components/Wrapper.vue +1 -1
- package/composables/api_fetch.js +2 -2
- package/composables/run_function_when_microservices_connected.js +1 -1
- package/composables/upload_file.js +2 -2
- package/composables/viewer_call.js +38 -38
- package/geode-opengeodeweb-back-5.10.0-rc.8.tgz +0 -0
- package/geode-opengeodeweb-viewer-1.11.0-rc.4.tgz +0 -0
- package/internal_stores/mesh/edges.js +49 -52
- package/internal_stores/mesh/index.js +21 -13
- package/internal_stores/mesh/points.js +9 -7
- package/internal_stores/mesh/polygons.js +9 -7
- package/internal_stores/mesh/polyhedra.js +8 -6
- package/internal_stores/model/blocks.js +1 -1
- package/internal_stores/model/corners.js +1 -1
- package/internal_stores/model/edges.js +1 -8
- package/internal_stores/model/index.js +3 -1
- package/internal_stores/model/lines.js +2 -2
- package/internal_stores/model/points.js +2 -2
- package/internal_stores/model/surfaces.js +1 -1
- package/package.json +17 -9
- package/stores/data_base.js +10 -1
- package/stores/data_style.js +7 -6
- package/stores/feedback.js +1 -1
- package/stores/geode.js +5 -5
- package/stores/hybrid_viewer.js +7 -1
- package/stores/infra.js +10 -10
- package/stores/menu.js +3 -3
- package/stores/treeview.js +1 -1
- package/stores/viewer.js +5 -6
- package/tests/integration/data/fake_id/edged_curve.vtp +20 -0
- package/tests/integration/microservices/back/requirements.in +1 -0
- package/tests/integration/microservices/back/requirements.txt +75 -0
- package/tests/integration/microservices/viewer/requirements.in +1 -0
- package/tests/integration/microservices/viewer/requirements.txt +87 -0
- package/tests/integration/stores/DataStyle/mesh/Edges.nuxt.test.js +138 -0
- package/{test → tests/unit}/components/CrsSelector.nuxt.test.js +6 -3
- package/{test → tests/unit}/components/ExtensionSelector.nuxt.test.js +6 -3
- package/{test → tests/unit}/components/FeedBack/ErrorsBanner.nuxt.test.js +10 -3
- package/{test → tests/unit}/components/FeedBack/Snackers.nuxt.test.js +24 -21
- package/{test → tests/unit}/components/FileSelector.nuxt.test.js +5 -2
- package/{test → tests/unit}/components/FileUploader.nuxt.test.js +6 -3
- package/{test → tests/unit}/components/Inspector/InspectionButton.nuxt.test.js +6 -3
- package/{test → tests/unit}/components/Launcher.nuxt.test.js +9 -2
- package/{test → tests/unit}/components/MissingFilesSelector.nuxt.test.js +6 -3
- package/{test → tests/unit}/components/ObjectSelector.nuxt.test.js +35 -3
- package/{test → tests/unit}/components/PackagesVersions.nuxt.test.js +5 -3
- package/{test → tests/unit}/components/Wrapper.nuxt.test.js +1 -1
- package/{test → tests/unit}/composables/api_fetch.nuxt.test.js +3 -2
- package/{test/composables/run_function_when_microservices_connected.test.js → tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js} +18 -5
- package/{test → tests/unit}/composables/upload_file.nuxt.test.js +7 -8
- package/{test → tests/unit}/stores/Feedback.nuxt.test.js +12 -8
- package/{test → tests/unit}/stores/Geode.nuxt.test.js +33 -10
- package/{test → tests/unit}/stores/Infra.nuxt.test.js +58 -25
- package/{test → tests/unit}/stores/Viewer.nuxt.test.js +101 -20
- package/{test → tests/unit}/utils/validate_schema.nuxt.test.js +3 -0
- package/tests/vitest.config.js +33 -0
- package/utils/default_styles.js +246 -0
- package/utils/local.js +180 -0
- package/.github/workflows/Branch-protection.yml +0 -11
- package/.github/workflows/CICD.yml +0 -37
- package/.github/workflows/prepare_pr.yml +0 -11
- package/vitest.config.js +0 -13
- /package/components/{ContextMenu.vue → Viewer/ContextMenu.vue} +0 -0
- /package/components/{ContextMenuItem.vue → Viewer/ContextMenuItem.vue} +0 -0
- /package/{test → tests/unit}/components/Inspector/ResultPanel.nuxt.test.js +0 -0
- /package/{test → tests/unit}/components/Step.nuxt.test.js +0 -0
- /package/{test → tests/unit}/components/Stepper.nuxt.test.js +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches-ignore:
|
|
6
|
+
- master
|
|
7
|
+
- next
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test-integration:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- name: Node setup
|
|
15
|
+
uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: 22
|
|
18
|
+
- name: Python setup
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: 3.12
|
|
22
|
+
- name: Install python dependencies
|
|
23
|
+
run: |
|
|
24
|
+
cd ./tests/integration/microservices/viewer
|
|
25
|
+
python3 -m venv venv
|
|
26
|
+
source venv/bin/activate
|
|
27
|
+
pip install --extra-index-url https://wheels.vtk.org -r requirements.txt
|
|
28
|
+
- name: Install and run tests
|
|
29
|
+
run: |
|
|
30
|
+
npm i
|
|
31
|
+
|
|
32
|
+
npm run test:integration
|
|
33
|
+
test:
|
|
34
|
+
uses: Geode-solutions/actions/.github/workflows/js-test.yml@master
|
|
35
|
+
with:
|
|
36
|
+
repos: ${{ vars.REPOS }}
|
|
37
|
+
secrets: inherit
|
package/.oxlintrc.json
ADDED
package/.releaserc
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
extends: ["@commitlint/config-angular"],
|
|
3
|
+
rules: {
|
|
4
|
+
"scope-empty": [2, "never"],
|
|
5
|
+
"subject-empty": [2, "never"],
|
|
6
|
+
"subject-max-length": [0],
|
|
7
|
+
"body-leading-blank": [0],
|
|
8
|
+
"footer-leading-blank": [0],
|
|
9
|
+
"header-max-length": [0],
|
|
10
|
+
"scope-case": [0],
|
|
11
|
+
"subject-case": [0],
|
|
12
|
+
"subject-full-stop": [0],
|
|
13
|
+
"type-case": [0],
|
|
14
|
+
"type-empty": [0],
|
|
15
|
+
},
|
|
16
|
+
}
|
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ClientOnly>
|
|
3
|
-
<div style="position: relative
|
|
3
|
+
<div class="fill-height" style="position: relative">
|
|
4
4
|
<VeaseViewToolbar />
|
|
5
5
|
<slot name="ui"></slot>
|
|
6
6
|
<v-col
|
|
7
7
|
ref="viewer"
|
|
8
|
-
style="
|
|
9
|
-
|
|
10
|
-
position: relative;
|
|
11
|
-
z-index: 0;
|
|
12
|
-
height: 100%;
|
|
13
|
-
width: 100%;
|
|
14
|
-
"
|
|
15
|
-
class="pa-0"
|
|
8
|
+
style="overflow: hidden; position: relative; z-index: 0"
|
|
9
|
+
:style="{ height: viewerHeight }"
|
|
16
10
|
@click="get_x_y"
|
|
17
|
-
@keydown.esc="
|
|
11
|
+
@keydown.esc="viewerStore.toggle_picking_mode(false)"
|
|
18
12
|
/>
|
|
19
13
|
</div>
|
|
20
14
|
</ClientOnly>
|
|
21
15
|
</template>
|
|
22
16
|
|
|
23
17
|
<script setup>
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
height: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "100%",
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
|
|
24
25
|
const container = useTemplateRef("viewer")
|
|
25
26
|
const hybridViewerStore = useHybridViewerStore()
|
|
26
|
-
|
|
27
|
+
const viewerStore = useViewerStore()
|
|
27
28
|
const { windowWidth, windowHeight } = useWindowSize()
|
|
28
29
|
const { width, height } = useElementSize(container)
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
const viewerHeight = computed(() => props.height)
|
|
32
|
+
|
|
33
|
+
const debouncedResize = debounce(() => {
|
|
31
34
|
hybridViewerStore.resize(width.value, height.value)
|
|
35
|
+
}, 100)
|
|
36
|
+
|
|
37
|
+
watch([windowWidth, windowHeight, width, height], () => {
|
|
38
|
+
debouncedResize()
|
|
32
39
|
})
|
|
33
40
|
|
|
34
41
|
onMounted(async () => {
|
|
@@ -36,6 +43,25 @@
|
|
|
36
43
|
await hybridViewerStore.initHybridViewer()
|
|
37
44
|
await nextTick()
|
|
38
45
|
hybridViewerStore.setContainer(container)
|
|
46
|
+
debouncedResize()
|
|
39
47
|
}
|
|
40
48
|
})
|
|
49
|
+
|
|
50
|
+
function debounce(func, wait) {
|
|
51
|
+
let timeout
|
|
52
|
+
return function executedFunction(...args) {
|
|
53
|
+
const later = () => {
|
|
54
|
+
clearTimeout(timeout)
|
|
55
|
+
func(...args)
|
|
56
|
+
}
|
|
57
|
+
clearTimeout(timeout)
|
|
58
|
+
timeout = setTimeout(later, wait)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function get_x_y(event) {
|
|
63
|
+
emit("click", event)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
defineEmits(["click"])
|
|
41
67
|
</script>
|
package/components/Launcher.vue
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<v-img
|
|
25
25
|
:src="geode_objects[key].image"
|
|
26
26
|
cover
|
|
27
|
-
:class="!value['is_loadable'] ? 'disabled' :
|
|
27
|
+
:class="!value['is_loadable'] ? 'disabled' : undefined"
|
|
28
28
|
/>
|
|
29
29
|
</v-card>
|
|
30
30
|
</span>
|
|
@@ -66,44 +66,81 @@
|
|
|
66
66
|
const allowed_objects = ref({})
|
|
67
67
|
const toggle_loading = useToggle(loading)
|
|
68
68
|
|
|
69
|
+
function select_geode_object(object_map) {
|
|
70
|
+
const object_keys = Object.keys(object_map)
|
|
71
|
+
if (!object_keys.length) {
|
|
72
|
+
return undefined
|
|
73
|
+
}
|
|
74
|
+
if (
|
|
75
|
+
object_keys.length === 1 &&
|
|
76
|
+
object_map[object_keys[0]].is_loadable > 0
|
|
77
|
+
) {
|
|
78
|
+
return object_keys[0]
|
|
79
|
+
}
|
|
80
|
+
const highest_load_score = Math.max(
|
|
81
|
+
...object_keys.map((key) => object_map[key].is_loadable),
|
|
82
|
+
)
|
|
83
|
+
if (highest_load_score <= 0) {
|
|
84
|
+
return undefined
|
|
85
|
+
}
|
|
86
|
+
const best_score_objects = object_keys.filter(
|
|
87
|
+
(key) => object_map[key].is_loadable === highest_load_score,
|
|
88
|
+
)
|
|
89
|
+
if (best_score_objects.length === 1) {
|
|
90
|
+
return best_score_objects[0]
|
|
91
|
+
}
|
|
92
|
+
const highest_priority = Math.max(
|
|
93
|
+
...best_score_objects.map(
|
|
94
|
+
(key) => object_map[key].object_priority ?? -Infinity,
|
|
95
|
+
),
|
|
96
|
+
)
|
|
97
|
+
const best_priority_objects = best_score_objects.filter(
|
|
98
|
+
(key) => object_map[key].object_priority === highest_priority,
|
|
99
|
+
)
|
|
100
|
+
if (highest_priority !== -Infinity && best_priority_objects.length === 1) {
|
|
101
|
+
return best_priority_objects[0]
|
|
102
|
+
}
|
|
103
|
+
return undefined
|
|
104
|
+
}
|
|
105
|
+
|
|
69
106
|
async function get_allowed_objects() {
|
|
70
107
|
toggle_loading()
|
|
71
108
|
allowed_objects.value = {}
|
|
72
|
-
|
|
73
|
-
for (const filename of filenames) {
|
|
109
|
+
const promise_array = filenames.map((filename) => {
|
|
74
110
|
const params = { filename, supported_feature }
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
111
|
+
return api_fetch({ schema, params })
|
|
112
|
+
})
|
|
78
113
|
const responses = await Promise.all(promise_array)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
(i) => !values.some((j) => !Object.keys(j).includes(i)),
|
|
114
|
+
const allowed_objects_list = responses.map(
|
|
115
|
+
(response) => response.data.value.allowed_objects,
|
|
116
|
+
)
|
|
117
|
+
const all_keys = [...new Set(allowed_objects_list.flatMap(Object.keys))]
|
|
118
|
+
const common_keys = all_keys.filter((key) =>
|
|
119
|
+
allowed_objects_list.every((obj) => key in obj),
|
|
86
120
|
)
|
|
87
|
-
|
|
121
|
+
const final_object = {}
|
|
88
122
|
for (const key of common_keys) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
123
|
+
const load_scores = allowed_objects_list.map(
|
|
124
|
+
(obj) => obj[key].is_loadable,
|
|
125
|
+
)
|
|
126
|
+
const priorities = allowed_objects_list
|
|
127
|
+
.map((obj) => obj[key].object_priority)
|
|
128
|
+
.filter((p) => p !== undefined && p !== null)
|
|
129
|
+
final_object[key] = { is_loadable: Math.min(...load_scores) }
|
|
130
|
+
if (priorities.length) {
|
|
131
|
+
final_object[key].object_priority = Math.max(...priorities)
|
|
95
132
|
}
|
|
96
133
|
}
|
|
97
|
-
|
|
98
134
|
allowed_objects.value = final_object
|
|
99
|
-
|
|
100
|
-
|
|
135
|
+
const selected_object = select_geode_object(final_object)
|
|
136
|
+
if (selected_object) {
|
|
137
|
+
set_geode_object(selected_object)
|
|
101
138
|
}
|
|
102
139
|
toggle_loading()
|
|
103
140
|
}
|
|
104
141
|
|
|
105
142
|
function set_geode_object(input_geode_object) {
|
|
106
|
-
if (input_geode_object
|
|
143
|
+
if (input_geode_object) {
|
|
107
144
|
emit("update_values", { input_geode_object })
|
|
108
145
|
emit("increment_step")
|
|
109
146
|
}
|
package/components/Recaptcha.vue
CHANGED
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
<script setup>
|
|
11
11
|
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
|
|
12
12
|
|
|
13
|
-
const dataBaseStore = useDataBaseStore()
|
|
14
|
-
|
|
15
13
|
const props = defineProps({
|
|
16
14
|
id: { type: String, required: true },
|
|
17
15
|
})
|
|
@@ -21,10 +19,6 @@
|
|
|
21
19
|
const polygon_attribute_names = ref([])
|
|
22
20
|
const polygon_attribute = reactive({ name: polygon_attribute_name.value })
|
|
23
21
|
|
|
24
|
-
const meta_data = computed(() => {
|
|
25
|
-
return dataBaseStore.itemMetaDatas(props.id)
|
|
26
|
-
})
|
|
27
|
-
|
|
28
22
|
onMounted(() => {
|
|
29
23
|
if (model.value != null) {
|
|
30
24
|
polygon_attribute_name.value = model.value.name
|
|
@@ -45,8 +39,7 @@
|
|
|
45
39
|
{
|
|
46
40
|
schema: back_schemas.opengeodeweb_back.polygon_attribute_names,
|
|
47
41
|
params: {
|
|
48
|
-
|
|
49
|
-
filename: meta_data.value.native_filename,
|
|
42
|
+
id: props.id,
|
|
50
43
|
},
|
|
51
44
|
},
|
|
52
45
|
{
|
|
@@ -32,12 +32,7 @@
|
|
|
32
32
|
id: { type: String, required: true },
|
|
33
33
|
})
|
|
34
34
|
|
|
35
|
-
const dataBaseStore = useDataBaseStore()
|
|
36
|
-
|
|
37
35
|
const polyhedron_attribute_names = ref([])
|
|
38
|
-
const meta_data = computed(() => {
|
|
39
|
-
return dataBaseStore.itemMetaDatas(props.id)
|
|
40
|
-
})
|
|
41
36
|
|
|
42
37
|
onMounted(() => {
|
|
43
38
|
getVertexAttributes()
|
|
@@ -48,8 +43,7 @@
|
|
|
48
43
|
{
|
|
49
44
|
schema: back_schemas.opengeodeweb_back.polyhedron_attribute_names,
|
|
50
45
|
params: {
|
|
51
|
-
|
|
52
|
-
filename: meta_data.value.native_filename,
|
|
46
|
+
id: props.id,
|
|
53
47
|
},
|
|
54
48
|
},
|
|
55
49
|
{
|
|
@@ -38,8 +38,6 @@
|
|
|
38
38
|
<script setup>
|
|
39
39
|
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
|
|
40
40
|
|
|
41
|
-
const dataBaseStore = useDataBaseStore()
|
|
42
|
-
|
|
43
41
|
const emit = defineEmits(["update_value"])
|
|
44
42
|
|
|
45
43
|
const props = defineProps({
|
|
@@ -56,10 +54,6 @@
|
|
|
56
54
|
|
|
57
55
|
const texture_coordinates = ref([])
|
|
58
56
|
|
|
59
|
-
const meta_data = computed(() => {
|
|
60
|
-
return dataBaseStore.itemMetaDatas(props.id)
|
|
61
|
-
})
|
|
62
|
-
|
|
63
57
|
onMounted(() => {
|
|
64
58
|
getTextureCoordinates()
|
|
65
59
|
})
|
|
@@ -69,8 +63,7 @@
|
|
|
69
63
|
{
|
|
70
64
|
schema: back_schemas.opengeodeweb_back.texture_coordinates,
|
|
71
65
|
params: {
|
|
72
|
-
|
|
73
|
-
filename: meta_data.value.native_filename,
|
|
66
|
+
id: props.id,
|
|
74
67
|
},
|
|
75
68
|
},
|
|
76
69
|
{
|
|
@@ -33,9 +33,6 @@
|
|
|
33
33
|
const dataBaseStore = useDataBaseStore()
|
|
34
34
|
|
|
35
35
|
const vertex_attribute_names = ref([])
|
|
36
|
-
const meta_data = computed(() => {
|
|
37
|
-
return dataBaseStore.itemMetaDatas(props.id)
|
|
38
|
-
})
|
|
39
36
|
|
|
40
37
|
onMounted(() => {
|
|
41
38
|
getVertexAttributes()
|
|
@@ -46,8 +43,7 @@
|
|
|
46
43
|
{
|
|
47
44
|
schema: back_schemas.opengeodeweb_back.vertex_attribute_names,
|
|
48
45
|
params: {
|
|
49
|
-
|
|
50
|
-
filename: meta_data.value.native_filename,
|
|
46
|
+
id: props.id,
|
|
51
47
|
},
|
|
52
48
|
},
|
|
53
49
|
{
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
</template>
|
|
43
43
|
|
|
44
44
|
<script setup>
|
|
45
|
-
const treeviewStore =
|
|
45
|
+
const treeviewStore = useTreeviewStore()
|
|
46
46
|
const menuStore = useMenuStore()
|
|
47
47
|
const cardContainer = useTemplateRef("cardContainer")
|
|
48
48
|
const containerWidth = ref(window.innerWidth)
|
package/components/Wrapper.vue
CHANGED
package/composables/api_fetch.js
CHANGED
|
@@ -4,8 +4,8 @@ export function api_fetch(
|
|
|
4
4
|
{ schema, params },
|
|
5
5
|
{ request_error_function, response_function, response_error_function } = {},
|
|
6
6
|
) {
|
|
7
|
-
const feedback_store =
|
|
8
|
-
const geode_store =
|
|
7
|
+
const feedback_store = useFeedbackStore()
|
|
8
|
+
const geode_store = useGeodeStore()
|
|
9
9
|
|
|
10
10
|
const body = params || {}
|
|
11
11
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function run_function_when_microservices_connected(function_to_run) {
|
|
2
|
-
const infra_store =
|
|
2
|
+
const infra_store = useInfraStore()
|
|
3
3
|
const { microservices_connected } = storeToRefs(infra_store)
|
|
4
4
|
if (microservices_connected.value) {
|
|
5
5
|
function_to_run()
|
|
@@ -2,8 +2,8 @@ export async function upload_file(
|
|
|
2
2
|
{ route, file },
|
|
3
3
|
{ request_error_function, response_function, response_error_function } = {},
|
|
4
4
|
) {
|
|
5
|
-
const feedback_store =
|
|
6
|
-
const geode_store =
|
|
5
|
+
const feedback_store = useFeedbackStore()
|
|
6
|
+
const geode_store = useGeodeStore()
|
|
7
7
|
if (!(file instanceof File)) {
|
|
8
8
|
throw new Error("file must be a instance of File")
|
|
9
9
|
}
|
|
@@ -2,8 +2,8 @@ export function viewer_call(
|
|
|
2
2
|
{ schema, params = {} },
|
|
3
3
|
{ request_error_function, response_function, response_error_function } = {},
|
|
4
4
|
) {
|
|
5
|
-
const feedback_store =
|
|
6
|
-
const viewer_store =
|
|
5
|
+
const feedback_store = useFeedbackStore()
|
|
6
|
+
const viewer_store = useViewerStore()
|
|
7
7
|
|
|
8
8
|
const { valid, error } = validate_schema(schema, params)
|
|
9
9
|
|
|
@@ -19,45 +19,45 @@ export function viewer_call(
|
|
|
19
19
|
|
|
20
20
|
const client = viewer_store.client
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
if (client) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
)
|
|
43
|
-
.catch((error) => {
|
|
44
|
-
feedback_store.add_error(
|
|
45
|
-
error.code,
|
|
46
|
-
schema.route,
|
|
47
|
-
error.message,
|
|
48
|
-
error.message,
|
|
49
|
-
)
|
|
50
|
-
if (response_error_function) {
|
|
51
|
-
response_error_function(error)
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
if (!client) {
|
|
24
|
+
reject()
|
|
25
|
+
}
|
|
26
|
+
viewer_store.start_request()
|
|
27
|
+
client
|
|
28
|
+
.getConnection()
|
|
29
|
+
.getSession()
|
|
30
|
+
.call(schema.$id, [params])
|
|
31
|
+
.then(
|
|
32
|
+
(value) => {
|
|
33
|
+
if (response_function) {
|
|
34
|
+
response_function(value)
|
|
35
|
+
}
|
|
36
|
+
resolve()
|
|
37
|
+
},
|
|
38
|
+
(reason) => {
|
|
39
|
+
if (request_error_function) {
|
|
40
|
+
request_error_function(reason)
|
|
52
41
|
}
|
|
53
42
|
reject()
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
43
|
+
},
|
|
44
|
+
)
|
|
45
|
+
.catch((error) => {
|
|
46
|
+
feedback_store.add_error(
|
|
47
|
+
error.code,
|
|
48
|
+
schema.route,
|
|
49
|
+
error.message,
|
|
50
|
+
error.message,
|
|
51
|
+
)
|
|
52
|
+
if (response_error_function) {
|
|
53
|
+
response_error_function(error)
|
|
54
|
+
}
|
|
55
|
+
reject()
|
|
56
|
+
})
|
|
57
|
+
.finally(() => {
|
|
58
|
+
viewer_store.stop_request()
|
|
59
|
+
})
|
|
59
60
|
})
|
|
60
|
-
return promise
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export default viewer_call
|
|
Binary file
|
|
Binary file
|