Skip to content

Commit

Permalink
Merge pull request #11 from urgetolearn/main
Browse files Browse the repository at this point in the history
added "start a local network" section
  • Loading branch information
technomad01 authored Sep 24, 2024
2 parents 5528a17 + 60f3cb2 commit 32adbb2
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
21 changes: 19 additions & 2 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,31 @@ const fs = require("fs");
const { TreeViewProvider } = require("./src/treeview");
const { createConnectionProfileWebview } = require("./src/webview");

const fabricsamples = require('./src/fabricsamples');

function activate(context) {
const hyperledgerProvider = new fabricsamples();
vscode.window.registerTreeDataProvider('start-local-network', hyperledgerProvider);
const treeViewProviderFabric = new TreeViewProvider(
"fabric-network",
context
);
const treeViewProviderDesc = new TreeViewProvider("network-desc", context);
const treeViewProviderWallet = new TreeViewProvider("wallets", context);

const disposable1 = vscode.commands.registerCommand(
"myview.button1",
function () {
vscode.window.showInformationMessage("Stop Network!");
console.log("Button1");
}
);
const disposable2 = vscode.commands.registerCommand(
"myview.button2",
function () {
vscode.window.showInformationMessage("Start Network!");
console.log("Button2");
}
);
vscode.window.createTreeView("fabric-network", {
treeDataProvider: treeViewProviderFabric,
});
Expand Down Expand Up @@ -341,7 +358,7 @@ function extractWalletDetails(walletData) {
return null;
}

function deactivate() {}
function deactivate() { }

module.exports = {
activate,
Expand Down
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@
"command": "wallets.uploadWallet",
"when": "view == wallets",
"group": "navigation"
},
{
"command": "myview.button1",
"when": "view == start-local-network",
"group": "navigation"
},
{
"command": "myview.button2",
"when": "view == start-local-network",
"group": "navigation"
}
],
"view/item/context": [
Expand Down Expand Up @@ -174,6 +184,14 @@
"title": "Delete Wallet",
"category": "Wallets",
"icon": "$(trash)"
},
{
"command": "myview.button1",
"title": "🔴"
},
{
"command": "myview.button2",
"title": "🟢"
}
]
},
Expand Down
34 changes: 34 additions & 0 deletions src/fabricsamples.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const vscode = require('vscode');

class fabricsamples {
constructor() {
// Define the tree structure
this.treeData = [
{
label: "Fabric Sample",
collapsibleState: vscode.TreeItemCollapsibleState.Collapsed, // Collapsible node

}
];
}

getTreeItem(element) {
const treeItem = new vscode.TreeItem(
element.label,
element.collapsibleState
);
return treeItem;
}

getChildren(element) {
if (element) {
// Return children for the given element
return element.children || [];
} else {
// Return top-level items (i.e., Start a Local Network)
return this.treeData;
}
}
}

module.exports = fabricsamples;

0 comments on commit 32adbb2

Please sign in to comment.