Skip to content

Commit 38ab208

Browse files
committed
Reverse entries, lint
1 parent b16f28d commit 38ab208

3 files changed

Lines changed: 17 additions & 19 deletions

File tree

src/components/ProcessingResults.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
>
9999
</div>
100100
</v-card-text>
101-
102101
</v-card>
103102
</template>
104103

src/components/ProjectSelectionDialog.vue

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,47 @@
11
<template lang="html">
2-
32
<v-dialog v-if="projects.length > 0" width="auto" max-height="500">
43
<template v-slot:activator="{ props: activatorProps }">
5-
<v-btn
6-
variant="outlined"
7-
density="comfortable"
8-
color="primary"
9-
v-bind="activatorProps"
10-
>
4+
<v-btn variant="outlined" density="comfortable" color="primary" v-bind="activatorProps">
115
Load
126
</v-btn>
137
</template>
148
<template v-slot:default="{ isActive }">
159
<v-card title="Load Project">
1610
<v-list density="compact" color="transparent" class="pa-0">
1711
<v-list-item
18-
v-for="project in projects"
12+
v-for="project in sortedProjects"
1913
:key="project"
20-
@click.stop="queryProcess(project); isActive.value = false"
14+
@click.stop="
15+
queryProcess(project)
16+
isActive.value = false
17+
"
2118
>
2219
<v-label class="text-capitalize mb-1">{{ project }}</v-label>
2320
</v-list-item>
2421
</v-list>
25-
22+
2623
<v-card-actions>
2724
<v-spacer></v-spacer>
28-
29-
<v-btn
30-
text="Close Dialog"
31-
@click="isActive.value = false"
32-
></v-btn>
25+
26+
<v-btn text="Close Dialog" @click="isActive.value = false"></v-btn>
3327
</v-card-actions>
3428
</v-card>
3529
</template>
3630
</v-dialog>
3731
</template>
3832

3933
<script setup lang="ts">
34+
import { computed } from 'vue'
4035
import useProcessing from '../composables/useProcessing'
4136
import useMap from '../composables/useMap'
4237
4338
const { projects, loadProject } = useProcessing()
4439
const { displayGeoJSON, fitMapToBbox } = useMap()
4540
41+
const sortedProjects = computed(() => {
42+
return projects.value.slice().reverse()
43+
})
44+
4645
const queryProcess = async (id: string) => {
4746
const polygons = await loadProject(id)
4847
displayGeoJSON(polygons)

src/composables/useProcessing.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,16 +282,16 @@ export default function useProcessing() {
282282
try {
283283
isProjectLoading.value = true
284284
const response = await fetch(`${apiBaseUrl}projects/${id}`, {
285-
headers: createHeaders()
285+
headers: createHeaders(),
286286
})
287287
const project = await response.json()
288-
if (project.status == "completed") {
288+
if (project.status == 'completed') {
289289
const blob = await fetch(project.results.polygons)
290290
const polygons = await blob.json()
291291
polygons.bbox = project.parameters.inference.bbox
292292
return polygons
293293
} else {
294-
throw new Error("Process is not yet completed")
294+
throw new Error("Processing hasn't finished yet. Please try again later.")
295295
}
296296
} catch (e) {
297297
showError((e as Error)?.message || String(e))

0 commit comments

Comments
 (0)