diff --git a/images/dark/go-to-file.svg b/images/dark/go-to-file.svg
new file mode 100644
index 00000000..ed302ae1
--- /dev/null
+++ b/images/dark/go-to-file.svg
@@ -0,0 +1,3 @@
+
diff --git a/images/light/go-to-file.svg b/images/light/go-to-file.svg
new file mode 100644
index 00000000..392a840c
--- /dev/null
+++ b/images/light/go-to-file.svg
@@ -0,0 +1,3 @@
+
diff --git a/package.json b/package.json
index fce75530..01a39c9e 100644
--- a/package.json
+++ b/package.json
@@ -136,6 +136,14 @@
}
],
"commands": [
+ {
+ "command": "tekton.edit",
+ "title": "Open In Editor",
+ "icon": {
+ "light": "images/light/go-to-file.svg",
+ "dark": "images/dark/go-to-file.svg"
+ }
+ },
{
"command": "tekton.pipeline.preview",
"title": "Open Pipeline preview to the Side",
@@ -708,33 +716,13 @@
"group": "c2"
},
{
- "command": "tekton.openInEditor",
- "when": "view =~ /^tekton(CustomTree|PipelineExplorer)View/ && viewItem == pipeline",
- "group": "c0@1"
- },
- {
- "command": "tekton.openInEditor",
- "when": "view =~ /^tekton(CustomTree|PipelineExplorer)View/ && viewItem == pipelinerun",
- "group": "c0@1"
- },
- {
- "command": "tekton.openInEditor",
- "when": "view =~ /^tekton(CustomTree|PipelineExplorer)View/ && viewItem == clustertask",
- "group": "c0@1"
- },
- {
- "command": "tekton.openInEditor",
- "when": "view =~ /^tekton(CustomTree|PipelineExplorer)View/ && viewItem == pipelineresource",
- "group": "c0@1"
- },
- {
- "command": "tekton.openInEditor",
- "when": "view =~ /^tekton(CustomTree|PipelineExplorer)View/ && viewItem == taskrun",
- "group": "c0@1"
+ "command": "tekton.edit",
+ "when": "view =~ /^tekton(CustomTree|PipelineExplorer)View/ && viewItem =~ /^(pipeline|pipelinerun|clustertask|pipelineresource|taskrun|triggertemplates|triggerbinding|eventlistener|conditions|task)$/",
+ "group": "inline"
},
{
"command": "tekton.openInEditor",
- "when": "view =~ /^tekton(CustomTree|PipelineExplorer)View/ && viewItem == task",
+ "when": "view =~ /^tekton(CustomTree|PipelineExplorer)View/ && viewItem =~ /^(pipeline|pipelinerun|clustertask|pipelineresource|taskrun|task|triggertemplates|triggerbinding|eventlistener|conditions)$/",
"group": "c0@1"
}
],
diff --git a/src/extension.ts b/src/extension.ts
index 1b418f61..d7408d92 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -42,6 +42,7 @@ export async function activate(context: vscode.ExtensionContext): Promise
vscode.commands.registerCommand('tekton.explorer.refresh', (context) => execute(Pipeline.refresh, context)),
vscode.commands.registerCommand('tekton.pipeline.start', (context) => execute(Pipeline.start, context)),
vscode.commands.registerCommand('tekton.openInEditor', (context) => execute(TektonItem.openInEditor, context)),
+ vscode.commands.registerCommand('tekton.edit', (context) => execute(TektonItem.openInEditor, context)),
vscode.commands.registerCommand('tekton.pipeline.restart', (context) => execute(Pipeline.restart, context)),
//vscode.commands.registerCommand('tekton.pipeline.createFromLocal', (context) => execute(Pipeline.createFromLocal, context)),
vscode.commands.registerCommand('tekton.pipeline.list', (context) => execute(Pipeline.list, context)),
diff --git a/src/tkn.ts b/src/tkn.ts
index 6f14d29f..c26220a2 100644
--- a/src/tkn.ts
+++ b/src/tkn.ts
@@ -4,7 +4,7 @@
*-----------------------------------------------------------------------------------------------*/
import { CliCommand, CliExitData, Cli, CliImpl, createCliCommand, cliCommandToString } from './cli';
-import { ProviderResult, TreeItemCollapsibleState, Terminal, Uri, workspace, TreeItem, Command as vsCommand } from 'vscode';
+import { ProviderResult, TreeItemCollapsibleState, Terminal, Uri, workspace, TreeItem } from 'vscode';
import { WindowUtil } from './util/windowUtils';
import * as path from 'path';
import { ToolsConfig } from './tools';
@@ -62,9 +62,13 @@ export enum ContextType {
TASKNODE = 'tasknode',
CLUSTERTASKNODE = 'clustertasknode',
TKN_DOWN = 'tknDown',
+ TRIGGERTEMPLATESNODE = 'triggertemplatesnode',
TRIGGERTEMPLATES = 'triggertemplates',
+ TRIGGERBINDINGNODE= 'triggerbindingnode',
TRIGGERBINDING= 'triggerbinding',
+ EVENTLISTENERNODE= 'eventlistenernode',
EVENTLISTENER= 'eventlistener',
+ CONDITIONSNODE = 'conditionsnode',
CONDITIONS = 'conditions',
PIPELINERUNNODE = 'pipelinerunnode',
}
@@ -344,26 +348,46 @@ export class TektonNodeImpl implements TektonNode {
tooltip: 'Cannot connect to the tekton',
getChildren: () => []
},
- triggertemplates: {
+ triggertemplatesnode: {
icon: 'TT.svg',
tooltip: 'TriggerTemplates: {label}',
getChildren: () => this.tkn.getTriggerTemplates(this)
},
- triggerbinding: {
+ triggertemplates: {
+ icon: 'TT.svg',
+ tooltip: 'TriggerTemplates: {label}',
+ getChildren: () => []
+ },
+ triggerbindingnode: {
icon: 'TB.svg',
tooltip: 'TriggerBinding: {label}',
getChildren: () => this.tkn.getTriggerBinding(this)
},
- eventlistener: {
+ triggerbinding: {
+ icon: 'TB.svg',
+ tooltip: 'TriggerBinding: {label}',
+ getChildren: () => []
+ },
+ eventlistenernode: {
icon: 'EL.svg',
tooltip: 'EventListener: {label}',
getChildren: () => this.tkn.getEventListener(this)
},
- conditions: {
+ eventlistener: {
+ icon: 'EL.svg',
+ tooltip: 'EventListener: {label}',
+ getChildren: () => []
+ },
+ conditionsnode: {
icon: 'C.svg',
tooltip: 'Conditions: {label}',
getChildren: () => this.tkn.getConditions(this)
},
+ conditions: {
+ icon: 'C.svg',
+ tooltip: 'Conditions: {label}',
+ getChildren: () => []
+ },
taskrunnode: {
icon: 'TR.svg',
tooltip: 'TaskRuns: {label}',
@@ -408,15 +432,6 @@ export class TektonNodeImpl implements TektonNode {
return format(this.CONTEXT_DATA[this.contextValue].tooltip, this);
}
- get command(): vsCommand | undefined {
- const arrName = ['Pipelines', 'Tasks', 'ClusterTasks', 'PipelineResources', 'TriggerTemplates', 'TriggerBinding', 'EventListener', 'Conditions', 'PipelineRuns', 'TaskRuns'];
- if (arrName.includes(this.name)) {
- return undefined;
- } else {
- return { command: 'tekton.openInEditor', title: 'Open In Editor', arguments: [this] };
- }
- }
-
get label(): string {
return this.name;
}
@@ -667,10 +682,10 @@ export class TknImpl implements Tkn {
const clustertaskNode = new TektonNodeImpl(TknImpl.ROOT, 'ClusterTasks', ContextType.CLUSTERTASKNODE, this, TreeItemCollapsibleState.Collapsed);
const taskRunNode = new TektonNodeImpl(TknImpl.ROOT, 'TaskRuns', ContextType.TASKRUNNODE, this, TreeItemCollapsibleState.Collapsed);
const pipelineResourceNode = new TektonNodeImpl(TknImpl.ROOT, 'PipelineResources', ContextType.PIPELINERESOURCENODE, this, TreeItemCollapsibleState.Collapsed);
- const triggerTemplatesNode = new TektonNodeImpl(TknImpl.ROOT, 'TriggerTemplates', ContextType.TRIGGERTEMPLATES, this, TreeItemCollapsibleState.Collapsed);
- const triggerBindingNode = new TektonNodeImpl(TknImpl.ROOT, 'TriggerBinding', ContextType.TRIGGERBINDING, this, TreeItemCollapsibleState.Collapsed);
- const eventListenerNode = new TektonNodeImpl(TknImpl.ROOT, 'EventListener', ContextType.EVENTLISTENER, this, TreeItemCollapsibleState.Collapsed);
- const conditionsNode = new TektonNodeImpl(TknImpl.ROOT, 'Conditions', ContextType.CONDITIONS, this, TreeItemCollapsibleState.Collapsed);
+ const triggerTemplatesNode = new TektonNodeImpl(TknImpl.ROOT, 'TriggerTemplates', ContextType.TRIGGERTEMPLATESNODE, this, TreeItemCollapsibleState.Collapsed);
+ const triggerBindingNode = new TektonNodeImpl(TknImpl.ROOT, 'TriggerBinding', ContextType.TRIGGERBINDINGNODE, this, TreeItemCollapsibleState.Collapsed);
+ const eventListenerNode = new TektonNodeImpl(TknImpl.ROOT, 'EventListener', ContextType.EVENTLISTENERNODE, this, TreeItemCollapsibleState.Collapsed);
+ const conditionsNode = new TektonNodeImpl(TknImpl.ROOT, 'Conditions', ContextType.CONDITIONSNODE, this, TreeItemCollapsibleState.Collapsed);
pipelineTree.push(pipelineNode, pipelineRunNode, taskNode, clustertaskNode, taskRunNode,pipelineResourceNode, triggerTemplatesNode, triggerBindingNode, eventListenerNode, conditionsNode);
this.cache.set(pipelineNode, await this.getPipelines(pipelineNode));
this.cache.set(pipelineRunNode, await this.getPipelineRunsList(pipelineRunNode));