From c8ee9c2cd9c0953f39d8f659e8c3ee0ab626fb6d Mon Sep 17 00:00:00 2001 From: Sanjula Ganepola Date: Sat, 30 Nov 2024 16:05:02 -0500 Subject: [PATCH] Add focus task action Signed-off-by: Sanjula Ganepola --- package.json | 14 ++++++++++++++ src/views/history/history.ts | 5 ----- src/views/history/historyTreeDataProvider.ts | 7 +++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index eb776fd..ece76bb 100644 --- a/package.json +++ b/package.json @@ -240,6 +240,11 @@ "enablement": "viewItem =~ /^githubLocalActions.history_(Success|Failed|Cancelled).*/", "icon": "$(close)" }, + { + "category": "GitHub Local Actions", + "command": "githubLocalActions.focusTask", + "title": "Focus Task" + }, { "category": "GitHub Local Actions", "command": "githubLocalActions.refreshSettings", @@ -436,6 +441,10 @@ "command": "githubLocalActions.remove", "when": "never" }, + { + "command": "githubLocalActions.focusTask", + "when": "never" + }, { "command": "githubLocalActions.refreshSettings", "when": "never" @@ -640,6 +649,11 @@ "when": "view == history && viewItem =~ /^githubLocalActions.history.*/", "group": "inline@3" }, + { + "command": "githubLocalActions.focusTask", + "when": "view == history && viewItem =~ /^githubLocalActions.history.*/", + "group": "0_focus@0" + }, { "command": "githubLocalActions.createSecretFile", "when": "view == settings && viewItem =~ /^githubLocalActions.secrets.*/", diff --git a/src/views/history/history.ts b/src/views/history/history.ts index aaa724d..f722bf3 100644 --- a/src/views/history/history.ts +++ b/src/views/history/history.ts @@ -34,11 +34,6 @@ export default class HistoryTreeItem extends TreeItem implements GithubLocalActi `Started: ${Utils.getDateString(history.date.start)}\n` + `Ended: ${endTime ? Utils.getDateString(endTime) : 'N/A'}\n` + `Total Duration: ${totalDuration ? totalDuration : 'N/A'}`; - // this.command = { - // title: 'Focus Task', - // command: 'githubLocalActions.focusTask', - // arguments: [this] - // }; } async getChildren(): Promise { diff --git a/src/views/history/historyTreeDataProvider.ts b/src/views/history/historyTreeDataProvider.ts index 683abb4..a10dcc1 100644 --- a/src/views/history/historyTreeDataProvider.ts +++ b/src/views/history/historyTreeDataProvider.ts @@ -31,8 +31,15 @@ export default class HistoryTreeDataProvider implements TreeDataProvider { + if (value === 'View Output') { + await commands.executeCommand('githubLocalActions.viewOutput', historyTreeItem); + } + }); }), commands.registerCommand('githubLocalActions.viewOutput', async (historyTreeItem: HistoryTreeItem) => { await act.historyManager.viewOutput(historyTreeItem.history);