-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathworkflowNode.ts
More file actions
36 lines (30 loc) · 1.07 KB
/
workflowNode.ts
File metadata and controls
36 lines (30 loc) · 1.07 KB
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
30
31
32
33
34
35
36
import * as vscode from "vscode";
import {getPinnedWorkflows} from "../../configuration/configuration";
import {GitHubRepoContext} from "../../git/repository";
import {Workflow} from "../../model";
import {getWorkflowUri} from "../../workflow/workflow";
export class WorkflowNode extends vscode.TreeItem {
constructor(
public readonly gitHubRepoContext: GitHubRepoContext,
public readonly wf: Workflow,
public readonly workflowContext?: string
) {
super(wf.name, vscode.TreeItemCollapsibleState.Collapsed);
this.updateContextValue();
}
updateContextValue() {
this.contextValue = "workflow";
const workflowFullPath = getWorkflowUri(this.gitHubRepoContext, this.wf.path);
if (workflowFullPath) {
const relativeWorkflowPath = vscode.workspace.asRelativePath(workflowFullPath);
if (new Set(getPinnedWorkflows()).has(relativeWorkflowPath)) {
this.contextValue += " pinned";
} else {
this.contextValue += " pinnable";
}
}
if (this.workflowContext) {
this.contextValue += this.workflowContext;
}
}
}