-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathProcessList.vue
More file actions
43 lines (37 loc) · 1.21 KB
/
ProcessList.vue
File metadata and controls
43 lines (37 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<template lang="html">
<v-expansion-panel-text>
<v-list density="compact" color="transparent" class="pa-0">
<v-list-item
v-for="project in projects"
class="group"
:key="project"
@click.stop="queryProcess(project)"
>
<v-label class="text-capitalize mb-1">{{ project }}</v-label>
</v-list-item>
</v-list>
</v-expansion-panel-text>
</template>
<script setup lang="ts">
import { generateJWT } from '../functions/generate-jwt'
import useProcessing from '../composables/useProcessing'
import useMap from '../composables/useMap'
const { projects } = useProcessing()
const { displayGeoJSON, fitMapToBbox } = useMap()
const queryProcess = async (id) => {
const token = generateJWT()
const res = await fetch(`${import.meta.env.VITE_API_BASE_URL}projects/${id}`, {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
}
}).then( res => res.json() )
const blob = await fetch(res.results.polygons)
const data = await blob.text()
const polygons = JSON.parse(data)
displayGeoJSON(polygons)
fitMapToBbox(res.parameters.inference.bbox) //TODO: add loading throbber
}
</script>
<style lang="css" scoped>
</style>