Skip to content

Commit

Permalink
fix: delete node function
Browse files Browse the repository at this point in the history
  • Loading branch information
necipsagiro committed Aug 19, 2023
1 parent 3794cf0 commit dc32f27
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ After the node is installed and synced with the latest block, you can recover an

### Validator Operations

You can perform operations such as "Validator List, Create Validator, Edit Validator, Withdraw Rewards, Delegate, Redelegate, Vote, Unjail, Send Token, Wallets, Logs" of your Node from the Validator Operations section.
You can perform operations such as "Validator List, Add Validator, Edit Validator, Withdraw Rewards, Delegate, Redelegate, Vote, Unjail, Send Token, Wallets, Logs" of your Node from the Validator Operations section.
You can easily update your node with the latest binary versions, participate in network proposals, unjail your node if necessary, send tokens, delegate(stake) tokens to your node or other validators, redelegate tokens, and manage your wallets securely. Klein empowers you to perform all the necessary tasks and operations on your node without complex command-line interactions. It's a convenient and efficient solution for managing and maximizing the potential of your blockchain node.

![](/docs/images/image5.png)
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/cosmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fn delete_node(mut GLOBAL_STRUCT:Option<SessionManager>) {

channel
.exec(&format!(
"bash -c -l \"sudo systemctl stop $EXECUTE; sudo systemctl disable $EXECUTE; sudo rm -rf /etc/systemd/system/$EXECUTE* $(which $EXECUTE) $HOME/$SYSTEM_FOLDER* $HOME/$SYSTEM_FILE* $HOME/$EXECUTE*; sed -i '/EXECUTE/d; /CHAIN_ID/d; /PORT/d; /DENOM/d; /SEEDS/d; /PEERS/d; /VERSION/d; /SYSTEM_FOLDER/d; /PROJECT_FOLDER/d; /GO_VERSION/d; /GENESIS_FILE/d; /ADDRBOOK/d; /MIN_GAS/d; /SEED_MODE/d; /PATH/d; /REPO/d; /MONIKER/d; /SNAPSHOT_URL/d; /WALLET_NAME/d' ~/.bash_profile; source .bash_profile; unset EXECUTE CHAIN_ID PORT DENOM SEEDS PEERS VERSION SYSTEM_FOLDER PROJECT_FOLDER GO_VERSION GENESIS_FILE ADDRBOOK MIN_GAS SEED_MODE PATH REPO MONIKER SNAPSHOT_URL WALLET_NAME\""
"bash -c -l \"sudo systemctl stop $EXECUTE; sudo systemctl disable $EXECUTE; sudo rm -rf /etc/systemd/system/$EXECUTE* $(which $EXECUTE) $HOME/$SYSTEM_FOLDER* $HOME/$EXECUTE*; sed -i '/EXECUTE/d; /CHAIN_ID/d; /PORT/d; /DENOM/d; /SEEDS/d; /PEERS/d; /VERSION/d; /SYSTEM_FOLDER/d; /PROJECT_FOLDER/d; /GO_VERSION/d; /GENESIS_FILE/d; /ADDRBOOK/d; /MIN_GAS/d; /SEED_MODE/d; /PATH/d; /REPO/d; /MONIKER/d; /SNAPSHOT_URL/d; /WALLET_NAME/d' ~/.bash_profile; source .bash_profile; unset EXECUTE CHAIN_ID PORT DENOM SEEDS PEERS VERSION SYSTEM_FOLDER PROJECT_FOLDER GO_VERSION GENESIS_FILE ADDRBOOK MIN_GAS SEED_MODE PATH REPO MONIKER SNAPSHOT_URL WALLET_NAME\""
))
.unwrap();
let mut s = String::new();
Expand Down
48 changes: 40 additions & 8 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,19 +252,51 @@ fn delete_node(exception: String) -> Result<(), String> {
.channel_session()
.map_err(|e| e.to_string())?;
let command = match exception.as_str() {
"celestia-light" => format!(
r#"bash -c -l "sudo systemctl stop $EXECUTE; sudo systemctl disable $EXECUTE;
"celestia-light" => format!(r#"bash -c -l "
sudo systemctl stop $EXECUTE;
sudo systemctl disable $EXECUTE;
pkill -f $EXECUTE;
sudo rm -rf .celestia-app .celestia-light-blockspacerace-0 /etc/systemd/system/$EXECUTE* $(which celestia) $(which celestia-appd) $SYSTEM_FOLDER* $HOME/$SYSTEM_FOLDER* $HOME/$SYSTEM_FILE* $HOME/$EXECUTE*;
sudo rm -rf .celestia-app .celestia-light-blockspacerace-0;
sudo rm -rf $(which celestia);
sudo rm -rf $(which celestia-appd);
if [ -d "/etc/systemd/system/$EXECUTE*" ]; then
sudo rm -rf "/etc/systemd/system/${{EXECUTE}}"*;
fi
if [ -d "$HOME/$SYSTEM_FOLDER" ]; then
sudo rm -rf "$HOME/$SYSTEM_FOLDER"*;
fi
if [ -d "$HOME/$PROJECT_FOLDER" ]; then
sudo rm -rf "$HOME/$PROJECT_FOLDER"*;
fi
if [ -d "$HOME/$EXECUTE" ]; then
sudo rm -rf "$HOME/$EXECUTE"*;
fi
sudo rm -rf /usr/local/go /root/go;
sed -i '/MAIN_WALLET_NAME/d; /MAIN_WALLET_ADDRESS/d; /NODE_PROPERLY_INSTALLED/d; /EXECUTE/d; /CHAIN_ID/d; /PORT/d; /DENOM/d; /SEEDS/d; /PEERS/d; /VERSION/d; /SYSTEM_FOLDER/d; /PROJECT_FOLDER/d; /GO_VERSION/d; /GENESIS_FILE/d; /ADDRBOOK/d; /MIN_GAS/d; /SEED_MODE/d; /REPO/d; /MONIKER/d; /SNAPSHOT_URL/d; /WALLET_NAME/d' ~/.bash_profile; source ~/.bash_profile;
unset NODE_PROPERLY_INSTALLED EXECUTE CHAIN_ID PORT DENOM SEEDS PEERS VERSION SYSTEM_FOLDER PROJECT_FOLDER GO_VERSION GENESIS_FILE ADDRBOOK MIN_GAS SEED_MODE REPO MONIKER SNAPSHOT_URL WALLET_NAME""#
),
_ => format!(
r#"bash -c -l "sudo systemctl stop $EXECUTE; sudo systemctl disable $EXECUTE;
_ => format!(r#"bash -c -l '
sudo systemctl stop $EXECUTE;
sudo systemctl disable $EXECUTE;
pkill -f $EXECUTE;
sudo rm -rf /etc/systemd/system/$EXECUTE* $(which $EXECUTE) $HOME/$SYSTEM_FILE* $HOME/$EXECUTE* $SYSTEM_FOLDER* $HOME/$SYSTEM_FOLDER*;
sed -i '/MAIN_WALLET_NAME/d; /MAIN_WALLET_ADDRESS/d; /NODE_PROPERLY_INSTALLED/d; /EXECUTE/d; /CHAIN_ID/d; /PORT/d; /DENOM/d; /SEEDS/d; /PEERS/d; /VERSION/d; /SYSTEM_FOLDER/d; /PROJECT_FOLDER/d; /GO_VERSION/d; /GENESIS_FILE/d; /ADDRBOOK/d; /MIN_GAS/d; /SEED_MODE/d; /REPO/d; /MONIKER/d; /SNAPSHOT_URL/d; /WALLET_NAME/d' ~/.bash_profile; source ~/.bash_profile;
unset NODE_PROPERLY_INSTALLED EXECUTE CHAIN_ID PORT DENOM SEEDS PEERS VERSION SYSTEM_FOLDER PROJECT_FOLDER GO_VERSION GENESIS_FILE ADDRBOOK MIN_GAS SEED_MODE REPO MONIKER SNAPSHOT_URL WALLET_NAME""#
if [ -d "/etc/systemd/system/$EXECUTE" ]; then
sudo rm -rf "/etc/systemd/system/${{EXECUTE}}"*;
fi
if [ -d "$(which $EXECUTE)" ]; then
sudo rm -rf "$(which $EXECUTE)"*;
fi
if [ -d "$HOME/$SYSTEM_FOLDER" ]; then
sudo rm -rf "$HOME/$SYSTEM_FOLDER"*;
fi
if [ -d "$HOME/$PROJECT_FOLDER" ]; then
sudo rm -rf "$HOME/$PROJECT_FOLDER"*;
fi
if [ -d "$HOME/$EXECUTE" ]; then
sudo rm -rf "$HOME/$EXECUTE"*;
fi
sudo rm -rf /usr/local/go /root/go;
sed -i "/MAIN_WALLET_NAME/d; /MAIN_WALLET_ADDRESS/d; /NODE_PROPERLY_INSTALLED/d; /EXECUTE/d; /CHAIN_ID/d; /PORT/d; /DENOM/d; /SEEDS/d; /PEERS/d; /VERSION/d; /SYSTEM_FOLDER/d; /PROJECT_FOLDER/d; /GO_VERSION/d; /GENESIS_FILE/d; /ADDRBOOK/d; /MIN_GAS/d; /SEED_MODE/d; /REPO/d; /MONIKER/d; /SNAPSHOT_URL/d; /WALLET_NAME/d" ~/.bash_profile; source ~/.bash_profile;
unset NODE_PROPERLY_INSTALLED EXECUTE CHAIN_ID PORT DENOM SEEDS PEERS VERSION SYSTEM_FOLDER PROJECT_FOLDER GO_VERSION GENESIS_FILE ADDRBOOK MIN_GAS SEED_MODE REPO MONIKER SNAPSHOT_URL WALLET_NAME'"#
),
};
channel.exec(&command).map_err(|e| e.to_string())?;
Expand Down
2 changes: 1 addition & 1 deletion src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@
</button>
<div class="sidebar-dropdown-subbuttons">
<button class="each-dropdown-subbutton" id="validator-list-button">Validator List</button><br>
<button class="each-dropdown-subbutton" id="create-validator-button">Create Validator</button><br>
<button class="each-dropdown-subbutton" id="add-validator-button">Add Validator</button><br>
<button class="each-dropdown-subbutton" id="edit-validator-button">Edit Validator</button><br>
<button class="each-dropdown-subbutton" id="withdraw-rewards-button">Withdraw Rewards</button><br>
<button class="each-dropdown-subbutton" id="delegate-token-button">Delegate</button><br>
Expand Down
10 changes: 5 additions & 5 deletions src/node-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const loadNodePage = async (start) => {
document.querySelector(".all-home-wrapper").setAttribute("style", "display: none;");

exception = all_projects.find(item => item.project.name == currentIp.icon)?.project.identifier;
buttons_to_hide = ["node-information-button", "validator-list-button", "create-validator-button", "edit-validator-button", "withdraw-rewards-button", "delegate-token-button", "redelegate-token-button", "vote-button", "unjail-button", "send-token-button"];
buttons_to_hide = ["node-information-button", "validator-list-button", "add-validator-button", "edit-validator-button", "withdraw-rewards-button", "delegate-token-button", "redelegate-token-button", "vote-button", "unjail-button", "send-token-button"];
for (button of buttons_to_hide) {
document.getElementById(button).style.display = currentIp.icon == "Celestia Light" ? "none" : "";
document.getElementById(button).nextElementSibling.style.display = currentIp.icon == "Celestia Light" ? "none" : "";
Expand Down Expand Up @@ -476,7 +476,7 @@ const validatorListSetup = async () => {
hideLoadingAnimation();
window.scrollTo(0, 400);
};
const createValidatorSetup = () => {
const addValidatorSetup = () => {
document.querySelector(".each-button").addEventListener("click", async () => {
if (syncStatusChartPopupText.innerText.includes("Node is synced!")) {
showLoadingAnimation();
Expand Down Expand Up @@ -811,7 +811,7 @@ const setupNodePage = () => {
const subButtonsDiv = document.querySelector(".sidebar-dropdown-subbuttons");
const nodeOperationsButton = document.getElementById("node-operations-button");
const validatorListButton = document.getElementById("validator-list-button");
const createValidatorButton = document.getElementById("create-validator-button");
const addValidatorButton = document.getElementById("add-validator-button");
const editValidatorButton = document.getElementById("edit-validator-button");
const withdrawRewardsButton = document.getElementById("withdraw-rewards-button");
const unjailButton = document.getElementById("unjail-button");
Expand Down Expand Up @@ -900,8 +900,8 @@ const setupNodePage = () => {
validatorListButton.addEventListener("click", async function () {
await changePage("page-content/validator-list.html", validatorListSetup);
});
createValidatorButton.addEventListener("click", async function () {
await handleKeyringExistance("page-content/create-validator.html", createValidatorSetup);
addValidatorButton.addEventListener("click", async function () {
await handleKeyringExistance("page-content/add-validator.html", addValidatorSetup);
});
editValidatorButton.addEventListener("click", async function () {
await handleKeyringExistance("page-content/edit-validator.html", editValidatorSetup);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="each-row">
<div class="page-heading">Create Validator</div>
<div class="page-heading">Add Validator</div>
</div>
<div class="each-row">
<div class="each-input">
Expand Down Expand Up @@ -49,6 +49,13 @@
<div class="each-input-field-border"></div>
</div>
</div>
<div class="each-row">
<div class="each-input" style="width: 100%;">
<div class="each-input-label">Validator Public Key</div>
<input class="each-input-field" placeholder=" " style="width: 100%;"></input>
<div class="each-input-field-border"></div>
</div>
</div>
<div class="each-row">
<div class="each-input" style="width: 100%;">
<div class="each-input-label">Details - <span class="each-input-label-optional">Optional</span></div>
Expand Down

0 comments on commit dc32f27

Please sign in to comment.