feat: add more docker api

This commit is contained in:
2019-08-27 15:03:30 +08:00
parent f0810cc9d9
commit 3e480da539
20 changed files with 117 additions and 28 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "@dayu/vscode",
"displayName": "vscode",
"description": "",
"description": "Dayu VsCode Plugin",
"publisher": "MiaoWoo",
"version": "0.0.1",
"engines": {
@@ -56,6 +56,7 @@
}
},
"scripts": {
"package": "vsce package",
"vscode:prepublish": "yarn run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",

View File

@@ -7,6 +7,7 @@ import { OpenFaasProvider, DockerProvider } from './provider'
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {
console.log('init...')
new DockerProvider(context);
new OpenFaasProvider(context);
}

View File

@@ -28,7 +28,7 @@ export class DockerProvider extends BaseProvider<vscode.TreeItem> {
context.subscriptions.push(
vscode.commands.registerCommand('dayu.container.logs', (item: vscode.TreeItem) => {
let value: ItemContextValue = JSON.parse(item.contextValue);
let url = `https://faas.n.yumc.pw?action=container&data=${value.data.id}`;
let url = `https://dayu-api.miaowoo.cc?action=container&data=${value.data.id}`;
return vscode.commands.executeCommand("mini-browser.openUrl", url);
}),
vscode.window.registerTreeDataProvider('docker-explorer', this)

View File

@@ -35,7 +35,7 @@ export class OpenFaasProvider extends BaseProvider<vscode.TreeItem> {
switch (value.type) {
case Type.ROOT:
let funcs = await faas.getFunctions();
return funcs.map(f => {
return funcs.map((f: any) => {
return this.createTreeItem({
label: f.name,
tooltip: JSON.stringify(f, undefined, 2)