forked from Qortal/qortal-ui
Add notification to add peer
This commit is contained in:
parent
1dac72b7f3
commit
65676b0413
@ -2,7 +2,7 @@ import {css, html, LitElement} from 'lit'
|
|||||||
import {render} from 'lit/html.js'
|
import {render} from 'lit/html.js'
|
||||||
import {Epml} from '../../../epml.js'
|
import {Epml} from '../../../epml.js'
|
||||||
import isElectron from 'is-electron'
|
import isElectron from 'is-electron'
|
||||||
import {get, registerTranslateConfig, translate, use} from '../../../../core/translate/index.js'
|
import {get, registerTranslateConfig, translate, use} from 'lit-translate'
|
||||||
import '@polymer/paper-spinner/paper-spinner-lite.js'
|
import '@polymer/paper-spinner/paper-spinner-lite.js'
|
||||||
import '@material/mwc-icon'
|
import '@material/mwc-icon'
|
||||||
import '@material/mwc-textfield'
|
import '@material/mwc-textfield'
|
||||||
@ -119,7 +119,7 @@ class NodeManagement extends LitElement {
|
|||||||
display: flex;
|
display: flex;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
`;
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -152,127 +152,93 @@ class NodeManagement extends LitElement {
|
|||||||
<h2>${translate("nodepage.nchange1")} ${this.nodeDomain}</h2>
|
<h2>${translate("nodepage.nchange1")} ${this.nodeDomain}</h2>
|
||||||
<mwc-button style="float:right;" class="red" ?hidden="${(this.upTime === "offline")}" @click=${() => this.stopNode()}><mwc-icon>dangerous</mwc-icon> ${translate("nodepage.nchange31")}</mwc-button>
|
<mwc-button style="float:right;" class="red" ?hidden="${(this.upTime === "offline")}" @click=${() => this.stopNode()}><mwc-icon>dangerous</mwc-icon> ${translate("nodepage.nchange31")}</mwc-button>
|
||||||
<mwc-button style="float:right;" ?hidden="${(this.upTime === "offline")}" @click=${() => this.restartNode()}><mwc-icon>360</mwc-icon> ${translate("nodepage.nchange33")}</mwc-button>
|
<mwc-button style="float:right;" ?hidden="${(this.upTime === "offline")}" @click=${() => this.restartNode()}><mwc-icon>360</mwc-icon> ${translate("nodepage.nchange33")}</mwc-button>
|
||||||
<span class="sblack"><br />${translate("nodepage.nchange2")} ${this.upTime}</span>
|
<span class="sblack"><br>${translate("nodepage.nchange2")} ${this.upTime}</span>
|
||||||
<br /><br />
|
<br><br>
|
||||||
<div id="minting">
|
<div id="minting">
|
||||||
<div style="min-height:48px; display: flex; padding-bottom: 6px;">
|
<div style="min-height:48px; display: flex; padding-bottom: 6px;">
|
||||||
<h3 style="margin: 0; flex: 1; padding-top: 8px; display: inline;">${translate("nodepage.nchange3")}</h3>
|
<h3 style="margin: 0; flex: 1; padding-top: 8px; display: inline;">${translate("nodepage.nchange3")}</h3>
|
||||||
<mwc-button
|
<mwc-button style="float: right;" @click=${() => this.shadowRoot.getElementById('addMintingAccountDialog').show()}>
|
||||||
style="float:right;"
|
|
||||||
@click=${() => this.shadowRoot.querySelector("#addMintingAccountDialog").show()}
|
|
||||||
>
|
|
||||||
<mwc-icon>add</mwc-icon>
|
<mwc-icon>add</mwc-icon>
|
||||||
${translate("nodepage.nchange4")}
|
${translate("nodepage.nchange4")}
|
||||||
</mwc-button>
|
</mwc-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Add Minting Account Dialog -->
|
|
||||||
<mwc-dialog id="addMintingAccountDialog" scrimClickAction="${this.addMintingAccountLoading ? "" : "close"}">
|
|
||||||
<div>${translate("nodepage.nchange5")}</div>
|
|
||||||
<br />
|
|
||||||
<mwc-textfield
|
|
||||||
?disabled="${this.addMintingAccountLoading}"
|
|
||||||
label="${translate("nodepage.nchange6")}"
|
|
||||||
id="addMintingAccountKey"
|
|
||||||
>
|
|
||||||
</mwc-textfield>
|
|
||||||
<div style="text-align:right; height:36px;" ?hidden=${this.addMintingAccountMessage === ""}>
|
|
||||||
<span ?hidden="${this.addMintingAccountLoading}">
|
|
||||||
${this.addMintingAccountMessage}
|
|
||||||
</span>
|
|
||||||
<span ?hidden="${!this.addMintingAccountLoading}">
|
|
||||||
<!-- loading message -->
|
|
||||||
${translate("nodepage.nchange7")}
|
|
||||||
<paper-spinner-lite
|
|
||||||
style="margin-top:12px;"
|
|
||||||
?active="${this.addMintingAccountLoading}"
|
|
||||||
alt="Adding minting account"
|
|
||||||
>
|
|
||||||
</paper-spinner-lite>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<mwc-button
|
|
||||||
?disabled="${this.addMintingAccountLoading}"
|
|
||||||
slot="primaryAction"
|
|
||||||
@click=${this.addMintingAccount}
|
|
||||||
>
|
|
||||||
${translate("nodepage.nchange8")}
|
|
||||||
</mwc-button>
|
|
||||||
<mwc-button
|
|
||||||
?disabled="${this.addMintingAccountLoading}"
|
|
||||||
slot="secondaryAction"
|
|
||||||
dialogAction="cancel"
|
|
||||||
class="red"
|
|
||||||
>
|
|
||||||
${translate("general.close")}
|
|
||||||
</mwc-button>
|
|
||||||
</mwc-dialog>
|
|
||||||
|
|
||||||
<vaadin-grid theme="large" id="mintingAccountsGrid" ?hidden="${this.isEmptyArray(this.mintingAccounts)}" .items="${this.mintingAccounts}" aria-label="Minting Accounts" all-rows-visible>
|
<vaadin-grid theme="large" id="mintingAccountsGrid" ?hidden="${this.isEmptyArray(this.mintingAccounts)}" .items="${this.mintingAccounts}" aria-label="Minting Accounts" all-rows-visible>
|
||||||
<vaadin-grid-column auto-width header="${translate("nodepage.nchange9")}" path="mintingAccount"></vaadin-grid-column>
|
<vaadin-grid-column auto-width header="${translate("nodepage.nchange9")}" path="mintingAccount"></vaadin-grid-column>
|
||||||
<vaadin-grid-column auto-width header="${translate("nodepage.nchange10")}" path="recipientAccount"></vaadin-grid-column>
|
<vaadin-grid-column auto-width header="${translate("nodepage.nchange10")}" path="recipientAccount"></vaadin-grid-column>
|
||||||
<vaadin-grid-column width="12em" header="${translate("nodepage.nchange11")}" .renderer=${(root, column, data) => {
|
<vaadin-grid-column width="12em" header="${translate("nodepage.nchange11")}" .renderer=${(root, column, data) => {
|
||||||
render(html`<mwc-button class="red" ?disabled=${this.removeMintingAccountLoading} @click=${() => this.removeMintingAccount(data.item.publicKey)}><mwc-icon>create</mwc-icon> ${translate("nodepage.nchange12")}</mwc-button>`, root)
|
render(html`
|
||||||
|
<mwc-button class="red" ?disabled=${this.removeMintingAccountLoading} @click=${() => this.removeMintingAccount(data.item.publicKey)}>
|
||||||
|
<mwc-icon>create</mwc-icon> ${translate("nodepage.nchange12")}
|
||||||
|
</mwc-button>
|
||||||
|
`, root)
|
||||||
}}></vaadin-grid-column>
|
}}></vaadin-grid-column>
|
||||||
</vaadin-grid>
|
</vaadin-grid>
|
||||||
${this.isEmptyArray(this.mintingAccounts) ? html`<span style="color: var(--black);">${translate("nodepage.nchange13")}</span>` : ""}
|
${this.isEmptyArray(this.mintingAccounts) ? html`<span style="color: var(--black);">${translate("nodepage.nchange13")}</span>` : ""}
|
||||||
</div>
|
</div><br>
|
||||||
<br />
|
|
||||||
<div id="peers">
|
<div id="peers">
|
||||||
<div style="min-height: 48px; display: flex; padding-bottom: 6px;">
|
<div style="min-height: 48px; display: flex; padding-bottom: 6px;">
|
||||||
<h3 style="margin: 0; flex: 1; padding-top: 8px; display: inline;">
|
<h3 style="margin: 0; flex: 1; padding-top: 8px; display: inline;">
|
||||||
<span>${translate("nodepage.nchange14")}</span>
|
<span>${translate("nodepage.nchange14")}</span>
|
||||||
<span>(${this.peers.length})</span>
|
<span>(${this.peers.length})</span>
|
||||||
</h3>
|
</h3>
|
||||||
<mwc-button @click=${() => this.shadowRoot.querySelector("#addPeerDialog").show()}><mwc-icon>add</mwc-icon> ${translate("nodepage.nchange15")}</mwc-button>
|
<mwc-button @click=${() => this.shadowRoot.getElementById('addPeerDialog').show()}><mwc-icon>add</mwc-icon> ${translate("nodepage.nchange15")}</mwc-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<mwc-dialog id="addPeerDialog" scrimClickAction="${this.addPeerLoading ? "" : "close"}">
|
|
||||||
<div>${translate("nodepage.nchange16")}</div>
|
|
||||||
<br />
|
|
||||||
<mwc-textfield ?disabled="${this.addPeerLoading}" label="${translate("nodepage.nchange17")}" id="addPeerAddress" ></mwc-textfield>
|
|
||||||
<div style="text-align:right; height:36px;" ?hidden=${this.addPeerMessage === ""}>
|
|
||||||
<span ?hidden="${this.addPeerLoading}"> ${this.addPeerMessage} </span>
|
|
||||||
<span ?hidden="${!this.addPeerLoading}">
|
|
||||||
<paper-spinner-lite
|
|
||||||
style="margin-top:12px;"
|
|
||||||
?active="${this.addPeerLoading}"
|
|
||||||
alt="Adding minting account"
|
|
||||||
>
|
|
||||||
</paper-spinner-lite>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<mwc-button
|
|
||||||
?disabled="${this.addPeerLoading}"
|
|
||||||
@click="${this.addPeer}"
|
|
||||||
slot="primaryAction"
|
|
||||||
>
|
|
||||||
${translate("nodepage.nchange8")}
|
|
||||||
</mwc-button>
|
|
||||||
<mwc-button
|
|
||||||
slot="secondaryAction"
|
|
||||||
dialogAction="cancel"
|
|
||||||
?disabled="${this.addPeerLoading}"
|
|
||||||
class="red"
|
|
||||||
>
|
|
||||||
${translate("general.close")}
|
|
||||||
</mwc-button>
|
|
||||||
</mwc-dialog>
|
|
||||||
|
|
||||||
<vaadin-grid theme="large" id="peersGrid" ?hidden="${this.isEmptyArray(this.peers)}" .items="${this.peers}" aria-label="Peers" all-rows-visible>
|
<vaadin-grid theme="large" id="peersGrid" ?hidden="${this.isEmptyArray(this.peers)}" .items="${this.peers}" aria-label="Peers" all-rows-visible>
|
||||||
<vaadin-grid-column header="${translate("nodepage.nchange18")}" path="address"></vaadin-grid-column>
|
<vaadin-grid-column header="${translate("nodepage.nchange18")}" path="address"></vaadin-grid-column>
|
||||||
<vaadin-grid-column header="${translate("nodepage.nchange19")}" path="lastHeight"></vaadin-grid-column>
|
<vaadin-grid-column header="${translate("nodepage.nchange19")}" path="lastHeight"></vaadin-grid-column>
|
||||||
<vaadin-grid-column header="${translate("nodepage.nchange20")}" path="version"></vaadin-grid-column>
|
<vaadin-grid-column header="${translate("nodepage.nchange20")}" path="version"></vaadin-grid-column>
|
||||||
<vaadin-grid-column header="${translate("nodepage.nchange21")}" path="age"></vaadin-grid-column>
|
<vaadin-grid-column header="${translate("nodepage.nchange21")}" path="age"></vaadin-grid-column>
|
||||||
<vaadin-grid-column width="12em" header="${translate("nodepage.nchange22")}" .renderer=${(root, column, data) => {
|
<vaadin-grid-column width="12em" header="${translate("nodepage.nchange22")}" .renderer=${(root, column, data) => {
|
||||||
render(html`<mwc-button class="red" @click=${() => this.removePeer(data.item.address, data.index)}><mwc-icon>delete</mwc-icon> ${translate("nodepage.nchange12")}</mwc-button><mwc-button class="green" @click=${() => this.forceSyncPeer(data.item.address, data.index)}> ${translate("nodepage.nchange23")}</mwc-button>`, root)
|
render(html`
|
||||||
|
<mwc-button class="red" @click=${() => this.removePeer(data.item.address, data.index)}>
|
||||||
|
<mwc-icon>delete</mwc-icon> ${translate("nodepage.nchange12")}
|
||||||
|
</mwc-button>
|
||||||
|
<mwc-button class="green" @click=${() => this.forceSyncPeer(data.item.address, data.index)}>
|
||||||
|
${translate("nodepage.nchange23")}
|
||||||
|
</mwc-button>
|
||||||
|
`, root)
|
||||||
}}></vaadin-grid-column>
|
}}></vaadin-grid-column>
|
||||||
</vaadin-grid>
|
</vaadin-grid>
|
||||||
${this.isEmptyArray(this.peers) ? html`<span style="color: var(--black);">${translate("nodepage.nchange24")}</span>` : ""}
|
${this.isEmptyArray(this.peers) ? html`<span style="color: var(--black);">${translate("nodepage.nchange24")}</span>` : ""}
|
||||||
</div>
|
</div><br>
|
||||||
<br />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<mwc-dialog id="addPeerDialog" scrimClickAction="" escapeKeyAction="">
|
||||||
|
<div>${translate("nodepage.nchange16")}</div><br>
|
||||||
|
<mwc-textfield ?disabled="${this.addPeerLoading}" label="${translate("nodepage.nchange17")}" id="addPeerAddress" ></mwc-textfield>
|
||||||
|
<div style="text-align: center; height: 36px;" ?hidden="${!this.addPeerLoading}">
|
||||||
|
<span>
|
||||||
|
<paper-spinner-lite style="margin-top: 12px;" ?active="${this.addPeerLoading}" alt="Adding new peer"></paper-spinner-lite>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<mwc-button ?disabled="${this.addPeerLoading}" @click="${this.addPeer}" slot="primaryAction">
|
||||||
|
${translate("nodepage.nchange8")}
|
||||||
|
</mwc-button>
|
||||||
|
<mwc-button slot="secondaryAction" ?disabled="${this.addPeerLoading}" @click="${() => this.closeAddPeerDialog()}" class="red">
|
||||||
|
${translate("general.close")}
|
||||||
|
</mwc-button>
|
||||||
|
</mwc-dialog>
|
||||||
|
|
||||||
|
<mwc-dialog id="addMintingAccountDialog" scrimClickAction="${this.addMintingAccountLoading ? "" : "close"}">
|
||||||
|
<div>${translate("nodepage.nchange5")}</div><br>
|
||||||
|
<mwc-textfield ?disabled="${this.addMintingAccountLoading}" label="${translate("nodepage.nchange6")}" id="addMintingAccountKey"></mwc-textfield>
|
||||||
|
<div style="text-align:right; height:36px;" ?hidden=${this.addMintingAccountMessage === ""}>
|
||||||
|
<span ?hidden="${this.addMintingAccountLoading}">
|
||||||
|
${this.addMintingAccountMessage}
|
||||||
|
</span>
|
||||||
|
<span ?hidden="${!this.addMintingAccountLoading}">
|
||||||
|
${translate("nodepage.nchange7")}
|
||||||
|
<paper-spinner-lite style="margin-top:12px;" ?active="${this.addMintingAccountLoading}" alt="Adding minting account"></paper-spinner-lite>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<mwc-button ?disabled="${this.addMintingAccountLoading}" slot="primaryAction" @click=${this.addMintingAccount}>
|
||||||
|
${translate("nodepage.nchange8")}
|
||||||
|
</mwc-button>
|
||||||
|
<mwc-button ?disabled="${this.addMintingAccountLoading}" slot="secondaryAction" dialogAction="cancel" class="red">
|
||||||
|
${translate("general.close")}
|
||||||
|
</mwc-button>
|
||||||
|
</mwc-dialog>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,7 +287,9 @@ class NodeManagement extends LitElement {
|
|||||||
|
|
||||||
const getNodeUpTime = () => {
|
const getNodeUpTime = () => {
|
||||||
this.upTime = ""
|
this.upTime = ""
|
||||||
parentEpml.request("apiCall", { url: `/admin/uptime` }).then((res) => {
|
parentEpml.request("apiCall", {
|
||||||
|
url: `/admin/uptime`
|
||||||
|
}).then((res) => {
|
||||||
this.upTime = convertMsToTime(res)
|
this.upTime = convertMsToTime(res)
|
||||||
})
|
})
|
||||||
setTimeout(getNodeUpTime, 60000)
|
setTimeout(getNodeUpTime, 60000)
|
||||||
@ -329,7 +297,9 @@ class NodeManagement extends LitElement {
|
|||||||
|
|
||||||
const updatePeers = () => {
|
const updatePeers = () => {
|
||||||
this.peers = []
|
this.peers = []
|
||||||
parentEpml.request("apiCall", { url: `/peers` }).then((res) => {
|
parentEpml.request("apiCall", {
|
||||||
|
url: `/peers`
|
||||||
|
}).then((res) => {
|
||||||
this.peers = res
|
this.peers = res
|
||||||
})
|
})
|
||||||
setTimeout(updatePeers, 60000)
|
setTimeout(updatePeers, 60000)
|
||||||
@ -361,7 +331,9 @@ class NodeManagement extends LitElement {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
parentEpml.imReady()
|
parentEpml.imReady()
|
||||||
|
|
||||||
this.clearConsole()
|
this.clearConsole()
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
this.clearConsole()
|
this.clearConsole()
|
||||||
}, 60000)
|
}, 60000)
|
||||||
@ -405,15 +377,13 @@ class NodeManagement extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
forceSyncPeer(peerAddress, rowIndex) {
|
forceSyncPeer(peerAddress, rowIndex) {
|
||||||
parentEpml
|
parentEpml.request("apiCall", {
|
||||||
.request("apiCall", {
|
|
||||||
url: `/admin/forcesync?apiKey=${this.getApiKey()}`,
|
url: `/admin/forcesync?apiKey=${this.getApiKey()}`,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: peerAddress,
|
body: peerAddress
|
||||||
})
|
}).then((res) => {
|
||||||
.then((res) => {
|
let snackString = get("nodepage.nchange25")
|
||||||
let err3string = get("nodepage.nchange25")
|
parentEpml.request('showSnackBar', `${snackString}` + peerAddress)
|
||||||
parentEpml.request('showSnackBar', `${err3string}` + peerAddress)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,11 +392,11 @@ class NodeManagement extends LitElement {
|
|||||||
.request("apiCall", {
|
.request("apiCall", {
|
||||||
url: `/peers?apiKey=${this.getApiKey()}`,
|
url: `/peers?apiKey=${this.getApiKey()}`,
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
body: peerAddress,
|
body: peerAddress
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let err4string = get("nodepage.nchange26")
|
let snackString = get("nodepage.nchange26")
|
||||||
parentEpml.request('showSnackBar', `${err4string}` + peerAddress)
|
parentEpml.request('showSnackBar', `${snackString}` + peerAddress)
|
||||||
this.peers.splice(rowIndex, 1)
|
this.peers.splice(rowIndex, 1)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -438,8 +408,8 @@ class NodeManagement extends LitElement {
|
|||||||
method: "GET"
|
method: "GET"
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let err7string = get("nodepage.nchange32")
|
let snackString = get("nodepage.nchange32")
|
||||||
parentEpml.request('showSnackBar', `${err7string}`)
|
parentEpml.request('showSnackBar', `${snackString}`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,44 +420,52 @@ class NodeManagement extends LitElement {
|
|||||||
method: "GET"
|
method: "GET"
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let err7string = get("nodepage.nchange34")
|
let snackString = get("nodepage.nchange34")
|
||||||
parentEpml.request('showSnackBar', `${err7string}`)
|
parentEpml.request('showSnackBar', `${snackString}`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onPageNavigation(pageUrl) {
|
async addPeer() {
|
||||||
parentEpml.request("setPageUrl", pageUrl)
|
|
||||||
}
|
|
||||||
|
|
||||||
addPeer(e) {
|
|
||||||
this.addPeerLoading = true
|
this.addPeerLoading = true
|
||||||
const addPeerAddress = this.shadowRoot.querySelector("#addPeerAddress").value
|
const addPeerAddress = this.shadowRoot.getElementById('addPeerAddress').value
|
||||||
|
console.log("ADDRESS", addPeerAddress)
|
||||||
parentEpml
|
await parentEpml.request("apiCall", {
|
||||||
.request("apiCall", {
|
|
||||||
url: `/peers?apiKey=${this.getApiKey()}`,
|
url: `/peers?apiKey=${this.getApiKey()}`,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: addPeerAddress,
|
body: addPeerAddress
|
||||||
})
|
}).then((res) => {
|
||||||
.then((res) => {
|
console.log("RES", res)
|
||||||
this.addPeerMessage = res.message
|
if (res === true) {
|
||||||
|
let trueString = get("walletpage.wchange52")
|
||||||
|
parentEpml.request('showSnackBar', `${trueString}`)
|
||||||
this.addPeerLoading = false
|
this.addPeerLoading = false
|
||||||
|
this.shadowRoot.getElementById('addPeerAddress').value = ''
|
||||||
|
this.shadowRoot.getElementById('addPeerDialog').close()
|
||||||
|
} else if (res === false || res.error === 123) {
|
||||||
|
let falseString = get("tabmenu.tm41")
|
||||||
|
parentEpml.request('showSnackBar', `${falseString}`)
|
||||||
|
this.addPeerLoading = false
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
addMintingAccount(e) {
|
closeAddPeerDialog() {
|
||||||
|
this.addPeerLoading = false
|
||||||
|
this.shadowRoot.getElementById('addPeerAddress').value = ''
|
||||||
|
this.shadowRoot.getElementById('addPeerDialog').close()
|
||||||
|
}
|
||||||
|
|
||||||
|
addMintingAccount() {
|
||||||
this.addMintingAccountLoading = true
|
this.addMintingAccountLoading = true
|
||||||
this.addMintingAccountMessage = "Loading..."
|
this.addMintingAccountMessage = "Loading..."
|
||||||
|
|
||||||
this.addMintingAccountKey = this.shadowRoot.querySelector("#addMintingAccountKey").value
|
this.addMintingAccountKey = this.shadowRoot.querySelector("#addMintingAccountKey").value
|
||||||
|
|
||||||
parentEpml
|
parentEpml.request("apiCall", {
|
||||||
.request("apiCall", {
|
|
||||||
url: `/admin/mintingaccounts?apiKey=${this.getApiKey()}`,
|
url: `/admin/mintingaccounts?apiKey=${this.getApiKey()}`,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: this.addMintingAccountKey,
|
body: this.addMintingAccountKey
|
||||||
})
|
}).then((res) => {
|
||||||
.then((res) => {
|
|
||||||
if (res === true) {
|
if (res === true) {
|
||||||
this.updateMintingAccounts()
|
this.updateMintingAccounts()
|
||||||
this.addMintingAccountKey = ""
|
this.addMintingAccountKey = ""
|
||||||
@ -503,7 +481,9 @@ class NodeManagement extends LitElement {
|
|||||||
|
|
||||||
updateMintingAccounts() {
|
updateMintingAccounts() {
|
||||||
this.mintingAccounts = []
|
this.mintingAccounts = []
|
||||||
parentEpml.request("apiCall", { url: `/admin/mintingaccounts` }).then((res) => {
|
parentEpml.request("apiCall", {
|
||||||
|
url: `/admin/mintingaccounts`
|
||||||
|
}).then((res) => {
|
||||||
this.mintingAccounts = res
|
this.mintingAccounts = res
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -514,17 +494,17 @@ class NodeManagement extends LitElement {
|
|||||||
parentEpml.request("apiCall", {
|
parentEpml.request("apiCall", {
|
||||||
url: `/admin/mintingaccounts?apiKey=${this.getApiKey()}`,
|
url: `/admin/mintingaccounts?apiKey=${this.getApiKey()}`,
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
body: publicKey,
|
body: publicKey
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res === true) {
|
if (res === true) {
|
||||||
this.updateMintingAccounts()
|
this.updateMintingAccounts()
|
||||||
this.removeMintingAccountLoading = false
|
this.removeMintingAccountLoading = false
|
||||||
let err5string = get("nodepage.nchange29")
|
let snackString = get("nodepage.nchange29")
|
||||||
parentEpml.request('showSnackBar', `${err5string}`)
|
parentEpml.request('showSnackBar', `${snackString}`)
|
||||||
} else {
|
} else {
|
||||||
this.removeMintingAccountLoading = false
|
this.removeMintingAccountLoading = false
|
||||||
let err6string = get("nodepage.nchange30")
|
let snackString = get("nodepage.nchange30")
|
||||||
parentEpml.request('showSnackBar', `${err6string}`)
|
parentEpml.request('showSnackBar', `${snackString}`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user