2727 />
2828 </div >
2929 <h1 class =" text-7xl" >JPlag Report Viewer</h1 >
30- <div v-if =" !hasQueryFile && ! loadingFiles && !exampleFiles" >
30+ <div v-if =" !loadingFiles && !exampleFiles" >
3131 <div
3232 class =" border-accent-dark bg-accent/25 mx-auto mt-10 flex w-96 cursor-pointer flex-col justify-center rounded-md border px-5 py-5"
3333 @click =" uploadFileThroughWindow()"
5656
5757<script setup lang="ts">
5858import { onErrorCaptured , ref , type Ref } from ' vue'
59- import { useRoute } from ' vue-router'
6059import { router } from ' @/router'
6160import VersionInfoComponent from ' ../components/VersionInfoComponent.vue'
6261import { reportStore } from ' @/stores/reportStore'
63- import { REPORT_FILE_NAME , useLocalReportFileMode } from ' @/stores/fileLoading'
62+ import { canLoadFile } from ' @/stores/fileLoading'
6463import { uiStore } from ' @/stores/uiStore'
6564import { ReportFileHandler } from ' @jplag/parser'
6665import { LoadingCircle } from ' @jplag/ui-components/base'
@@ -69,7 +68,7 @@ reportStore().reset()
6968
7069const exampleFiles = ref (import .meta .env .MODE == ' demo' || import .meta .env .MODE == ' dev-demo' )
7170
72- useLocalReportFileMode ().then ((value ) => {
71+ canLoadFile ().then ((value ) => {
7372 if (value ) {
7473 navigateToOverview ()
7574 }
@@ -81,22 +80,6 @@ const loadingFiles = ref(false)
8180type fileMethod = ' query' | ' upload' | ' unknown'
8281const errors: Ref <{ error: Error ; source: fileMethod }[]> = ref ([])
8382
84- // Loads file passed in query param, if any.
85- const queryParams = useRoute ().query
86- let queryFileURL: URL | null = null
87- if (typeof queryParams .file === ' string' && queryParams .file !== ' ' ) {
88- try {
89- queryFileURL = new URL (queryParams .file )
90- } catch (e ) {
91- registerError (e as Error , ' query' )
92- queryFileURL = null
93- }
94- }
95- if (queryFileURL !== null ) {
96- loadQueryFile (queryFileURL )
97- }
98- const hasQueryFile = queryFileURL !== null
99-
10083function navigateToOverview() {
10184 router .push ({
10285 name: ' OverviewView'
@@ -164,21 +147,6 @@ async function uploadFileThroughWindow() {
164147 input .click ()
165148}
166149
167- /**
168- * Handles click on Continue with query file.
169- */
170- async function loadQueryFile(url : URL ) {
171- try {
172- const response = await fetch (url )
173- if (! response .ok ) {
174- throw new Error (' Response not OK' )
175- }
176- await handleFile (await response .blob (), REPORT_FILE_NAME )
177- } catch (e ) {
178- registerError (e as Error , ' query' )
179- }
180- }
181-
182150function registerError(error : Error , source : fileMethod ) {
183151 loadingFiles .value = false
184152 errors .value .push ({ error , source })
0 commit comments