@geode/opengeodeweb-front 6.0.0-rc.3 → 6.0.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.
@@ -5,8 +5,11 @@
5
5
  "properties": {
6
6
  "input_geode_object": {
7
7
  "type": "string"
8
+ },
9
+ "filename": {
10
+ "type": "string"
8
11
  }
9
12
  },
10
- "required": ["input_geode_object"],
13
+ "required": ["input_geode_object", "filename"],
11
14
  "additionalProperties": false
12
15
  }
@@ -1,28 +1,30 @@
1
1
  <template>
2
2
  <FetchingData v-if="loading" />
3
3
  <v-row
4
- v-for="item in geode_objects_and_output_extensions"
5
- :key="item.geode_object"
4
+ v-for="(
5
+ output_extensions, output_geode_object
6
+ ) in geode_objects_and_output_extensions"
7
+ :key="output_geode_object"
6
8
  class="justify-left"
7
9
  >
8
10
  <v-card class="card ma-2 pa-2" width="100%">
9
- <v-tooltip :text="`Export as a ${item.geode_object}`" location="bottom">
11
+ <v-tooltip :text="`Export as a ${output_geode_object}`" location="bottom">
10
12
  <template v-slot:activator="{ props }">
11
13
  <v-card-title v-bind="props">
12
- {{ item.geode_object }}
14
+ {{ output_geode_object }}
13
15
  </v-card-title>
14
16
  </template>
15
17
  </v-tooltip>
16
18
  <v-card-text>
17
19
  <v-row>
18
20
  <v-col
19
- v-for="output in item.outputs"
20
- :key="output.extension"
21
+ v-for="(extension, output_extension) in output_extensions"
22
+ :key="output_extension"
21
23
  cols="auto"
22
24
  class="pa-0"
23
25
  >
24
26
  <v-tooltip
25
- :disabled="output.is_saveable"
27
+ :disabled="extension.is_saveable"
26
28
  text="Data not saveable with this file extension"
27
29
  location="bottom"
28
30
  >
@@ -30,13 +32,15 @@
30
32
  <span v-bind="props">
31
33
  <v-card
32
34
  class="card ma-2"
33
- :color="output.is_saveable ? 'primary' : 'grey'"
35
+ :color="extension.is_saveable ? 'primary' : 'grey'"
34
36
  hover
35
- @click="set_variables(item.geode_object, output.extension)"
36
- :disabled="!output.is_saveable"
37
+ @click="
38
+ set_variables(output_geode_object, output_extension)
39
+ "
40
+ :disabled="!extension.is_saveable"
37
41
  >
38
42
  <v-card-title align="center">
39
- {{ output.extension }}
43
+ {{ output_extension }}
40
44
  </v-card-title>
41
45
  </v-card>
42
46
  </span>
@@ -50,6 +54,7 @@
50
54
  </template>
51
55
 
52
56
  <script setup>
57
+ import _ from "lodash"
53
58
  import schema from "@/assets/schemas/ExtensionSelector.json"
54
59
 
55
60
  const emit = defineEmits([
@@ -60,33 +65,65 @@
60
65
 
61
66
  const props = defineProps({
62
67
  input_geode_object: { type: String, required: true },
68
+ filenames: { type: Array, required: true },
63
69
  })
64
- const { input_geode_object } = props
65
-
66
- const geode_objects_and_output_extensions = ref([])
70
+ const { input_geode_object, filenames } = props
71
+ const geode_objects_and_output_extensions = ref({})
67
72
  const loading = ref(false)
68
73
 
69
74
  const toggle_loading = useToggle(loading)
70
75
 
71
76
  async function get_output_file_extensions() {
72
77
  toggle_loading()
73
- const params = { input_geode_object }
74
- await api_fetch(
75
- { schema, params },
76
- {
77
- response_function: (response) => {
78
- geode_objects_and_output_extensions.value =
79
- response._data.geode_objects_and_output_extensions
80
- },
81
- },
82
- )
78
+ geode_objects_and_output_extensions.vaue = {}
79
+ var promise_array = []
80
+ for (const filename of filenames) {
81
+ const params = { input_geode_object, filename }
82
+ const promise = new Promise((resolve, reject) => {
83
+ api_fetch(
84
+ { schema, params },
85
+ {
86
+ request_error_function: () => {
87
+ reject()
88
+ },
89
+ response_function: (response) => {
90
+ const data = response._data.geode_objects_and_output_extensions
91
+ if (_.isEmpty(geode_objects_and_output_extensions.value)) {
92
+ geode_objects_and_output_extensions.value = data
93
+ } else {
94
+ for (const [geode_object, geode_object_value] of Object.entries(
95
+ data,
96
+ )) {
97
+ for (const [
98
+ output_extension,
99
+ output_extension_value,
100
+ ] of Object.entries(geode_object_value)) {
101
+ if (!output_extension_value["is_saveable"]) {
102
+ geode_objects_and_output_extensions.value[geode_object][
103
+ output_extension
104
+ ]["is_saveable"] = false
105
+ }
106
+ }
107
+ }
108
+ }
109
+ resolve()
110
+ },
111
+ response_error_function: () => {
112
+ reject()
113
+ },
114
+ },
115
+ )
116
+ })
117
+ promise_array.push(promise)
118
+ }
119
+ await Promise.all(promise_array)
83
120
  toggle_loading()
84
121
  }
85
122
 
86
- function set_variables(geode_object, output_extension) {
87
- if (geode_object != "" && output_extension != "") {
123
+ function set_variables(output_geode_object, output_extension) {
124
+ if (output_geode_object != "" && output_extension != "") {
88
125
  const keys_values_object = {
89
- output_geode_object: geode_object,
126
+ output_geode_object,
90
127
  output_extension,
91
128
  }
92
129
  emit("update_values", keys_values_object)
@@ -49,15 +49,29 @@
49
49
 
50
50
  async function upload_files() {
51
51
  toggle_loading()
52
- await upload_file(
53
- { route, files: multiple ? files.value : [files.value[0]] },
54
- {
55
- response_function: () => {
56
- files_uploaded.value = true
57
- emit("files_uploaded", files.value)
58
- },
59
- },
60
- )
52
+ var promise_array = []
53
+ for (const file of files.value) {
54
+ const promise = new Promise((resolve, reject) => {
55
+ upload_file(
56
+ { route, file },
57
+ {
58
+ request_error_function: () => {
59
+ reject()
60
+ },
61
+ response_function: () => {
62
+ resolve()
63
+ },
64
+ response_error_function: () => {
65
+ reject()
66
+ },
67
+ },
68
+ )
69
+ })
70
+ promise_array.push(promise)
71
+ }
72
+ await Promise.all(promise_array)
73
+ files_uploaded.value = true
74
+ emit("files_uploaded", files.value)
61
75
  toggle_loading()
62
76
  }
63
77
 
@@ -54,11 +54,11 @@
54
54
  const props = defineProps({
55
55
  multiple: { type: Boolean, required: true },
56
56
  input_geode_object: { type: String, required: true },
57
- files: { type: Array, required: true },
57
+ filenames: { type: Array, required: true },
58
58
  route: { type: String, required: true },
59
59
  })
60
60
 
61
- const { multiple, input_geode_object, files, route } = props
61
+ const { multiple, input_geode_object, filenames, route } = props
62
62
 
63
63
  const accept = ref("")
64
64
  const loading = ref(false)
@@ -73,39 +73,51 @@
73
73
  }
74
74
 
75
75
  async function missing_files() {
76
+ toggle_loading()
76
77
  has_missing_files.value = false
77
78
  mandatory_files.value = []
78
79
  additional_files.value = []
79
- toggle_loading()
80
- for (const file of files) {
81
- const params = { input_geode_object, filename: file.name }
82
- await api_fetch(
83
- { schema, params },
84
- {
85
- response_function: (response) => {
86
- has_missing_files.value = response._data.has_missing_files
87
- mandatory_files.value = [].concat(
88
- mandatory_files.value,
89
- response._data.mandatory_files,
90
- )
91
- additional_files.value = [].concat(
92
- additional_files.value,
93
- response._data.additional_files,
94
- )
95
- const files_list = [].concat(
96
- mandatory_files.value,
97
- additional_files.value,
98
- )
99
- accept.value = files_list
100
- .map((filename) => "." + filename.split(".").pop())
101
- .join(",")
102
- if (!has_missing_files.value) {
103
- console.log("MISSING FILESSELECTOR increment_step")
104
- emit("increment_step")
105
- }
80
+ var promise_array = []
81
+
82
+ for (const filename of filenames) {
83
+ const params = { input_geode_object, filename }
84
+ const promise = new Promise((resolve, reject) => {
85
+ api_fetch(
86
+ { schema, params },
87
+ {
88
+ request_error_function: () => {
89
+ reject()
90
+ },
91
+ response_function: (response) => {
92
+ has_missing_files.value = response._data.has_missing_files
93
+ ? true
94
+ : has_missing_files.value
95
+ mandatory_files.value = [].concat(
96
+ mandatory_files.value,
97
+ response._data.mandatory_files,
98
+ )
99
+ additional_files.value = [].concat(
100
+ additional_files.value,
101
+ response._data.additional_files,
102
+ )
103
+ resolve()
104
+ },
105
+ response_error_function: () => {
106
+ reject()
107
+ },
106
108
  },
107
- },
108
- )
109
+ )
110
+ })
111
+ promise_array.push(promise)
112
+ }
113
+ await Promise.all(promise_array)
114
+ if (!has_missing_files.value) {
115
+ emit("increment_step")
116
+ } else {
117
+ accept.value = []
118
+ .concat(mandatory_files.value, additional_files.value)
119
+ .map((filename) => "." + filename.split(".").pop())
120
+ .join(",")
109
121
  }
110
122
  toggle_loading()
111
123
  }
@@ -31,17 +31,18 @@
31
31
  </template>
32
32
 
33
33
  <script setup>
34
+ import { toRaw } from "vue"
34
35
  import geode_objects from "@/assets/geode_objects"
35
36
  import schema from "@/assets/schemas/ObjectSelector.json"
36
37
 
37
38
  const emit = defineEmits(["update_values", "increment_step"])
38
39
 
39
40
  const props = defineProps({
40
- files: { type: Array, required: true },
41
+ filenames: { type: Array, required: true },
41
42
  key: { type: String, required: false, default: null },
42
43
  })
43
44
 
44
- const { files, key } = props
45
+ const { filenames, key } = props
45
46
 
46
47
  const loading = ref(false)
47
48
  const allowed_objects = ref([])
@@ -49,22 +50,43 @@
49
50
  const toggle_loading = useToggle(loading)
50
51
 
51
52
  async function get_allowed_objects() {
52
- const params = { filename: files[0].name, key }
53
53
  toggle_loading()
54
- await api_fetch(
55
- { schema, params },
56
- {
57
- response_function: (response) => {
58
- allowed_objects.value = response._data.allowed_objects
59
- },
60
- },
61
- )
54
+ allowed_objects.value = []
55
+ var promise_array = []
56
+ for (const filename of filenames) {
57
+ const params = { filename, key }
58
+ const promise = new Promise((resolve, reject) => {
59
+ api_fetch(
60
+ { schema, params },
61
+ {
62
+ request_error_function: () => {
63
+ reject()
64
+ },
65
+ response_function: (response) => {
66
+ if (allowed_objects.value.length == 0) {
67
+ allowed_objects.value = response._data.allowed_objects
68
+ } else {
69
+ allowed_objects.value = toRaw(allowed_objects.value).filter(
70
+ (value) => response._data.allowed_objects.includes(value),
71
+ )
72
+ }
73
+ resolve()
74
+ },
75
+ response_error_function: () => {
76
+ reject()
77
+ },
78
+ },
79
+ )
80
+ })
81
+ promise_array.push(promise)
82
+ }
83
+ await Promise.all(promise_array)
62
84
  toggle_loading()
63
85
  }
64
86
 
65
- function set_geode_object(geode_object) {
66
- if (geode_object != "") {
67
- emit("update_values", { input_geode_object: geode_object })
87
+ function set_geode_object(input_geode_object) {
88
+ if (input_geode_object != "") {
89
+ emit("update_values", { input_geode_object })
68
90
  emit("increment_step")
69
91
  }
70
92
  }
@@ -63,9 +63,7 @@
63
63
  }
64
64
 
65
65
  function update_values_event(keys_values_object) {
66
- console.log("update_values_event", keys_values_object)
67
66
  for (const [key, value] of Object.entries(keys_values_object)) {
68
- console.log(key, value)
69
67
  stepper_tree[key] = value
70
68
  }
71
69
  }
@@ -1,14 +1,12 @@
1
1
  export function upload_file(
2
- { route, files },
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
7
 
8
8
  const body = new FormData()
9
- for (let i = 0; i < files.length; i++) {
10
- body.append("content", files[i])
11
- }
9
+ body.append("file", file)
12
10
 
13
11
  const request_options = {
14
12
  method: "PUT",
package/package.json CHANGED
@@ -4,37 +4,37 @@
4
4
  "lint": "eslint --fix --ext .js,.vue --ignore-path .gitignore ."
5
5
  },
6
6
  "devDependencies": {
7
- "eslint": "^8.53.0",
7
+ "eslint": "^8.55.0",
8
8
  "eslint-plugin-import": "^2.29.0",
9
9
  "eslint-plugin-nuxt": "^4.0.0",
10
10
  "eslint-plugin-prettier": "^5.0.1",
11
11
  "eslint-plugin-prettier-vue": "^5.0.0",
12
- "eslint-plugin-vue": "^9.18.1",
13
- "eslint-plugin-vuetify": "^2.0.5",
14
- "nuxt": "^3.8.1",
15
- "prettier": "3.0.3"
12
+ "eslint-plugin-vue": "^9.19.2",
13
+ "eslint-plugin-vuetify": "^2.1.0",
14
+ "nuxt": "^3.8.2",
15
+ "prettier": "3.1.1"
16
16
  },
17
17
  "overrides": {
18
18
  "vue": "latest"
19
19
  },
20
20
  "description": "OpenSource Vue/Vuetify framework for web applications",
21
21
  "type": "module",
22
- "version": "6.0.0-rc.3",
22
+ "version": "6.0.0",
23
23
  "main": "./nuxt.config.js",
24
24
  "dependencies": {
25
- "@kitware/vtk.js": "^29.1.1",
25
+ "@kitware/vtk.js": "^29.2.0",
26
26
  "@mdi/font": "^7.3.67",
27
27
  "@pinia/nuxt": "^0.5.1",
28
- "@types/node": "^20.8.10",
29
- "@vueuse/components": "^10.5.0",
30
- "@vueuse/core": "^10.5.0",
28
+ "@types/node": "^20.10.4",
29
+ "@vueuse/components": "^10.7.0",
30
+ "@vueuse/core": "^10.7.0",
31
31
  "ajv": "^8.12.0",
32
32
  "lodash": "^4.17.21",
33
33
  "pinia": "^2.1.7",
34
34
  "sass": "^1.69.5",
35
35
  "semver": "^7.5.4",
36
36
  "vue-recaptcha": "^2.0.3",
37
- "vuetify": "^3.3.23",
37
+ "vuetify": "^3.4.6",
38
38
  "wslink": "^1.12.4"
39
39
  },
40
40
  "repository": {