diff --git a/static/components/relay-details/relay-details.html b/static/components/relay-details/relay-details.html
index 5baf10f..87b61ee 100644
--- a/static/components/relay-details/relay-details.html
+++ b/static/components/relay-details/relay-details.html
@@ -1 +1,23 @@
-
xxx
+
+
+
+ Update Relay
+
+
+ Delete Relay
+
+
+
diff --git a/static/components/relay-details/relay-details.js b/static/components/relay-details/relay-details.js
index 5cda00f..1ea2b7d 100644
--- a/static/components/relay-details/relay-details.js
+++ b/static/components/relay-details/relay-details.js
@@ -4,7 +4,7 @@ async function relayDetails(path) {
name: 'relay-details',
template,
- props: [],
+ props: ['relay-id', 'adminkey', 'inkey'],
data: function () {
return {
items: [],
@@ -21,6 +21,25 @@ async function relayDetails(path) {
methods: {
satBtc(val, showUnit = true) {
return satOrBtc(val, showUnit, this.satsDenominated)
+ },
+ deleteRelay: function () {
+ LNbits.utils
+ .confirmDialog(
+ 'All data will be lost! Are you sure you want to delete this relay?'
+ )
+ .onOk(async () => {
+ try {
+ await LNbits.api.request(
+ 'DELETE',
+ '/nostrrelay/api/v1/relay/' + this.relayId,
+ this.adminkey
+ )
+ this.$emit('relay-deleted', this.relayId)
+ } catch (error) {
+ console.warn(error)
+ LNbits.utils.notifyApiError(error)
+ }
+ })
}
},
diff --git a/static/js/index.js b/static/js/index.js
index aaffaa1..a76d950 100644
--- a/static/js/index.js
+++ b/static/js/index.js
@@ -35,6 +35,12 @@ const relays = async () => {
label: 'ID',
field: 'id'
},
+ {
+ name: 'toggle',
+ align: 'left',
+ label: 'Active',
+ field: ''
+ },
{
name: 'name',
align: 'left',
@@ -146,33 +152,17 @@ const relays = async () => {
}
},
- deleteRelay: function (relayId) {
- LNbits.utils
- .confirmDialog(
- 'All data will be lost! Are you sure you want to delete this relay?'
- )
- .onOk(async () => {
- try {
- const response = await LNbits.api.request(
- 'DELETE',
- '/nostrrelay/api/v1/relay/' + relayId,
- this.g.user.wallets[0].adminkey
- )
-
- this.relayLinks = _.reject(this.relayLinks, function (obj) {
- return obj.id === relayId
- })
- } catch (error) {
- LNbits.utils.notifyApiError(error)
- }
- })
- },
-
sendFormDataRelay: async function () {
console.log('### sendFormDataRelay')
this.createRelay(this.formDialogRelay.data)
},
+ handleRelayDeleted: function (relayId) {
+ this.relayLinks = _.reject(this.relayLinks, function (obj) {
+ return obj.id === relayId
+ })
+ },
+
exportrelayCSV: function () {
LNbits.utils.exportCSV(
this.relaysTable.columns,
diff --git a/templates/nostrrelay/index.html b/templates/nostrrelay/index.html
index 63061fa..cdf4fb0 100644
--- a/templates/nostrrelay/index.html
+++ b/templates/nostrrelay/index.html
@@ -68,8 +68,8 @@
/>
-
-
+ {{props.row.id}}
+
-
-