From 709e201fec3033bb133e624b67cfb26961b826a7 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Tue, 7 Feb 2023 16:41:57 +0200 Subject: [PATCH] feat: add UI for blocked/allowed public keys --- .../relay-details/relay-details.html | 88 ++++++++++++++++++- .../components/relay-details/relay-details.js | 23 ++++- 2 files changed, 107 insertions(+), 4 deletions(-) diff --git a/static/components/relay-details/relay-details.html b/static/components/relay-details/relay-details.html index 3730477..c108a16 100644 --- a/static/components/relay-details/relay-details.html +++ b/static/components/relay-details/relay-details.html @@ -3,7 +3,8 @@ - + + @@ -156,8 +157,89 @@ zzz - - qqq + +
+
+
Allowed Public Key
+
+ +
+
+ Add +
+
+
+
+
+ {{p}} + +
+
+
+
+ +
+
+
Blocked Public Key
+
+ +
+
+ Add +
+
+
+
+
+ {{p}} + +
+
+
diff --git a/static/components/relay-details/relay-details.js b/static/components/relay-details/relay-details.js index 9f002c0..09266ec 100644 --- a/static/components/relay-details/relay-details.js +++ b/static/components/relay-details/relay-details.js @@ -9,6 +9,8 @@ async function relayDetails(path) { return { tab: 'info', relay: null, + blockedPubkey: '', + allowedPubkey: '', formDialogItem: { show: false, data: { @@ -59,7 +61,9 @@ async function relayDetails(path) { wallet: '', costToJoin: 0, freeStorage: 0, - storageCostPerKb: 0 + storageCostPerKb: 0, + allowedPublicKeys: [], + blockedPublicKeys: [] } this.relay = data @@ -90,6 +94,23 @@ async function relayDetails(path) { togglePaidRelay: async function () { this.relay.config.wallet = this.relay.config.wallet || this.walletOptions[0].value + }, + allowPublicKey: function () { + this.relay.config.allowedPublicKeys.push(this.allowedPubkey) + this.allowedPubkey = '' + }, + blockPublicKey: function () { + this.relay.config.blockedPublicKeys.push(this.blockedPubkey) + this.blockedPubkey = '' + }, + deleteAllowedPublicKey: function (pubKey) { + this.relay.config.allowedPublicKeys = + this.relay.config.allowedPublicKeys.filter(p => p !== pubKey) + }, + + deleteBlockedPublicKey: function (pubKey) { + this.relay.config.blockedPublicKeys = + this.relay.config.blockedPublicKeys.filter(p => p !== pubKey) } },