add error message in homepage of dataset visualizer if could not load dataset
This commit is contained in:
parent
fe483b1d0d
commit
c97d3c36e4
|
@ -9,10 +9,21 @@
|
||||||
</head>
|
</head>
|
||||||
<body class="h-screen overflow-hidden font-mono text-white" x-data="{
|
<body class="h-screen overflow-hidden font-mono text-white" x-data="{
|
||||||
inputValue: '',
|
inputValue: '',
|
||||||
|
errorMessage: '',
|
||||||
navigateToDataset() {
|
navigateToDataset() {
|
||||||
const trimmedValue = this.inputValue.trim();
|
const trimmedValue = this.inputValue.trim();
|
||||||
if (trimmedValue) {
|
if (trimmedValue) {
|
||||||
window.location.href = `/${trimmedValue}`;
|
fetch(`/${trimmedValue}`, { method: 'HEAD' })
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
window.location.href = `/${trimmedValue}`;
|
||||||
|
} else {
|
||||||
|
this.errorMessage = `Error when trying to visualize the dataset. Please make sure you uploaded the dataset ${trimmedValue}`;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.errorMessage = `Error when trying to visualize the dataset. Please make sure you uploaded the dataset ${trimmedValue}`;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}">
|
}">
|
||||||
|
@ -54,7 +65,8 @@
|
||||||
Go
|
Go
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Display error message if dataset not found -->
|
||||||
|
<div x-show="errorMessage" class="text-red-500 mt-2" x-text="errorMessage"></div>
|
||||||
<details class="mt-4 max-w-full px-4">
|
<details class="mt-4 max-w-full px-4">
|
||||||
<summary>More example datasets</summary>
|
<summary>More example datasets</summary>
|
||||||
<ul class="list-disc list-inside max-h-28 overflow-y-auto break-all">
|
<ul class="list-disc list-inside max-h-28 overflow-y-auto break-all">
|
||||||
|
@ -65,4 +77,4 @@
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue