-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathworkflowJobNode.ts
More file actions
29 lines (24 loc) · 995 Bytes
/
workflowJobNode.ts
File metadata and controls
29 lines (24 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import * as vscode from "vscode";
import {GitHubRepoContext} from "../../git/repository";
import {WorkflowJob} from "../../store/WorkflowJob";
import {getIconForWorkflowRun} from "../icons";
import {WorkflowStepNode} from "../workflows/workflowStepNode";
export class WorkflowJobNode extends vscode.TreeItem {
constructor(public readonly gitHubRepoContext: GitHubRepoContext, public readonly job: WorkflowJob) {
super(
job.job.name,
(job.job.steps && job.job.steps.length > 0 && vscode.TreeItemCollapsibleState.Collapsed) || undefined
);
this.contextValue = "job";
if (this.job.job.status === "completed") {
this.contextValue += " completed";
}
this.iconPath = getIconForWorkflowRun(this.job.job);
}
hasSteps(): boolean {
return !!(this.job.job.steps && this.job.job.steps.length > 0);
}
getSteps(): WorkflowStepNode[] {
return (this.job.job.steps || []).map(s => new WorkflowStepNode(this.gitHubRepoContext, this.job, s));
}
}