Skip to content

Commit dcf809d

Browse files
committed
Partial fix of evaluate job select
1 parent a67ea61 commit dcf809d

46 files changed

Lines changed: 285 additions & 361 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

client/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM node:24.0.2-alpine3.21 AS build
22
COPY . .
3-
RUN npm ci && npm run build-only
3+
RUN npm ci && npm run build
44

55
FROM nginx:1.28.0-alpine3.21-slim
66
COPY --from=build /dist /usr/share/nginx/html

client/package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"@biomejs/biome": "^1.9.4",
2424
"@rollup/plugin-yaml": "^4.1.2",
2525
"@tsconfig/node24": "^24.0.1",
26+
"@types/content-disposition": "^0.5.8",
2627
"@types/node": "^22.15.21",
2728
"@vitejs/plugin-vue": "^5.2.4",
2829
"@vue/tsconfig": "^0.7.0",

client/src/App.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
</template>
1010
</GTabs>
1111

12-
<GModal :show="appStore.errors.length > 0" title="Ocharme!" @hide="appStore.resetErrors">
12+
<GModal :show="errorsStore.errors.length > 0" title="Ocharme!" @hide="errorsStore.resetErrors">
1313
<p>
1414
Please try again or contact
1515
<MailAddress /> for support.
1616
</p>
17-
<GInfo v-for="(error, i) in appStore.errors" :key="i" error>{{ error }}</GInfo>
17+
<GInfo v-for="(error, i) in errorsStore.errors" :key="i" error>{{ error }}</GInfo>
1818
</GModal>
1919
</template>
2020

2121
<script setup lang="ts">
2222
import stores from "@/stores"
2323
24-
const appStore = stores.useApp()
24+
const errorsStore = stores.useErrors()
2525
const userStore = stores.useUser()
2626
2727
onMounted(() => {

client/src/api/benchmarks.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,13 @@
22
* API for fetching benchmarks.
33
*/
44

5+
import axios, { type AxiosResponse } from "axios"
56
import type { Benchmarks } from "@/types/assays"
6-
// --- libraries ---
7-
import axios from "axios"
8-
// --- types ---
9-
import type { AxiosResponse } from "axios"
107

118
type BenchmarksResponse = AxiosResponse<Benchmarks>
129

13-
// --- data ---
1410
const benchmarksPath = "/benchmarks"
1511

16-
// --- methods ---
1712
/**
1813
* Fetch all benchmarks.
1914
*/

client/src/api/corpora.ts

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,19 @@
22
* API calls for creating, updating, deleting a corpus, and fetching the list of corpora.
33
*/
44

5+
import axios, { type AxiosResponse } from "axios"
56
import type {
67
CorpusMetadata,
78
MutableCorpusMetadata,
89
UUID,
910
} from "@/types/corpora"
10-
// --- libraries ---
11-
import axios from "axios"
12-
// --- types ---
13-
import type { AxiosResponse } from "axios"
1411

1512
type CorporaResponse = AxiosResponse<CorpusMetadata[]>
1613
type CorpusResponse = AxiosResponse<CorpusMetadata>
1714

18-
// --- data ---
1915
const corporaPath = "/corpora"
20-
const datasetCorporaPath = "/datasets_corpora"
16+
const corpusPath = (uuid: UUID): string => `${corporaPath}/${uuid}`
2117

22-
// --- computed ---
23-
const corpusPath = (uuid: UUID) => `${corporaPath}/${uuid}`
24-
25-
// --- methods ---
2618
/**
2719
* Fetch all corpora for which the user has read access:
2820
* public (datasets), shared (collaborator/viewer), and owned.
@@ -39,13 +31,6 @@ export function getCorpus(uuid: UUID): Promise<CorpusResponse> {
3931
return axios.get(corpusPath(uuid))
4032
}
4133

42-
/**
43-
* Fetch all datasets. Note that all datasets are public. Cheaper than getCorpora().
44-
*/
45-
export function getDatasetCorpora(): Promise<CorporaResponse> {
46-
return axios.get(datasetCorporaPath)
47-
}
48-
4934
/**
5035
* Create a new corpus with the given metadata.
5136
* @param corpus Metadata of new corpus.
@@ -60,7 +45,7 @@ export function postCorpus(
6045
* Delete a corpus by UUID.
6146
* @param uuid UUID of corpus to delete.
6247
*/
63-
export function deleteCorpus(uuid: UUID) {
48+
export function deleteCorpus(uuid: UUID): Promise<AxiosResponse> {
6449
return axios.delete(corpusPath(uuid))
6550
}
6651

@@ -69,6 +54,9 @@ export function deleteCorpus(uuid: UUID) {
6954
* @param uuid UUID of corpus to update.
7055
* @param metadata New metadata.
7156
*/
72-
export function patchCorpus(uuid: UUID, metadata: MutableCorpusMetadata) {
57+
export function patchCorpus(
58+
uuid: UUID,
59+
metadata: MutableCorpusMetadata,
60+
): Promise<AxiosResponse> {
7361
return axios.patch(corpusPath(uuid), metadata)
7462
}

client/src/api/documents.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,19 @@
33
* and downloading the uploaded source document.
44
*/
55

6-
// -- api ---
7-
import * as Utils from "@/api/utils"
8-
import type { BlobResponse } from "@/api/utils"
6+
import axios, { type AxiosResponse } from "axios"
7+
import { getBlob, type BlobResponse } from "@/api/utils"
98
import type { UUID } from "@/types/corpora"
109
import type { DocumentMetadata } from "@/types/documents"
11-
// --- libraries ---
12-
import axios from "axios"
13-
// --- types ---
14-
import type { AxiosResponse } from "axios"
1510

1611
type DocumentsResponse = AxiosResponse<DocumentMetadata[]>
1712

18-
// --- computed ---
19-
const documentsPath = (corpus: UUID) => `/corpora/${corpus}/documents`
20-
const documentPath = (corpus: UUID, document: string) =>
13+
const documentsPath = (corpus: UUID): string => `/corpora/${corpus}/documents`
14+
const documentPath = (corpus: UUID, document: string): string =>
2115
`${documentsPath(corpus)}/${document}`
22-
const rawDocumentPath = (corpus: UUID, document: string) =>
16+
const rawDocumentPath = (corpus: UUID, document: string): string =>
2317
`${documentPath(corpus, document)}/raw`
2418

25-
// --- methods ---
2619
/**
2720
* Fetch all documents for a corpus.
2821
* @param corpus UUID of the corpus.
@@ -41,7 +34,7 @@ export function postDocument(
4134
corpus: UUID,
4235
document: FormData,
4336
contentType?: Record<string, string>,
44-
) {
37+
): Promise<AxiosResponse> {
4538
return axios.post(documentsPath(corpus), document, { headers: contentType })
4639
}
4740

@@ -50,7 +43,10 @@ export function postDocument(
5043
* @param corpus UUID of the corpus.
5144
* @param document Document name.
5245
*/
53-
export function deleteDocument(corpus: UUID, document: string) {
46+
export function deleteDocument(
47+
corpus: UUID,
48+
document: string,
49+
): Promise<AxiosResponse> {
5450
return axios.delete(documentPath(corpus, document))
5551
}
5652

@@ -63,5 +59,5 @@ export function getRawDocument(
6359
corpus: UUID,
6460
document: string,
6561
): Promise<BlobResponse> {
66-
return Utils.getBlob(rawDocumentPath(corpus, document))
62+
return getBlob(rawDocumentPath(corpus, document))
6763
}

client/src/api/evaluation.ts

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,40 @@
22
* API calls for fetching evaluation metrics and downloading them as a zip report.
33
*/
44

5-
// --- api ---
6-
import * as Utils from "@/api/utils"
7-
import type { BlobResponse } from "@/api/utils"
5+
import axios, { type AxiosResponse } from "axios"
6+
import { getBlob, type BlobResponse } from "@/api/utils"
87
import type { UUID } from "@/types/corpora"
98
import type {
109
ConfusionWrapper,
1110
DistributionWrapper,
1211
Metrics,
1312
TermComparison,
1413
} from "@/types/evaluation"
15-
// --- libraries ---
16-
import axios from "axios"
17-
// --- types ---
18-
import type { AxiosResponse } from "axios"
1914

2015
type ConfusionResponse = AxiosResponse<ConfusionWrapper>
2116
type DistributionResponse = AxiosResponse<DistributionWrapper>
2217
type MetricsResponse = AxiosResponse<Metrics>
2318

24-
// --- computed ---
25-
const evaluationPath = (corpus: UUID, hypothesis: string) =>
19+
const evaluationPath = (corpus: UUID, hypothesis: string): string =>
2620
`/corpora/${corpus}/jobs/${hypothesis}/evaluation`
27-
const confusionPath = (corpus: UUID, hypothesis: string) =>
21+
const confusionPath = (corpus: UUID, hypothesis: string): string =>
2822
`${evaluationPath(corpus, hypothesis)}/confusion`
29-
const confusionSamplesPath = (corpus: UUID, hypo: string) =>
30-
`${evaluationPath(corpus, hypo)}/confusion/download`
31-
const distributionPath = (corpus: UUID, hypothesis: string) =>
23+
const confusionSamplesPath = (corpus: UUID, hypo: string): string =>
24+
`${confusionPath(corpus, hypo)}/download`
25+
const distributionPath = (corpus: UUID, hypothesis: string): string =>
3226
`${evaluationPath(corpus, hypothesis)}/distribution`
33-
const metricsPath = (corpus: UUID, hypothesis: string) =>
27+
const metricsPath = (corpus: UUID, hypothesis: string): string =>
3428
`${evaluationPath(corpus, hypothesis)}/metrics`
35-
const metricsSamplesPath = (corpus: UUID, hypo: string) =>
36-
`${evaluationPath(corpus, hypo)}/metrics/download`
37-
const downloadPath = (corpus: UUID, hypothesis: string) =>
29+
const metricsSamplesPath = (corpus: UUID, hypo: string): string =>
30+
`${metricsPath(corpus, hypo)}/download`
31+
const downloadPath = (corpus: UUID, hypothesis: string): string =>
3832
`${evaluationPath(corpus, hypothesis)}/download`
3933
const documentLayerComparisonPath = (
4034
corpus: UUID,
4135
job: string,
4236
document: string,
43-
) => `/corpora/${corpus}/jobs/${job}/documents/${document}/evaluation`
37+
): string => `/corpora/${corpus}/jobs/${job}/documents/${document}/evaluation`
4438

45-
// --- methods ---
4639
/**
4740
* Fetch term frequency distribution.
4841
* @param corpus UUID of the corpus.
@@ -96,7 +89,7 @@ export function getDownloadEvaluation(
9689
hypothesis: string,
9790
reference: string,
9891
): Promise<BlobResponse> {
99-
return Utils.getBlob(downloadPath(corpus, hypothesis), {
92+
return getBlob(downloadPath(corpus, hypothesis), {
10093
params: { reference },
10194
})
10295
}
@@ -117,7 +110,7 @@ export function getConfusionSamples(
117110
refFilter: string,
118111
annotationType: string,
119112
): Promise<BlobResponse> {
120-
return Utils.getBlob(confusionSamplesPath(corpus, hypothesis), {
113+
return getBlob(confusionSamplesPath(corpus, hypothesis), {
121114
params: { reference, hypoFilter, refFilter, annotationType },
122115
})
123116
}
@@ -147,7 +140,7 @@ export function getMetricsSamples(
147140
if (group) {
148141
params.group = group
149142
}
150-
return Utils.getBlob(metricsSamplesPath(corpus, hypothesis), { params })
143+
return getBlob(metricsSamplesPath(corpus, hypothesis), { params })
151144
}
152145

153146
/**

client/src/api/export.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,25 @@
33
* Either converted to a certain format or merged with their original file if the format supports it.
44
*/
55

6-
// --- api ---
7-
import * as Utils from "@/api/utils"
8-
// --- types ---
9-
import type { BlobResponse } from "@/api/utils"
6+
import { getBlob, type BlobResponse } from "@/api/utils"
107
import type { UUID } from "@/types/corpora"
118
import type { Format } from "@/types/documents"
129

13-
// --- computed ---
1410
const convertCorpusPath = (
1511
corpus: UUID,
1612
job: string,
1713
format: Format,
1814
posHeadOnly: boolean,
19-
) =>
15+
): string =>
2016
`/corpora/${corpus}/jobs/${job}/export/convert?format=${format}&posHeadOnly=${posHeadOnly}`
2117
const mergeCorpusPath = (
2218
corpus: UUID,
2319
job: string,
2420
format: Format,
2521
posHeadOnly: boolean,
26-
) =>
22+
): string =>
2723
`/corpora/${corpus}/jobs/${job}/export/merge?format=${format}&posHeadOnly=${posHeadOnly}`
2824

29-
// --- methods ---
3025
/**
3126
* Download a corpus converted to the desired format.
3227
* @param corpus UUID of the corpus.
@@ -40,7 +35,7 @@ export function convertCorpus(
4035
format: Format,
4136
posHeadOnly: boolean,
4237
): Promise<BlobResponse> {
43-
return Utils.getBlob(convertCorpusPath(corpus, job, format, posHeadOnly))
38+
return getBlob(convertCorpusPath(corpus, job, format, posHeadOnly))
4439
}
4540

4641
/**
@@ -56,5 +51,5 @@ export function mergeCorpus(
5651
format: Format,
5752
posHeadOnly: boolean,
5853
): Promise<BlobResponse> {
59-
return Utils.getBlob(mergeCorpusPath(corpus, job, format, posHeadOnly))
54+
return getBlob(mergeCorpusPath(corpus, job, format, posHeadOnly))
6055
}
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,18 @@
22
* Axios config.
33
*/
44

5-
// --- libraries ---
65
import axios from "axios"
76

8-
// --- types ---
97
export type ErrorMessage = {
108
statusCode: string
119
message: string
1210
}
1311

14-
// --- methods ---
1512
/**
1613
* Set the axios request base to localhost:8010 if running locally,
1714
* or https://<hostname>/galahad/api/ if running in production.
1815
*/
19-
export const setAxiosBaseUrl = () => {
16+
export function setAxiosBaseUrl(): void {
2017
axios.defaults.baseURL =
2118
location.hostname === "localhost"
2219
? `${location.protocol}//localhost:8010`

0 commit comments

Comments
 (0)