[CHORE] bugfix formatting prettier (#1936)

This commit is contained in:
dni ⚡ 2023-09-12 21:05:43 +02:00 committed by GitHub
parent 4c16675b3b
commit 6acbf823ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 171 additions and 52 deletions

View File

@ -31,8 +31,13 @@
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<p>Active Funding<small> (Requires server restart)</small></p> <p>Active Funding<small> (Requires server restart)</small></p>
<q-select :disable="!isSuperUser" filled v-model="formData.lnbits_backend_wallet_class" <q-select
hint="Select the active funding wallet" :options="settings.lnbits_allowed_funding_sources"></q-select> :disable="!isSuperUser"
filled
v-model="formData.lnbits_backend_wallet_class"
hint="Select the active funding wallet"
:options="settings.lnbits_allowed_funding_sources"
></q-select>
</div> </div>
</div> </div>
</div> </div>
@ -40,20 +45,36 @@
<div class="row q-col-gutter-md"> <div class="row q-col-gutter-md">
<div class="col-12 col-md-4"> <div class="col-12 col-md-4">
<p>Invoice Expiry</p> <p>Invoice Expiry</p>
<q-input filled v-model.number="formData.lightning_invoice_expiry" type="number" <q-input
label="Invoice expiry (seconds)" mask="#######"> filled
v-model.number="formData.lightning_invoice_expiry"
type="number"
label="Invoice expiry (seconds)"
mask="#######"
>
</q-input> </q-input>
</div> </div>
<div class="col-12 col-md-8"> <div class="col-12 col-md-8">
<p>Fee reserve</p> <p>Fee reserve</p>
<div class="row q-col-gutter-md"> <div class="row q-col-gutter-md">
<div class="col-6"> <div class="col-6">
<q-input type="number" filled v-model="formData.lnbits_reserve_fee_min" label="Reserve fee in msats"> <q-input
type="number"
filled
v-model="formData.lnbits_reserve_fee_min"
label="Reserve fee in msats"
>
</q-input> </q-input>
</div> </div>
<div class="col-6"> <div class="col-6">
<q-input type="number" filled name="lnbits_reserve_fee_percent" <q-input
v-model="formData.lnbits_reserve_fee_percent" label="Reserve fee in percent" step="0.1"></q-input> type="number"
filled
name="lnbits_reserve_fee_percent"
v-model="formData.lnbits_reserve_fee_percent"
label="Reserve fee in percent"
step="0.1"
></q-input>
</div> </div>
</div> </div>
</div> </div>
@ -64,13 +85,30 @@
<p class="q-my-md"> <p class="q-my-md">
Funding Sources<small> (Requires server restart)</small> Funding Sources<small> (Requires server restart)</small>
</p> </p>
<q-list v-for="(fund, idx) in settings.lnbits_allowed_funding_sources" :key="idx"> <q-list
<q-expansion-item expand-separator icon="payments" :label="prettyFunding.get(fund) || fund" v-for="(fund, idx) in settings.lnbits_allowed_funding_sources"
v-if="funding_sources.get(fund)"> :key="idx"
>
<q-expansion-item
expand-separator
icon="payments"
:label="prettyFunding.get(fund) || fund"
v-if="funding_sources.get(fund)"
>
<q-card> <q-card>
<q-card-section v-for="([key, prop], i) in Object.entries(funding_sources.get(fund))" :key="i"> <q-card-section
<q-input dense filled type="text" v-model="formData[key]" :label="prop.label" class="q-pr-md" v-for="([key, prop], i) in Object.entries(funding_sources.get(fund))"
:hint="prop.hint"></q-input> :key="i"
>
<q-input
dense
filled
type="text"
v-model="formData[key]"
:label="prop.label"
class="q-pr-md"
:hint="prop.hint"
></q-input>
</q-card-section> </q-card-section>
</q-card> </q-card>
</q-expansion-item> </q-expansion-item>
@ -78,4 +116,4 @@
</div> </div>
</div> </div>
</q-card-section> </q-card-section>
</q-tab-panel> </q-tab-panel>

View File

@ -2,26 +2,63 @@
%} {% 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-my-md"> <div class="col q-my-md">
<q-btn :label="$t('save')" color="primary" @click="updateSettings" :disabled="!checkChanges"> <q-btn
<q-tooltip v-if="checkChanges">{%raw%}{{ $t('save_tooltip') }}{%endraw%}</q-tooltip> :label="$t('save')"
color="primary"
@click="updateSettings"
:disabled="!checkChanges"
>
<q-tooltip v-if="checkChanges"
>{%raw%}{{ $t('save_tooltip') }}{%endraw%}</q-tooltip
>
<q-badge v-if="checkChanges" color="red" rounded floating style="padding: 6px; border-radius: 6px" /> <q-badge
v-if="checkChanges"
color="red"
rounded
floating
style="padding: 6px; border-radius: 6px"
/>
</q-btn> </q-btn>
<q-btn v-if="isSuperUser" :label="$t('restart')" color="primary" @click="restartServer"> <q-btn
<q-tooltip v-if="needsRestart">{%raw%}{{ $t('restart_tooltip') }}{%endraw%}</q-tooltip> v-if="isSuperUser"
:label="$t('restart')"
color="primary"
@click="restartServer"
>
<q-tooltip v-if="needsRestart"
>{%raw%}{{ $t('restart_tooltip') }}{%endraw%}</q-tooltip
>
<q-badge v-if="needsRestart" color="red" rounded floating style="padding: 6px; border-radius: 6px" /> <q-badge
v-if="needsRestart"
color="red"
rounded
floating
style="padding: 6px; border-radius: 6px"
/>
</q-btn> </q-btn>
<q-btn v-if="isSuperUser" :label="$t('topup')" color="primary" @click="topUpDialog.show = true"> <q-btn
v-if="isSuperUser"
:label="$t('topup')"
color="primary"
@click="topUpDialog.show = true"
>
<q-tooltip>{%raw%}{{ $t('add_funds_tooltip') }}{%endraw%}</q-tooltip> <q-tooltip>{%raw%}{{ $t('add_funds_tooltip') }}{%endraw%}</q-tooltip>
</q-btn> </q-btn>
<q-btn :label="$t('download_backup')" flat @click="downloadBackup"></q-btn> <q-btn :label="$t('download_backup')" flat @click="downloadBackup"></q-btn>
<q-btn flat v-if="isSuperUser" :label="$t('reset_defaults')" color="primary" @click="deleteSettings" <q-btn
class="float-right"> flat
v-if="isSuperUser"
:label="$t('reset_defaults')"
color="primary"
@click="deleteSettings"
class="float-right"
>
<q-tooltip>{%raw%}{{ $t('reset_defaults_tooltip') }}{%endraw%}</q-tooltip> <q-tooltip>{%raw%}{{ $t('reset_defaults_tooltip') }}{%endraw%}</q-tooltip>
</q-btn> </q-btn>
</div> </div>
@ -33,15 +70,35 @@
<div class="q-pa-md"> <div class="q-pa-md">
<div class="q-gutter-y-md"> <div class="q-gutter-y-md">
<q-tabs v-model="tab" active-color="primary" align="justify"> <q-tabs v-model="tab" active-color="primary" align="justify">
<q-tab name="funding" :label="$t('funding')" @update="val => tab = val.name"></q-tab> <q-tab
name="funding"
:label="$t('funding')"
@update="val => tab = val.name"
></q-tab>
<q-tab name="users" :label="$t('users')" @update="val => tab = val.name"></q-tab> <q-tab
name="users"
:label="$t('users')"
@update="val => tab = val.name"
></q-tab>
<q-tab name="server" :label="$t('server')" @update="val => tab = val.name"></q-tab> <q-tab
name="server"
:label="$t('server')"
@update="val => tab = val.name"
></q-tab>
<q-tab name="security" :label="$t('security')" @update="val => tab = val.name"></q-tab> <q-tab
name="security"
:label="$t('security')"
@update="val => tab = val.name"
></q-tab>
<q-tab name="theme" :label="$t('theme')" @update="val => tab = val.name"></q-tab> <q-tab
name="theme"
:label="$t('theme')"
@update="val => tab = val.name"
></q-tab>
</q-tabs> </q-tabs>
</div> </div>
</div> </div>
@ -65,20 +122,43 @@
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<q-input dense type="text" filled v-model="wallet.id" label="Wallet ID" :hint="$t('topup_hint')"></q-input> <q-input
dense
type="text"
filled
v-model="wallet.id"
label="Wallet ID"
:hint="$t('topup_hint')"
></q-input>
<br /> <br />
</div> </div>
<div class="col-12"> <div class="col-12">
<q-input dense type="number" filled v-model="wallet.amount" :label="$t('amount')"></q-input> <q-input
dense
type="number"
filled
v-model="wallet.amount"
:label="$t('amount')"
></q-input>
</div> </div>
</div> </div>
<div class="row q-mt-lg"> <div class="row q-mt-lg">
<q-btn :label="$t('topup')" color="primary" @click="topupWallet"></q-btn> <q-btn
:label="$t('topup')"
color="primary"
@click="topupWallet"
></q-btn>
<q-btn v-close-popup flat color="grey" class="q-ml-auto" :label="$t('cancel')"></q-btn> <q-btn
v-close-popup
flat
color="grey"
class="q-ml-auto"
:label="$t('cancel')"
></q-btn>
</div> </div>
</q-form> </q-form>
</q-card> </q-card>
@ -137,19 +217,19 @@
tab: 'funding', tab: 'funding',
needsRestart: false, needsRestart: false,
prettyFunding: new Map([ prettyFunding: new Map([
["VoidWallet", "Void Wallet"], ['VoidWallet', 'Void Wallet'],
["FakeWallet", "Fake Wallet"], ['FakeWallet', 'Fake Wallet'],
["CoreLightningWallet", "Core Lightning"], ['CoreLightningWallet', 'Core Lightning'],
["CoreLightningRestWallet", "Core Lightning"], ['CoreLightningRestWallet', 'Core Lightning'],
["LndRestWallet", "Lightning Network Daemon (LND Rest)"], ['LndRestWallet', 'Lightning Network Daemon (LND Rest)'],
["LndWallet", "Lightning Network Daemon (LND)"], ['LndWallet', 'Lightning Network Daemon (LND)'],
["LnTipsWallet", "LN.Tips"], ['LnTipsWallet', 'LN.Tips'],
["LNPayWallet", "LN Pay"], ['LNPayWallet', 'LN Pay'],
["EclairWallet", "Eclair (ACINQ)"], ['EclairWallet', 'Eclair (ACINQ)'],
["LNbitsWallet", "LNBits"], ['LNbitsWallet', 'LNBits'],
["OpenNodeWallet", "OpenNode"], ['OpenNodeWallet', 'OpenNode'],
["ClicheWallet", "Cliche (NBD)"], ['ClicheWallet', 'Cliche (NBD)'],
["SparkWallet", "Spark"] ['SparkWallet', 'Spark']
]), ]),
funding_sources: new Map([ funding_sources: new Map([
['VoidWallet', null], ['VoidWallet', null],
@ -406,7 +486,7 @@
'/api/v1/ws/' + '/api/v1/ws/' +
digestHex digestHex
this.ws = new WebSocket(localUrl) this.ws = new WebSocket(localUrl)
this.ws.addEventListener('message', async ({ data }) => { this.ws.addEventListener('message', async ({data}) => {
this.logs.push(data.toString()) this.logs.push(data.toString())
const scrollArea = this.$refs.logScroll const scrollArea = this.$refs.logScroll
if (scrollArea) { if (scrollArea) {
@ -545,7 +625,7 @@
.then(response => { .then(response => {
this.isSuperUser = response.data.is_super_user || false this.isSuperUser = response.data.is_super_user || false
this.settings = response.data this.settings = response.data
this.formData = { ...this.settings } this.formData = {...this.settings}
this.updateFundingData() this.updateFundingData()
this.getNotifications() this.getNotifications()
}) })
@ -568,16 +648,17 @@
.then(response => { .then(response => {
this.needsRestart = this.needsRestart =
this.settings.lnbits_backend_wallet_class !== this.settings.lnbits_backend_wallet_class !==
this.formData.lnbits_backend_wallet_class || this.formData.lnbits_backend_wallet_class ||
this.settings.lnbits_killswitch !== this.settings.lnbits_killswitch !==
this.formData.lnbits_killswitch this.formData.lnbits_killswitch
this.settings = this.formData this.settings = this.formData
this.formData = _.clone(this.settings) this.formData = _.clone(this.settings)
this.updateFundingData() this.updateFundingData()
this.$q.notify({ this.$q.notify({
type: 'positive', type: 'positive',
message: `Success! Settings changed! ${this.needsRestart ? 'Restart required!' : '' message: `Success! Settings changed! ${
}`, this.needsRestart ? 'Restart required!' : ''
}`,
icon: null icon: null
}) })
}) })
@ -616,4 +697,4 @@
} }
}) })
</script> </script>
{% endblock %} {% endblock %}