From 51c486c15a58279f38134ddeb42db2167e8e8eb8 Mon Sep 17 00:00:00 2001 From: d11n Date: Wed, 19 Jan 2022 03:52:05 +0100 Subject: [PATCH] Add Lightning page with services (#3308) * Add Lightning page with services * Adapt other services pages * Display Lightning services only for internal node --- BTCPayServer.Tests/SeleniumTester.cs | 9 +- .../Components/MainNav/Default.cshtml | 2 +- .../UIStoresController.LightningLike.cs | 63 ++++- .../Controllers/UIStoresController.cs | 12 +- .../Models/AdditionalServiceViewModel.cs | 10 + .../StoreViewModels/LightningViewModel.cs | 8 + BTCPayServer/Views/UILightning/_Nav.cshtml | 8 + .../UIServer/CLightningRestServices.cshtml | 222 ++++++++-------- .../Views/UIServer/LndServices.cshtml | 243 +++++++++--------- BTCPayServer/Views/UIServer/P2PService.cshtml | 86 +++---- BTCPayServer/Views/UIServer/RPCService.cshtml | 86 +++---- BTCPayServer/Views/UIStores/Lightning.cshtml | 65 +++++ .../Views/UIStores/LightningSettings.cshtml | 59 ++--- BTCPayServer/Views/UIStores/StoreNavPages.cs | 2 +- BTCPayServer/wwwroot/img/icon-sprite.svg | 4 + .../wwwroot/img/lightningterminal.png | Bin 0 -> 17222 bytes BTCPayServer/wwwroot/img/rtl.png | Bin 0 -> 15285 bytes BTCPayServer/wwwroot/img/spark.png | Bin 0 -> 7526 bytes BTCPayServer/wwwroot/img/thunderhub.png | Bin 0 -> 15463 bytes BTCPayServer/wwwroot/main/site.css | 21 ++ 20 files changed, 532 insertions(+), 368 deletions(-) create mode 100644 BTCPayServer/Models/AdditionalServiceViewModel.cs create mode 100644 BTCPayServer/Models/StoreViewModels/LightningViewModel.cs create mode 100644 BTCPayServer/Views/UILightning/_Nav.cshtml create mode 100644 BTCPayServer/Views/UIStores/Lightning.cshtml create mode 100644 BTCPayServer/wwwroot/img/lightningterminal.png create mode 100644 BTCPayServer/wwwroot/img/rtl.png create mode 100644 BTCPayServer/wwwroot/img/spark.png create mode 100644 BTCPayServer/wwwroot/img/thunderhub.png diff --git a/BTCPayServer.Tests/SeleniumTester.cs b/BTCPayServer.Tests/SeleniumTester.cs index 685820286..779bbd477 100644 --- a/BTCPayServer.Tests/SeleniumTester.cs +++ b/BTCPayServer.Tests/SeleniumTester.cs @@ -245,10 +245,12 @@ namespace BTCPayServer.Tests { AddLightningNode(null, null, true); } + public void AddLightningNode(LightningConnectionType? connectionType = null, bool test = true) { AddLightningNode(null, connectionType, test); } + public void AddLightningNode(string cryptoCode = null, LightningConnectionType? connectionType = null, bool test = true) { cryptoCode ??= "BTC"; @@ -407,6 +409,11 @@ namespace BTCPayServer.Tests { GoToStore(StoreNavPages.PaymentMethods); Driver.FindElement(By.Id($"StoreNav-Lightning{cryptoCode}")).Click(); + // if Lightning is already set up we need to navigate to the settings + if (Driver.PageSource.Contains("id=\"SectionNav-LightningSettings\"")) + { + Driver.FindElement(By.Id("SectionNav-LightningSettings")).Click(); + } } public void SelectStoreContext(string storeId) @@ -431,7 +438,7 @@ namespace BTCPayServer.Tests { if (storeId is null) { - this.Driver.FindElement(By.Id("StoreNav-Invoices")).Click(); + Driver.FindElement(By.Id("StoreNav-Invoices")).Click(); } else { diff --git a/BTCPayServer/Components/MainNav/Default.cshtml b/BTCPayServer/Components/MainNav/Default.cshtml index f1f5022a3..670049da8 100644 --- a/BTCPayServer/Components/MainNav/Default.cshtml +++ b/BTCPayServer/Components/MainNav/Default.cshtml @@ -78,7 +78,7 @@