Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add zipfilename to title and overview #1444

Merged
merged 4 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions report-viewer/src/stores/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export interface State {

fileIdToDisplayName: Map<string, string>
submissionIdsToComparisonFileName: Map<string, Map<string, string>>
/**
* Name of the file uploaded
*/
uploadedFileName: string
}

/**
Expand Down
6 changes: 4 additions & 2 deletions report-viewer/src/stores/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const store = defineStore('store', {
singleModeUsed: false,
// only used in single mode
singleFillRawContent: '',
fileIdToDisplayName: new Map()
fileIdToDisplayName: new Map(),
uploadedFileName: ''
},
uiState: {
useDarkMode: false,
Expand Down Expand Up @@ -101,7 +102,8 @@ const store = defineStore('store', {
zipModeUsed: false,
singleModeUsed: false,
singleFillRawContent: '',
fileIdToDisplayName: new Map()
fileIdToDisplayName: new Map(),
uploadedFileName: ''
}
},
/**
Expand Down
5 changes: 5 additions & 0 deletions report-viewer/src/views/FileUploadView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ fetch('/results.zip')
})
.catch(() => {})

document.title = 'JPlag Report Viewer'
const loadingFiles = ref(false)
type fileMethod = 'query' | 'local' | 'upload' | 'unknown'
const errors: Ref<{ error: Error; source: fileMethod }[]> = ref([])
Expand Down Expand Up @@ -162,6 +163,7 @@ async function uploadFileOnDrag(e: DragEvent) {
let dropped = e.dataTransfer?.files
try {
if (dropped?.length === 1) {
store().state.uploadedFileName = dropped[0].name
await handleFile(dropped[0])
} else {
throw new Error('Not exactly one file')
Expand All @@ -185,6 +187,7 @@ async function uploadFileThroughWindow() {
if (!file) {
return
}
store().state.uploadedFileName = file.name
handleFile(file)
}
input.click()
Expand All @@ -209,6 +212,7 @@ async function loadQueryFile(url: URL) {
* Handles click on Continue with local files.
*/
function continueWithLocal() {
store().state.uploadedFileName = 'results.zip'
store().setLoadingType({
local: true,
zip: localFiles.value === 'zip',
Expand All @@ -219,6 +223,7 @@ function continueWithLocal() {

function registerError(error: Error, source: fileMethod) {
loadingFiles.value = false
store().state.uploadedFileName = ''
errors.value.push({ error, source })
console.error(error)
}
Expand Down
3 changes: 3 additions & 0 deletions report-viewer/src/views/InformationView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<TextInformation label="Min Token Match" class="pb-1">{{
overview.matchSensitivity
}}</TextInformation>
<TextInformation label="Result File Name">{{
store().state.uploadedFileName
}}</TextInformation>
</ScrollableComponent>
</Container>

Expand Down
5 changes: 5 additions & 0 deletions report-viewer/src/views/OverviewView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<h2>JPlag Report</h2>
<div class="flex flex-row items-center space-x-5">
<TextInformation label="Submission Directory">{{ submissionPathValue }}</TextInformation>
<TextInformation label="Result name">{{
store().state.uploadedFileName
}}</TextInformation>
<TextInformation label="Total Submissions">{{
store().getSubmissionIds.length
}}</TextInformation>
Expand Down Expand Up @@ -139,6 +142,8 @@ const props = defineProps({
}
})

document.title = `${store().state.uploadedFileName} - JPlag Report Viewer`

const hasMoreSubmissionPaths = computed(() => props.overview.submissionFolderPath.length > 1)
const submissionPathValue = computed(() =>
hasMoreSubmissionPaths.value
Expand Down