Fixed prettier (again)

This commit is contained in:
Ben Arc 2021-04-09 00:49:01 +01:00
parent d872f0d138
commit 61f6e2a4f2
2 changed files with 319 additions and 268 deletions

View File

@ -4,10 +4,13 @@
<div class="col-12 col-md-7 q-gutter-y-md"> <div class="col-12 col-md-7 q-gutter-y-md">
<q-card> <q-card>
<q-card-section> <q-card-section>
{% raw %} {% raw %}
<q-btn unelevated color="deep-purple" @click="formDialogCharge.show = true" <q-btn
>New charge </q-btn unelevated
> color="deep-purple"
@click="formDialogCharge.show = true"
>New charge
</q-btn>
</q-card-section> </q-card-section>
</q-card> </q-card>
@ -19,15 +22,20 @@
</div> </div>
<div class="col-auto"> <div class="col-auto">
<q-input borderless dense debounce="300" v-model="filter" placeholder="Search"> <q-input
<template v-slot:append> borderless
<q-icon name="search"></q-icon> dense
</template> debounce="300"
</q-input> v-model="filter"
<q-btn flat color="grey" @click="exportchargeCSV" placeholder="Search"
>Export to CSV</q-btn >
> <template v-slot:append>
<q-icon name="search"></q-icon>
</template>
</q-input>
<q-btn flat color="grey" @click="exportchargeCSV"
>Export to CSV</q-btn
>
</div> </div>
</div> </div>
<q-table <q-table
@ -39,25 +47,26 @@
:pagination.sync="ChargesTable.pagination" :pagination.sync="ChargesTable.pagination"
:filter="filter" :filter="filter"
> >
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width></q-th>
<q-th auto-width></q-th>
<template v-slot:header="props"> <q-th
<q-tr :props="props"> v-for="col in props.cols"
<q-th auto-width></q-th> :key="col.name"
<q-th auto-width></q-th> :props="props"
auto-width
<q-th v-for="col in props.cols" :key="col.name" :props="props" auto-width> >
<div v-if="col.name == 'id'"></div> <div v-if="col.name == 'id'"></div>
<div v-else> <div v-else>{{ col.label }}</div>
{{ col.label }} </q-th>
</div> <q-th auto-width></q-th>
</q-th> </q-tr>
<q-th auto-width></q-th> </template>
</q-tr>
</template>
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr :props="props"> <q-tr :props="props">
<q-td auto-width> <q-td auto-width>
<q-btn <q-btn
unelevated unelevated
@ -69,50 +78,44 @@
:href="props.row.displayUrl" :href="props.row.displayUrl"
target="_blank" target="_blank"
> >
<q-tooltip> <q-tooltip> Payment link </q-tooltip>
Payment link </q-btn>
</q-tooltip>
</q-btn>
</q-td> </q-td>
<q-td auto-width> <q-td auto-width>
<q-btn
<q-btn v-if="props.row.time_elapsed && props.row.balance < props.row.amount" v-if="props.row.time_elapsed && props.row.balance < props.row.amount"
unelevated unelevated
flat flat
dense dense
size="xs" size="xs"
icon="error" icon="error"
:color="($q.dark.isActive) ? 'red' : 'red'" :color="($q.dark.isActive) ? 'red' : 'red'"
> >
<q-tooltip> <q-tooltip> Time elapsed </q-tooltip>
Time elapsed
</q-tooltip>
</q-btn> </q-btn>
<q-btn v-else-if="props.row.balance >= props.row.amount" <q-btn
v-else-if="props.row.balance >= props.row.amount"
unelevated unelevated
flat flat
dense dense
size="xs" size="xs"
icon="check" icon="check"
:color="($q.dark.isActive) ? 'green' : 'green'" :color="($q.dark.isActive) ? 'green' : 'green'"
> >
<q-tooltip> <q-tooltip> PAID! </q-tooltip>
PAID!
</q-tooltip>
</q-btn> </q-btn>
<q-btn v-else <q-btn
v-else
unelevated unelevated
dense dense
size="xs" size="xs"
icon="cached" icon="cached"
flat flat
:color="($q.dark.isActive) ? 'blue' : 'blue'" :color="($q.dark.isActive) ? 'blue' : 'blue'"
> >
<q-tooltip> <q-tooltip> Processing </q-tooltip>
Processing
</q-tooltip>
</q-btn> </q-btn>
<q-btn <q-btn
flat flat
@ -122,57 +125,44 @@
icon="cancel" icon="cancel"
color="pink" color="pink"
> >
<q-tooltip> <q-tooltip> Delete charge </q-tooltip>
Delete charge </q-btn>
</q-tooltip> </q-td>
</q-btn> <q-td
v-for="col in props.cols"
:key="col.name"
</q-td> :props="props"
<q-td v-for="col in props.cols" :key="col.name" :props="props" auto-width> auto-width
<div v-if="col.name == 'id'"></div> >
<div v-else> <div v-if="col.name == 'id'"></div>
{{ col.value }} <div v-else>{{ col.value }}</div>
</div>
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>
{% endraw %} {% endraw %}
</q-table> </q-table>
</q-card-section> </q-card-section>
</q-card> </q-card>
</div> </div>
<div class="col-12 col-md-5 q-gutter-y-md"> <div class="col-12 col-md-5 q-gutter-y-md">
<q-card> <q-card>
<q-card-section> <q-card-section>
<h6 class="text-subtitle1 q-my-none"> <h6 class="text-subtitle1 q-my-none">LNbits satspay Extension</h6>
LNbits satspay Extension
</h6>
</q-card-section> </q-card-section>
<q-card-section class="q-pa-none"> <q-card-section class="q-pa-none">
<q-separator></q-separator> <q-separator></q-separator>
<q-list> <q-list> {% include "satspay/_api_docs.html" %} </q-list>
{% include "satspay/_api_docs.html" %}
</q-list>
</q-card-section> </q-card-section>
</q-card> </q-card>
</div> </div>
<q-dialog v-model="formDialogCharge.show" position="top" @hide="closeFormDialog"> <q-dialog
v-model="formDialogCharge.show"
position="top"
@hide="closeFormDialog"
>
<q-card class="q-pa-lg q-pt-xl lnbits__dialog-card"> <q-card class="q-pa-lg q-pt-xl lnbits__dialog-card">
<q-form @submit="sendFormDataCharge" class="q-gutter-md"> <q-form @submit="sendFormDataCharge" class="q-gutter-md">
<q-input <q-input
filled filled
dense dense
@ -187,7 +177,7 @@
v-model.trim="formDialogCharge.data.amount" v-model.trim="formDialogCharge.data.amount"
type="number" type="number"
label="*Amount (sats)" label="*Amount (sats)"
></q-input> ></q-input>
<q-input <q-input
filled filled
@ -196,69 +186,82 @@
type="number" type="number"
max="1440" max="1440"
label="*Mins valid for (max 1440)" label="*Mins valid for (max 1440)"
> </q-input> >
</q-input>
<q-input <q-input
filled filled
dense dense
v-model.trim="formDialogCharge.data.webhook" v-model.trim="formDialogCharge.data.webhook"
type="url" type="url"
label="Webhook (URL to send transaction data to once paid)" label="Webhook (URL to send transaction data to once paid)"
> </q-input> >
</q-input>
<q-input <q-input
filled filled
dense dense
v-model.trim="formDialogCharge.data.completelink" v-model.trim="formDialogCharge.data.completelink"
type="url" type="url"
label="Completed button URL" label="Completed button URL"
> </q-input> >
<q-input </q-input>
filled <q-input
dense filled
v-model.trim="formDialogCharge.data.completelinktext" dense
type="text" v-model.trim="formDialogCharge.data.completelinktext"
label="Completed button text (ie 'Back to merchant')" type="text"
> </q-input> label="Completed button text (ie 'Back to merchant')"
>
</q-input>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div v-if="walletLinks.length > 0"> <div v-if="walletLinks.length > 0">
<q-checkbox v-model="formDialogCharge.data.onchain" label="Onchain" /> <q-checkbox
</div> v-model="formDialogCharge.data.onchain"
<div v-else> label="Onchain"
<q-checkbox :value=false label="Onchain" disabled> />
<q-tooltip> </div>
Watch-Only extension MUST be activated and have a wallet <div v-else>
</q-tooltip> <q-checkbox :value="false" label="Onchain" disabled>
</q-checkbox> <q-tooltip>
Watch-Only extension MUST be activated and have a wallet
</div> </q-tooltip>
</q-checkbox>
</div>
</div> </div>
<div class="col"> <div class="col">
<div> <div>
<q-checkbox v-model="formDialogCharge.data.lnbits" label="LNbits wallet" /> <q-checkbox
</div> v-model="formDialogCharge.data.lnbits"
label="LNbits wallet"
/>
</div>
</div> </div>
</div> </div>
<div v-if="formDialogCharge.data.onchain">
<q-select
filled
dense
emit-value
v-model="formDialogCharge.data.onchainwallet"
:options="walletLinks"
label="Onchain Wallet"
/>
</div>
<div v-if="formDialogCharge.data.onchain">
<q-select filled dense emit-value v-model="formDialogCharge.data.onchainwallet" :options="walletLinks" label="Onchain Wallet" />
</div>
<div v-if="formDialogCharge.data.lnbits">
<q-select <q-select
filled v-if="formDialogCharge.data.lnbits"
dense filled
emit-value dense
v-model="formDialogCharge.data.lnbitswallet" emit-value
:options="g.user.walletOptions" v-model="formDialogCharge.data.lnbitswallet"
label="Wallet *"> :options="g.user.walletOptions"
</div> label="Wallet *"
>
</q-select>
<div class="row q-mt-lg"> <div class="row q-mt-lg">
<q-btn <q-btn
unelevated unelevated
@ -276,35 +279,30 @@
</q-form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>
</div> </div>
{% endblock %} {% block scripts %} {{ window_vars(user) }} {% endblock %} {% block scripts %} {{ window_vars(user) }}
<script src="{{ url_for('static', filename='vendor/vue-qrcode@1.0.2/vue-qrcode.min.js') }}"></script> <script src="{{ url_for('static', filename='vendor/vue-qrcode@1.0.2/vue-qrcode.min.js') }}"></script>
<style> <style></style>
</style>
<script> <script>
Vue.component(VueQrcode.name, VueQrcode) Vue.component(VueQrcode.name, VueQrcode)
var mapCharge = obj => { var mapCharge = obj => {
obj._data = _.clone(obj) obj._data = _.clone(obj)
obj.theTime = (obj.time * 60) - (Date.now()/1000 - obj.timestamp) obj.theTime = obj.time * 60 - (Date.now() / 1000 - obj.timestamp)
obj.time = obj.time + "mins" obj.time = obj.time + 'mins'
if(obj.time_elapsed){ if (obj.time_elapsed) {
obj.date = "Time elapsed" obj.date = 'Time elapsed'
} } else {
else{
obj.date = Quasar.utils.date.formatDate( obj.date = Quasar.utils.date.formatDate(
new Date((obj.theTime - 3600)*1000), new Date((obj.theTime - 3600) * 1000),
'HH:mm:ss' 'HH:mm:ss'
)} )
}
obj.displayUrl = ['/satspay/', obj.id].join('') obj.displayUrl = ['/satspay/', obj.id].join('')
return obj return obj
} }
new Vue({ new Vue({
el: '#vue', el: '#vue',
mixins: [windowMixin], mixins: [windowMixin],
@ -318,19 +316,18 @@
ChargeLinks: [], ChargeLinks: [],
ChargeLinksObj: [], ChargeLinksObj: [],
onchainwallet: '', onchainwallet: '',
currentaddress: "", currentaddress: '',
Addresses: { Addresses: {
show: false, show: false,
data: null data: null
}, },
mempool:{ mempool: {
endpoint:"" endpoint: ''
}, },
ChargesTable: { ChargesTable: {
columns: [ columns: [
{
{
name: 'theId', name: 'theId',
align: 'left', align: 'left',
label: 'ID', label: 'ID',
@ -373,23 +370,23 @@
field: 'onchainaddress' field: 'onchainaddress'
}, },
{ {
name: 'LNbits wallet', name: 'LNbits wallet',
align: 'left', align: 'left',
label: 'LNbits wallet', label: 'LNbits wallet',
field: 'lnbitswallet' field: 'lnbitswallet'
}, },
{ {
name: 'Webhook link', name: 'Webhook link',
align: 'left', align: 'left',
label: 'Webhook link', label: 'Webhook link',
field: 'webhook' field: 'webhook'
}, },
{ {
name: 'Paid link', name: 'Paid link',
align: 'left', align: 'left',
label: 'Paid link', label: 'Paid link',
field: 'completelink' field: 'completelink'
}, }
], ],
pagination: { pagination: {
rowsPerPage: 10 rowsPerPage: 10
@ -403,10 +400,10 @@
show: false, show: false,
data: { data: {
onchain: false, onchain: false,
lnbits:false, lnbits: false,
description: "", description: '',
time: null, time: null,
amount: null, amount: null
} }
}, },
qrCodeDialog: { qrCodeDialog: {
@ -418,13 +415,13 @@
methods: { methods: {
cancelCharge: function (data) { cancelCharge: function (data) {
var self = this var self = this
self.formDialogCharge.data.description = "" self.formDialogCharge.data.description = ''
self.formDialogCharge.data.onchainwallet = "" self.formDialogCharge.data.onchainwallet = ''
self.formDialogCharge.data.lnbitswallet = "" self.formDialogCharge.data.lnbitswallet = ''
self.formDialogCharge.data.time = null self.formDialogCharge.data.time = null
self.formDialogCharge.data.amount = null self.formDialogCharge.data.amount = null
self.formDialogCharge.data.webhook = "" self.formDialogCharge.data.webhook = ''
self.formDialogCharge.data.completelink = "" self.formDialogCharge.data.completelink = ''
self.formDialogCharge.show = false self.formDialogCharge.show = false
}, },
@ -441,7 +438,7 @@
for (i = 0; i < response.data.length; i++) { for (i = 0; i < response.data.length; i++) {
self.walletLinks.push(response.data[i].id) self.walletLinks.push(response.data[i].id)
} }
return return
}) })
.catch(function (error) { .catch(function (error) {
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
@ -488,17 +485,17 @@
self = this self = this
var refreshIntervalId = setInterval(function () { var refreshIntervalId = setInterval(function () {
for (i = 0; i < self.ChargeLinks.length - 1; i++) { for (i = 0; i < self.ChargeLinks.length - 1; i++) {
if(self.ChargeLinks[i]["paid"] == 'True'){ if (self.ChargeLinks[i]['paid'] == 'True') {
setTimeout(function(){ setTimeout(function () {
LNbits.api LNbits.api
.request( .request(
'GET', 'GET',
'/satspay/api/v1/charges/balance/' + self.ChargeLinks[i]["id"], '/satspay/api/v1/charges/balance/' +
"filla" self.ChargeLinks[i]['id'],
) 'filla'
.then(function (response) { )
}) .then(function (response) {})
}, 2000); }, 2000)
} }
} }
self.getCharges() self.getCharges()
@ -530,10 +527,11 @@
'/satspay/api/v1/charge/' + chargeId, '/satspay/api/v1/charge/' + chargeId,
self.g.user.wallets[0].adminkey self.g.user.wallets[0].adminkey
) )
.then(function (response) { .then(function (response) {
self.ChargeLinks = _.reject(self.ChargeLinks, function (obj) { self.ChargeLinks = _.reject(self.ChargeLinks, function (obj) {
return obj.id === chargeId return obj.id === chargeId
})}) })
})
.catch(function (error) { .catch(function (error) {
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
}) })
@ -542,17 +540,16 @@
exportchargeCSV: function () { exportchargeCSV: function () {
var self = this var self = this
LNbits.utils.exportCSV(self.ChargesTable.columns, this.ChargeLinks) LNbits.utils.exportCSV(self.ChargesTable.columns, this.ChargeLinks)
}, }
}, },
created: function () { created: function () {
var self = this var self = this
var getCharges = this.getCharges var getCharges = this.getCharges
getCharges() getCharges()
var getWalletLinks = this.getWalletLinks var getWalletLinks = this.getWalletLinks
getWalletLinks() getWalletLinks()
var timerCount = this.timerCount var timerCount = this.timerCount
timerCount() timerCount()
} }
}) })
</script> </script>

View File

@ -5,24 +5,23 @@
<q-card> <q-card>
<q-card-section> <q-card-section>
{% raw %} {% raw %}
<q-btn unelevated color="deep-purple" @click="formDialog.show = true">New wallet </q-btn> <q-btn unelevated color="deep-purple" @click="formDialog.show = true"
>New wallet
</q-btn>
<q-btn unelevated color="deep-purple" icon="edit"> <q-btn unelevated color="deep-purple" icon="edit">
<div class="cursor-pointer"> <div class="cursor-pointer">
<q-tooltip> <q-tooltip> Point to another Mempool </q-tooltip>
Point to another Mempool
</q-tooltip>
{{ this.mempool.endpoint }} {{ this.mempool.endpoint }}
<q-popup-edit v-model="mempool.endpoint"> <q-popup-edit v-model="mempool.endpoint">
<q-input color="accent" v-model="mempool.endpoint"> <q-input color="accent" v-model="mempool.endpoint"> </q-input>
</q-input>
<center> <center>
<q-btn flat dense @click="updateMempool()" v-close-popup>set</q-btn> <q-btn flat dense @click="updateMempool()" v-close-popup
>set</q-btn
>
<q-btn flat dense v-close-popup>cancel</q-btn> <q-btn flat dense v-close-popup>cancel</q-btn>
</center> </center>
</q-popup-edit> </q-popup-edit>
</div> </div>
</q-btn> </q-btn>
</q-card-section> </q-card-section>
</q-card> </q-card>
@ -34,20 +33,37 @@
<h5 class="text-subtitle1 q-my-none">Wallets</h5> <h5 class="text-subtitle1 q-my-none">Wallets</h5>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<q-input borderless dense debounce="300" v-model="filter" placeholder="Search"> <q-input
borderless
dense
debounce="300"
v-model="filter"
placeholder="Search"
>
<template v-slot:append> <template v-slot:append>
<q-icon name="search"></q-icon> <q-icon name="search"></q-icon>
</template> </template>
</q-input> </q-input>
</div> </div>
</div> </div>
<q-table flat dense :data="walletLinks" row-key="id" :columns="WalletsTable.columns" <q-table
:pagination.sync="WalletsTable.pagination" :filter="filter"> flat
dense
:data="walletLinks"
row-key="id"
:columns="WalletsTable.columns"
:pagination.sync="WalletsTable.pagination"
:filter="filter"
>
<template v-slot:header="props"> <template v-slot:header="props">
<q-tr :props="props"> <q-tr :props="props">
<q-th auto-width></q-th> <q-th auto-width></q-th>
<q-th v-for="col in props.cols" :key="col.name" :props="props" auto-width> <q-th
v-for="col in props.cols"
:key="col.name"
:props="props"
auto-width
>
{{ col.label }} {{ col.label }}
</q-th> </q-th>
<q-th auto-width></q-th> <q-th auto-width></q-th>
@ -55,26 +71,34 @@
</template> </template>
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr :props="props"> <q-tr :props="props">
<q-td auto-width> <q-td auto-width>
<q-btn
<q-btn unelevated dense size="xs" icon="dns" :color="($q.dark.isActive) ? 'grey-7' : 'grey-5'" unelevated
@click="openQrCodeDialog(props.row.id)"> dense
size="xs"
<q-tooltip> icon="dns"
Adresses :color="($q.dark.isActive) ? 'grey-7' : 'grey-5'"
</q-tooltip> @click="openQrCodeDialog(props.row.id)"
>
<q-tooltip> Adresses </q-tooltip>
</q-btn> </q-btn>
<q-btn flat dense size="xs" @click="deleteWalletLink(props.row.id)" icon="cancel" color="pink"></q-btn> <q-btn
flat
dense
size="xs"
@click="deleteWalletLink(props.row.id)"
icon="cancel"
color="pink"
></q-btn>
</q-td> </q-td>
</q-td> <q-td
<q-td v-for="col in props.cols" :key="col.name" :props="props" auto-width> v-for="col in props.cols"
:key="col.name"
:props="props"
auto-width
>
{{ col.value }} {{ col.value }}
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>
</q-table> </q-table>
@ -87,15 +111,11 @@
<div class="col-12 col-md-5 q-gutter-y-md"> <div class="col-12 col-md-5 q-gutter-y-md">
<q-card> <q-card>
<q-card-section> <q-card-section>
<h6 class="text-subtitle1 q-my-none"> <h6 class="text-subtitle1 q-my-none">LNbits Watch Only Extension</h6>
LNbits Watch Only Extension
</h6>
</q-card-section> </q-card-section>
<q-card-section class="q-pa-none"> <q-card-section class="q-pa-none">
<q-separator></q-separator> <q-separator></q-separator>
<q-list> <q-list> {% include "watchonly/_api_docs.html" %} </q-list>
{% include "watchonly/_api_docs.html" %}
</q-list>
</q-card-section> </q-card-section>
</q-card> </q-card>
</div> </div>
@ -103,16 +123,36 @@
<q-dialog v-model="formDialog.show" position="top" @hide="closeFormDialog"> <q-dialog v-model="formDialog.show" position="top" @hide="closeFormDialog">
<q-card class="q-pa-lg q-pt-xl lnbits__dialog-card"> <q-card class="q-pa-lg q-pt-xl lnbits__dialog-card">
<q-form @submit="sendFormData" class="q-gutter-md"> <q-form @submit="sendFormData" class="q-gutter-md">
<q-input filled dense v-model.trim="formDialog.data.title" type="text" label="Title"></q-input> <q-input
filled
dense
v-model.trim="formDialog.data.title"
type="text"
label="Title"
></q-input>
<q-input filled type="textarea" v-model="formDialog.data.masterpub" height="50px" autogrow <q-input
label="Account Extended Public Key; xpub, ypub, zpub; Bitcoin Descriptor"></q-input> filled
type="textarea"
v-model="formDialog.data.masterpub"
height="50px"
autogrow
label="Account Extended Public Key; xpub, ypub, zpub; Bitcoin Descriptor"
></q-input>
<div class="row q-mt-lg"> <div class="row q-mt-lg">
<q-btn unelevated color="deep-purple" :disable=" <q-btn
unelevated
color="deep-purple"
:disable="
formDialog.data.masterpub == null || formDialog.data.masterpub == null ||
formDialog.data.title == null" type="submit">Create Watch-only Wallet</q-btn> formDialog.data.title == null"
<q-btn v-close-popup flat color="grey" class="q-ml-auto">Cancel</q-btn> type="submit"
>Create Watch-only Wallet</q-btn
>
<q-btn v-close-popup flat color="grey" class="q-ml-auto"
>Cancel</q-btn
>
</div> </div>
</q-form> </q-form>
</q-card> </q-card>
@ -123,50 +163,69 @@
{% raw %} {% raw %}
<h5 class="text-subtitle1 q-my-none">Addresses</h5> <h5 class="text-subtitle1 q-my-none">Addresses</h5>
<q-separator></q-separator><br /> <q-separator></q-separator><br />
<p><strong>Current:</strong> <p>
<strong>Current:</strong>
{{ currentaddress }} {{ currentaddress }}
<q-btn flat dense size="ms" icon="visibility" type="a" :href="mempool.endpoint + '/address/' + currentaddress" <q-btn
target="_blank"></q-btn> flat
dense
size="ms"
icon="visibility"
type="a"
:href="mempool.endpoint + '/address/' + currentaddress"
target="_blank"
></q-btn>
</p> </p>
<q-responsive :ratio="1" class="q-mx-xl q-mb-md"> <q-responsive :ratio="1" class="q-mx-xl q-mb-md">
<qrcode :value="currentaddress" :options="{width: 800}" class="rounded-borders"></qrcode> <qrcode
:value="currentaddress"
:options="{width: 800}"
class="rounded-borders"
></qrcode>
</q-responsive> </q-responsive>
<p style="word-break: break-all;"> <p style="word-break: break-all">
<q-scroll-area style="height: 200px; max-width: 100%">
<q-scroll-area style="height: 200px; max-width: 100%;">
<q-list bordered v-for="data in Addresses.data.slice().reverse()"> <q-list bordered v-for="data in Addresses.data.slice().reverse()">
<q-item> <q-item>
<q-item-section>{{ data.address }}</q-item-section> <q-item-section>{{ data.address }}</q-item-section>
<q-btn flat dense size="ms" icon="visibility" type="a" <q-btn
:href="mempool.endpoint + '/address/' + data.address" target="_blank"></q-btn> flat
dense
size="ms"
icon="visibility"
type="a"
:href="mempool.endpoint + '/address/' + data.address"
target="_blank"
></q-btn>
</q-item> </q-item>
</q-list> </q-list>
</q-scroll-area> </q-scroll-area>
</p> </p>
<div class="row q-mt-lg q-gutter-sm"> <div class="row q-mt-lg q-gutter-sm">
<q-btn outline color="grey" @click="getFreshAddress(current)" class="q-ml-sm">Get fresh address</q-btn> <q-btn
outline
color="grey"
@click="getFreshAddress(current)"
class="q-ml-sm"
>Get fresh address</q-btn
>
<q-btn v-close-popup flat color="grey" class="q-ml-auto">Close</q-btn> <q-btn v-close-popup flat color="grey" class="q-ml-auto">Close</q-btn>
</div> </div>
</q-card> </q-card>
</q-dialog> </q-dialog>
{% endraw %} {% endraw %}
</div> </div>
{% endblock %} {% block scripts %} {{ window_vars(user) }} {% endblock %} {% block scripts %} {{ window_vars(user) }}
<script src="{{ url_for('static', filename='vendor/vue-qrcode@1.0.2/vue-qrcode.min.js') }}"></script> <script src="{{ url_for('static', filename='vendor/vue-qrcode@1.0.2/vue-qrcode.min.js') }}"></script>
<style> <style></style>
</style>
<script> <script>
Vue.component(VueQrcode.name, VueQrcode) Vue.component(VueQrcode.name, VueQrcode)
Vue.filter('reverse', function (value) { Vue.filter('reverse', function (value) {
// slice to make a copy of array, then reverse the copy // slice to make a copy of array, then reverse the copy
return value.slice().reverse(); return value.slice().reverse()
}); })
var locationPath = [ var locationPath = [
window.location.protocol, window.location.protocol,
'//', '//',
@ -201,17 +260,17 @@
checker: null, checker: null,
walletLinks: [], walletLinks: [],
AddressesLinks: [], AddressesLinks: [],
currentaddress: "", currentaddress: '',
Addresses: { Addresses: {
show: false, show: false,
data: null data: null
}, },
mempool: { mempool: {
endpoint: "" endpoint: ''
}, },
WalletsTable: { WalletsTable: {
columns: [ columns: [
{ name: 'id', align: 'left', label: 'ID', field: 'id' }, {name: 'id', align: 'left', label: 'ID', field: 'id'},
{ {
name: 'title', name: 'title',
align: 'left', align: 'left',
@ -223,7 +282,7 @@
align: 'left', align: 'left',
label: 'MasterPub', label: 'MasterPub',
field: 'masterpub' field: 'masterpub'
}, }
], ],
pagination: { pagination: {
rowsPerPage: 10 rowsPerPage: 10
@ -250,11 +309,9 @@
this.g.user.wallets[0].inkey this.g.user.wallets[0].inkey
) )
.then(function (response) { .then(function (response) {
return reponse.data return reponse.data
}) })
.catch(function (error) { .catch(function (error) {
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
}) })
}, },
@ -268,15 +325,13 @@
) )
.then(function (response) { .then(function (response) {
self.Addresses.data = response.data self.Addresses.data = response.data
self.currentaddress = self.Addresses.data[self.Addresses.data.length - 1].address self.currentaddress =
self.Addresses.data[self.Addresses.data.length - 1].address
self.AddressesLinks = response.data.map(function (obj) { self.AddressesLinks = response.data.map(function (obj) {
return mapAddresses(obj) return mapAddresses(obj)
}) })
}) })
.catch(function (error) { .catch(function (error) {
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
}) })
}, },
@ -291,7 +346,8 @@
) )
.then(function (response) { .then(function (response) {
self.Addresses.data = response.data self.Addresses.data = response.data
self.currentaddress = self.Addresses.data[self.Addresses.data.length - 1].address self.currentaddress =
self.Addresses.data[self.Addresses.data.length - 1].address
}) })
}, },
getMempool: function () { getMempool: function () {
@ -318,7 +374,9 @@
.request( .request(
'PUT', 'PUT',
'/watchonly/api/v1/mempool', '/watchonly/api/v1/mempool',
wallet.adminkey, self.mempool) wallet.adminkey,
self.mempool
)
.then(function (response) { .then(function (response) {
self.mempool.endpoint = response.data.endpoint self.mempool.endpoint = response.data.endpoint
self.walletLinks.push(mapwalletLink(response.data)) self.walletLinks.push(mapwalletLink(response.data))
@ -337,7 +395,6 @@
this.g.user.wallets[0].inkey this.g.user.wallets[0].inkey
) )
.then(function (response) { .then(function (response) {
self.walletLinks = response.data.map(function (obj) { self.walletLinks = response.data.map(function (obj) {
self.getAddresses(obj.id) self.getAddresses(obj.id)
return mapWalletLink(obj) return mapWalletLink(obj)
@ -348,7 +405,6 @@
}) })
}, },
closeFormDialog: function () { closeFormDialog: function () {
this.formDialog.data = { this.formDialog.data = {
is_unique: false is_unique: false
@ -365,7 +421,6 @@
var wallet = this.g.user.wallets[0] var wallet = this.g.user.wallets[0]
var data = _.omit(this.formDialog.data, 'wallet') var data = _.omit(this.formDialog.data, 'wallet')
this.createWalletLink(wallet, data) this.createWalletLink(wallet, data)
}, },
createWalletLink: function (wallet, data) { createWalletLink: function (wallet, data) {
var self = this var self = this
@ -382,7 +437,7 @@
}, },
deleteWalletLink: function (linkId) { deleteWalletLink: function (linkId) {
var self = this var self = this
var link = _.findWhere(this.walletLinks, { id: linkId }) var link = _.findWhere(this.walletLinks, {id: linkId})
LNbits.utils LNbits.utils
.confirmDialog('Are you sure you want to delete this pay link?') .confirmDialog('Are you sure you want to delete this pay link?')
.onOk(function () { .onOk(function () {
@ -404,8 +459,7 @@
}, },
exportCSV: function () { exportCSV: function () {
LNbits.utils.exportCSV(this.paywallsTable.columns, this.paywalls) LNbits.utils.exportCSV(this.paywallsTable.columns, this.paywalls)
}, }
}, },
created: function () { created: function () {
if (this.g.user.wallets.length) { if (this.g.user.wallets.length) {
@ -417,4 +471,4 @@
} }
}) })
</script> </script>
{% endblock %} {% endblock %}