init settings view and refresh action
Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
63
package.json
63
package.json
@@ -26,7 +26,9 @@
|
||||
"engines": {
|
||||
"vscode": "^1.93.0"
|
||||
},
|
||||
"activationEvents": [],
|
||||
"activationEvents": [
|
||||
"onStartupFinished"
|
||||
],
|
||||
"main": "./dist/extension.js",
|
||||
"contributes": {
|
||||
"viewsContainers": {
|
||||
@@ -50,11 +52,6 @@
|
||||
"name": "Workflows",
|
||||
"icon": "$(remote-explorer)"
|
||||
},
|
||||
{
|
||||
"id": "events",
|
||||
"name": "Events",
|
||||
"icon": "$(rocket)"
|
||||
},
|
||||
{
|
||||
"id": "settings",
|
||||
"name": "Settings",
|
||||
@@ -62,7 +59,59 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"commands": [],
|
||||
"commands": [
|
||||
{
|
||||
"category": "GitHub Local Actions",
|
||||
"command": "githubLocalActions.refreshComponents",
|
||||
"title": "Refresh",
|
||||
"icon": "$(refresh)"
|
||||
},
|
||||
{
|
||||
"category": "GitHub Local Actions",
|
||||
"command": "githubLocalActions.refreshWorkflows",
|
||||
"title": "Refresh",
|
||||
"icon": "$(refresh)"
|
||||
},
|
||||
{
|
||||
"category": "GitHub Local Actions",
|
||||
"command": "githubLocalActions.refreshSettings",
|
||||
"title": "Refresh",
|
||||
"icon": "$(refresh)"
|
||||
}
|
||||
],
|
||||
"menus": {
|
||||
"commandPalette": [
|
||||
{
|
||||
"command": "githubLocalActions.refreshComponents",
|
||||
"when": "never"
|
||||
},
|
||||
{
|
||||
"command": "githubLocalActions.refreshWorkflows",
|
||||
"when": "never"
|
||||
},
|
||||
{
|
||||
"command": "githubLocalActions.refreshSettings",
|
||||
"when": "never"
|
||||
}
|
||||
],
|
||||
"view/title": [
|
||||
{
|
||||
"command": "githubLocalActions.refreshComponents",
|
||||
"when": "view == components",
|
||||
"group": "navigation@0"
|
||||
},
|
||||
{
|
||||
"command": "githubLocalActions.refreshWorkflows",
|
||||
"when": "view == workflows",
|
||||
"group": "navigation@0"
|
||||
},
|
||||
{
|
||||
"command": "githubLocalActions.refreshSettings",
|
||||
"when": "view == settings",
|
||||
"group": "navigation@0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"colors": [
|
||||
{
|
||||
"id": "GitHubLocalActions.enabled",
|
||||
|
||||
@@ -2,6 +2,7 @@ import * as vscode from 'vscode';
|
||||
import { window } from 'vscode';
|
||||
import ComponentsTreeDataProvider from './views/components/componentsTreeDataProvider';
|
||||
import { DecorationProvider } from './views/decorationProvider';
|
||||
import SettingsTreeDataProvider from './views/settings/settingsTreeDataProvider';
|
||||
import WorkflowsTreeDataProvider from './views/workflows/workflowsTreeDataProvider';
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
@@ -13,9 +14,12 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
const componentsTreeView = window.createTreeView(ComponentsTreeDataProvider.VIEW_ID, { treeDataProvider: componentsTreeDataProvider });
|
||||
const workflowsTreeDataProvider = new WorkflowsTreeDataProvider(context);
|
||||
const workflowsTreeView = window.createTreeView(WorkflowsTreeDataProvider.VIEW_ID, { treeDataProvider: workflowsTreeDataProvider });
|
||||
const settingsTreeDataProvider = new SettingsTreeDataProvider(context);
|
||||
const settingsTreeView = window.createTreeView(SettingsTreeDataProvider.VIEW_ID, { treeDataProvider: settingsTreeDataProvider });
|
||||
context.subscriptions.push(
|
||||
componentsTreeView,
|
||||
workflowsTreeView,
|
||||
settingsTreeView,
|
||||
window.registerFileDecorationProvider(decorationProvider)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CancellationToken, EventEmitter, ExtensionContext, TreeDataProvider, TreeItem } from "vscode";
|
||||
import { CancellationToken, commands, EventEmitter, ExtensionContext, TreeDataProvider, TreeItem } from "vscode";
|
||||
import { ComponentManager } from "../componentManager";
|
||||
import { GithubLocalActionsTreeItem } from "../githubLocalActionsTreeItem";
|
||||
import ComponentTreeItem from "./component";
|
||||
@@ -11,6 +11,12 @@ export default class ComponentsTreeDataProvider implements TreeDataProvider<Gith
|
||||
|
||||
constructor(context: ExtensionContext) {
|
||||
this.componentManager = new ComponentManager();
|
||||
|
||||
context.subscriptions.push(
|
||||
commands.registerCommand('githubLocalActions.refreshComponents', async () => {
|
||||
this.refresh();
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
refresh(element?: GithubLocalActionsTreeItem) {
|
||||
|
||||
16
src/views/settings/environments.ts
Normal file
16
src/views/settings/environments.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode";
|
||||
import { GithubLocalActionsTreeItem } from "../githubLocalActionsTreeItem";
|
||||
|
||||
export default class EnvironmentsTreeItem extends TreeItem implements GithubLocalActionsTreeItem {
|
||||
static contextValue = 'environments';
|
||||
|
||||
constructor() {
|
||||
super('Environments', TreeItemCollapsibleState.Collapsed);
|
||||
this.contextValue = EnvironmentsTreeItem.contextValue;
|
||||
this.iconPath = new ThemeIcon('server-environment');
|
||||
}
|
||||
|
||||
async getChildren(): Promise<GithubLocalActionsTreeItem[]> {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
16
src/views/settings/secrets.ts
Normal file
16
src/views/settings/secrets.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode";
|
||||
import { GithubLocalActionsTreeItem } from "../githubLocalActionsTreeItem";
|
||||
|
||||
export default class SecretsTreeItem extends TreeItem implements GithubLocalActionsTreeItem {
|
||||
static contextValue = 'secrets';
|
||||
|
||||
constructor() {
|
||||
super('Secrets', TreeItemCollapsibleState.Collapsed);
|
||||
this.contextValue = SecretsTreeItem.contextValue;
|
||||
this.iconPath = new ThemeIcon('lock');
|
||||
}
|
||||
|
||||
async getChildren(): Promise<GithubLocalActionsTreeItem[]> {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
47
src/views/settings/settingsTreeDataProvider.ts
Normal file
47
src/views/settings/settingsTreeDataProvider.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { CancellationToken, commands, EventEmitter, ExtensionContext, TreeDataProvider, TreeItem } from "vscode";
|
||||
import { GithubLocalActionsTreeItem } from "../githubLocalActionsTreeItem";
|
||||
import EnvironmentsTreeItem from "./environments";
|
||||
import SecretsTreeItem from "./secrets";
|
||||
import VariablesTreeItem from "./variables";
|
||||
|
||||
export default class SettingsTreeDataProvider implements TreeDataProvider<GithubLocalActionsTreeItem> {
|
||||
private _onDidChangeTreeData = new EventEmitter<GithubLocalActionsTreeItem | undefined | null | void>();
|
||||
readonly onDidChangeTreeData = this._onDidChangeTreeData.event;
|
||||
public static VIEW_ID = 'settings';
|
||||
|
||||
constructor(context: ExtensionContext) {
|
||||
context.subscriptions.push(
|
||||
commands.registerCommand('githubLocalActions.refreshSettings', async () => {
|
||||
this.refresh();
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
refresh(element?: GithubLocalActionsTreeItem) {
|
||||
this._onDidChangeTreeData.fire(element);
|
||||
}
|
||||
|
||||
getTreeItem(element: GithubLocalActionsTreeItem): GithubLocalActionsTreeItem | Thenable<GithubLocalActionsTreeItem> {
|
||||
return element;
|
||||
}
|
||||
|
||||
async resolveTreeItem(item: TreeItem, element: GithubLocalActionsTreeItem, token: CancellationToken): Promise<GithubLocalActionsTreeItem> {
|
||||
if (element.getToolTip) {
|
||||
element.tooltip = await element.getToolTip();
|
||||
}
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
async getChildren(element?: GithubLocalActionsTreeItem): Promise<GithubLocalActionsTreeItem[]> {
|
||||
if (element) {
|
||||
return element.getChildren();
|
||||
} else {
|
||||
return [
|
||||
new EnvironmentsTreeItem(),
|
||||
new SecretsTreeItem(),
|
||||
new VariablesTreeItem()
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
16
src/views/settings/variables.ts
Normal file
16
src/views/settings/variables.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode";
|
||||
import { GithubLocalActionsTreeItem } from "../githubLocalActionsTreeItem";
|
||||
|
||||
export default class VariablesTreeItem extends TreeItem implements GithubLocalActionsTreeItem {
|
||||
static contextValue = 'variables';
|
||||
|
||||
constructor() {
|
||||
super('Variables', TreeItemCollapsibleState.Collapsed);
|
||||
this.contextValue = VariablesTreeItem.contextValue;
|
||||
this.iconPath = new ThemeIcon('symbol-key');
|
||||
}
|
||||
|
||||
async getChildren(): Promise<GithubLocalActionsTreeItem[]> {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CancellationToken, EventEmitter, ExtensionContext, TreeDataProvider, TreeItem } from "vscode";
|
||||
import { CancellationToken, commands, EventEmitter, ExtensionContext, TreeDataProvider, TreeItem } from "vscode";
|
||||
import { GithubLocalActionsTreeItem } from "../githubLocalActionsTreeItem";
|
||||
import { WorkflowManager } from "../workflowManager";
|
||||
import WorkflowTreeItem from "./workflow";
|
||||
@@ -11,6 +11,12 @@ export default class WorkflowsTreeDataProvider implements TreeDataProvider<Githu
|
||||
|
||||
constructor(context: ExtensionContext) {
|
||||
this.workflowManager = new WorkflowManager();
|
||||
|
||||
context.subscriptions.push(
|
||||
commands.registerCommand('githubLocalActions.refreshWorkflows', async () => {
|
||||
this.refresh();
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
refresh(element?: GithubLocalActionsTreeItem) {
|
||||
|
||||
Reference in New Issue
Block a user