|
|
@ -21,7 +21,7 @@ import LoadingSpinner from './components/LoadingSpinner.vue'; |
|
|
import IconClose from './components/icons/IconClose.vue'; |
|
|
import IconClose from './components/icons/IconClose.vue'; |
|
|
import IconWarning from './components/icons/IconWarning.vue'; |
|
|
import IconWarning from './components/icons/IconWarning.vue'; |
|
|
import IconAvatarDefault from './components/icons/IconAvatarDefault.vue'; |
|
|
import IconAvatarDefault from './components/icons/IconAvatarDefault.vue'; |
|
|
import ClientTransfer from './components/ClientTransfer.vue' |
|
|
import ClientTransfer from './components/ClientTransfer.vue'; |
|
|
|
|
|
|
|
|
class API { |
|
|
class API { |
|
|
async call({ method, path, body }) { |
|
|
async call({ method, path, body }) { |
|
|
@ -346,13 +346,15 @@ export default { |
|
|
this.clientCreateName = ''; |
|
|
this.clientCreateName = ''; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
async refresh ({ updateCharts = false } = {}) { |
|
|
async refresh({ updateCharts = false } = {}) { |
|
|
if (!this.authenticated) return; |
|
|
if (!this.authenticated) return; |
|
|
|
|
|
|
|
|
const clientsData = await this.api.getClients(); |
|
|
const clientsData = await this.api.getClients(); |
|
|
this.clients = clientsData.map((client) => { |
|
|
this.clients = clientsData.map((client) => { |
|
|
if (client.name.includes('@') && client.name.includes('.')) { |
|
|
if (client.name.includes('@') && client.name.includes('.')) { |
|
|
client.avatar = `https://www.gravatar.com/avatar/${sha256(client.name)}?d=blank`; |
|
|
client.avatar = `https://www.gravatar.com/avatar/${sha256( |
|
|
|
|
|
client.name |
|
|
|
|
|
)}?d=blank`; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!this.clientsPersist[client.id]) { |
|
|
if (!this.clientsPersist[client.id]) { |
|
|
@ -369,10 +371,12 @@ export default { |
|
|
|
|
|
|
|
|
if (updateCharts) { |
|
|
if (updateCharts) { |
|
|
this.clientsPersist[client.id].transferRxCurrent = |
|
|
this.clientsPersist[client.id].transferRxCurrent = |
|
|
client.transferRx - this.clientsPersist[client.id].transferRxPrevious; |
|
|
client.transferRx - |
|
|
|
|
|
this.clientsPersist[client.id].transferRxPrevious; |
|
|
this.clientsPersist[client.id].transferRxPrevious = client.transferRx; |
|
|
this.clientsPersist[client.id].transferRxPrevious = client.transferRx; |
|
|
this.clientsPersist[client.id].transferTxCurrent = |
|
|
this.clientsPersist[client.id].transferTxCurrent = |
|
|
client.transferTx - this.clientsPersist[client.id].transferTxPrevious; |
|
|
client.transferTx - |
|
|
|
|
|
this.clientsPersist[client.id].transferTxPrevious; |
|
|
this.clientsPersist[client.id].transferTxPrevious = client.transferTx; |
|
|
this.clientsPersist[client.id].transferTxPrevious = client.transferTx; |
|
|
|
|
|
|
|
|
this.clientsPersist[client.id].transferRxHistory.push( |
|
|
this.clientsPersist[client.id].transferRxHistory.push( |
|
|
@ -386,11 +390,15 @@ export default { |
|
|
this.clientsPersist[client.id].transferTxHistory.shift(); |
|
|
this.clientsPersist[client.id].transferTxHistory.shift(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
client.transferTxCurrent = this.clientsPersist[client.id].transferTxCurrent; |
|
|
client.transferTxCurrent = |
|
|
client.transferRxCurrent = this.clientsPersist[client.id].transferRxCurrent; |
|
|
this.clientsPersist[client.id].transferTxCurrent; |
|
|
|
|
|
client.transferRxCurrent = |
|
|
|
|
|
this.clientsPersist[client.id].transferRxCurrent; |
|
|
|
|
|
|
|
|
client.transferTxHistory = this.clientsPersist[client.id].transferTxHistory; |
|
|
client.transferTxHistory = |
|
|
client.transferRxHistory = this.clientsPersist[client.id].transferRxHistory; |
|
|
this.clientsPersist[client.id].transferTxHistory; |
|
|
|
|
|
client.transferRxHistory = |
|
|
|
|
|
this.clientsPersist[client.id].transferRxHistory; |
|
|
client.transferMax = Math.max( |
|
|
client.transferMax = Math.max( |
|
|
...client.transferTxHistory, |
|
|
...client.transferTxHistory, |
|
|
...client.transferRxHistory |
|
|
...client.transferRxHistory |
|
|
@ -403,7 +411,7 @@ export default { |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
login (e) { |
|
|
login(e) { |
|
|
e.preventDefault(); |
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
|
if (!this.password) return; |
|
|
if (!this.password) return; |
|
|
@ -429,7 +437,7 @@ export default { |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
logout (e) { |
|
|
logout(e) { |
|
|
e.preventDefault(); |
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
|
this.api |
|
|
this.api |
|
|
@ -443,7 +451,7 @@ export default { |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
createClient () { |
|
|
createClient() { |
|
|
const name = this.clientCreateName; |
|
|
const name = this.clientCreateName; |
|
|
if (!name) return; |
|
|
if (!name) return; |
|
|
|
|
|
|
|
|
@ -453,42 +461,42 @@ export default { |
|
|
.finally(() => this.refresh().catch(console.error)); |
|
|
.finally(() => this.refresh().catch(console.error)); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
deleteClient (client) { |
|
|
deleteClient(client) { |
|
|
this.api |
|
|
this.api |
|
|
.deleteClient({ clientId: client.id }) |
|
|
.deleteClient({ clientId: client.id }) |
|
|
.catch((err) => alert(err.message || err.toString())) |
|
|
.catch((err) => alert(err.message || err.toString())) |
|
|
.finally(() => this.refresh().catch(console.error)); |
|
|
.finally(() => this.refresh().catch(console.error)); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
enableClient (client) { |
|
|
enableClient(client) { |
|
|
this.api |
|
|
this.api |
|
|
.enableClient({ clientId: client.id }) |
|
|
.enableClient({ clientId: client.id }) |
|
|
.catch((err) => alert(err.message || err.toString())) |
|
|
.catch((err) => alert(err.message || err.toString())) |
|
|
.finally(() => this.refresh().catch(console.error)); |
|
|
.finally(() => this.refresh().catch(console.error)); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
disableClient (client) { |
|
|
disableClient(client) { |
|
|
this.api |
|
|
this.api |
|
|
.disableClient({ clientId: client.id }) |
|
|
.disableClient({ clientId: client.id }) |
|
|
.catch((err) => alert(err.message || err.toString())) |
|
|
.catch((err) => alert(err.message || err.toString())) |
|
|
.finally(() => this.refresh().catch(console.error)); |
|
|
.finally(() => this.refresh().catch(console.error)); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
updateClientName (client, name) { |
|
|
updateClientName(client, name) { |
|
|
this.api |
|
|
this.api |
|
|
.updateClientName({ clientId: client.id, name }) |
|
|
.updateClientName({ clientId: client.id, name }) |
|
|
.catch((err) => alert(err.message || err.toString())) |
|
|
.catch((err) => alert(err.message || err.toString())) |
|
|
.finally(() => this.refresh().catch(console.error)); |
|
|
.finally(() => this.refresh().catch(console.error)); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
updateClientAddress (client, address) { |
|
|
updateClientAddress(client, address) { |
|
|
this.api |
|
|
this.api |
|
|
.updateClientAddress({ clientId: client.id, address }) |
|
|
.updateClientAddress({ clientId: client.id, address }) |
|
|
.catch((err) => alert(err.message || err.toString())) |
|
|
.catch((err) => alert(err.message || err.toString())) |
|
|
.finally(() => this.refresh().catch(console.error)); |
|
|
.finally(() => this.refresh().catch(console.error)); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
toggleTheme () { |
|
|
toggleTheme() { |
|
|
if (this.isDark) { |
|
|
if (this.isDark) { |
|
|
localStorage.theme = 'light'; |
|
|
localStorage.theme = 'light'; |
|
|
document.documentElement.classList.remove('dark'); |
|
|
document.documentElement.classList.remove('dark'); |
|
|
@ -524,7 +532,10 @@ export default { |
|
|
</h1> |
|
|
</h1> |
|
|
<h2 class="text-sm text-gray-400 dark:text-neutral-400 mb-10"></h2> |
|
|
<h2 class="text-sm text-gray-400 dark:text-neutral-400 mb-10"></h2> |
|
|
|
|
|
|
|
|
<UpdateNotification :latestRelease="latestRelease" :currentRelease="currentRelease" /> |
|
|
<UpdateNotification |
|
|
|
|
|
:latestRelease="latestRelease" |
|
|
|
|
|
:currentRelease="currentRelease" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
<div |
|
|
<div |
|
|
class="shadow-md rounded-lg bg-white dark:bg-neutral-700 overflow-hidden" |
|
|
class="shadow-md rounded-lg bg-white dark:bg-neutral-700 overflow-hidden" |
|
|
@ -939,7 +950,9 @@ export default { |
|
|
<div |
|
|
<div |
|
|
class="h-20 w-20 mb-10 mt-5 mx-auto rounded-full bg-red-800 dark:bg-red-800 relative overflow-hidden" |
|
|
class="h-20 w-20 mb-10 mt-5 mx-auto rounded-full bg-red-800 dark:bg-red-800 relative overflow-hidden" |
|
|
> |
|
|
> |
|
|
<IconAvatarDefault class="w-10 h-10 m-5 text-white dark:text-white" /> |
|
|
<IconAvatarDefault |
|
|
|
|
|
class="w-10 h-10 m-5 text-white dark:text-white" |
|
|
|
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<input |
|
|
<input |
|
|
|