Skip to content

Commit 0117792

Browse files
committed
Show jobs table again
1 parent ee13d17 commit 0117792

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

client/src/views/annotate/subviews/JobsView.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<!-- result summary cell -->
3939
<template #cell-resultSummary="d">
4040
<!-- <span v-for="key in Object.keys(d.value)" :key="key"><span :key="key" v-if="d.value[key] > 0">{{ key }}: {{ d.value[key] }}, </span></span> -->
41-
{{ d.value.numTokens }}
41+
{{ d.value.tokens }}
4242
</template>
4343

4444
<!-- era cell -->
@@ -61,7 +61,7 @@
6161
<template #cell-progress="d">
6262
<span>
6363
<!-- note that percentage is calculated based on num documents, ie not very accurate -->
64-
{{ d.item.progress.total === 0 ? '' : formatProgress(d.item.progress) }}
64+
{{ d.item.progress.total === 0 ? '0%' : formatProgress(d.item.progress) }}
6565
<span v-if="d.item.progress.hasError" style="color: var(--int-red)">error !!</span>
6666
</span>
6767
<GSpinner class="spinner" small v-show="d.item.progress.busy" />

server/src/main/kotlin/org/ivdnt/galahad/documents/Document.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import java.io.File
1515
* Use [Document.create] instead.
1616
*
1717
* A folder has the following files, that store the document's data:
18-
* - plaintext.txt: the document's text content
1918
* - metadata.json: a cache file storing [DocumentMetadata] about the document
2019
* - uploaded/[name]: the uploaded raw file
2120
*/
@@ -60,7 +59,6 @@ class Document(
6059
ThreadPoolUtil.pool.execute {
6160
file.copyTo(doc.uploadedFile, overwrite = true)
6261
}
63-
// plaintext & sourceLayer
6462
val internalFile = InternalFile.create(file)
6563
// First try to access the layer. If the file is invalid, this will throw.
6664
val sourceLayer = internalFile.layer

server/src/main/kotlin/org/ivdnt/galahad/jobs/Jobs.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.ivdnt.galahad.jobs
22

3+
import org.ivdnt.galahad.annotations.LayerPreview
4+
import org.ivdnt.galahad.annotations.LayerSummary
35
import org.ivdnt.galahad.annotations.SOURCE_LAYER_NAME
46
import org.ivdnt.galahad.corpora.Corpus
57
import org.ivdnt.galahad.exceptions.JobNotFoundException
@@ -37,10 +39,21 @@ class Jobs(
3739
// Safe to create it now
3840
return ctor(key)
3941
}
42+
4043
override fun ctor(key: String): Job = Job(dir.resolve(key), corpus)
4144
override fun throwNotFound(key: String): Nothing = throw JobNotFoundException(key)
4245
override fun deleteOrThrow(key: String) {
4346
JobController.unqueue(readOrThrow(key))
4447
super.deleteOrThrow(key)
4548
}
49+
50+
fun readAllMetadata(): List<JobMetadata> {
51+
// Create a map of all taggers with empty metadata
52+
val allJobs = Tagger.taggers.mapValues {
53+
JobMetadata(it.value, Progress(), LayerPreview(emptyList()), LayerSummary(0), 0)
54+
}
55+
// replace the entries for which a job exists
56+
val jobs = readAll().map { it.metadata }.associateBy { it.tagger.id }
57+
return (allJobs + jobs).values.toList()
58+
}
4659
}

server/src/main/kotlin/org/ivdnt/galahad/web/controller/JobsController.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ class JobsController(
4747
@GetMapping(JOBS_URL)
4848
fun getJobs(
4949
@PathVariable @Parameter(description = "Corpus UUID") corpus: UUID,
50-
@RequestParam(defaultValue = "true") @Parameter(description = "Only show jobs that have a result. Otherwise also shows potential jobs.") hasResult: Boolean = true,
51-
): List<JobMetadata> = corpus.readJobs().readAll().map { it.metadata }.toList()
50+
): List<JobMetadata> = corpus.readJobs().readAllMetadata()
5251

5352
@Operation(
5453
summary = "Get single job metadata",

0 commit comments

Comments
 (0)