Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolved conflicts #19

Merged
merged 2 commits into from
Nov 13, 2024
Merged
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: 60 additions & 32 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
*/
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 @@ -19,6 +24,57 @@ 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 @@ -102,7 +158,6 @@ 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 @@ -335,6 +390,7 @@ function activate(context) {
}
)
);


context.subscriptions.push(
vscode.commands.registerCommand("wallets.uploadWallet", async () => {
Expand Down Expand Up @@ -736,38 +792,10 @@ 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: 124 additions & 0 deletions package-lock.json

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

14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,17 @@
},
"commands": [
{
"command": "fabric-network.uploadNetwork",
"command": "extension.extractFunctions",
"title": "Debug-Chaincode ▶"
},
{
"command": "fabric-network.start",
"title": "Connection profile form",
"category": "Connection Profile",
"icon": "$(folder)"
},
{
"command": "fabric-network.openFilePicker",
"title": "Upload File",
"category": "Connection Profile",
"icon": "$(new-file)"
Expand Down Expand Up @@ -172,7 +182,9 @@
]
},
"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