From 6b9de2bd635852ce718fba2b3ccf94031ca3d4bc Mon Sep 17 00:00:00 2001 From: Arild Matsson Date: Tue, 22 Aug 2023 14:35:37 +0200 Subject: [PATCH 1/3] Fix locale default value, fix #116 --- src/i18n/locale.composable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/locale.composable.js b/src/i18n/locale.composable.js index 9217157..5ece7aa 100644 --- a/src/i18n/locale.composable.js +++ b/src/i18n/locale.composable.js @@ -3,7 +3,7 @@ import { useI18n } from "vue-i18n"; import { useStorage } from "@vueuse/core"; import { filesize } from "filesize"; -const storedLocale = useStorage("locale"); +const storedLocale = useStorage("locale", ""); export default function useLocale() { const { locale } = useI18n(); From cf4f31511a616fda47d82915875b91819d617a7e Mon Sep 17 00:00:00 2001 From: Arild Matsson Date: Tue, 22 Aug 2023 15:18:58 +0200 Subject: [PATCH 2/3] Load all corpora before loading one, fix #117 --- src/corpus/Corpus.vue | 10 ++++++++-- src/corpus/config/config.composable.js | 6 +++--- src/corpus/exports/exports.composable.js | 6 +++--- src/corpus/job/job.composable.js | 10 +++++----- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/corpus/Corpus.vue b/src/corpus/Corpus.vue index 9a99f2b..4f9886e 100644 --- a/src/corpus/Corpus.vue +++ b/src/corpus/Corpus.vue @@ -23,9 +23,11 @@ diff --git a/src/corpus/config/config.composable.js b/src/corpus/config/config.composable.js index 5e599d7..dda45e9 100644 --- a/src/corpus/config/config.composable.js +++ b/src/corpus/config/config.composable.js @@ -9,8 +9,8 @@ export default function useConfig(corpusId) { const { th } = useLocale(); const mink = useMinkBackend(); - const corpus = corpusStore.corpora[corpusId]; - const config = computed(() => corpus?.config); + const corpus = computed(() => corpusStore.corpora[corpusId]); + const config = computed(() => corpus.value?.config); const corpusName = computed(() => th(config.value?.name)); async function loadConfig() { @@ -21,7 +21,7 @@ export default function useConfig(corpusId) { if (error.response?.status == 404) return emptyConfig(); throw error; }); - corpus.config = config; + corpus.value.config = config; } async function uploadConfig(config, corpusId_ = corpusId) { diff --git a/src/corpus/exports/exports.composable.js b/src/corpus/exports/exports.composable.js index 1b88db2..3d5a13b 100644 --- a/src/corpus/exports/exports.composable.js +++ b/src/corpus/exports/exports.composable.js @@ -6,14 +6,14 @@ import useMessenger from "@/message/messenger.composable"; export default function useExports(corpusId) { const corpusStore = useCorpusStore(); - const corpus = corpusStore.corpora[corpusId]; - const exports = computed(() => corpus?.exports); + const corpus = computed(() => corpusStore.corpora[corpusId]); + const exports = computed(() => corpus.value?.exports); const mink = useMinkBackend(); const { alertError } = useMessenger(); async function loadExports() { const exports = await mink.loadExports(corpusId).catch(alertError); - corpus.exports = exports; + corpus.value.exports = exports; } async function downloadResult() { diff --git a/src/corpus/job/job.composable.js b/src/corpus/job/job.composable.js index db33ff3..1f6c8dc 100644 --- a/src/corpus/job/job.composable.js +++ b/src/corpus/job/job.composable.js @@ -49,23 +49,23 @@ class JobStatus { export default function useJob(corpusId) { const corpusStore = useCorpusStore(); - const corpus = corpusStore.corpora[corpusId]; + const corpus = computed(() => corpusStore.corpora[corpusId]); const mink = useMinkBackend(); const { alertError } = useMessenger(); async function loadJob() { - corpus.status = await mink + corpus.value.status = await mink .loadJob(corpusId) .catch(() => ({})) .catch(alertError); } async function runJob() { - corpus.status = await mink.runJob(corpusId).catch(alertError); + corpus.value.status = await mink.runJob(corpusId).catch(alertError); } async function install() { - corpus.status = await mink.install(corpusId).catch(alertError); + corpus.value.status = await mink.install(corpusId).catch(alertError); } async function abortJob() { @@ -73,7 +73,7 @@ export default function useJob(corpusId) { await loadJob(); } - const jobStatus = computed(() => corpus?.status); + const jobStatus = computed(() => corpus.value?.status); const sparvStatus = computed( () => new JobStatus(jobStatus.value?.job_status?.sparv) ); From 9b44cb3b0fba41f15a87318734515e4bf34076a0 Mon Sep 17 00:00:00 2001 From: Arild Matsson Date: Tue, 22 Aug 2023 15:20:58 +0200 Subject: [PATCH 3/3] Fix undefined callback --- src/auth/auth.composable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auth/auth.composable.js b/src/auth/auth.composable.js index 5451790..0f4c08f 100644 --- a/src/auth/auth.composable.js +++ b/src/auth/auth.composable.js @@ -51,7 +51,7 @@ export function useAuth() { router.push("/access-denied"); return; } - callback(); + callback?.(); } /** Fetch JWT, store it and use it for API client. */