Add history tree item command to open task
Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
@@ -37,11 +37,18 @@ export default class HistoryTreeItem extends TreeItem implements GithubLocalActi
|
|||||||
this.iconPath = new ThemeIcon('circle-slash', new ThemeColor('GitHubLocalActions.yellow'));
|
this.iconPath = new ThemeIcon('circle-slash', new ThemeColor('GitHubLocalActions.yellow'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.tooltip = `Name: ${history.name}\n` +
|
this.tooltip = `Name: ${history.name} #${history.count}\n` +
|
||||||
|
`Path: ${history.commandArgs.fsPath}\n` +
|
||||||
|
`${history.commandArgs.extraHeader.map(header => `${header.key}: ${header.value}`).join('\n')}\n` +
|
||||||
`Status: ${history.status}\n` +
|
`Status: ${history.status}\n` +
|
||||||
`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[]> {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { CancellationToken, commands, EventEmitter, ExtensionContext, extensions, TreeDataProvider, TreeItem, workspace } from "vscode";
|
import { CancellationToken, commands, EventEmitter, ExtensionContext, extensions, TreeDataProvider, TreeItem, window, workspace } from "vscode";
|
||||||
import { act } from "../../extension";
|
import { act } from "../../extension";
|
||||||
import { HistoryStatus } from "../../historyManager";
|
import { HistoryStatus } from "../../historyManager";
|
||||||
import { Utils } from "../../utils";
|
import { Utils } from "../../utils";
|
||||||
@@ -26,6 +26,14 @@ export default class HistoryTreeDataProvider implements TreeDataProvider<GithubL
|
|||||||
commands.registerCommand('githubLocalActions.refreshHistory', async () => {
|
commands.registerCommand('githubLocalActions.refreshHistory', async () => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}),
|
}),
|
||||||
|
commands.registerCommand('githubLocalActions.focusTask', async (historyTreeItem: HistoryTreeItem) => {
|
||||||
|
const terminals = window.terminals;
|
||||||
|
for (const terminal of terminals) {
|
||||||
|
if (terminal.creationOptions.name === `${historyTreeItem.history.name} #${historyTreeItem.history.count}`) {
|
||||||
|
terminal.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
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);
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user