remove types class
Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
import { Component, Status } from "../types";
|
||||
|
||||
export class ComponentManager {
|
||||
components: Component[] = [
|
||||
{
|
||||
name: 'nektos/act',
|
||||
status: Status.Enabled,
|
||||
icon: 'package'
|
||||
},
|
||||
{
|
||||
name: 'Docker Engine',
|
||||
status: Status.Disabled,
|
||||
icon: 'dashboard'
|
||||
},
|
||||
{
|
||||
name: 'GitHub Actions Extension',
|
||||
status: Status.Warning,
|
||||
icon: 'extensions',
|
||||
message: 'GitHub Actions extension is not required but is recommended to take advantage of workflow editor features'
|
||||
},
|
||||
{
|
||||
name: 'GitHub CLI',
|
||||
status: Status.Warning,
|
||||
icon: 'terminal',
|
||||
message: 'GitHub CLI is not required but is recommended if you plan to use it to retrieve GitHub tokens'
|
||||
}
|
||||
];
|
||||
|
||||
async getComponents(): Promise<Component[]> {
|
||||
return this.components;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri } from "vscode";
|
||||
import { Component } from "../../types";
|
||||
import { GithubLocalActionsTreeItem } from "../githubLocalActionsTreeItem";
|
||||
import { Component } from "../../componentManager";
|
||||
|
||||
export default class ComponentTreeItem extends TreeItem implements GithubLocalActionsTreeItem {
|
||||
static contextValue = 'component';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CancellationToken, commands, EventEmitter, ExtensionContext, TreeDataProvider, TreeItem } from "vscode";
|
||||
import { ComponentManager } from "../componentManager";
|
||||
import { ComponentManager } from "../../componentManager";
|
||||
import { GithubLocalActionsTreeItem } from "../githubLocalActionsTreeItem";
|
||||
import ComponentTreeItem from "./component";
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
import * as fs from "fs/promises";
|
||||
import * as path from "path";
|
||||
import { workspace } from "vscode";
|
||||
import * as yaml from "yaml";
|
||||
import { Workflow } from "../types";
|
||||
|
||||
export class WorkflowManager {
|
||||
async getWorkflows(): Promise<Workflow[]> {
|
||||
const workflows: Workflow[] = [];
|
||||
|
||||
const workspaceFolders = workspace.workspaceFolders;
|
||||
if (workspaceFolders && workspaceFolders.length > 0) {
|
||||
const workflowFileUris = await workspace.findFiles(`.github/workflows/*.{yml,yaml}`);
|
||||
|
||||
for await (const workflowFileUri of workflowFileUris) {
|
||||
try {
|
||||
const fileContent = await fs.readFile(workflowFileUri.fsPath, 'utf8');
|
||||
|
||||
workflows.push({
|
||||
name: path.parse(workflowFileUri.fsPath).name,
|
||||
uri: workflowFileUri,
|
||||
content: yaml.parse(fileContent)
|
||||
});
|
||||
} catch (error) {
|
||||
workflows.push({
|
||||
name: path.parse(workflowFileUri.fsPath).name,
|
||||
uri: workflowFileUri,
|
||||
error: 'Failed to parse workflow file'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return workflows;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri } from "vscode";
|
||||
import { Workflow } from "../../types";
|
||||
import { Workflow } from "../../workflowManager";
|
||||
import { GithubLocalActionsTreeItem } from "../githubLocalActionsTreeItem";
|
||||
|
||||
export default class WorkflowTreeItem extends TreeItem implements GithubLocalActionsTreeItem {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CancellationToken, commands, EventEmitter, ExtensionContext, TreeDataProvider, TreeItem, window, workspace } from "vscode";
|
||||
import { WorkflowManager } from "../../workflowManager";
|
||||
import { GithubLocalActionsTreeItem } from "../githubLocalActionsTreeItem";
|
||||
import { WorkflowManager } from "../workflowManager";
|
||||
import WorkflowTreeItem from "./workflow";
|
||||
|
||||
export default class WorkflowsTreeDataProvider implements TreeDataProvider<GithubLocalActionsTreeItem> {
|
||||
@@ -19,6 +19,9 @@ export default class WorkflowsTreeDataProvider implements TreeDataProvider<Githu
|
||||
commands.registerCommand('githubLocalActions.openWorkflow', async (workflowTreeItem: WorkflowTreeItem) => {
|
||||
const document = await workspace.openTextDocument(workflowTreeItem.workflow.uri);
|
||||
await window.showTextDocument(document);
|
||||
}),
|
||||
commands.registerCommand('githubLocalActions.runWorkflow', async (workflowTreeItem: WorkflowTreeItem) => {
|
||||
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user