@geode/opengeodeweb-front 0.0.1 → 0.0.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.
- package/components/Errors/Banner.vue +48 -0
- package/components/Errors/Snackers.vue +49 -0
- package/components/ExtensionSelector.vue +58 -0
- package/components/FileSelector.vue +47 -0
- package/components/ObjectSelector.vue +67 -0
- package/components/PackagesVersions.vue +55 -0
- package/package.json +1 -1
- package/plugins/vuetify.js +45 -0
- package/stores/cloud.js +71 -0
- package/stores/errors.js +20 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-banner v-if="server_error" elevation="2" style="background-color: grey; z-index:100;" position="fixed">
|
|
3
|
+
<v-row>
|
|
4
|
+
<v-col cols="auto" class="white--text text-center">
|
|
5
|
+
<v-tooltip location="end">
|
|
6
|
+
<span>
|
|
7
|
+
We turn off our server automatically after 5 minutes of inactivity
|
|
8
|
+
</span>
|
|
9
|
+
<template #activator="{ props }">
|
|
10
|
+
<v-icon v-bind="props" color="white" class="justify-right">
|
|
11
|
+
mdi-information-outline
|
|
12
|
+
</v-icon>
|
|
13
|
+
</template>
|
|
14
|
+
</v-tooltip>
|
|
15
|
+
</v-col>
|
|
16
|
+
<v-col cols="auto" class="text-white font-weight-bold">Server timed out due to inactivity,
|
|
17
|
+
please reload this page
|
|
18
|
+
or click here:
|
|
19
|
+
</v-col>
|
|
20
|
+
<v-col cols="auto" align-items="center">
|
|
21
|
+
<v-btn @click="reload()" color="grey" density='compact'>
|
|
22
|
+
Reload
|
|
23
|
+
</v-btn>
|
|
24
|
+
</v-col>
|
|
25
|
+
<v-spacer />
|
|
26
|
+
<v-col cols="auto">
|
|
27
|
+
<v-btn icon flat size="20" @click="errors_store.delete_server_error()" color="grey" class=".align-center">
|
|
28
|
+
<v-icon icon="mdi-close" size="20" color="white" />
|
|
29
|
+
</v-btn>
|
|
30
|
+
</v-col>
|
|
31
|
+
</v-row>
|
|
32
|
+
</v-banner>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script setup>
|
|
36
|
+
const errors_store = use_errors_store()
|
|
37
|
+
const { server_error } = storeToRefs(errors_store)
|
|
38
|
+
|
|
39
|
+
function reload () {
|
|
40
|
+
window.location.reload()
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<style scoped>
|
|
45
|
+
.v-btn {
|
|
46
|
+
text-transform: unset !important;
|
|
47
|
+
}
|
|
48
|
+
</style>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-snackbar :style="{ 'margin-bottom': calc_margin(index) }" v-for="(error, index) in errors" :key="index"
|
|
3
|
+
v-model="show" color="error" location="bottom right" transition="slide-x-reverse-transition" max-width="30%"
|
|
4
|
+
height="20px">
|
|
5
|
+
<v-row dense class="flex-nowrap">
|
|
6
|
+
<v-col cols="auto">
|
|
7
|
+
<v-tooltip location="left">
|
|
8
|
+
<span>
|
|
9
|
+
{{ error.code }}<br />
|
|
10
|
+
{{ error.route }}<br />
|
|
11
|
+
{{ error.description }}
|
|
12
|
+
<br>
|
|
13
|
+
</span>
|
|
14
|
+
<template #activator="{ props }">
|
|
15
|
+
<v-icon v-bind="props" color="white" class="justify-right">
|
|
16
|
+
mdi-information-outline
|
|
17
|
+
</v-icon>
|
|
18
|
+
</template>
|
|
19
|
+
</v-tooltip>
|
|
20
|
+
</v-col>
|
|
21
|
+
<v-col cols="9" class="text-no-wrap overflow-hidden">
|
|
22
|
+
{{ error.name }}
|
|
23
|
+
</v-col>
|
|
24
|
+
<v-spacer />
|
|
25
|
+
<v-col cols="auto">
|
|
26
|
+
<v-btn icon flat size="20" @click="errors_store.delete_error(index)" color="error">
|
|
27
|
+
<v-icon icon="mdi-close" size="20" color="white" />
|
|
28
|
+
</v-btn>
|
|
29
|
+
</v-col>
|
|
30
|
+
</v-row>
|
|
31
|
+
</v-snackbar>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script setup>
|
|
35
|
+
const errors_store = use_errors_store()
|
|
36
|
+
const { errors } = storeToRefs(errors_store)
|
|
37
|
+
|
|
38
|
+
const show = true
|
|
39
|
+
|
|
40
|
+
function calc_margin (index) {
|
|
41
|
+
return (index * 60) + 8 + 'px'
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<style scoped>
|
|
46
|
+
.v-snackbar :deep(.v-snackbar__content) {
|
|
47
|
+
width: 100%;
|
|
48
|
+
}
|
|
49
|
+
</style>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row class="justify-left">
|
|
3
|
+
<v-col v-for="file_extension in file_extensions" :key="file_extension" cols="2">
|
|
4
|
+
<v-card class="card ma-2" hover elevation="5" @click="set_output_extension(file_extension)">
|
|
5
|
+
<v-card-title align="center">
|
|
6
|
+
{{ file_extension }}
|
|
7
|
+
</v-card-title>
|
|
8
|
+
</v-card>
|
|
9
|
+
</v-col>
|
|
10
|
+
</v-row>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup>
|
|
14
|
+
import geode_objects from '@assets/geode_objects';
|
|
15
|
+
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
geode_object: { type: String, required: true, validator (value) { return geode_objects.keys().includes(value) } },
|
|
18
|
+
route_prefix: { type: String, required: true },
|
|
19
|
+
variable_to_update: { type: String, required: true },
|
|
20
|
+
variable_to_increment: { type: String, required: true },
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const { geode_object, route_prefix, variable_to_update, variable_to_increment } = props
|
|
24
|
+
|
|
25
|
+
const file_extensions = ref([])
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
async function get_output_file_extensions () {
|
|
29
|
+
|
|
30
|
+
const params = new FormData()
|
|
31
|
+
params.append('geode_object', geode_object)
|
|
32
|
+
|
|
33
|
+
await api_fetch(`${route_prefix}/output_file_extensions`, { method: 'POST', body: params },
|
|
34
|
+
{
|
|
35
|
+
'response_function': (response) => {
|
|
36
|
+
file_extensions.value = response._data.output_file_extensions
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function set_output_extension (extension) {
|
|
43
|
+
const stepper_tree = inject('stepper_tree')
|
|
44
|
+
stepper_tree[variable_to_update] = extension
|
|
45
|
+
stepper_tree[variable_to_increment]++
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
onMounted(() => {
|
|
49
|
+
get_output_file_extensions()
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<style scoped>
|
|
55
|
+
.card {
|
|
56
|
+
border-radius: 15px;
|
|
57
|
+
}
|
|
58
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-file-input v-model="files" :multiple="multiple" :label="label" :accept="accept"
|
|
3
|
+
:rules="[(value) => !!value || 'The file is mandatory']" color="primary" chips counter show-size
|
|
4
|
+
@click:clear="stepper_tree.files = []" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
|
+
const stepper_tree = inject('stepper_tree')
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
multiple: { type: Boolean, required: true },
|
|
12
|
+
label: { type: String, required: true },
|
|
13
|
+
route_prefix: { type: String, required: true },
|
|
14
|
+
variable_to_update: { type: String, required: true },
|
|
15
|
+
variable_to_increment: { type: String, required: true },
|
|
16
|
+
|
|
17
|
+
})
|
|
18
|
+
const { multiple, label, route_prefix, variable_to_update, variable_to_increment } = props.component_options
|
|
19
|
+
|
|
20
|
+
const accept = ref('')
|
|
21
|
+
const files = ref([])
|
|
22
|
+
|
|
23
|
+
watch(files, (value) => {
|
|
24
|
+
stepper_tree[variable_to_update] = value
|
|
25
|
+
stepper_tree[variable_to_increment]++
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
function fill_extensions (response) {
|
|
29
|
+
const extensions = response._data.extensions.map((extension) => '.' + extension).join(',')
|
|
30
|
+
accept.value = extensions
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function get_allowed_files () {
|
|
34
|
+
const route = `${route_prefix}/allowed_files`
|
|
35
|
+
await api_fetch(route, { method: 'GET' },
|
|
36
|
+
{
|
|
37
|
+
'response_function': (response) => {
|
|
38
|
+
fill_extensions(response)
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
onMounted(async () => {
|
|
44
|
+
await get_allowed_files()
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
</script>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row v-if="allowed_objects.length" class="justify-left">
|
|
3
|
+
<v-col v-for="object in allowed_objects" :key="object" cols="2" md="2">
|
|
4
|
+
<v-card v-ripple class="card ma-2" hover elevation="5" rounded>
|
|
5
|
+
<v-img :src="geode_objects[object].image" cover @click="set_geode_object(object)" />
|
|
6
|
+
<v-tooltip activator="parent" location="bottom">
|
|
7
|
+
{{ geode_objects[object].tooltip }}
|
|
8
|
+
</v-tooltip>
|
|
9
|
+
</v-card>
|
|
10
|
+
</v-col>
|
|
11
|
+
</v-row>
|
|
12
|
+
<v-row v-else>
|
|
13
|
+
<v-card class="card ma-2" variant="tonal" elevation="5" rounded>
|
|
14
|
+
<v-card-text>
|
|
15
|
+
This file format isn't supported! Please check the <a href="https://docs.geode-solutions.com/formats/"
|
|
16
|
+
target="_blank">
|
|
17
|
+
supported file formats documentation</a> for more information
|
|
18
|
+
</v-card-text>
|
|
19
|
+
</v-card>
|
|
20
|
+
</v-row>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup>
|
|
24
|
+
import geode_objects from '@assets/geode_objects';
|
|
25
|
+
|
|
26
|
+
const props = defineProps({
|
|
27
|
+
geode_object: { type: String, required: true, validator (value) { return geode_objects.keys().includes(value) } },
|
|
28
|
+
route_prefix: { type: String, required: true },
|
|
29
|
+
files: { type: Array, required: true },
|
|
30
|
+
variable_to_update: { type: String, required: true },
|
|
31
|
+
variable_to_increment: { type: String, required: true },
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const { geode_objects, route_prefix, files } = props
|
|
35
|
+
|
|
36
|
+
const allowed_objects = ref([])
|
|
37
|
+
|
|
38
|
+
async function get_allowed_objects () {
|
|
39
|
+
|
|
40
|
+
const params = new FormData()
|
|
41
|
+
params.append('filename', files[0].name)
|
|
42
|
+
|
|
43
|
+
await api_fetch(`${route_prefix}/allowed_objects`,
|
|
44
|
+
{ method: 'POST', body: params },
|
|
45
|
+
{
|
|
46
|
+
'response_function': (response) => { allowed_objects.value = response._data.allowed_objects }
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function set_geode_object (geode_object) {
|
|
51
|
+
const stepper_tree = inject('stepper_tree')
|
|
52
|
+
stepper_tree[variable_to_update] = geode_object
|
|
53
|
+
stepper_tree[variable_to_increment]++
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
onMounted(() => {
|
|
57
|
+
get_allowed_objects()
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<style scoped>
|
|
64
|
+
.card {
|
|
65
|
+
border-radius: 15px;
|
|
66
|
+
}
|
|
67
|
+
</style>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container>
|
|
3
|
+
This tool uses our Open-Source codes
|
|
4
|
+
<v-tooltip location="end">
|
|
5
|
+
<span v-for="package_version in packages_versions" :key="package_version.package">
|
|
6
|
+
{{ package_version.package }} v{{ package_version.version }}
|
|
7
|
+
<br>
|
|
8
|
+
</span>
|
|
9
|
+
<template #activator="{ props }">
|
|
10
|
+
<v-icon v-bind="props" color="primary" class="justify-right">
|
|
11
|
+
mdi-information-outline
|
|
12
|
+
</v-icon>
|
|
13
|
+
</template>
|
|
14
|
+
</v-tooltip>
|
|
15
|
+
</v-container>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup>
|
|
19
|
+
const props = defineProps({
|
|
20
|
+
route_prefix: { type: String, required: true }
|
|
21
|
+
})
|
|
22
|
+
const { tool_route } = props
|
|
23
|
+
|
|
24
|
+
const { is_cloud_running } = storeToRefs(cloud_store)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
const packages_versions = ref([])
|
|
28
|
+
|
|
29
|
+
async function get_packages_versions () {
|
|
30
|
+
const route = `${tool_route}/versions`
|
|
31
|
+
await api_fetch(route, { method: 'GET' }, {
|
|
32
|
+
'response_function': (response) => {
|
|
33
|
+
packages_versions.value = response._data.versions
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
watch(is_cloud_running, (value) => {
|
|
39
|
+
if (value === true) {
|
|
40
|
+
get_packages_versions()
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
onMounted(() => {
|
|
45
|
+
if (is_cloud_running.value === true) {
|
|
46
|
+
get_packages_versions()
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
onActivated(() => {
|
|
51
|
+
if (is_cloud_running.value === true) {
|
|
52
|
+
get_packages_versions()
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
</script>
|
package/package.json
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createVuetify } from 'vuetify'
|
|
2
|
+
import * as components from 'vuetify/components'
|
|
3
|
+
import { VDataTable } from 'vuetify/labs/VDataTable'
|
|
4
|
+
import * as directives from 'vuetify/directives'
|
|
5
|
+
|
|
6
|
+
import '@mdi/font/css/materialdesignicons.css'
|
|
7
|
+
import colors from 'vuetify/lib/util/colors'
|
|
8
|
+
import 'vuetify/styles'
|
|
9
|
+
|
|
10
|
+
const light_theme = {
|
|
11
|
+
dark: false,
|
|
12
|
+
colors: {
|
|
13
|
+
background: '#FFFFFF',
|
|
14
|
+
primary: colors.teal.darken1,
|
|
15
|
+
secondary: colors.teal.lighten4,
|
|
16
|
+
accent: colors.amber.accent4,
|
|
17
|
+
error: colors.red.lighten2,
|
|
18
|
+
info: colors.yellow.accent4,
|
|
19
|
+
success: colors.green.accent4,
|
|
20
|
+
warning: colors.orange.accent4,
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default defineNuxtPlugin(nuxtApp => {
|
|
25
|
+
const vuetify = createVuetify({
|
|
26
|
+
components: {
|
|
27
|
+
...components,
|
|
28
|
+
VDataTable,
|
|
29
|
+
},
|
|
30
|
+
directives,
|
|
31
|
+
theme: {
|
|
32
|
+
defaultTheme: 'light_theme',
|
|
33
|
+
themes: {
|
|
34
|
+
light_theme,
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
defaultAssets: false,
|
|
38
|
+
icons: {
|
|
39
|
+
defaultSet: 'mdi'
|
|
40
|
+
},
|
|
41
|
+
ssr: true
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
nuxtApp.vueApp.use(vuetify)
|
|
45
|
+
})
|
package/stores/cloud.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
import { use_errors_store } from './errors'
|
|
3
|
+
|
|
4
|
+
export const use_cloud_store = defineStore('cloud', {
|
|
5
|
+
state: () => ({
|
|
6
|
+
ID: '',
|
|
7
|
+
is_captcha_validated: false,
|
|
8
|
+
is_cloud_running: false,
|
|
9
|
+
is_connexion_launched: false,
|
|
10
|
+
request_counter: 0
|
|
11
|
+
}),
|
|
12
|
+
actions: {
|
|
13
|
+
async create_connexion () {
|
|
14
|
+
if (this.is_connexion_launched) { return }
|
|
15
|
+
this.is_connexion_launched = true
|
|
16
|
+
const ID = localStorage.getItem('ID')
|
|
17
|
+
if (ID === null || typeof ID === 'undefined') {
|
|
18
|
+
return this.create_backend()
|
|
19
|
+
} else {
|
|
20
|
+
const config = useRuntimeConfig()
|
|
21
|
+
const { data, error } = await useFetch(`${config.public.API_URL}/${ID}/ping`, { method: 'POST' })
|
|
22
|
+
console.log("error", error)
|
|
23
|
+
if (data.value !== null) {
|
|
24
|
+
this.ID = ID
|
|
25
|
+
this.is_cloud_running = true
|
|
26
|
+
return this.ping_task()
|
|
27
|
+
} else {
|
|
28
|
+
return this.create_backend()
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
async create_backend () {
|
|
33
|
+
const errors_store = use_errors_store()
|
|
34
|
+
const config = useRuntimeConfig()
|
|
35
|
+
const { data, error } = await useFetch(`${config.public.API_URL}${config.public.SITE_BRANCH}/tools/createbackend`, { method: 'POST' })
|
|
36
|
+
if (data.value !== null) {
|
|
37
|
+
this.ID = data.value.ID
|
|
38
|
+
localStorage.setItem('ID', data.value.ID)
|
|
39
|
+
this.is_cloud_running = true
|
|
40
|
+
return this.ping_task()
|
|
41
|
+
} else {
|
|
42
|
+
console.log("error : ", error)
|
|
43
|
+
errors_store.server_error = true
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
ping_task () {
|
|
48
|
+
setInterval(() => this.do_ping(), 10 * 1000)
|
|
49
|
+
},
|
|
50
|
+
async do_ping () {
|
|
51
|
+
const errors_store = use_errors_store()
|
|
52
|
+
const config = useRuntimeConfig()
|
|
53
|
+
const { data, error } = await useFetch(`${config.public.API_URL}/${this.ID}/ping`, { method: 'POST' })
|
|
54
|
+
if (data.value !== null) {
|
|
55
|
+
this.is_cloud_running = true
|
|
56
|
+
} else {
|
|
57
|
+
errors_store.server_error = true
|
|
58
|
+
console.log("error : ", error)
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
mutations: {
|
|
63
|
+
start_request (state) {
|
|
64
|
+
state.request_counter++
|
|
65
|
+
},
|
|
66
|
+
stop_request (state) {
|
|
67
|
+
state.request_counter--
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
})
|
package/stores/errors.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
|
|
3
|
+
export const use_errors_store = defineStore('errors', {
|
|
4
|
+
state: () => ({
|
|
5
|
+
errors: [],
|
|
6
|
+
server_error: false,
|
|
7
|
+
}),
|
|
8
|
+
actions: {
|
|
9
|
+
add_error (error_object) {
|
|
10
|
+
this.errors.push(error_object)
|
|
11
|
+
console.log(this.errors)
|
|
12
|
+
},
|
|
13
|
+
delete_error (error_index) {
|
|
14
|
+
this.errors.splice(error_index, 1)
|
|
15
|
+
},
|
|
16
|
+
delete_server_error () {
|
|
17
|
+
this.server_error = false
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
})
|