feat: add Switch dropdown options for profile management
- Add "Import Existing Key" option with vpn_key icon - Add "Generate New Key" option to create fresh nsec - Add "Remove <name>" option to delete merchant from DB - Wire up generate-key event to existing generateKeys function 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ce0cc3813e
commit
f466559b51
3 changed files with 58 additions and 3 deletions
|
|
@ -19,7 +19,9 @@ window.app.component('merchant-tab', {
|
||||||
'merchant-deleted',
|
'merchant-deleted',
|
||||||
'toggle-merchant-state',
|
'toggle-merchant-state',
|
||||||
'restart-nostr-connection',
|
'restart-nostr-connection',
|
||||||
'profile-updated'
|
'profile-updated',
|
||||||
|
'import-key',
|
||||||
|
'generate-key'
|
||||||
],
|
],
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
|
|
@ -57,6 +59,32 @@ window.app.component('merchant-tab', {
|
||||||
handleMerchantDeleted: function () {
|
handleMerchantDeleted: function () {
|
||||||
this.$emit('merchant-deleted')
|
this.$emit('merchant-deleted')
|
||||||
},
|
},
|
||||||
|
removeMerchant: function () {
|
||||||
|
const name =
|
||||||
|
this.merchantConfig?.display_name ||
|
||||||
|
this.merchantConfig?.name ||
|
||||||
|
'this merchant'
|
||||||
|
LNbits.utils
|
||||||
|
.confirmDialog(
|
||||||
|
`Are you sure you want to remove "${name}"? This will delete all associated data (stalls, products, orders, messages).`
|
||||||
|
)
|
||||||
|
.onOk(async () => {
|
||||||
|
try {
|
||||||
|
await LNbits.api.request(
|
||||||
|
'DELETE',
|
||||||
|
`/nostrmarket/api/v1/merchant/${this.merchantId}`,
|
||||||
|
this.adminkey
|
||||||
|
)
|
||||||
|
this.$emit('merchant-deleted')
|
||||||
|
this.$q.notify({
|
||||||
|
type: 'positive',
|
||||||
|
message: 'Merchant removed'
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
LNbits.utils.notifyApiError(error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
toggleMerchantState: function () {
|
toggleMerchantState: function () {
|
||||||
this.$emit('toggle-merchant-state')
|
this.$emit('toggle-merchant-state')
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -70,12 +70,38 @@
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-separator></q-separator>
|
<q-separator></q-separator>
|
||||||
<q-item clickable v-close-popup @click="$emit('import-key')">
|
<q-item clickable v-close-popup @click="$emit('import-key')">
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="vpn_key" color="primary"></q-icon>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
<q-item-label>Import Existing Key</q-item-label>
|
||||||
|
<q-item-label caption>Use an existing nsec</q-item-label>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable v-close-popup @click="$emit('generate-key')">
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
<q-icon name="add" color="primary"></q-icon>
|
<q-icon name="add" color="primary"></q-icon>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label>Add New Profile</q-item-label>
|
<q-item-label>Generate New Key</q-item-label>
|
||||||
<q-item-label caption>Import a different nsec</q-item-label>
|
<q-item-label caption>Create a fresh nsec</q-item-label>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-separator></q-separator>
|
||||||
|
<q-item clickable v-close-popup @click="removeMerchant">
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="delete" color="negative"></q-icon>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
<q-item-label class="text-negative"
|
||||||
|
>Remove
|
||||||
|
<span
|
||||||
|
v-text="merchantConfig?.display_name || merchantConfig?.name || 'Profile'"
|
||||||
|
></span
|
||||||
|
></q-item-label>
|
||||||
|
<q-item-label caption
|
||||||
|
>Remove this nPub from the DB</q-item-label
|
||||||
|
>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,7 @@
|
||||||
@toggle-merchant-state="toggleMerchantState"
|
@toggle-merchant-state="toggleMerchantState"
|
||||||
@restart-nostr-connection="restartNostrConnection"
|
@restart-nostr-connection="restartNostrConnection"
|
||||||
@import-key="showImportKeysDialog"
|
@import-key="showImportKeysDialog"
|
||||||
|
@generate-key="generateKeys"
|
||||||
@profile-updated="getMerchant"
|
@profile-updated="getMerchant"
|
||||||
></merchant-tab>
|
></merchant-tab>
|
||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue