mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-06 08:06:43 +08:00
fix Module Test
This commit is contained in:
@@ -265,7 +265,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
@media (width <= 768px) {
|
@media (width <= 768px) {
|
||||||
.orrent-list-vscroll {
|
.orrent-list-vscroll {
|
||||||
block-size: calc(100vh - 10rem);
|
block-size: calc(100vh - 9rem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -2,24 +2,34 @@
|
|||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
|
|
||||||
// 定义所有的模块ID、名称列表
|
// 定义所有的模块ID、名称列表
|
||||||
const modules = ref([
|
const modules = ref<
|
||||||
{ id: 'FileTransferModule', name: '媒体目录', state: '', errmsg: '', loading: false },
|
{
|
||||||
{ id: 'IndexerModule', name: '站点索引', state: '', errmsg: '', loading: false },
|
id: string
|
||||||
{ id: 'DoubanModule', name: '豆瓣', state: '', errmsg: '', loading: false },
|
name: string
|
||||||
{ id: 'TheMovieDbModule', name: 'TheMovieDb', state: '', errmsg: '', loading: false },
|
state: 'success' | 'error' | 'warning' | 'info' | undefined
|
||||||
{ id: 'TheTvDbModule', name: 'TheTvDb', state: '', errmsg: '', loading: false },
|
errmsg: string
|
||||||
{ id: 'FanartModule', name: 'Fanart', state: '', errmsg: '', loading: false },
|
loading: boolean
|
||||||
{ id: 'EmbyModule', name: 'Emby', state: '', errmsg: '', loading: false },
|
}[]
|
||||||
{ id: 'JellyfinModule', name: 'Jellyfin', state: '', errmsg: '', loading: false },
|
>([])
|
||||||
{ id: 'PlexModule', name: 'Plex', state: '', errmsg: '', loading: false },
|
|
||||||
{ id: 'WechatModule', name: '微信', state: '', errmsg: '', loading: false },
|
// 调用API查询模块列表
|
||||||
{ id: 'TelegramModule', name: 'Telegram', state: '', errmsg: '', loading: false },
|
async function getModules() {
|
||||||
{ id: 'SlackModule', name: 'Slack', state: '', errmsg: '', loading: false },
|
try {
|
||||||
{ id: 'SynologyChatModule', name: 'Synology Chat', state: '', errmsg: '', loading: false },
|
const result: { [key: string]: any } = await api.get('system/modulelist')
|
||||||
{ id: 'VoceChatModule', name: 'VoceChat', state: '', errmsg: '', loading: false },
|
if (result.success) {
|
||||||
{ id: 'QbittorrentModule', name: 'Qbittorrent', state: '', errmsg: '', loading: false },
|
const moduleList = result.data?.modules
|
||||||
{ id: 'TransmissionModule', name: 'Transmission', state: '', errmsg: '', loading: false },
|
if (moduleList) {
|
||||||
])
|
moduleList.forEach((module: { id: string; name: string }) => {
|
||||||
|
modules.value.push({ id: module.id, name: module.name, state: undefined, errmsg: '', loading: false })
|
||||||
|
})
|
||||||
|
// 逐个检查所有模块
|
||||||
|
for (let i = 0; i < modules.value.length; i++) await moduleTest(i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 调用API测试模块
|
// 调用API测试模块
|
||||||
async function moduleTest(index: number) {
|
async function moduleTest(index: number) {
|
||||||
@@ -33,7 +43,7 @@ async function moduleTest(index: number) {
|
|||||||
target.state = 'success'
|
target.state = 'success'
|
||||||
target.name = `${target.name} - 正常`
|
target.name = `${target.name} - 正常`
|
||||||
} else if (result.message?.includes('模块未加载')) {
|
} else if (result.message?.includes('模块未加载')) {
|
||||||
target.state = ''
|
target.state = undefined
|
||||||
target.name = `${target.name} - 未启用`
|
target.name = `${target.name} - 未启用`
|
||||||
} else {
|
} else {
|
||||||
target.state = 'error'
|
target.state = 'error'
|
||||||
@@ -44,11 +54,9 @@ async function moduleTest(index: number) {
|
|||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载
|
// 加载
|
||||||
onMounted(async () => {
|
onMounted(getModules)
|
||||||
// 逐个检查所有模块
|
|
||||||
for (let i = 0; i < modules.value.length; i++) await moduleTest(i)
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
Reference in New Issue
Block a user