Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions src/components/ProcessList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,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) => {
Comment thread
niebl marked this conversation as resolved.
Outdated
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() )
Comment thread
niebl marked this conversation as resolved.
Outdated
const blob = await fetch(res.results.polygons)
Comment thread
niebl marked this conversation as resolved.
Outdated
const data = await blob.text()
const polygons = JSON.parse(data)
Comment thread
niebl marked this conversation as resolved.
Outdated
displayGeoJSON(polygons)
fitMapToBbox(res.parameters.inference.bbox) //TODO: add loading throbber
}

</script>

<style lang="css" scoped>

</style>
4 changes: 4 additions & 0 deletions src/components/ProcessingResults.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
</v-btn>
</v-expansion-panel-text>
</v-expansion-panel>
<v-expansion-panel title="Processes" class="panel processes">
<ProcessList />
</v-expansion-panel>
</v-expansion-panels>
</div>

Expand Down Expand Up @@ -98,6 +101,7 @@ import useMap from '../composables/useMap'
import useNotifier from '../composables/useNotifier'
import useAreaOfInterest from '../composables/useAreaOfInterest'
import PropertiesDisplay from './PropertiesDisplay.vue'
import ProcessList from './ProcessList.vue'
import { mdiChevronDown, mdiTarget } from '@mdi/js'
import { type Feature } from 'geojson'

Expand Down
1 change: 1 addition & 0 deletions src/composables/useProcessing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,5 +282,6 @@ export default function useProcessing() {
isProcessing,
processBatch,
processSmallArea,
projects
}
}