From cddf57d4c7dd9bda78fb07cf5a1164c212a95e4e Mon Sep 17 00:00:00 2001 From: Vadim Lazuk Date: Thu, 3 Dec 2026 23:06:32 +0300 Subject: [PATCH] fix(deployment): offer the deployment actions in Customize Main Toolbar (#7878) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Customize Main Toolbar lists only actions with an icon, and seven visible deployment actions (Upload to…, Download from…, Download from Default Server, the two Compare with Deployed Version actions and the two Sync with Deployed actions) had none. They now use the existing export, download, diff and refresh icons, so they can be added to the toolbar. Closes #7863 Co-authored-by: Inf1mum <8135225+Inf1mum@users.noreply.github.com> --- src/features/deployment/actions.test.tsx | 40 +++++++++++++++++++++++- src/features/deployment/actions.tsx | 7 +++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/features/deployment/actions.test.tsx b/src/features/deployment/actions.test.tsx index db9052d4c7..55145f8d4f 100644 --- a/src/features/deployment/actions.test.tsx +++ b/src/features/deployment/actions.test.tsx @@ -1,9 +1,10 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; import type { DeploymentServerValid } from "@/platform/remoteSettings"; import type { SyncEntry } from "@/platform/ipc"; +import { hasIcon } from "@/ui/icons"; const mocks = vi.hoisted(() => ({ - actions: [] as { id: string; run: (context: { arg: string[] }) => unknown }[], + actions: [] as { id: string; icon?: string; hidden?: boolean; run: (context: { arg: string[] }) => unknown }[], servers: [] as DeploymentServerValid[], groups: [] as { id: string; name: string; servers: string[] }[], defaultServer: "one", @@ -357,3 +358,40 @@ describe("Compare with Deployed Version", () => { expect(mocks.execute).not.toHaveBeenCalled(); }); }); + +describe("toolbar customization eligibility", () => { + const byId = (id: string) => mocks.actions.find((action) => action.id === id); + + it.each([ + ["deployment.uploadToDefault", "export"], + ["deployment.uploadTo", "export"], + ["deployment.downloadFromDefault", "download"], + ["deployment.downloadFrom", "download"], + ["deployment.compareWithDefault", "diff"], + ["deployment.compareWith", "diff"], + ["deployment.syncWith", "refresh"], + ["deployment.syncWithDefault", "refresh"], + ])("exposes %s with a valid icon (%s) for Customize Main Toolbar", (id, icon) => { + const action = byId(id); + expect(action).toBeDefined(); + expect(action?.hidden).toBeFalsy(); + expect(action?.icon).toBe(icon); + expect(hasIcon(action!.icon!)).toBe(true); + }); + + it("keeps internal actions hidden and Automatic Upload iconless", () => { + for (const id of [ + "deployment.uploadLocalInto", + "deployment.uploadFiles", + "deployment.uploadFolder", + "deployment.downloadRemoteInto", + ]) { + expect(byId(id)?.hidden).toBe(true); + } + expect(byId("deployment.toggleAutoUpload")?.icon).toBeUndefined(); + expect(byId("deployment.deleteFromServer")?.icon).toBe("trash"); + expect(byId("deployment.browseRemoteHost")?.icon).toBe("web"); + expect(byId("deployment.openInBrowser")?.icon).toBe("web"); + expect(byId("deployment.configure")?.icon).toBe("settings"); + }); +}); diff --git a/src/features/deployment/actions.tsx b/src/features/deployment/actions.tsx index 97236c5f72..188a72d374 100644 --- a/src/features/deployment/actions.tsx +++ b/src/features/deployment/actions.tsx @@ -573,6 +573,7 @@ export function registerDeploymentActions(): () => void { title: "Upload to…", description: "Upload the selected files and folders to a deployment server", category: CATEGORY, + icon: "export", when, keywords: ["deploy", "sftp", "upload", "remote"], run: withTargets(async (paths) => { @@ -598,6 +599,7 @@ export function registerDeploymentActions(): () => void { title: "Download from Default Server", description: "Replace the selected files and folders with their copies on the default deployment server", category: CATEGORY, + icon: "download", when, keywords: ["deploy", "sftp", "download", "remote"], run: withTargets(async (paths) => transfer("download", await defaultServer("Download from", paths), paths)), @@ -607,6 +609,7 @@ export function registerDeploymentActions(): () => void { title: "Download from…", description: "Replace the selected files and folders with their copies on a deployment server", category: CATEGORY, + icon: "download", when, keywords: ["deploy", "sftp", "download", "remote"], run: withTargets(async (paths) => transfer("download", await pickServer("Download from", paths), paths)), @@ -615,6 +618,7 @@ export function registerDeploymentActions(): () => void { id: "deployment.compareWithDefault", title: "Compare with Deployed Version", category: CATEGORY, + icon: "diff", when, keywords: ["deploy", "sftp", "remote", "diff"], run: ({ arg }) => compareFile(arg, false), @@ -623,6 +627,7 @@ export function registerDeploymentActions(): () => void { id: "deployment.compareWith", title: "Compare with Deployed Version on…", category: CATEGORY, + icon: "diff", when, keywords: ["deploy", "sftp", "remote", "diff"], run: ({ arg }) => compareFile(arg, true), @@ -632,6 +637,7 @@ export function registerDeploymentActions(): () => void { title: "Sync with Deployed to…", description: "Compare local files with a deployment server and synchronize them", category: CATEGORY, + icon: "refresh", when, keywords: ["deploy", "sftp", "compare", "synchronize", "remote", "diff"], run: ({ arg }) => { @@ -647,6 +653,7 @@ export function registerDeploymentActions(): () => void { title: "Sync with Deployed to Default Server", description: "Compare local files with the default deployment server and synchronize them", category: CATEGORY, + icon: "refresh", when, keywords: ["deploy", "sftp", "compare", "synchronize", "remote", "diff"], run: withTargets(async (paths) => {