feat: 添加进度框以显示系统配置重载状态

This commit is contained in:
jxxghp
2025-03-08 08:07:04 +08:00
parent faafbb59c6
commit 793cdd8f4c
5 changed files with 41 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ import api from '@/api'
import { TransferDirectoryConf, StorageConf } from '@/api/types'
import DirectoryCard from '@/components/cards/DirectoryCard.vue'
import StorageCard from '@/components/cards/StorageCard.vue'
import ProgressDialog from '@/components/dialog/ProgressDialog.vue'
// 所有下载目录
const directories = ref<TransferDirectoryConf[]>([])
@@ -20,6 +21,9 @@ const mediaCategories = ref<{ [key: string]: any }>({})
// 提示框
const $toast = useToast()
// 进度框
const progressDialog = ref(false)
// 数据源
const sourceItems = [
{ 'title': 'TheMovieDb', 'value': 'themoviedb' },
@@ -54,6 +58,7 @@ async function loadSystemSettings() {
// 重载系统生效配置
async function reloadSystem() {
progressDialog.value = true
try {
const result: { [key: string]: any } = await api.get('system/reload')
if (result.success) $toast.success('系统配置已生效')
@@ -61,6 +66,7 @@ async function reloadSystem() {
} catch (error) {
console.log(error)
}
progressDialog.value = false
}
// 移动结束
@@ -141,7 +147,7 @@ function addDirectory() {
monitor_type: '',
media_type: '',
media_category: '',
transfer_type: ''
transfer_type: '',
})
orderDirectoryCards()
}
@@ -304,4 +310,6 @@ onMounted(() => {
</VCard>
</VCol>
</VRow>
<!-- 进度框 -->
<ProgressDialog v-if="progressDialog" v-model="progressDialog" text="正在应用配置..." />
</template>

View File

@@ -4,6 +4,7 @@ import api from '@/api'
import draggable from 'vuedraggable'
import type { NotificationConf, NotificationSwitchConf } from '@/api/types'
import NotificationChannelCard from '@/components/cards/NotificationChannelCard.vue'
import ProgressDialog from '@/components/dialog/ProgressDialog.vue'
// 所有消息渠道
const notifications = ref<NotificationConf[]>([])
@@ -11,6 +12,9 @@ const notifications = ref<NotificationConf[]>([])
// 提示框
const $toast = useToast()
// 进度框
const progressDialog = ref(false)
// 消息类型开关
const notificationSwitchs = ref<NotificationSwitchConf[]>([
{
@@ -49,6 +53,7 @@ const notificationSwitchs = ref<NotificationSwitchConf[]>([
// 重载系统生效配置
async function reloadSystem() {
progressDialog.value = true
try {
const result: { [key: string]: any } = await api.get('system/reload')
if (result.success) $toast.success('系统配置已生效')
@@ -56,6 +61,7 @@ async function reloadSystem() {
} catch (error) {
console.log(error)
}
progressDialog.value = false
}
// 添加通知渠道
@@ -240,4 +246,6 @@ onMounted(() => {
</VCard>
</VCol>
</VRow>
<!-- 进度框 -->
<ProgressDialog v-if="progressDialog" v-model="progressDialog" text="正在应用配置..." />
</template>

View File

@@ -1,10 +1,14 @@
<script lang="ts" setup>
import { useToast } from 'vue-toast-notification'
import api from '@/api'
import ProgressDialog from '@/components/dialog/ProgressDialog.vue'
// 提示框
const $toast = useToast()
// 进度框
const progressDialog = ref(false)
// 站点重置
const isConfirmResetSites = ref(false)
@@ -90,6 +94,7 @@ async function loadSiteSettings() {
// 重载系统生效配置
async function reloadSystem() {
progressDialog.value = true
try {
const result: { [key: string]: any } = await api.get('system/reload')
if (result.success) $toast.success('系统配置已生效')
@@ -97,6 +102,7 @@ async function reloadSystem() {
} catch (error) {
console.log(error)
}
progressDialog.value = false
}
// 调用API保存设置
@@ -269,4 +275,6 @@ onMounted(() => {
</VCard>
</VCol>
</VRow>
<!-- 进度框 -->
<ProgressDialog v-if="progressDialog" v-model="progressDialog" text="正在应用配置..." />
</template>

View File

@@ -2,10 +2,14 @@
import { useToast } from 'vue-toast-notification'
import api from '@/api'
import type { FilterRuleGroup, Site } from '@/api/types'
import ProgressDialog from '@/components/dialog/ProgressDialog.vue'
// 提示框
const $toast = useToast()
// 进度框
const progressDialog = ref(false)
// 所有站点
const allSites = ref<Site[]>([])
@@ -147,6 +151,7 @@ async function querySubscribeRules() {
// 重载系统生效配置
async function reloadSystem() {
progressDialog.value = true
try {
const result: { [key: string]: any } = await api.get('system/reload')
if (result.success) $toast.success('系统配置已生效')
@@ -154,6 +159,7 @@ async function reloadSystem() {
} catch (error) {
console.log(error)
}
progressDialog.value = false
}
// 保存订阅设置
@@ -304,4 +310,6 @@ onMounted(() => {
</VCard>
</VCol>
</VRow>
<!-- 进度框 -->
<ProgressDialog v-if="progressDialog" v-model="progressDialog" text="正在应用配置..." />
</template>

View File

@@ -8,6 +8,7 @@ import { DownloaderConf, MediaServerConf } from '@/api/types'
import DownloaderCard from '@/components/cards/DownloaderCard.vue'
import MediaServerCard from '@/components/cards/MediaServerCard.vue'
import { copyToClipboard } from '@/@core/utils/navigator'
import ProgressDialog from '@/components/dialog/ProgressDialog.vue'
// 系统设置项
const SystemSettings = ref<any>({
@@ -68,6 +69,9 @@ const downloaders = ref<DownloaderConf[]>([])
// 提示框
const $toast = useToast()
// 进度框
const progressDialog = ref(false)
// 高级设置对话框
const advancedDialog = ref(false)
@@ -85,6 +89,7 @@ async function loadDownloaderSetting() {
// 重载系统生效配置
async function reloadSystem() {
progressDialog.value = true
try {
const result: { [key: string]: any } = await api.get('system/reload')
if (result.success) $toast.success('系统配置已生效')
@@ -92,6 +97,7 @@ async function reloadSystem() {
} catch (error) {
console.log(error)
}
progressDialog.value = false
}
// 调用API保存下载器设置
@@ -838,4 +844,6 @@ onDeactivated(() => {
</VCardActions>
</VCard>
</VDialog>
<!-- 进度框 -->
<ProgressDialog v-if="progressDialog" v-model="progressDialog" text="正在应用配置..." />
</template>