-
Notifications
You must be signed in to change notification settings - Fork 175
Expand file tree
/
Copy pathenvironmentsNode.ts
More file actions
26 lines (21 loc) · 936 Bytes
/
environmentsNode.ts
File metadata and controls
26 lines (21 loc) · 936 Bytes
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
import * as vscode from "vscode";
import {GitHubRepoContext} from "../../git/repository";
import {EnvironmentNode} from "./environmentNode";
import {Environment} from "../../model";
export class EnvironmentsNode extends vscode.TreeItem {
constructor(public readonly gitHubRepoContext: GitHubRepoContext) {
super("Environments", vscode.TreeItemCollapsibleState.Collapsed);
this.iconPath = new vscode.ThemeIcon("server-environment");
}
async getEnvironments(): Promise<EnvironmentNode[]> {
const opts = this.gitHubRepoContext.client.repos.getAllEnvironments.endpoint.merge({
owner: this.gitHubRepoContext.owner,
repo: this.gitHubRepoContext.name,
per_page: 100
});
// retrieve all environments
const result = await this.gitHubRepoContext.client.paginate<Environment>(opts);
const data = result || [];
return data.map(e => new EnvironmentNode(this.gitHubRepoContext, e));
}
}