fix(deployment): offer the deployment actions in Customize Main Toolbar (#7878)

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 <[email protected]>
Цей коміт міститься в:
Vadim LazukтаInf1mum authored and GitHub committed 2026-12-04 04:06:32 +08:00
1 джерело 8c82d9924c
коміт cddf57d4c7
2 files changed
+46 -1

No files matched your search

+39 -1
Переглянути файл
@@ -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");
});
});
+7
Переглянути файл
@@ -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) => {