-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
163 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<template> | ||
<div class="flex h-screen text-center"> | ||
<div class="w-screen"> | ||
<div> | ||
<img | ||
class="mx-auto mt-32 h-auto w-60" | ||
src="@/assets/jplag-light-transparent.png" | ||
alt="JPlag Logo" | ||
v-if="store().uiState.useDarkMode" | ||
/> | ||
<img | ||
class="mx-auto mt-32 h-auto w-60" | ||
src="@/assets/jplag-dark-transparent.png" | ||
alt="JPlag Logo" | ||
v-else | ||
/> | ||
</div> | ||
<Container class="mx-auto mt-10 w-fit max-w-5xl space-y-5 p-5"> | ||
<div class="space-y-2"> | ||
<h3 class="text-2xl font-bold"> | ||
You are trying to open a report from an older version of JPlag | ||
</h3> | ||
<p class="text-xl"> | ||
The report you are trying to open has version {{ uploadedVersion.toString() }}. <br /> | ||
The current version of JPlag is {{ reportViewerVersion.toString() }}. The report viewer | ||
can open reports from version {{ minimalReportVersion.toString() }}<br /> | ||
You can access the old report viewer here: | ||
</p> | ||
</div> | ||
<a :href="buildOldVersionLink()"> | ||
<Interactable class="mx-auto mt-2 !border-accent-dark !bg-accent !bg-opacity-50"> | ||
Open old report viewer | ||
</Interactable> | ||
</a> | ||
<RouterLink :to="{ name: 'FileUploadView' }"> | ||
<Interactable class="mx-auto mt-6"> Back to file upload </Interactable> | ||
</RouterLink> | ||
</Container> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import Container from '@/components/ContainerComponent.vue' | ||
import Interactable from '@/components/InteractableComponent.vue' | ||
import { store } from '@/stores/store' | ||
import { reportViewerVersion, minimalReportVersion, Version } from '@/model/Version' | ||
import { computed } from 'vue' | ||
const props = defineProps({ | ||
version: { | ||
type: String, | ||
required: true | ||
} | ||
}) | ||
const uploadedVersion = computed(() => { | ||
const parts = props.version.split('.').map(Number) | ||
return new Version(parts[0], parts[1], parts[2]) | ||
}) | ||
/** | ||
* @param minVersion is inclusive | ||
* @param maxVersion is inclusive | ||
*/ | ||
interface VersionMapEntry { | ||
minVersion: Version | ||
maxVersion: Version | ||
pathName: string | ||
} | ||
const versionMap: VersionMapEntry[] = [ | ||
{ | ||
minVersion: new Version(4, 2, 0), | ||
maxVersion: new Version(5, 1, 0), | ||
pathName: 'v5' | ||
} | ||
] | ||
const requestedVersion = computed(() => { | ||
for (const entry of versionMap) { | ||
if ( | ||
uploadedVersion.value.compareTo(entry.minVersion) >= 0 && | ||
uploadedVersion.value.compareTo(entry.maxVersion) <= 0 | ||
) { | ||
return entry | ||
} | ||
} | ||
return null | ||
}) | ||
function buildOldVersionLink() { | ||
return `${window.location.origin}/${requestedVersion.value?.pathName}/` | ||
} | ||
</script> |