Skip to content

Commit

Permalink
feat(patch-list): new r-click action "Refresh Patch Data" for patches
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantinos Maninakis <maninak@protonmail.com>
  • Loading branch information
maninak committed Jul 16, 2024
1 parent c524f73 commit 6386bf8
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
29 changes: 23 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -176,6 +184,10 @@
"command": "radicle.viewPatchDetails",
"when": "false"
},
{
"command": "radicle.refreshOnePatch",
"when": "false"
},
{
"command": "radicle.checkoutPatch",
"when": "false"
Expand Down Expand Up @@ -205,7 +217,7 @@
],
"view/title": [
{
"command": "radicle.refreshPatches",
"command": "radicle.refreshAllPatches",
"when": "view == patches-view",
"group": "navigation@1"
}
Expand All @@ -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",
Expand All @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion src/helpers/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Patch> | undefined) => {
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/webview.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/webviews/src/components/PatchDetailButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function revealPatch() {
<vscode-button
class="self-center"
appearance="secondary"
title="Refresh All Data on This Page"
title="Refresh Patch Data"
@click="refetchPatchData"
>
<!-- eslint-disable-next-line vue/no-deprecated-slot-attribute -->
Expand Down

0 comments on commit 6386bf8

Please sign in to comment.