diff --git a/CHANGELOG.md b/CHANGELOG.md index ceb66d61..55db3dcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ - **settings:** disallow usage of now unsupported relative paths for config `radicle.advanced.pathToRadBinary` - **settings:** support trailing slashes for config `radicle.advanced.pathToNodeHome` - **patch-list:** show all possible actions for a patch on its context menu (right click) +- **patch-list:** add new context-menu action "Refresh Patch Data" for a patch item ### 🔥 Performance diff --git a/package.json b/package.json index 3e7492c6..eb70fe47 100644 --- a/package.json +++ b/package.json @@ -119,13 +119,21 @@ "enablement": "radicle.isRadInitialized" }, { - "command": "radicle.refreshPatches", - "title": "Refresh Patches View", + "command": "radicle.refreshAllPatches", + "title": "Refresh All Patch Data", "shortTitle": "Refresh Patches", "category": "Radicle", "icon": "$(refresh)", "enablement": "radicle.isRadInitialized" }, + { + "command": "radicle.refreshOnePatch", + "title": "Refresh Patch Data", + "shortTitle": "Refresh Patch", + "category": "Radicle", + "icon": "$(refresh)", + "enablement": "radicle.isRadInitialized" + }, { "command": "radicle.viewPatchDetails", "title": "Open Patch Details", @@ -176,6 +184,10 @@ "command": "radicle.viewPatchDetails", "when": "false" }, + { + "command": "radicle.refreshOnePatch", + "when": "false" + }, { "command": "radicle.checkoutPatch", "when": "false" @@ -205,7 +217,7 @@ ], "view/title": [ { - "command": "radicle.refreshPatches", + "command": "radicle.refreshAllPatches", "when": "view == patches-view", "group": "navigation@1" } @@ -219,12 +231,17 @@ { "command": "radicle.viewPatchDetails", "when": "view == patches-view && viewItem =~ /patch/", - "group": "contextMenu@1" + "group": "contextMenu.A@1" + }, + { + "command": "radicle.refreshOnePatch", + "when": "view == patches-view && viewItem =~ /patch/", + "group": "contextMenu.A@2" }, { "command": "radicle.copyPatchId", "when": "view == patches-view && viewItem =~ /patch/", - "group": "contextMenu@2" + "group": "contextMenu.C@1" }, { "command": "radicle.checkoutPatch", @@ -234,7 +251,7 @@ { "command": "radicle.checkoutPatch", "when": "view == patches-view && viewItem =~ /patch:checked-out-false/", - "group": "contextMenu@3" + "group": "contextMenu.B@1" }, { "command": "radicle.checkoutDefaultBranch", diff --git a/src/helpers/command.ts b/src/helpers/command.ts index 8b0e58a5..14aa3ac5 100644 --- a/src/helpers/command.ts +++ b/src/helpers/command.ts @@ -101,9 +101,12 @@ export function registerAllCommands(): void { registerVsCodeCmd('radicle.collapsePatches', () => { commands.executeCommand('workbench.actions.treeView.patches-view.collapseAll') }) - registerVsCodeCmd('radicle.refreshPatches', () => { + registerVsCodeCmd('radicle.refreshAllPatches', () => { usePatchStore().resetAllPatches() }) + registerVsCodeCmd('radicle.refreshOnePatch', (patchId: Patch['id']) => { + usePatchStore().refetchPatch(patchId) + }) registerVsCodeCmd('radicle.checkoutPatch', checkOutPatch) registerVsCodeCmd('radicle.checkoutDefaultBranch', checkOutDefaultBranch) registerVsCodeCmd('radicle.copyPatchId', async (patch: Partial | undefined) => { diff --git a/src/helpers/webview.ts b/src/helpers/webview.ts index 89bf0af4..0c18f421 100644 --- a/src/helpers/webview.ts +++ b/src/helpers/webview.ts @@ -1,4 +1,4 @@ -import { Uri, ViewColumn, type Webview, type WebviewPanel, window } from 'vscode' +import { Uri, ViewColumn, type Webview, type WebviewPanel, commands, window } from 'vscode' import { type WebviewId, allWebviewIds, @@ -261,7 +261,7 @@ async function handleMessageFromWebviewPatchDetail( copyToClipboardAndNotify(message.payload.textToCopy) break case 'refreshPatchData': - usePatchStore().refetchPatch(message.payload.patchId) + commands.executeCommand('radicle.refreshOnePatch', message.payload.patchId) break case 'checkOutPatchBranch': checkOutPatch(message.payload.patch) diff --git a/src/webviews/src/components/PatchDetailButtons.vue b/src/webviews/src/components/PatchDetailButtons.vue index 2178c074..8396d383 100644 --- a/src/webviews/src/components/PatchDetailButtons.vue +++ b/src/webviews/src/components/PatchDetailButtons.vue @@ -27,7 +27,7 @@ function revealPatch() {