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

Bug fix #917

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
15 changes: 11 additions & 4 deletions frontend/src/components/navbar/Broadcast.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div v-if="showBanner" :class="bannerClass" class="min-h-[72px] w-full flex items-center py-4">
<div v-if="showBanner.show" :class="bannerClass" class="min-h-[72px] w-full flex items-center py-4">
<div class="page-responsive-width flex justify-between md:gap-6 md:items-start">
<div class="flex items-center gap-4 md:flex-col md:items-start max-w-[80%]">
<div v-if="isLight" class="flex justify-center items-center rounded-[10px] p-3 bg-white border border-gray-200">
Expand All @@ -22,8 +22,10 @@
import { ElMessage } from 'element-plus';
import { computed, onMounted } from 'vue';
import SvgIcon from '../shared/SvgIcon.vue';
import { useStorage } from '@vueuse/core'

const showBanner = ref(false)

const showBanner = useStorage('show_banner', {initialied: false, show: false}, sessionStorage)

const activeBroadcast = ref({
theme: '',
Expand Down Expand Up @@ -51,14 +53,19 @@
activeBroadcast.value.status = data.value.data.status
activeBroadcast.value.bc_type = data.value.data.bc_type
activeBroadcast.value.content = data.value.data.content
showBanner.value = true
if (!showBanner.value.initialied) {
showBanner.value.initialied = true
showBanner.value.show = true
}
} else {
showBanner.value.initialied = false
showBanner.value.show = false
ElMessage.warning(error.value.msg)
}
}

const closeBanner = () => {
showBanner.value = false
showBanner.value.show = false
}

onMounted(() => {
Expand Down
21 changes: 14 additions & 7 deletions frontend/src/components/shared/RepoCards.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
:repo="repo"
:repo-type="repoType" />
</div>
<div v-else-if="repoType === 'model' && totalRepos === 0 ">
<div v-else-if="repoType === 'model' && loading === false && totalRepos === 0">
<EmptyModels />
</div>
<div
Expand Down Expand Up @@ -144,6 +144,7 @@
const totalRepos = ref(0)

const activeTags = ref({})
const loading = ref(true)

const reposData = ref(Array)
const sortOptions = [
Expand Down Expand Up @@ -224,12 +225,18 @@
}

async function loadRepos(url) {
const { error, data } = await useFetchApi(url).json()
if (data.value) {
reposData.value = data.value.data
totalRepos.value = data.value.total
} else {
ElMessage.warning(error.value.msg || t('all.fetchError'))
try {
const { error, data } = await useFetchApi(url).json()
if (data.value) {
reposData.value = data.value.data
totalRepos.value = data.value.total
} else {
ElMessage.warning(error.value.msg || t('all.fetchError'))
}
} catch(error) {
ElMessage.warning(error)
} finally {
loading.value = false
}
}

Expand Down
Loading