mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
+1
-1
@@ -32,7 +32,7 @@ api.interceptors.response.use(
|
|||||||
router.push('/login')
|
router.push('/login')
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.reject(new Error(error))
|
return Promise.reject(error)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ onMounted(() => {
|
|||||||
</VCol>
|
</VCol>
|
||||||
</VRow>
|
</VRow>
|
||||||
<VRow>
|
<VRow>
|
||||||
<VCol cols="12" md="6" v-if="props.storage == 'local'">
|
<VCol cols="12" md="6">
|
||||||
<VSwitch
|
<VSwitch
|
||||||
v-model="transferForm.scrape"
|
v-model="transferForm.scrape"
|
||||||
label="刮削元数据"
|
label="刮削元数据"
|
||||||
|
|||||||
@@ -12,12 +12,18 @@ import MediaServerLibrary from '@/views/dashboard/MediaServerLibrary.vue'
|
|||||||
import MediaServerPlaying from '@/views/dashboard/MediaServerPlaying.vue'
|
import MediaServerPlaying from '@/views/dashboard/MediaServerPlaying.vue'
|
||||||
import DashboardRender from '@/components/render/DashboardRender.vue'
|
import DashboardRender from '@/components/render/DashboardRender.vue'
|
||||||
import { isNullOrEmptyObject } from '@/@core/utils'
|
import { isNullOrEmptyObject } from '@/@core/utils'
|
||||||
|
|
||||||
// 输入参数
|
// 输入参数
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
// 仪表板配置
|
// 仪表板配置
|
||||||
config: Object as PropType<DashboardItem>,
|
config: Object as PropType<DashboardItem>,
|
||||||
// 刷新状态
|
// 刷新状态
|
||||||
refreshStatus: Boolean,
|
refreshStatus: Boolean,
|
||||||
|
// 是否允许刷新数据
|
||||||
|
allowRefresh: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['update:refreshStatus'])
|
const emit = defineEmits(['update:refreshStatus'])
|
||||||
@@ -32,10 +38,10 @@ onUnmounted(() => {
|
|||||||
<AnalyticsStorage v-if="config?.id === 'storage'" />
|
<AnalyticsStorage v-if="config?.id === 'storage'" />
|
||||||
<AnalyticsMediaStatistic v-else-if="config?.id === 'mediaStatistic'" />
|
<AnalyticsMediaStatistic v-else-if="config?.id === 'mediaStatistic'" />
|
||||||
<AnalyticsWeeklyOverview v-else-if="config?.id === 'weeklyOverview'" />
|
<AnalyticsWeeklyOverview v-else-if="config?.id === 'weeklyOverview'" />
|
||||||
<AnalyticsSpeed v-else-if="config?.id === 'speed'" />
|
<AnalyticsSpeed v-else-if="config?.id === 'speed'" :allowRefresh="props.allowRefresh" />
|
||||||
<AnalyticsScheduler v-else-if="config?.id === 'scheduler'" />
|
<AnalyticsScheduler v-else-if="config?.id === 'scheduler'" :allowRefresh="props.allowRefresh" />
|
||||||
<AnalyticsCpu v-else-if="config?.id === 'cpu'" />
|
<AnalyticsCpu v-else-if="config?.id === 'cpu'" :allowRefresh="props.allowRefresh" />
|
||||||
<AnalyticsMemory v-else-if="config?.id === 'memory'" />
|
<AnalyticsMemory v-else-if="config?.id === 'memory'" :allowRefresh="props.allowRefresh" />
|
||||||
<MediaServerLibrary v-else-if="config?.id === 'library'" />
|
<MediaServerLibrary v-else-if="config?.id === 'library'" />
|
||||||
<MediaServerPlaying v-else-if="config?.id === 'playing'" />
|
<MediaServerPlaying v-else-if="config?.id === 'playing'" />
|
||||||
<MediaServerLatest v-else-if="config?.id === 'latest'" />
|
<MediaServerLatest v-else-if="config?.id === 'latest'" />
|
||||||
|
|||||||
+14
-1
@@ -19,6 +19,9 @@ const superUser = store.state.auth.superUser
|
|||||||
// 是否拉升高度
|
// 是否拉升高度
|
||||||
const isElevated = ref(true)
|
const isElevated = ref(true)
|
||||||
|
|
||||||
|
// 是否发送请求的总开关
|
||||||
|
const isRequest = ref(true)
|
||||||
|
|
||||||
// 计算属性,控制是否拉升高度
|
// 计算属性,控制是否拉升高度
|
||||||
const elevatedConf = controlledComputed(
|
const elevatedConf = controlledComputed(
|
||||||
() => isElevated.value,
|
() => isElevated.value,
|
||||||
@@ -269,7 +272,8 @@ async function getPluginDashboard(id: string, key: string) {
|
|||||||
if (
|
if (
|
||||||
res.attrs?.refresh &&
|
res.attrs?.refresh &&
|
||||||
pluginDashboardRefreshStatus.value[pluginDashboardId] &&
|
pluginDashboardRefreshStatus.value[pluginDashboardId] &&
|
||||||
enableConfig.value[pluginDashboardId]
|
enableConfig.value[pluginDashboardId] &&
|
||||||
|
isRequest.value
|
||||||
) {
|
) {
|
||||||
// 清除之前的定时器
|
// 清除之前的定时器
|
||||||
if (refreshTimers.value[pluginDashboardId]) {
|
if (refreshTimers.value[pluginDashboardId]) {
|
||||||
@@ -298,6 +302,14 @@ onBeforeMount(async () => {
|
|||||||
await loadDashboardConfig()
|
await loadDashboardConfig()
|
||||||
getPluginDashboardMeta()
|
getPluginDashboardMeta()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onActivated(async () => {
|
||||||
|
isRequest.value = true
|
||||||
|
})
|
||||||
|
|
||||||
|
onDeactivated(() => {
|
||||||
|
isRequest.value = false
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -314,6 +326,7 @@ onBeforeMount(async () => {
|
|||||||
<VCol v-if="enableConfig[buildPluginDashboardId(element.id, element.key)] && element.cols" v-bind:="element.cols">
|
<VCol v-if="enableConfig[buildPluginDashboardId(element.id, element.key)] && element.cols" v-bind:="element.cols">
|
||||||
<DashboardElement
|
<DashboardElement
|
||||||
:config="element"
|
:config="element"
|
||||||
|
:allow-refresh="isRequest"
|
||||||
v-model:refreshStatus="pluginDashboardRefreshStatus[buildPluginDashboardId(element.id, element.key)]"
|
v-model:refreshStatus="pluginDashboardRefreshStatus[buildPluginDashboardId(element.id, element.key)]"
|
||||||
/>
|
/>
|
||||||
</VCol>
|
</VCol>
|
||||||
|
|||||||
@@ -4,6 +4,15 @@ import { useTheme } from 'vuetify'
|
|||||||
import { hexToRgb } from '@layouts/utils'
|
import { hexToRgb } from '@layouts/utils'
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
|
|
||||||
|
// 输入参数
|
||||||
|
const props = defineProps({
|
||||||
|
// 是否允许刷新数据
|
||||||
|
allowRefresh: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const vuetifyTheme = useTheme()
|
const vuetifyTheme = useTheme()
|
||||||
|
|
||||||
const currentTheme = controlledComputed(
|
const currentTheme = controlledComputed(
|
||||||
@@ -94,6 +103,7 @@ const chartOptions = controlledComputed(
|
|||||||
|
|
||||||
// 调用API接口获取最新CPU使用率
|
// 调用API接口获取最新CPU使用率
|
||||||
async function getCpuUsage() {
|
async function getCpuUsage() {
|
||||||
|
if (!props.allowRefresh) return
|
||||||
try {
|
try {
|
||||||
// 请求数据
|
// 请求数据
|
||||||
current.value = (await api.get('dashboard/cpu')) ?? 0
|
current.value = (await api.get('dashboard/cpu')) ?? 0
|
||||||
|
|||||||
@@ -5,6 +5,15 @@ import { hexToRgb } from '@layouts/utils'
|
|||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import { formatBytes } from '@/@core/utils/formatters'
|
import { formatBytes } from '@/@core/utils/formatters'
|
||||||
|
|
||||||
|
// 输入参数
|
||||||
|
const props = defineProps({
|
||||||
|
// 是否允许刷新数据
|
||||||
|
allowRefresh: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const vuetifyTheme = useTheme()
|
const vuetifyTheme = useTheme()
|
||||||
|
|
||||||
const currentTheme = controlledComputed(
|
const currentTheme = controlledComputed(
|
||||||
@@ -100,6 +109,7 @@ const chartOptions = controlledComputed(
|
|||||||
|
|
||||||
// 调用API接口获取最新内存使用量
|
// 调用API接口获取最新内存使用量
|
||||||
async function getMemorgUsage() {
|
async function getMemorgUsage() {
|
||||||
|
if (!props.allowRefresh) return
|
||||||
try {
|
try {
|
||||||
// 请求数据
|
// 请求数据
|
||||||
;[usedMemory.value, memoryUsage.value] = await api.get('dashboard/memory')
|
;[usedMemory.value, memoryUsage.value] = await api.get('dashboard/memory')
|
||||||
|
|||||||
@@ -2,6 +2,15 @@
|
|||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import type { ScheduleInfo } from '@/api/types'
|
import type { ScheduleInfo } from '@/api/types'
|
||||||
|
|
||||||
|
// 输入参数
|
||||||
|
const props = defineProps({
|
||||||
|
// 是否允许刷新数据
|
||||||
|
allowRefresh: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// 定时服务列表
|
// 定时服务列表
|
||||||
const schedulerList = ref<ScheduleInfo[]>([])
|
const schedulerList = ref<ScheduleInfo[]>([])
|
||||||
|
|
||||||
@@ -10,6 +19,9 @@ let refreshTimer: NodeJS.Timeout | null = null
|
|||||||
|
|
||||||
// 调用API加载定时服务列表
|
// 调用API加载定时服务列表
|
||||||
async function loadSchedulerList() {
|
async function loadSchedulerList() {
|
||||||
|
if (!props.allowRefresh) {
|
||||||
|
return
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const res: ScheduleInfo[] = await api.get('dashboard/schedule')
|
const res: ScheduleInfo[] = await api.get('dashboard/schedule')
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,15 @@ import { formatFileSize } from '@/@core/utils/formatters'
|
|||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import type { DownloaderInfo } from '@/api/types'
|
import type { DownloaderInfo } from '@/api/types'
|
||||||
|
|
||||||
|
// 输入参数
|
||||||
|
const props = defineProps({
|
||||||
|
// 是否允许刷新数据
|
||||||
|
allowRefresh: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// 定时器
|
// 定时器
|
||||||
let refreshTimer: NodeJS.Timeout | null = null
|
let refreshTimer: NodeJS.Timeout | null = null
|
||||||
|
|
||||||
@@ -35,6 +44,10 @@ const infoItems = ref([
|
|||||||
|
|
||||||
// 调用API查询下载器数据
|
// 调用API查询下载器数据
|
||||||
async function loadDownloaderInfo() {
|
async function loadDownloaderInfo() {
|
||||||
|
if (!props.allowRefresh) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res: DownloaderInfo = await api.get('dashboard/downloader')
|
const res: DownloaderInfo = await api.get('dashboard/downloader')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user