fix: use Quasar.notify (#2707)

* fix: use Quasar.Notify.create
instead of this.$q, had issues when pasting invoice, using the `Quasar`
is more consistent
This commit is contained in:
dni ⚡ 2024-09-24 16:18:56 +02:00 committed by GitHub
parent 99c5f00c91
commit 1d0547ea97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 46 additions and 47 deletions

View file

@ -1020,7 +1020,7 @@
this.filteredExtensions = this.extensions.concat([]) this.filteredExtensions = this.extensions.concat([])
this.handleTabChanged('installed') this.handleTabChanged('installed')
this.tab = 'installed' this.tab = 'installed'
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Extension uninstalled!' message: 'Extension uninstalled!'
}) })
@ -1050,7 +1050,7 @@
extension.installedRelease = null extension.installedRelease = null
extension.inProgress = false extension.inProgress = false
extension.hasDatabaseTables = false extension.hasDatabaseTables = false
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Extension DB deleted!' message: 'Extension DB deleted!'
}) })
@ -1069,7 +1069,7 @@
this.g.user.wallets[0].adminkey this.g.user.wallets[0].adminkey
) )
.then(response => { .then(response => {
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: `Extension '${extension.id}' ${action}d!` message: `Extension '${extension.id}' ${action}d!`
}) })
@ -1094,7 +1094,7 @@
this.g.user.wallets[0].adminkey this.g.user.wallets[0].adminkey
) )
.then(response => { .then(response => {
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Extension enabled!' message: 'Extension enabled!'
}) })
@ -1115,7 +1115,7 @@
this.g.user.wallets[0].adminkey this.g.user.wallets[0].adminkey
) )
.then(response => { .then(response => {
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Extension disabled!' message: 'Extension disabled!'
}) })
@ -1148,7 +1148,7 @@
} }
) )
.then(response => { .then(response => {
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Payment info updated!' message: 'Payment info updated!'
}) })
@ -1330,7 +1330,7 @@
ws.addEventListener('message', async ({data}) => { ws.addEventListener('message', async ({data}) => {
const payment = JSON.parse(data) const payment = JSON.parse(data)
if (payment.pending === false) { if (payment.pending === false) {
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Invoice Paid!' message: 'Invoice Paid!'
}) })
@ -1399,13 +1399,13 @@
this.paylinkWebsocket.addEventListener('message', async ({data}) => { this.paylinkWebsocket.addEventListener('message', async ({data}) => {
const resp = JSON.parse(data) const resp = JSON.parse(data)
if (resp.paid) { if (resp.paid) {
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Invoice Paid!' message: 'Invoice Paid!'
}) })
this.installExtension(this.selectedRelease) this.installExtension(this.selectedRelease)
} else { } else {
this.$q.notify({ Quasar.Notify.create({
type: 'warning', type: 'warning',
message: 'Invoice tracking lost!' message: 'Invoice tracking lost!'
}) })

View file

@ -319,7 +319,7 @@
.confirmDialog('Do you really wanna disconnect this peer?') .confirmDialog('Do you really wanna disconnect this peer?')
.onOk(() => { .onOk(() => {
this.api('DELETE', `/peers/${id}`).then(response => { this.api('DELETE', `/peers/${id}`).then(response => {
this.$q.notify({ Quasar.Notify.create({
message: 'Disconnected', message: 'Disconnected',
icon: null icon: null
}) })

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -94,7 +94,7 @@ window.app = Vue.createApp({
} }
) )
this.user = data this.user = data
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Account updated.' message: 'Account updated.'
}) })
@ -104,7 +104,7 @@ window.app = Vue.createApp({
}, },
updatePassword: async function () { updatePassword: async function () {
if (!this.user.username) { if (!this.user.username) {
this.$q.notify({ Quasar.Notify.create({
type: 'warning', type: 'warning',
message: 'Please set a username first.' message: 'Please set a username first.'
}) })
@ -125,7 +125,7 @@ window.app = Vue.createApp({
) )
this.user = data this.user = data
this.passwordData.show = false this.passwordData.show = false
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Password updated.' message: 'Password updated.'
}) })
@ -135,7 +135,7 @@ window.app = Vue.createApp({
}, },
showChangePassword: function () { showChangePassword: function () {
if (!this.user.username) { if (!this.user.username) {
this.$q.notify({ Quasar.Notify.create({
type: 'warning', type: 'warning',
message: 'Please set a username first.' message: 'Please set a username first.'
}) })

View file

@ -185,7 +185,7 @@ window.app = Vue.createApp({
LNbits.api LNbits.api
.request('GET', '/admin/api/v1/restart/') .request('GET', '/admin/api/v1/restart/')
.then(response => { .then(response => {
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Success! Restarted Server', message: 'Success! Restarted Server',
icon: null icon: null
@ -260,7 +260,7 @@ window.app = Vue.createApp({
this.settings.lnbits_killswitch !== this.formData.lnbits_killswitch this.settings.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.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: `Success! Settings changed! ${ message: `Success! Settings changed! ${
this.needsRestart ? 'Restart required!' : '' this.needsRestart ? 'Restart required!' : ''
@ -279,7 +279,7 @@ window.app = Vue.createApp({
LNbits.api LNbits.api
.request('DELETE', '/admin/api/v1/settings') .request('DELETE', '/admin/api/v1/settings')
.then(response => { .then(response => {
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: message:
'Success! Restored settings to defaults, restart required!', 'Success! Restored settings to defaults, restart required!',

View file

@ -503,9 +503,8 @@ window.windowMixin = {
) )
}, },
copyText: function (text, message, position) { copyText: function (text, message, position) {
var notify = this.$q.notify
Quasar.copyToClipboard(text).then(function () { Quasar.copyToClipboard(text).then(function () {
notify({ Quasar.Notify.create({
message: message || 'Copied to clipboard!', message: message || 'Copied to clipboard!',
position: position || 'bottom' position: position || 'bottom'
}) })

View file

@ -773,7 +773,7 @@ window.app.component('lnbits-update-balance', {
}) })
.then(_ => { .then(_ => {
credit = parseInt(credit) credit = parseInt(credit)
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: this.$t('wallet_topup_ok', { message: this.$t('wallet_topup_ok', {
amount: credit amount: credit

View file

@ -4,7 +4,7 @@ window.app.component('lnbits-extension-settings-form', {
methods: { methods: {
async updateSettings() { async updateSettings() {
if (!this.settings) { if (!this.settings) {
return this.$q.notify({ return Quasar.Notify.create({
message: 'No settings to update', message: 'No settings to update',
type: 'negative' type: 'negative'
}) })

View file

@ -78,7 +78,7 @@ window.app = Vue.createApp({
}) })
}, },
processing: function () { processing: function () {
this.$q.notify({ Quasar.Notify.create({
timeout: 0, timeout: 0,
message: 'Processing...', message: 'Processing...',
icon: null icon: null

View file

@ -223,7 +223,7 @@ window.app = Vue.createApp({
.request('POST', '/users/api/v1/user', null, this.createUserDialog.data) .request('POST', '/users/api/v1/user', null, this.createUserDialog.data)
.then(() => { .then(() => {
this.fetchUsers() this.fetchUsers()
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Success! User created!', message: 'Success! User created!',
icon: null icon: null
@ -243,7 +243,7 @@ window.app = Vue.createApp({
) )
.then(() => { .then(() => {
this.fetchUsers() this.fetchUsers()
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Success! User created!', message: 'Success! User created!',
icon: null icon: null
@ -261,7 +261,7 @@ window.app = Vue.createApp({
.request('DELETE', `/users/api/v1/user/${user_id}`) .request('DELETE', `/users/api/v1/user/${user_id}`)
.then(() => { .then(() => {
this.fetchUsers() this.fetchUsers()
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Success! User deleted!', message: 'Success! User deleted!',
icon: null icon: null
@ -280,7 +280,7 @@ window.app = Vue.createApp({
) )
.then(() => { .then(() => {
this.fetchWallets(user_id) this.fetchWallets(user_id)
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Success! Undeleted user wallet!', message: 'Success! Undeleted user wallet!',
icon: null icon: null
@ -299,7 +299,7 @@ window.app = Vue.createApp({
.request('DELETE', `/users/api/v1/user/${user_id}/wallet/${wallet}`) .request('DELETE', `/users/api/v1/user/${user_id}/wallet/${wallet}`)
.then(() => { .then(() => {
this.fetchWallets(user_id) this.fetchWallets(user_id)
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Success! User wallet deleted!', message: 'Success! User wallet deleted!',
icon: null icon: null
@ -379,7 +379,7 @@ window.app = Vue.createApp({
.request('GET', `/users/api/v1/user/${user_id}/admin`) .request('GET', `/users/api/v1/user/${user_id}/admin`)
.then(() => { .then(() => {
this.fetchUsers() this.fetchUsers()
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: 'Success! Toggled admin!', message: 'Success! Toggled admin!',
icon: null icon: null
@ -411,7 +411,7 @@ window.app = Vue.createApp({
this.wallet this.wallet
) )
.then(_ => { .then(_ => {
this.$q.notify({ Quasar.Notify.create({
type: 'positive', type: 'positive',
message: `Success! Added ${this.wallet.amount} to ${this.wallet.id}`, message: `Success! Added ${this.wallet.amount} to ${this.wallet.id}`,
icon: null icon: null

View file

@ -152,7 +152,7 @@ window.app = Vue.createApp({
if (typeof response.data.lnurl_response === 'string') { if (typeof response.data.lnurl_response === 'string') {
// failure // failure
this.$q.notify({ Quasar.Notify.create({
timeout: 5000, timeout: 5000,
type: 'warning', type: 'warning',
message: `${this.receive.lnurl.domain} lnurl-withdraw call failed.`, message: `${this.receive.lnurl.domain} lnurl-withdraw call failed.`,
@ -161,7 +161,7 @@ window.app = Vue.createApp({
return return
} else if (response.data.lnurl_response === true) { } else if (response.data.lnurl_response === true) {
// success // success
this.$q.notify({ Quasar.Notify.create({
timeout: 5000, timeout: 5000,
message: `Invoice sent to ${this.receive.lnurl.domain}!`, message: `Invoice sent to ${this.receive.lnurl.domain}!`,
spinner: true spinner: true
@ -200,7 +200,7 @@ window.app = Vue.createApp({
? mapping[valid_error] ? mapping[valid_error]
: `ERROR: Camera error (${error.name})` : `ERROR: Camera error (${error.name})`
this.parse.camera.show = false this.parse.camera.show = false
this.$q.notify({ Quasar.Notify.create({
message: camera_error, message: camera_error,
type: 'negative' type: 'negative'
}) })
@ -220,7 +220,7 @@ window.app = Vue.createApp({
let data = response.data let data = response.data
if (data.status === 'ERROR') { if (data.status === 'ERROR') {
this.$q.notify({ Quasar.Notify.create({
timeout: 5000, timeout: 5000,
type: 'warning', type: 'warning',
message: `${data.domain} lnurl call failed.`, message: `${data.domain} lnurl call failed.`,
@ -290,7 +290,7 @@ window.app = Vue.createApp({
try { try {
invoice = decode(this.parse.data.request) invoice = decode(this.parse.data.request)
} catch (error) { } catch (error) {
this.$q.notify({ Quasar.Notify.create({
timeout: 3000, timeout: 3000,
type: 'warning', type: 'warning',
message: error + '.', message: error + '.',
@ -316,7 +316,7 @@ window.app = Vue.createApp({
var expireDate = new Date( var expireDate = new Date(
(invoice.data.time_stamp + tag.value) * 1000 (invoice.data.time_stamp + tag.value) * 1000
) )
cleanInvoice.expireDate = this.$q.utils.date.formatDate( cleanInvoice.expireDate = Quasar.date.formatDate(
expireDate, expireDate,
'YYYY-MM-DDTHH:mm:ss.SSSZ' 'YYYY-MM-DDTHH:mm:ss.SSSZ'
) )
@ -328,7 +328,7 @@ window.app = Vue.createApp({
this.parse.invoice = Object.freeze(cleanInvoice) this.parse.invoice = Object.freeze(cleanInvoice)
}, },
payInvoice: function () { payInvoice: function () {
let dismissPaymentMsg = this.$q.notify({ let dismissPaymentMsg = Quasar.Notify.create({
timeout: 0, timeout: 0,
message: this.$t('processing_payment') message: this.$t('processing_payment')
}) })
@ -361,7 +361,7 @@ window.app = Vue.createApp({
}) })
}, },
payLnurl: function () { payLnurl: function () {
let dismissPaymentMsg = this.$q.notify({ let dismissPaymentMsg = Quasar.Notify.create({
timeout: 0, timeout: 0,
message: 'Processing payment...' message: 'Processing payment...'
}) })
@ -394,7 +394,7 @@ window.app = Vue.createApp({
if (response.data.success_action) { if (response.data.success_action) {
switch (response.data.success_action.tag) { switch (response.data.success_action.tag) {
case 'url': case 'url':
this.$q.notify({ Quasar.Notify.create({
message: `<a target="_blank" style="color: inherit" href="${response.data.success_action.url}">${response.data.success_action.url}</a>`, message: `<a target="_blank" style="color: inherit" href="${response.data.success_action.url}">${response.data.success_action.url}</a>`,
caption: response.data.success_action.description, caption: response.data.success_action.description,
html: true, html: true,
@ -404,7 +404,7 @@ window.app = Vue.createApp({
}) })
break break
case 'message': case 'message':
this.$q.notify({ Quasar.Notify.create({
message: response.data.success_action.message, message: response.data.success_action.message,
type: 'positive', type: 'positive',
timeout: 0, timeout: 0,
@ -421,7 +421,7 @@ window.app = Vue.createApp({
) )
) )
.then(value => { .then(value => {
this.$q.notify({ Quasar.Notify.create({
message: value, message: value,
caption: response.data.success_action.description, caption: response.data.success_action.description,
html: true, html: true,
@ -443,7 +443,7 @@ window.app = Vue.createApp({
}) })
}, },
authLnurl: function () { authLnurl: function () {
let dismissAuthMsg = this.$q.notify({ let dismissAuthMsg = Quasar.Notify.create({
timeout: 10, timeout: 10,
message: 'Performing authentication...' message: 'Performing authentication...'
}) })
@ -452,7 +452,7 @@ window.app = Vue.createApp({
.authLnurl(this.g.wallet, this.parse.lnurlauth.callback) .authLnurl(this.g.wallet, this.parse.lnurlauth.callback)
.then(_ => { .then(_ => {
dismissAuthMsg() dismissAuthMsg()
this.$q.notify({ Quasar.Notify.create({
message: `Authentication successful.`, message: `Authentication successful.`,
type: 'positive', type: 'positive',
timeout: 3500 timeout: 3500
@ -462,7 +462,7 @@ window.app = Vue.createApp({
.catch(err => { .catch(err => {
dismissAuthMsg() dismissAuthMsg()
if (err.response.data.reason) { if (err.response.data.reason) {
this.$q.notify({ Quasar.Notify.create({
message: `Authentication failed. ${this.parse.lnurlauth.domain} says:`, message: `Authentication failed. ${this.parse.lnurlauth.domain} says:`,
caption: err.response.data.reason, caption: err.response.data.reason,
type: 'warning', type: 'warning',
@ -477,7 +477,7 @@ window.app = Vue.createApp({
LNbits.api LNbits.api
.request('PATCH', '/api/v1/wallet', this.g.wallet.adminkey, data) .request('PATCH', '/api/v1/wallet', this.g.wallet.adminkey, data)
.then(_ => { .then(_ => {
this.$q.notify({ Quasar.Notify.create({
message: `Wallet updated.`, message: `Wallet updated.`,
type: 'positive', type: 'positive',
timeout: 3500 timeout: 3500
@ -495,7 +495,7 @@ window.app = Vue.createApp({
LNbits.api LNbits.api
.deleteWallet(this.g.wallet) .deleteWallet(this.g.wallet)
.then(_ => { .then(_ => {
this.$q.notify({ Quasar.Notify.create({
timeout: 3000, timeout: 3000,
message: `Wallet deleted!`, message: `Wallet deleted!`,
spinner: true spinner: true