Skip to content

Commit 7d9b9e0

Browse files
committed
make it easier to access landing page when starting report viewer locally
1 parent 5f75427 commit 7d9b9e0

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

report-viewer/report-viewer/src/stores/reportStore.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export const reportStore = defineStore('reportStore', () => {
3939
const anonymizedSet = ref(new Set<string>())
4040
const anonymizedNumber = ref(new Map<string, number>())
4141

42+
const hasLoadedLocalReportBefore = ref(false)
43+
4244
function loadReport(
4345
_files: File[],
4446
_submissionFiles: SubmissionFile[],
@@ -301,7 +303,8 @@ export const reportStore = defineStore('reportStore', () => {
301303
allAreAnonymized,
302304
setAnonymous,
303305
getBaseCodeReport,
304-
getSubmissionIds
306+
getSubmissionIds,
307+
hasLoadedLocalReportBefore
305308
}
306309
})
307310

report-viewer/report-viewer/src/views/FileUploadView.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@
3535
<div>Drag and Drop report file on this page</div>
3636
<div>Or click here to select a file</div>
3737
</div>
38+
<!-- When we loaded a local report we can assume that a local report is present. If this is not the case we catch this with the localFileStatus -->
39+
<ButtonComponent
40+
v-if="reportStore().hasLoadedLocalReportBefore && localFileStatus !== 'notFound'"
41+
class="mx-auto my-2 w-96"
42+
@click="navigateToOverview()"
43+
>
44+
Open Local Report
45+
</ButtonComponent>
3846
<div>(No files will be uploaded)</div>
3947
<a
4048
href="https://github.com/jplag/JPlag/wiki/1.-How-to-Use-JPlag"
@@ -63,13 +71,17 @@ import { canLoadFile } from '@/stores/fileLoading'
6371
import { uiStore } from '@/stores/uiStore'
6472
import { ReportFileHandler } from '@jplag/parser'
6573
import { LoadingCircle } from '@jplag/ui-components/base'
74+
import ButtonComponent from '@jplag/ui-components/base/ButtonComponent.vue'
6675
6776
reportStore().reset()
77+
const localFileStatus = ref<'found' | 'notFound' | 'unknown'>('unknown')
6878
6979
const exampleFiles = ref(import.meta.env.MODE == 'demo' || import.meta.env.MODE == 'dev-demo')
7080
7181
canLoadFile().then((value) => {
72-
if (value) {
82+
localFileStatus.value = value ? 'found' : 'notFound'
83+
if (value && !reportStore().hasLoadedLocalReportBefore) {
84+
reportStore().hasLoadedLocalReportBefore = true
7385
navigateToOverview()
7486
}
7587
})

0 commit comments

Comments
 (0)