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)
|
||||||
|
@ -399,7 +415,6 @@
|
||||||
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,21 +430,29 @@
|
||||||
.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.utils
|
||||||
|
.confirmDialog(
|
||||||
|
'Are you sure you want to restore settings to default?'
|
||||||
|
)
|
||||||
|
.onOk(() => {
|
||||||
LNbits.api
|
LNbits.api
|
||||||
.request('DELETE', '/admin/api/v1/settings/?usr=' + this.g.user.id)
|
.request(
|
||||||
|
'DELETE',
|
||||||
|
'/admin/api/v1/settings/?usr=' + this.g.user.id
|
||||||
|
)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.$q.notify({
|
this.$q.notify({
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
|
@ -437,10 +460,12 @@
|
||||||
'Success! Restored settings to defaults, restart required!',
|
'Success! Restored settings to defaults, restart required!',
|
||||||
icon: null
|
icon: null
|
||||||
})
|
})
|
||||||
|
this.needsRestart = true
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
})
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
downloadBackup() {
|
downloadBackup() {
|
||||||
LNbits.api
|
LNbits.api
|
||||||
|
|
Loading…
Reference in New Issue
Block a user