Skip to content

Commit

Permalink
fix: Fix some UI glich on task and diagnose display
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Mar 6, 2024
1 parent b260983 commit 53aeed2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
8 changes: 4 additions & 4 deletions xmcl-keystone-ui/src/composables/instanceVersionDiagnose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function useInstanceVersionDiagnose(path: Ref<string>, runtime: Ref<Runti
}
}
if (commonIssues.length > 0) {
const options = { named: { count: commonIssues.length } }
const options = { count: commonIssues.length, name: commonIssues[0].library.path }
operations.push(async () => {
await installLibraries(commonIssues.map(v => v.library), version.id, commonIssues.length < 15)
})
Expand Down Expand Up @@ -198,17 +198,17 @@ export function useInstanceVersionDiagnose(path: Ref<string>, runtime: Ref<Runti
const assetsIssue = await diagnoseAssets(version)
if (abortSignal.aborted) { return }
if (assetsIssue.length > 0) {
const options = { named: { count: assetsIssue.length } }
const options = { count: assetsIssue.length, name: assetsIssue[0]?.asset.name }
operations.push(async () => {
await installAssets(assetsIssue.map(v => v.asset), version.id, assetsIssue.length < 15)
})
items.push(assetsIssue.some(v => v.type === 'corrupted')
? reactive({
title: computed(() => t('diagnosis.corruptedAssets.name', 2, options)),
title: computed(() => t('diagnosis.corruptedAssets.name', options, 2)),
description: computed(() => t('diagnosis.corruptedAssets.message')),
})
: reactive({
title: computed(() => t('diagnosis.missingAssets.name', 2, options)),
title: computed(() => t('diagnosis.missingAssets.name', options, 2)),
description: computed(() => t('diagnosis.missingAssets.message')),
}),
)
Expand Down
5 changes: 1 addition & 4 deletions xmcl-keystone-ui/src/composables/taskManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ export function useTaskManager() {
taskId: payload.uuid,
time: new Date(payload.time),
message: 'error' in payload && payload.error ? markRaw(payload.error) : payload.from ?? payload.to ?? '',
from: payload.from ?? '',
path: payload.path,
param: payload.param,
to: payload.to ?? '',
throughput: 0,
rawChildren: markRaw([]),
childrenDirty: false,
Expand Down Expand Up @@ -82,7 +80,6 @@ export function useTaskManager() {
tasks.value.unshift(item)
}
cache[id] = new WeakRef(item)
// console.log(`Add task ${add.path}(${id})`)
}
for (const update of updates) {
const { uuid, id, time, to, from, progress, total, chunkSize, state, error } = update
Expand All @@ -99,7 +96,7 @@ export function useTaskManager() {
item.total = total
}
item.time = new Date(time)
item.message = Object.freeze(error) || item.message
item.message = Object.freeze(error) || from || to || item.message
if (chunkSize) {
item.throughput += chunkSize
throughput.value += chunkSize
Expand Down
8 changes: 3 additions & 5 deletions xmcl-keystone-ui/src/entities/task.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { TaskState } from '@xmcl/runtime-api'

/**
* The task item represent a task or a sub task
* The task item represent a task on UI or a sub task
*/
export interface TaskItem {
/**
* The unique id of this task node
*/
* The unique id of this task node
*/
id: string

/**
Expand All @@ -31,8 +31,6 @@ export interface TaskItem {

path: string
param: Record<string, any>
from: string
to: string
message: object | string
total: number
progress: number
Expand Down

0 comments on commit 53aeed2

Please sign in to comment.