feat(admin): 转码设置页新增立即补齐转码按钮
This commit is contained in:
1 parent
d7d43fed44
commit
e51d371e07
7 files changed
+86
-5
No files matched your search
@@ -5,6 +5,7 @@ import type { ComputedRef, Ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { getMediaTranscodeProfileApi, saveMediaTranscodeProfileApi } from '@/api/admin/media'
|
||||
import { runTranscodeBackfillApi } from '@/api/admin/transcode'
|
||||
import type { MediaTranscodeProfile } from '@/api/admin/types'
|
||||
import { applyProfileToForm, buildProfilePayload } from './transcodeProfileModel'
|
||||
|
||||
@@ -15,6 +16,7 @@ interface SettingsContext {
|
||||
formRef: Ref<FormInstance | undefined>
|
||||
loading: Ref<boolean>
|
||||
saving: Ref<boolean>
|
||||
backfilling: Ref<boolean>
|
||||
loadError: Ref<string>
|
||||
canManage: ComputedRef<boolean>
|
||||
t: Translate
|
||||
@@ -77,3 +79,28 @@ export const saveTranscodeProfile = async (context: SettingsContext): Promise<vo
|
||||
context.saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 手动补齐转码:扫一遍缺码率产物/帧图的分集并入队。 */
|
||||
export const runTranscodeBackfill = async (context: SettingsContext): Promise<void> => {
|
||||
if (!context.canManage.value || context.backfilling.value) {
|
||||
return
|
||||
}
|
||||
context.backfilling.value = true
|
||||
try {
|
||||
const response = await runTranscodeBackfillApi()
|
||||
if (response.code !== 0) {
|
||||
ElMessage.error(response.message || context.t('transcodeSettings.backfillFailed'))
|
||||
return
|
||||
}
|
||||
const triggered = response.data?.triggered ?? 0
|
||||
if (triggered > 0) {
|
||||
ElMessage.success(context.t('transcodeSettings.backfillDone', { count: triggered }))
|
||||
} else {
|
||||
ElMessage.info(context.t('transcodeSettings.backfillEmpty'))
|
||||
}
|
||||
} catch {
|
||||
ElMessage.error(context.t('transcodeSettings.backfillFailed'))
|
||||
} finally {
|
||||
context.backfilling.value = false
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user