diff --git a/src/features/services/store.ts b/src/features/services/store.ts index 27d1b835..a9f5bd8f 100644 --- a/src/features/services/store.ts +++ b/src/features/services/store.ts @@ -363,13 +363,34 @@ export const pullImage = (connId: string, reference: string) => call(commands.dockerPull(r, endpointOf(connId), reference, out)), ); -export const prune = (connId: string, target: PruneTarget) => - task(connId, `Pruning ${target === "allImages" ? "unused images" : target}…`, tx("Could not prune"), (r, out) => +export function prune(connId: string, target: PruneTarget) { + const title = { + containers: tx("Pruning stopped containers…"), + images: tx("Pruning dangling images…"), + allImages: tx("Pruning unused images…"), + volumes: tx("Pruning unused volumes…"), + networks: tx("Pruning unused networks…"), + system: tx("Pruning the system…"), + }[target]; + return task(connId, title, tx("Could not prune"), (r, out) => call(commands.dockerPrune(r, endpointOf(connId), target, out)), ); +} export function composeOp(connId: string, project: string, files: string[], workingDir: string | null, op: ComposeOp) { - return task(connId, `Compose ${op} ${project}…`, tx`Compose ${op} failed for ${project}`, (r, out) => + const { title, failure } = { + start: { title: tx`Starting Compose project ${project}…`, failure: tx`Could not start Compose project ${project}` }, + stop: { title: tx`Stopping Compose project ${project}…`, failure: tx`Could not stop Compose project ${project}` }, + restart: { + title: tx`Restarting Compose project ${project}…`, + failure: tx`Could not restart Compose project ${project}`, + }, + down: { + title: tx`Taking down Compose project ${project}…`, + failure: tx`Could not take down Compose project ${project}`, + }, + }[op]; + return task(connId, title, failure, (r, out) => call(commands.dockerComposeOp(r, endpointOf(connId), project, files, workingDir, op, out)), ); } diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json index ed0d5867..9771374a 100644 --- a/src/platform/locales/text/zh.json +++ b/src/platform/locales/text/zh.json @@ -3420,13 +3420,11 @@ "Remove all networks not used by a container?": "移除所有未被容器使用的网络?", "Remove stopped containers, unused networks, dangling images and the build cache?": "移除已停止的容器、未使用的网络、悬空镜像和构建缓存?", "Prune {target}": "清理{target}", - "Pruning {target}…": "正在清理 {target}…", "Pulling {name}…": "正在拉取 {name}…", "containers": "容器", "images": "镜像", "volumes": "卷", "networks": "网络", - "unused images": "未使用的镜像", "Compose project '{name}'": "Compose 项目 '{name}'", "Engine {server} · CLI {client}": "引擎 {server} · CLI {client}", " · context {name}": " · 上下文 {name}", @@ -5847,5 +5845,18 @@ "Could not remove network": "无法删除网络", "Could not pull {reference}": "无法拉取 {reference}", "Could not prune": "无法清理", - "Compose {op} failed for {project}": "Compose {op} 在 {project} 上失败" + "Pruning stopped containers…": "正在清理已停止的容器…", + "Pruning dangling images…": "正在清理悬空镜像…", + "Pruning unused images…": "正在清理未使用的镜像…", + "Pruning unused volumes…": "正在清理未使用的卷…", + "Pruning unused networks…": "正在清理未使用的网络…", + "Pruning the system…": "正在清理系统…", + "Starting Compose project {project}…": "正在启动 Compose 项目 {project}…", + "Stopping Compose project {project}…": "正在停止 Compose 项目 {project}…", + "Restarting Compose project {project}…": "正在重启 Compose 项目 {project}…", + "Taking down Compose project {project}…": "正在停止并移除 Compose 项目 {project}…", + "Could not start Compose project {project}": "无法启动 Compose 项目 {project}", + "Could not stop Compose project {project}": "无法停止 Compose 项目 {project}", + "Could not restart Compose project {project}": "无法重启 Compose 项目 {project}", + "Could not take down Compose project {project}": "无法停止并移除 Compose 项目 {project}" }