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

View file

@ -319,7 +319,7 @@
.confirmDialog('Do you really wanna disconnect this peer?')
.onOk(() => {
this.api('DELETE', `/peers/${id}`).then(response => {
this.$q.notify({
Quasar.Notify.create({
message: 'Disconnected',
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.$q.notify({
Quasar.Notify.create({
type: 'positive',
message: 'Account updated.'
})
@ -104,7 +104,7 @@ window.app = Vue.createApp({
},
updatePassword: async function () {
if (!this.user.username) {
this.$q.notify({
Quasar.Notify.create({
type: 'warning',
message: 'Please set a username first.'
})
@ -125,7 +125,7 @@ window.app = Vue.createApp({
)
this.user = data
this.passwordData.show = false
this.$q.notify({
Quasar.Notify.create({
type: 'positive',
message: 'Password updated.'
})
@ -135,7 +135,7 @@ window.app = Vue.createApp({
},
showChangePassword: function () {
if (!this.user.username) {
this.$q.notify({
Quasar.Notify.create({
type: 'warning',
message: 'Please set a username first.'
})

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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