Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 32 additions & 60 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@
*/
const vscode = require("vscode");
const fs = require("fs");

const path = require("path");
const { TreeViewProvider } = require("./src/admin/treeview");
const { createConnectionProfileWebview } = require("./src/admin/webview");
const simpleGit = require('simple-git');
const { exec } = require('child_process');
const path = require('path');
const os = require('os');
const {
saveConnectionProfileToStorage,
loadConnectionProfilesFromStorage,
Expand All @@ -24,57 +19,6 @@ let loadedConnectionProfile = null;
const fabricsamples = require("./src/fabricsamples");

function activate(context) {
const fabricDebuggerPath = 'C:\\Users\\Public\\fabric-debugger';
function runupBashScript() {
const platform = process.platform;
const changeDirCommand = `cd "${fabricDebuggerPath}"`;
let runScriptCommand;
if (platform === 'win32') {
runScriptCommand = `wsl bash local-networkup.sh`;
} else {
runScriptCommand = `bash local-networkup.sh`;
}
const fullCommand = `${changeDirCommand} && ${runScriptCommand}`;
exec(fullCommand, (err, stdout, stderr) => {
if (err) {
vscode.window.showErrorMessage(`Error: ${stderr}`);
console.error(`Error: ${stderr}`);
return;
}
vscode.window.showInformationMessage(`Output: ${stdout}`);
console.log(`Output: ${stdout}`);
});
}
let greenButton = vscode.commands.registerCommand('myview.button1', () => {
runupBashScript();
});
context.subscriptions.push(greenButton);
function rundownBashScript() {
const platform = process.platform;
const changeDirCommand = `cd "${fabricDebuggerPath}"`;
let runScriptCommand;
if (platform === 'win32') {
runScriptCommand = `wsl bash local-networkdown.sh`;
} else {
runScriptCommand = `bash local-networkdown.sh`;
}
const fullCommand = `${changeDirCommand} && ${runScriptCommand}`;
exec(fullCommand, (err, stdout, stderr) => {
if (err) {
vscode.window.showErrorMessage(`Error: ${stderr}`);
console.error(`Error: ${stderr}`);
return;
}
vscode.window.showInformationMessage(`Output: ${stdout}`);
console.log(`Output: ${stdout}`);
});
}
let redButton = vscode.commands.registerCommand('myview.button2', () => {
rundownBashScript();
});
context.subscriptions.push(redButton);


const hyperledgerProvider = new fabricsamples();
vscode.window.registerTreeDataProvider(
"start-local-network",
Expand Down Expand Up @@ -158,6 +102,7 @@ function activate(context) {
"All files": ["*"],
},
});

if (fileUri && fileUri[0]) {
const filePath = fileUri[0].fsPath;
fs.readFile(filePath, "utf8", async (err, fileContents) => {
Expand Down Expand Up @@ -390,7 +335,6 @@ function activate(context) {
}
)
);


context.subscriptions.push(
vscode.commands.registerCommand("wallets.uploadWallet", async () => {
Expand Down Expand Up @@ -792,10 +736,38 @@ function extractWalletDetails(walletData) {
credentials = {},
} = walletData;

const certificate =
credentials.certificate ||
walletData.signedCert ||
walletData.certificate ||
"No Certificate Found";

const privateKey =
credentials.privateKey ||
walletData.privateKey ||
walletData.adminPrivateKey ||
"No Private Key Found";

if (
name &&
mspId &&
type &&
certificate !== "No Certificate Found" &&
privateKey !== "No Private Key Found"
) {
return {
name,
mspId,
certificate,
privateKey,
type,
};
} else {
console.warn("Missing required wallet data fields:");
}
}
return null;
}



function deactivate() {}

Expand Down
124 changes: 0 additions & 124 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 1 addition & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,7 @@
},
"commands": [
{
"command": "extension.extractFunctions",
"title": "Debug-Chaincode ▶"
},
{
"command": "fabric-network.start",
"title": "Connection profile form",
"category": "Connection Profile",
"icon": "$(folder)"
},
{
"command": "fabric-network.openFilePicker",
"command": "fabric-network.uploadNetwork",
"title": "Upload File",
"category": "Connection Profile",
"icon": "$(new-file)"
Expand Down Expand Up @@ -182,9 +172,7 @@
]
},
"dependencies": {
"@hyperledger/fabric-gateway": "^1.7.0",
"fabric-network": "^2.2.20",
"js-yaml": "^4.1.0",
"simple-git": "^3.27.0"
},
"publish": {
Expand Down
Loading
Loading