File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 11import { GitHubRepoContext } from "../git/repository" ;
2+ import { RepositoryPermission , hasWritePermission } from "../git/repository-permissions" ;
23import { log , logDebug } from "../log" ;
34import * as model from "../model" ;
45import { WorkflowJob } from "./WorkflowJob" ;
@@ -50,6 +51,18 @@ abstract class WorkflowRunBase {
5051 return this . _jobs ;
5152 }
5253
54+ contextValue ( permission : RepositoryPermission ) : string {
55+ const contextValues = [ "run" ] ;
56+ const completed = this . _run . status === "completed" ;
57+ if ( hasWritePermission ( permission ) ) {
58+ contextValues . push ( completed ? "rerunnable" : "cancelable" ) ;
59+ }
60+ if ( completed ) {
61+ contextValues . push ( "completed" ) ;
62+ }
63+ return contextValues . join ( " " ) ;
64+ }
65+
5366 protected abstract fetchJobs ( ) : Promise < WorkflowJob [ ] > ;
5467}
5568
Original file line number Diff line number Diff line change @@ -28,15 +28,7 @@ export class WorkflowRunNode extends vscode.TreeItem {
2828 this . run = run ;
2929 this . label = WorkflowRunNode . _getLabel ( run , this . workflowName ) ;
3030
31- const contextValues = [ "run" ] ;
32- const completed = this . run . run . status === "completed" ;
33- if ( hasWritePermission ( this . gitHubRepoContext . permissionLevel ) ) {
34- contextValues . push ( completed ? "rerunnable" : "cancelable" ) ;
35- }
36- if ( completed ) {
37- contextValues . push ( "completed" ) ;
38- }
39- this . contextValue = contextValues . join ( " " ) ;
31+ this . contextValue = this . run . contextValue ( this . gitHubRepoContext . permissionLevel ) ;
4032
4133 this . iconPath = getIconForWorkflowRun ( this . run . run ) ;
4234 this . tooltip = this . getTooltip ( ) ;
You can’t perform that action at this time.
0 commit comments