Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lang/en/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
},
"offline_download": {
"url": "URL",
"file_name": "File Name",
"file_size": "File Size",
"path": "Destination Path",
"transfer_src": "Source Path",
"transfer_src_local": "Source Path (Local)",
Expand Down
25 changes: 24 additions & 1 deletion src/pages/manage/tasks/Task.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { createSignal, For, Show } from "solid-js"
import { useT, useFetch } from "~/hooks"
import { PEmptyResp } from "~/types"
import { handleResp, notify, r } from "~/utils"
import { getFileSize, handleResp, notify, r } from "~/utils"
import { TaskAttribute, TaskLocalSetter, TasksProps } from "./Tasks"
import { me } from "~/store"

Expand Down Expand Up @@ -134,6 +134,9 @@ export const Task = (props: TaskAttribute & TasksProps & TaskLocalSetter) => {
)
const title =
matches === null ? props.name : props.nameAnalyzer.title(matches)
const showFileInfo = () =>
props.type === "offline_download" && props.done === "undone"
const fileSize = () => props.file_size || props.total_bytes
const startTime =
props.start_time === null ? -1 : new Date(props.start_time).getTime()
const endTime =
Expand Down Expand Up @@ -321,6 +324,26 @@ export const Task = (props: TaskAttribute & TasksProps & TaskLocalSetter) => {
}}
</For>
</Show>
<Show when={showFileInfo() && props.file_name}>
<GridItem
color="$neutral9"
textAlign="right"
css={{ whiteSpace: "nowrap" }}
>
{t(`tasks.attr.offline_download.file_name`)}
</GridItem>
<GridItem color="$neutral9">{props.file_name}</GridItem>
</Show>
<Show when={showFileInfo() && fileSize() > 0}>
<GridItem
color="$neutral9"
textAlign="right"
css={{ whiteSpace: "nowrap" }}
>
{t(`tasks.attr.offline_download.file_size`)}
</GridItem>
<GridItem color="$neutral9">{getFileSize(fileSize())}</GridItem>
</Show>
<GridItem
color="$neutral9"
textAlign="right"
Expand Down
2 changes: 2 additions & 0 deletions src/types/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ export interface TaskInfo {
start_time: string | null
end_time: string | null
total_bytes: number
file_name?: string
file_size?: number
error: string
}