Force reload the page on Import Analysis

This commit is contained in:
Soufiane Fariss
2024-07-31 21:24:38 +02:00
parent 0ea6f1e270
commit b7b8792f70
3 changed files with 6 additions and 17 deletions

View File

@@ -1,21 +1,13 @@
<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import Menubar from 'primevue/menubar'
const router = useRouter()
const items = ref([
{
label: 'Import Analysis',
icon: 'pi pi-file-import',
command: () => {
router.push('/')
// Force a route change even if we're already on the home page
// we need to this to force the page to reload
router.go(0)
}
command: () => window.location.replace(window.location.origin)
}
])
</script>
@@ -35,4 +27,4 @@ const items = ref([
</div>
</template>
</Menubar>
</template>
</template>

View File

@@ -17,7 +17,7 @@ export function useRdocLoader() {
const checkVersion = (rdoc) => {
const version = rdoc.meta.version
if (version < MIN_SUPPORTED_VERSION) {
console.log(
console.error(
`Version ${version} is not supported. Please use version ${MIN_SUPPORTED_VERSION} or higher.`
)
toast.add({
@@ -53,7 +53,7 @@ export function useRdocLoader() {
}
data = await response.json()
} else if (typeof source === 'object') {
// Direct JSON object
// Direct JSON object (Preview options)
data = source
} else {
throw new Error('Invalid source type')
@@ -67,7 +67,7 @@ export function useRdocLoader() {
summary: 'Success',
detail: 'JSON data loaded successfully',
life: 3000,
group: 'bc'
group: 'bc' // bottom-center
})
} else {
rdocData.value = null
@@ -80,7 +80,7 @@ export function useRdocLoader() {
summary: 'Error',
detail: error.message,
life: 3000,
group: 'bc'
group: 'bc' // bottom-center
})
}
}

View File

@@ -61,7 +61,6 @@ onMounted(() => {
</script>
<template>
<!-- When rdocData is set to null or version is not valid, show the description panel and upload options. -->
<Panel v-if="!rdocData || !isValidVersion">
<DescriptionPanel />
<UploadOptions
@@ -72,8 +71,6 @@ onMounted(() => {
/>
</Panel>
<!-- When rdocData is set and version is valid, show the metadata, settings panel, rule matches table,
function capabilities or process capabilities. -->
<Toast position="bottom-center" group="bc" />
<template v-if="rdocData && isValidVersion">
<MetadataPanel :data="rdocData" />