added tooltips, moved reset, and warnings
This commit is contained in:
parent
de6a77e750
commit
dde28e66a2
|
@ -1,8 +1,14 @@
|
||||||
{% extends "base.html" %} {% from "macros.jinja" import window_vars with context
|
{% extends "base.html" %} {% from "macros.jinja" import window_vars with context
|
||||||
%} {% block page %}
|
%} {% block page %}
|
||||||
<div class="row q-col-gutter-md justify-center">
|
<div class="row q-col-gutter-md justify-center">
|
||||||
<div class="col q-gutter-y-md q-my-md">
|
<div class="col q-my-md">
|
||||||
<q-btn label="Save" color="primary" @click="updateSettings">
|
<q-btn
|
||||||
|
label="Save"
|
||||||
|
color="primary"
|
||||||
|
@click="updateSettings"
|
||||||
|
:disabled="!checkChanges"
|
||||||
|
>
|
||||||
|
<q-tooltip v-if="checkChanges"> Save your changes </q-tooltip>
|
||||||
<q-badge
|
<q-badge
|
||||||
v-if="checkChanges"
|
v-if="checkChanges"
|
||||||
color="red"
|
color="red"
|
||||||
|
@ -11,26 +17,35 @@
|
||||||
style="padding: 6px; border-radius: 6px"
|
style="padding: 6px; border-radius: 6px"
|
||||||
/>
|
/>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<q-btn
|
<q-btn label="Restart server" color="primary" @click="restartServer">
|
||||||
label="Restart server"
|
<q-tooltip v-if="needsRestart">
|
||||||
color="primary"
|
Restart the server for changes to take effect
|
||||||
@click="restartServer"
|
</q-tooltip>
|
||||||
></q-btn>
|
<q-badge
|
||||||
<q-btn
|
v-if="needsRestart"
|
||||||
label="Reset to defaults"
|
color="red"
|
||||||
color="primary"
|
rounded
|
||||||
@click="deleteSettings"
|
floating
|
||||||
></q-btn>
|
style="padding: 6px; border-radius: 6px"
|
||||||
<q-btn
|
/>
|
||||||
label="Topup"
|
</q-btn>
|
||||||
color="primary"
|
<q-btn label="Topup" color="primary" @click="topUpDialog.show = true">
|
||||||
@click="topUpDialog.show = true"
|
<q-tooltip> Add funds to a wallet. </q-tooltip>
|
||||||
></q-btn>
|
</q-btn>
|
||||||
<!-- <q-btn
|
<!-- <q-btn
|
||||||
label="Download Database Backup"
|
label="Download Database Backup"
|
||||||
flat
|
flat
|
||||||
@click="downloadBackup"
|
@click="downloadBackup"
|
||||||
></q-btn> -->
|
></q-btn> -->
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
label="Reset to defaults"
|
||||||
|
color="primary"
|
||||||
|
@click="deleteSettings"
|
||||||
|
class="float-right"
|
||||||
|
>
|
||||||
|
<q-tooltip> Delete all settings and reset to defaults. </q-tooltip>
|
||||||
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row q-col-gutter-md justify-center">
|
<div class="row q-col-gutter-md justify-center">
|
||||||
|
@ -121,6 +136,7 @@
|
||||||
show: false
|
show: false
|
||||||
},
|
},
|
||||||
tab: 'funding',
|
tab: 'funding',
|
||||||
|
needsRestart: false,
|
||||||
funding_sources: new Map([
|
funding_sources: new Map([
|
||||||
['VoidWallet', null],
|
['VoidWallet', null],
|
||||||
[
|
[
|
||||||
|
@ -302,13 +318,12 @@
|
||||||
this.balance = +'{{ balance|safe }}'
|
this.balance = +'{{ balance|safe }}'
|
||||||
this.formData = _.clone(this.settings) //model
|
this.formData = _.clone(this.settings) //model
|
||||||
this.updateFundingData()
|
this.updateFundingData()
|
||||||
|
|
||||||
console.log(this.settings)
|
console.log(this.settings)
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
checkChanges() {
|
checkChanges() {
|
||||||
return !_.isEqual(this.settings, this.formData)
|
return !_.isEqual(this.settings, this.formData)
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
addAdminUser() {
|
addAdminUser() {
|
||||||
|
@ -361,6 +376,7 @@
|
||||||
message: 'Success! Restarted Server',
|
message: 'Success! Restarted Server',
|
||||||
icon: null
|
icon: null
|
||||||
})
|
})
|
||||||
|
this.needsRestart = false
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
|
@ -390,16 +406,15 @@
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
updateFundingData(){
|
updateFundingData() {
|
||||||
this.settings.lnbits_allowed_funding_sources.map(f => {
|
this.settings.lnbits_allowed_funding_sources.map(f => {
|
||||||
let opts = this.funding_sources.get(f)
|
let opts = this.funding_sources.get(f)
|
||||||
if (!opts) return
|
if (!opts) return
|
||||||
|
|
||||||
Object.keys(opts).forEach(e => {
|
Object.keys(opts).forEach(e => {
|
||||||
opts[e].value = this.settings[e]
|
opts[e].value = this.settings[e]
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
console.log("funding", this.funding_sources)
|
|
||||||
},
|
},
|
||||||
updateSettings() {
|
updateSettings() {
|
||||||
let data = {
|
let data = {
|
||||||
|
@ -415,31 +430,41 @@
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.settings = response.data.settings
|
this.settings = response.data.settings
|
||||||
this.formData = _.clone(this.settings)
|
this.formData = _.clone(this.settings)
|
||||||
|
this.needsRestart = true
|
||||||
this.updateFundingData()
|
this.updateFundingData()
|
||||||
this.$q.notify({
|
this.$q.notify({
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
message: 'Success! Settings changed!',
|
message: 'Success! Settings changed!',
|
||||||
icon: null
|
icon: null
|
||||||
})
|
})
|
||||||
console.log(this.settings)
|
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
deleteSettings() {
|
deleteSettings() {
|
||||||
LNbits.api
|
LNbits.utils
|
||||||
.request('DELETE', '/admin/api/v1/settings/?usr=' + this.g.user.id)
|
.confirmDialog(
|
||||||
.then(response => {
|
'Are you sure you want to restore settings to default?'
|
||||||
this.$q.notify({
|
)
|
||||||
type: 'positive',
|
.onOk(() => {
|
||||||
message:
|
LNbits.api
|
||||||
'Success! Restored settings to defaults, restart required!',
|
.request(
|
||||||
icon: null
|
'DELETE',
|
||||||
})
|
'/admin/api/v1/settings/?usr=' + this.g.user.id
|
||||||
})
|
)
|
||||||
.catch(function (error) {
|
.then(response => {
|
||||||
LNbits.utils.notifyApiError(error)
|
this.$q.notify({
|
||||||
|
type: 'positive',
|
||||||
|
message:
|
||||||
|
'Success! Restored settings to defaults, restart required!',
|
||||||
|
icon: null
|
||||||
|
})
|
||||||
|
this.needsRestart = true
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
LNbits.utils.notifyApiError(error)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
downloadBackup() {
|
downloadBackup() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user