Added search error page
For example while searching for curl and wget
This commit is contained in:
parent
0363294325
commit
79ab849df0
@ -186,10 +186,11 @@ export default defineComponent({
|
|||||||
|
|
||||||
// Search watcher
|
// Search watcher
|
||||||
watch(result, newValue => {
|
watch(result, newValue => {
|
||||||
const { next: nextResult, total, type, data: newData } = newValue
|
const { next: nextResult, total, type, data: newData, error } = newValue
|
||||||
|
|
||||||
const currentTabKey = `${type}Tab`
|
const currentTabKey = `${type}Tab`
|
||||||
let next = total
|
let next = total
|
||||||
|
state.results[currentTabKey].error = error
|
||||||
|
|
||||||
if (nextResult) {
|
if (nextResult) {
|
||||||
next = parseInt(nextResult.match(/index=(\d*)/)[1])
|
next = parseInt(nextResult.match(/index=(\d*)/)[1])
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
<BaseLoadingPlaceholder v-if="isLoading" />
|
<BaseLoadingPlaceholder v-if="isLoading" />
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div v-if="viewInfo.data.length === 0">
|
<ResultsError v-if="viewInfo.error" :error="viewInfo.error"></ResultsError>
|
||||||
<h1>{{ $t('search.noResultsAlbum') }}</h1>
|
<div v-else-if="viewInfo.data.length === 0">
|
||||||
|
<h1 class="text-center">{{ $t('search.noResultsAlbum') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else class="release-grid">
|
<div v-else class="release-grid">
|
||||||
@ -45,11 +46,13 @@
|
|||||||
<script>
|
<script>
|
||||||
import BaseLoadingPlaceholder from '@components/globals/BaseLoadingPlaceholder.vue'
|
import BaseLoadingPlaceholder from '@components/globals/BaseLoadingPlaceholder.vue'
|
||||||
import CoverContainer from '@components/globals/CoverContainer.vue'
|
import CoverContainer from '@components/globals/CoverContainer.vue'
|
||||||
|
import ResultsError from '@components/search/ResultsError.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
BaseLoadingPlaceholder,
|
BaseLoadingPlaceholder,
|
||||||
CoverContainer
|
CoverContainer,
|
||||||
|
ResultsError
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
viewInfo: {
|
viewInfo: {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<section>
|
<section>
|
||||||
<div v-if="!thereAreResults">
|
<ResultsError v-if="viewInfo.ERROR" :error="viewInfo.ERROR"></ResultsError>
|
||||||
<h1>{{ $t('search.noResults') }}</h1>
|
<div v-else-if="!thereAreResults">
|
||||||
|
<h1 class="text-center">{{ $t('search.noResults') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
@ -66,6 +67,7 @@ import ResultsTracks from '@components/search/ResultsTracks.vue'
|
|||||||
import ResultsAlbums from '@components/search/ResultsAlbums.vue'
|
import ResultsAlbums from '@components/search/ResultsAlbums.vue'
|
||||||
import ResultsArtists from '@components/search/ResultsArtists.vue'
|
import ResultsArtists from '@components/search/ResultsArtists.vue'
|
||||||
import ResultsPlaylists from '@components/search/ResultsPlaylists.vue'
|
import ResultsPlaylists from '@components/search/ResultsPlaylists.vue'
|
||||||
|
import ResultsError from '@components/search/ResultsError.vue'
|
||||||
|
|
||||||
import { formatSingleTrack, formatAlbums, formatArtist, formatPlaylist } from '@/data/search'
|
import { formatSingleTrack, formatAlbums, formatArtist, formatPlaylist } from '@/data/search'
|
||||||
import { standardizeData } from '@/data/standardize'
|
import { standardizeData } from '@/data/standardize'
|
||||||
@ -76,7 +78,8 @@ export default {
|
|||||||
ResultsTracks,
|
ResultsTracks,
|
||||||
ResultsAlbums,
|
ResultsAlbums,
|
||||||
ResultsArtists,
|
ResultsArtists,
|
||||||
ResultsPlaylists
|
ResultsPlaylists,
|
||||||
|
ResultsError
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
viewInfo: {
|
viewInfo: {
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
<BaseLoadingPlaceholder v-if="isLoading" />
|
<BaseLoadingPlaceholder v-if="isLoading" />
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div v-if="viewInfo.data.length === 0">
|
<ResultsError v-if="viewInfo.error" :error="viewInfo.error"></ResultsError>
|
||||||
<h1>{{ $t('search.noResultsArtist') }}</h1>
|
<div v-else-if="viewInfo.data.length === 0">
|
||||||
|
<h1 class="text-center">{{ $t('search.noResultsArtist') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else class="release-grid">
|
<div v-else class="release-grid">
|
||||||
@ -33,11 +34,13 @@
|
|||||||
<script>
|
<script>
|
||||||
import BaseLoadingPlaceholder from '@components/globals/BaseLoadingPlaceholder.vue'
|
import BaseLoadingPlaceholder from '@components/globals/BaseLoadingPlaceholder.vue'
|
||||||
import CoverContainer from '@components/globals/CoverContainer.vue'
|
import CoverContainer from '@components/globals/CoverContainer.vue'
|
||||||
|
import ResultsError from '@components/search/ResultsError.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
BaseLoadingPlaceholder,
|
BaseLoadingPlaceholder,
|
||||||
CoverContainer
|
CoverContainer,
|
||||||
|
ResultsError
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
viewInfo: {
|
viewInfo: {
|
||||||
|
17
src/components/search/ResultsError.vue
Normal file
17
src/components/search/ResultsError.vue
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<div class="text-center">
|
||||||
|
<h1>{{ $t('search.error') }}</h1>
|
||||||
|
<p class="secondary-text mt-4">{{ error }}</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
error: {
|
||||||
|
type: String,
|
||||||
|
default: "Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -3,8 +3,9 @@
|
|||||||
<BaseLoadingPlaceholder v-if="isLoading" />
|
<BaseLoadingPlaceholder v-if="isLoading" />
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div v-if="viewInfo.data.length === 0">
|
<ResultsError v-if="viewInfo.error" :error="viewInfo.error"></ResultsError>
|
||||||
<h1>{{ $t('search.noResultsPlaylist') }}</h1>
|
<div v-else-if="viewInfo.data.length === 0">
|
||||||
|
<h1 class="text-center">{{ $t('search.noResultsPlaylist') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="release-grid">
|
<div v-else class="release-grid">
|
||||||
<div v-for="playlist in viewInfo.data.slice(0, itemsToShow)" :key="playlist.playlistID" class="w-40 release">
|
<div v-for="playlist in viewInfo.data.slice(0, itemsToShow)" :key="playlist.playlistID" class="w-40 release">
|
||||||
@ -38,11 +39,13 @@
|
|||||||
<script>
|
<script>
|
||||||
import BaseLoadingPlaceholder from '@components/globals/BaseLoadingPlaceholder.vue'
|
import BaseLoadingPlaceholder from '@components/globals/BaseLoadingPlaceholder.vue'
|
||||||
import CoverContainer from '@components/globals/CoverContainer.vue'
|
import CoverContainer from '@components/globals/CoverContainer.vue'
|
||||||
|
import ResultsError from '@components/search/ResultsError.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
BaseLoadingPlaceholder,
|
BaseLoadingPlaceholder,
|
||||||
CoverContainer
|
CoverContainer,
|
||||||
|
ResultsError
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
viewInfo: {
|
viewInfo: {
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
<BaseLoadingPlaceholder v-if="isLoading" />
|
<BaseLoadingPlaceholder v-if="isLoading" />
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div v-if="viewInfo.data.length === 0">
|
<ResultsError v-if="viewInfo.error" :error="viewInfo.error"></ResultsError>
|
||||||
<h1>{{ $t('search.noResultsTrack') }}</h1>
|
<div v-else-if="viewInfo.data.length === 0">
|
||||||
|
<h1 class="text-center">{{ $t('search.noResultsTrack') }}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table v-else class="table w-full table--tracks">
|
<table v-else class="table w-full table--tracks">
|
||||||
@ -88,6 +89,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import BaseLoadingPlaceholder from '@components/globals/BaseLoadingPlaceholder.vue'
|
import BaseLoadingPlaceholder from '@components/globals/BaseLoadingPlaceholder.vue'
|
||||||
import PreviewControls from '@components/globals/PreviewControls.vue'
|
import PreviewControls from '@components/globals/PreviewControls.vue'
|
||||||
|
import ResultsError from '@components/search/ResultsError.vue'
|
||||||
import { playPausePreview } from '@components/globals/TheTrackPreview.vue'
|
import { playPausePreview } from '@components/globals/TheTrackPreview.vue'
|
||||||
|
|
||||||
import { convertDuration } from '@/utils/utils'
|
import { convertDuration } from '@/utils/utils'
|
||||||
@ -97,7 +99,8 @@ import { formatTitle } from '@/data/search'
|
|||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
BaseLoadingPlaceholder,
|
BaseLoadingPlaceholder,
|
||||||
PreviewControls
|
PreviewControls,
|
||||||
|
ResultsError
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
viewInfo: {
|
viewInfo: {
|
||||||
|
@ -13,7 +13,8 @@ export function standardizeData(rawObj, formatFunc) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
data: formattedData,
|
data: formattedData,
|
||||||
hasLoaded: rawObj.hasLoaded
|
hasLoaded: rawObj.hasLoaded,
|
||||||
|
error: rawObj.error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,8 @@ const en = {
|
|||||||
noResultsTrack: 'No Tracks found',
|
noResultsTrack: 'No Tracks found',
|
||||||
noResultsAlbum: 'No Albums found',
|
noResultsAlbum: 'No Albums found',
|
||||||
noResultsArtist: 'No Artists found',
|
noResultsArtist: 'No Artists found',
|
||||||
noResultsPlaylist: 'No Playlists found'
|
noResultsPlaylist: 'No Playlists found',
|
||||||
|
error: 'An error occurred, please try again later.'
|
||||||
},
|
},
|
||||||
searchbar: 'Search anything you want (or just paste a link)',
|
searchbar: 'Search anything you want (or just paste a link)',
|
||||||
downloads: 'downloads',
|
downloads: 'downloads',
|
||||||
|
@ -189,7 +189,8 @@ const it = {
|
|||||||
noResultsTrack: 'Nessun brano trovato',
|
noResultsTrack: 'Nessun brano trovato',
|
||||||
noResultsAlbum: 'Nessun album trovato',
|
noResultsAlbum: 'Nessun album trovato',
|
||||||
noResultsArtist: 'Nessun artista trovato',
|
noResultsArtist: 'Nessun artista trovato',
|
||||||
noResultsPlaylist: 'Nessuna playlist trovata'
|
noResultsPlaylist: 'Nessuna playlist trovata',
|
||||||
|
error: 'Si è verificato un errore, riprova più tardi.'
|
||||||
},
|
},
|
||||||
searchbar: 'Cerca qualsiasi cosa (o incolla semplicemente un link)',
|
searchbar: 'Cerca qualsiasi cosa (o incolla semplicemente un link)',
|
||||||
downloads: 'download',
|
downloads: 'download',
|
||||||
|
Loading…
Reference in New Issue
Block a user