Add focus task action

Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
Sanjula Ganepola
2024-11-30 16:05:02 -05:00
parent 5d1110653b
commit c8ee9c2cd9
3 changed files with 21 additions and 5 deletions

View File

@@ -240,6 +240,11 @@
"enablement": "viewItem =~ /^githubLocalActions.history_(Success|Failed|Cancelled).*/", "enablement": "viewItem =~ /^githubLocalActions.history_(Success|Failed|Cancelled).*/",
"icon": "$(close)" "icon": "$(close)"
}, },
{
"category": "GitHub Local Actions",
"command": "githubLocalActions.focusTask",
"title": "Focus Task"
},
{ {
"category": "GitHub Local Actions", "category": "GitHub Local Actions",
"command": "githubLocalActions.refreshSettings", "command": "githubLocalActions.refreshSettings",
@@ -436,6 +441,10 @@
"command": "githubLocalActions.remove", "command": "githubLocalActions.remove",
"when": "never" "when": "never"
}, },
{
"command": "githubLocalActions.focusTask",
"when": "never"
},
{ {
"command": "githubLocalActions.refreshSettings", "command": "githubLocalActions.refreshSettings",
"when": "never" "when": "never"
@@ -640,6 +649,11 @@
"when": "view == history && viewItem =~ /^githubLocalActions.history.*/", "when": "view == history && viewItem =~ /^githubLocalActions.history.*/",
"group": "inline@3" "group": "inline@3"
}, },
{
"command": "githubLocalActions.focusTask",
"when": "view == history && viewItem =~ /^githubLocalActions.history.*/",
"group": "0_focus@0"
},
{ {
"command": "githubLocalActions.createSecretFile", "command": "githubLocalActions.createSecretFile",
"when": "view == settings && viewItem =~ /^githubLocalActions.secrets.*/", "when": "view == settings && viewItem =~ /^githubLocalActions.secrets.*/",

View File

@@ -34,11 +34,6 @@ export default class HistoryTreeItem extends TreeItem implements GithubLocalActi
`Started: ${Utils.getDateString(history.date.start)}\n` + `Started: ${Utils.getDateString(history.date.start)}\n` +
`Ended: ${endTime ? Utils.getDateString(endTime) : 'N/A'}\n` + `Ended: ${endTime ? Utils.getDateString(endTime) : 'N/A'}\n` +
`Total Duration: ${totalDuration ? totalDuration : 'N/A'}`; `Total Duration: ${totalDuration ? totalDuration : 'N/A'}`;
// this.command = {
// title: 'Focus Task',
// command: 'githubLocalActions.focusTask',
// arguments: [this]
// };
} }
async getChildren(): Promise<GithubLocalActionsTreeItem[]> { async getChildren(): Promise<GithubLocalActionsTreeItem[]> {

View File

@@ -31,8 +31,15 @@ export default class HistoryTreeDataProvider implements TreeDataProvider<GithubL
for (const terminal of terminals) { for (const terminal of terminals) {
if (terminal.creationOptions.name === `${historyTreeItem.history.name} #${historyTreeItem.history.count}`) { if (terminal.creationOptions.name === `${historyTreeItem.history.name} #${historyTreeItem.history.count}`) {
terminal.show(); terminal.show();
return;
} }
} }
window.showErrorMessage(`${historyTreeItem.history.name} #${historyTreeItem.history.count} task is no longer open.`, 'View Output').then(async value => {
if (value === 'View Output') {
await commands.executeCommand('githubLocalActions.viewOutput', historyTreeItem);
}
});
}), }),
commands.registerCommand('githubLocalActions.viewOutput', async (historyTreeItem: HistoryTreeItem) => { commands.registerCommand('githubLocalActions.viewOutput', async (historyTreeItem: HistoryTreeItem) => {
await act.historyManager.viewOutput(historyTreeItem.history); await act.historyManager.viewOutput(historyTreeItem.history);