Add support for job and step level execution

Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
Sanjula Ganepola
2024-11-30 00:16:49 -05:00
parent d032fe2d3d
commit b96f1c613a
7 changed files with 273 additions and 41 deletions

37
src/views/history/step.ts Normal file
View File

@@ -0,0 +1,37 @@
import { TreeItem, TreeItemCollapsibleState, WorkspaceFolder } from "vscode";
import { HistoryManager, HistoryStatus, Step } from "../../historyManager";
import { Utils } from "../../utils";
import { GithubLocalActionsTreeItem } from "../githubLocalActionsTreeItem";
export default class StepTreeItem extends TreeItem implements GithubLocalActionsTreeItem {
static contextValue = 'githubLocalActions.step';
step: Step;
constructor(public workspaceFolder: WorkspaceFolder, step: Step) {
super(step.name, TreeItemCollapsibleState.None);
this.step = step;
let endTime: string | undefined;
let totalDuration: string | undefined;
if (step.date.end) {
endTime = step.date.end;
totalDuration = Utils.getTimeDuration(step.date.start, endTime);
} else if (step.status === HistoryStatus.Running) {
endTime = new Date().toString();
totalDuration = Utils.getTimeDuration(step.date.start, endTime);
}
this.description = totalDuration;
this.contextValue = `${StepTreeItem.contextValue}_${step.status}`;
this.iconPath = HistoryManager.statusToIcon(step.status);
this.tooltip = `Name: ${step.name}\n` +
`Status: ${step.status}\n` +
`Started: ${Utils.getDateString(step.date.start)}\n` +
`Ended: ${endTime ? Utils.getDateString(endTime) : 'N/A'}\n` +
`Total Duration: ${totalDuration ? totalDuration : 'N/A'}`;
}
async getChildren(): Promise<GithubLocalActionsTreeItem[]> {
return [];
}
}