modify the workspace dropdown for scratch pad workspace (#10131)

This commit is contained in:
Kent Wang
2026-06-22 13:22:47 +08:00
committed by GitHub
parent 6c24a0cdfe
commit 6a8d7da15b

View File

@@ -105,6 +105,7 @@ export const SidebarWorkspaceDropdown = ({
const workspaceName = workspace.name;
const projectName = project.name || getProductName();
const isCollection = workspace.scope === 'collection';
const isScratchpadWorkspace = models.workspace.isScratchpad(workspace);
const createRequest = (requestType: CreateRequestType) => {
newRequestFetcher.submit({
@@ -321,7 +322,38 @@ export const SidebarWorkspaceDropdown = ({
],
};
const allSections: ActionSection[] = [...createSections, actionSection];
const scratchpadActionList: ActionSection = {
name: 'Actions',
id: 'Actions',
icon: 'cog',
items: [
{
id: 'Export',
name: 'Export',
icon: 'file-export',
action: () => {
window.main.trackAnalyticsEvent({
event: AnalyticsEvent.exportStarted,
properties: { source: `${workspace.scope}-list` },
});
if (workspace.scope === 'mock-server') {
return exportMockServerToFile(workspace);
}
if (workspace.scope === 'environment') {
return exportGlobalEnvironmentToFile(workspace);
}
if (workspace.scope === 'mcp') {
return exportMcpClientToFile(workspace);
}
return setIsExportModalOpen(true);
},
},
],
};
const allSections: ActionSection[] = isScratchpadWorkspace
? [...createSections, scratchpadActionList]
: [...createSections, actionSection];
return (
<Fragment>