4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-14 11:15:50 +00:00

Added Bootstrap dialog

This commit is contained in:
AlphaX-Projects 2024-01-04 18:36:27 +01:00
parent 6123f5eb36
commit 1019896cf4
2 changed files with 54 additions and 21 deletions

View File

@ -1001,7 +1001,8 @@
"nchange33": "Restart Node", "nchange33": "Restart Node",
"nchange34": "Successfully Sent Restart Request!", "nchange34": "Successfully Sent Restart Request!",
"nchange35": "Start Node", "nchange35": "Start Node",
"nchange36": "Successfully Started Node!" "nchange36": "Successfully Started Node!",
"nchange37": "Clicking on continue will refresh your Qortal Core, your db will be removed, and you will downoad a new copy of the db, called “bootstrapping“."
}, },
"transpage": { "transpage": {
"tchange1": "Transaction request", "tchange1": "Transaction request",

View File

@ -154,7 +154,7 @@ class NodeManagement extends LitElement {
<div id="node-management-page"> <div id="node-management-page">
<div class="node-card"> <div class="node-card">
<h2>${translate("nodepage.nchange1")} ${this.nodeDomain}</h2> <h2>${translate("nodepage.nchange1")} ${this.nodeDomain}</h2>
<mwc-button style="float:right;" ?hidden="${(this.upTime === "offline")}" @click=${() => this.bootstrap()}><mwc-icon>restart_alt</mwc-icon>&nbsp;${translate("tour.tour18")}</mwc-button> <mwc-button style="float:right;" ?hidden="${(this.upTime === "offline")}" @click=${() => this.openBootstrapDialog()}><mwc-icon>restart_alt</mwc-icon>&nbsp;${translate("tour.tour18")}</mwc-button>
<mwc-button style="float:right;" ?hidden="${(this.upTime === "offline")}" @click=${() => this.restartNode()}><mwc-icon>360</mwc-icon>&nbsp;${translate("nodepage.nchange33")}</mwc-button> <mwc-button style="float:right;" ?hidden="${(this.upTime === "offline")}" @click=${() => this.restartNode()}><mwc-icon>360</mwc-icon>&nbsp;${translate("nodepage.nchange33")}</mwc-button>
${this.renderStartStopButton()} ${this.renderStartStopButton()}
<span class="sblack"><br>${translate("nodepage.nchange2")} ${this.upTime}</span> <span class="sblack"><br>${translate("nodepage.nchange2")} ${this.upTime}</span>
@ -244,6 +244,17 @@ class NodeManagement extends LitElement {
${translate("general.close")} ${translate("general.close")}
</mwc-button> </mwc-button>
</mwc-dialog> </mwc-dialog>
<mwc-dialog id="bootstrapDialog" scrimClickAction="" escapeKeyAction="">
<div style="text-align: center;">${translate("tour.tour18")}</div><br>
<div style="text-align: center;">${translate("nodepage.nchange37")}</div>
<mwc-button @click="${() => this.bootstrapNode()}" slot="primaryAction">
${translate("general.continue")}
</mwc-button>
<mwc-button slot="secondaryAction" @click="${() => this.closeBootstrapDialog()}" class="red">
${translate("login.lp4")}
</mwc-button>
</mwc-dialog>
` `
} }
@ -424,45 +435,66 @@ class NodeManagement extends LitElement {
window.parent.electronAPI.startCore() window.parent.electronAPI.startCore()
let startString = get("nodepage.nchange36") let startString = get("nodepage.nchange36")
parentEpml.request('showSnackBar', `${startString}`) parentEpml.request('showSnackBar', `${startString}`)
this.upTime = "starting node"
} }
} }
stopNode() { stopNode() {
parentEpml parentEpml.request("apiCall", {
.request("apiCall", {
url: `/admin/stop?apiKey=${this.getApiKey()}`, url: `/admin/stop?apiKey=${this.getApiKey()}`,
method: "GET" method: "GET"
}) }).then((res) => {
.then((res) => { if (res === true) {
let snackString = get("nodepage.nchange32") let snackString = get("nodepage.nchange32")
parentEpml.request('showSnackBar', `${snackString}`) parentEpml.request('showSnackBar', `${snackString}`)
this.upTime = "offline"
} else {
let snackString = get("walletpage.wchange44")
parentEpml.request('showSnackBar', `${snackString}`)
}
}) })
} }
restartNode() { restartNode() {
parentEpml parentEpml.request("apiCall", {
.request("apiCall", {
url: `/admin/restart?apiKey=${this.getApiKey()}`, url: `/admin/restart?apiKey=${this.getApiKey()}`,
method: "GET" method: "GET"
}) }).then((res) => {
.then((res) => { if (res === true) {
let snackString = get("nodepage.nchange34") let snackString = get("nodepage.nchange34")
parentEpml.request('showSnackBar', `${snackString}`) parentEpml.request('showSnackBar', `${snackString}`)
this.upTime = "restarting node"
} else {
let snackString = get("walletpage.wchange44")
parentEpml.request('showSnackBar', `${snackString}`)
}
}) })
} }
bootstrap() { bootstrapNode() {
parentEpml.request("apiCall", { parentEpml.request("apiCall", {
url: `/admin/bootstrap/?apiKey=${this.getApiKey()}`, url: `/admin/bootstrap/?apiKey=${this.getApiKey()}`,
method: "GET" method: "GET"
}).then((res) => { }).then((res) => {
if (res === true) { if (res === true) {
this.shadowRoot.getElementById('bootstrapDialog').close()
let snackString = get("tour.tour22") let snackString = get("tour.tour22")
parentEpml.request('showSnackBar', `${snackString}`) parentEpml.request('showSnackBar', `${snackString}`)
} else {
let snackString = get("walletpage.wchange44")
parentEpml.request('showSnackBar', `${snackString}`)
} }
}) })
} }
openBootstrapDialog() {
this.shadowRoot.getElementById('bootstrapDialog').show()
}
closeBootstrapDialog() {
this.shadowRoot.getElementById('bootstrapDialog').close()
}
async addPeer() { async addPeer() {
this.addPeerLoading = true this.addPeerLoading = true
const addPeerAddress = this.shadowRoot.getElementById('addPeerAddress').value const addPeerAddress = this.shadowRoot.getElementById('addPeerAddress').value