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

Remove single file upload #1957

Merged
merged 1 commit into from
Aug 30, 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
2 changes: 0 additions & 2 deletions report-viewer/src/model/factories/BaseFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export class BaseFactory {
return await (await this.getLocalFile(`/files/${path}`)).text()
} else if (store().state.zipModeUsed) {
return this.getFileFromStore(path)
} else if (store().state.singleModeUsed) {
return store().state.singleFillRawContent
} else if (await this.useLocalZipMode()) {
await new ZipFileHandler().handleFile(await this.getLocalFile(this.zipFileName))
store().setLoadingType('zip')
Expand Down
17 changes: 0 additions & 17 deletions report-viewer/src/model/fileHandling/JsonFileHandler.ts

This file was deleted.

8 changes: 0 additions & 8 deletions report-viewer/src/stores/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ export interface State {
* Indicates whether zip mode is used.
*/
zipModeUsed: boolean
/**
* Indicates whether single file mode is used.
*/
singleModeUsed: boolean
/**
* Files string if single mode is used.
*/
singleFillRawContent: string

fileIdToDisplayName: Map<string, string>
submissionIdsToComparisonFileName: Map<string, Map<string, string>>
Expand Down
15 changes: 1 addition & 14 deletions report-viewer/src/stores/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ const store = defineStore('store', {
// Mode that was used to load the files
localModeUsed: false,
zipModeUsed: false,
singleModeUsed: false,
// only used in single mode
singleFillRawContent: '',
fileIdToDisplayName: new Map(),
uploadedFileName: ''
},
Expand Down Expand Up @@ -133,8 +130,6 @@ const store = defineStore('store', {
submissions: {},
localModeUsed: false,
zipModeUsed: false,
singleModeUsed: false,
singleFillRawContent: '',
fileIdToDisplayName: new Map(),
uploadedFileName: ''
}
Expand Down Expand Up @@ -201,17 +196,9 @@ const store = defineStore('store', {
* Sets the loading type
* @param payload Type used to input JPlag results
*/
setLoadingType(loadingType: 'zip' | 'local' | 'single') {
setLoadingType(loadingType: 'zip' | 'local') {
this.state.localModeUsed = loadingType == 'local'
this.state.zipModeUsed = loadingType == 'zip'
this.state.singleModeUsed = loadingType == 'single'
},
/**
* Sets the raw content of the single file mode
* @param payload Raw content of the single file mode
*/
setSingleFileRawContent(payload: string) {
this.state.singleFillRawContent = payload
},
/**
* Switches whether darkMode is being used for the UI
Expand Down
18 changes: 0 additions & 18 deletions report-viewer/src/views/FileUploadView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import Button from '@/components/ButtonComponent.vue'
import VersionInfoComponent from '@/components/VersionInfoComponent.vue'
import LoadingCircle from '@/components/LoadingCircle.vue'
import { ZipFileHandler } from '@/model/fileHandling/ZipFileHandler'
import { JsonFileHandler } from '@/model/fileHandling/JsonFileHandler'
import { BaseFactory } from '@/model/factories/BaseFactory'

store().clearStore()
Expand Down Expand Up @@ -111,21 +110,6 @@ function navigateToOverview() {
})
}

/**
* Handles a json file on drop. It read the file and passes the file string to next window.
* @param file The json file to handle
*/
async function handleJsonFile(file: Blob) {
try {
await new JsonFileHandler().handleFile(file)
} catch (e) {
registerError(e as Error, 'upload')
return
}
store().setLoadingType('single')
navigateToOverview()
}

/**
* Handles a file on drop. It determines the file type and passes it to the corresponding handler.
* @param file File to handle
Expand All @@ -140,8 +124,6 @@ async function handleFile(file: Blob) {
store().setLoadingType('zip')
await new ZipFileHandler().handleFile(file)
return navigateToOverview()
case 'application/json':
return await handleJsonFile(file)
default:
throw new Error(`Unknown MIME type '${file.type}'`)
}
Expand Down