2024-10-30 07:23:45 +00:00
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
package views
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
2024-10-31 15:45:26 +00:00
import (
"fmt"
2024-10-31 21:13:52 +00:00
"github.com/ditatompel/xmr-remote-nodes/internal/ip"
2024-10-31 15:45:26 +00:00
"github.com/ditatompel/xmr-remote-nodes/internal/monero"
"github.com/ditatompel/xmr-remote-nodes/internal/paging"
2024-11-06 10:11:16 +00:00
"github.com/ditatompel/xmr-remote-nodes/utils"
2024-10-31 21:13:52 +00:00
"strings"
2024-10-31 15:45:26 +00:00
"time"
)
2024-11-03 09:15:01 +00:00
var nettypes = [ ] string { "mainnet" , "stagenet" , "testnet" }
2024-11-03 09:33:50 +00:00
var protocols = [ ] string { "tor" , "http" , "https" }
2024-11-03 09:15:01 +00:00
2024-11-03 11:03:13 +00:00
type nodeStatus struct {
Code int
Text string
}
var nodeStatuses = [ ] nodeStatus {
{ - 1 , "ANY" } ,
{ 1 , "Online" } ,
{ 0 , "Offline" } ,
}
2024-11-03 10:37:11 +00:00
func RemoteNodes ( data monero . Nodes , countries [ ] monero . Countries , q monero . QueryNodes , p paging . Pagination ) templ . Component {
2024-10-30 07:23:45 +00:00
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
templ_7745c5c3_Var1 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ . NopComponent
}
ctx = templ . ClearChildren ( ctx )
2024-11-04 11:02:24 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<!-- Hero --><section class=\"relative overflow-hidden pt-6\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = heroGradient ( ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<div class=\"relative z-10\"><div class=\"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-10 lg:py-16\"><div class=\"text-center\"><!-- Title --><div class=\"mt-5\"><h1 class=\"block font-extrabold text-4xl md:text-5xl lg:text-6xl text-neutral-200\">Public Monero Remote Nodes List</h1></div><!-- End Title --><div class=\"mt-5\"><p class=\"text-lg text-neutral-300\"><strong>Monero remote node</strong> is a device on the internet running the Monero software with full copy of the Monero blockchain that doesn't run on the same local machine where the Monero wallet is located.</p></div><hr class=\"mt-6\"></div><div class=\"max-w-3xl text-center mx-auto mt-8 prose prose-invert\"><p>Remote node can be used by people who, for their own reasons (usually because of hardware requirements, disk space, or technical abilities), cannot/don't want to run their own node and prefer to relay on one publicly available on the Monero network.</p><p>Using an open node will allow to make a transaction instantaneously, without the need to download the blockchain and sync to the Monero network first, but at the cost of the control over your privacy. the <strong>Monero community suggests to <span class=\"font-extrabold text-2xl underline decoration-double decoration-2 decoration-pink-500\">always run and use your own node</span></strong> to obtain the maximum possible privacy and to help decentralize the network.</p></div></div></div></section><!-- End Hero --><div class=\"flex flex-col max-w-6xl mx-auto mb-10\"><div class=\"min-w-full inline-block align-middle\">" )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-03 10:37:11 +00:00
templ_7745c5c3_Err = TableNodes ( data , countries , q , p ) . Render ( ctx , templ_7745c5c3_Buffer )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</div></div>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
} )
}
2024-11-03 10:37:11 +00:00
func TableNodes ( data monero . Nodes , countries [ ] monero . Countries , q monero . QueryNodes , p paging . Pagination ) templ . Component {
2024-10-31 15:45:26 +00:00
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
templ_7745c5c3_Var2 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = templ . NopComponent
}
ctx = templ . ClearChildren ( ctx )
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<div id=\"tbl_nodes\" class=\"bg-neutral-800 border border-neutral-700 rounded-xl shadow-sm overflow-hidden\"><div class=\"px-6 py-4 grid gap-3 md:flex md:justify-between md:items-center border-b border-neutral-700\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtRowPerPage ( "/remote-nodes" , "#tbl_nodes" , q . Limit , q ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-04 10:17:23 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<div>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtRefreshInterval ( "/remote-nodes" , "#tbl_nodes" , q . Refresh , q ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-04 10:29:07 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</div>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtReload ( "/remote-nodes" , "#tbl_nodes" , q ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</div><div class=\"overflow-x-auto\"><table class=\"dt\"><thead><tr><th scope=\"col\">Host:Port</th><th scope=\"col\">Nettype</th><th scope=\"col\">Protocol</th><th scope=\"col\">Country</th><th scope=\"col\">Status</th><th scope=\"col\">Estimate Fee</th>" )
2024-11-03 13:57:56 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtThSort ( "/remote-nodes" , "#tbl_nodes" , "Uptime" , "uptime" , q . SortBy , q . SortDirection , q ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtThSort ( "/remote-nodes" , "#tbl_nodes" , "Check" , "last_checked" , q . SortBy , q . SortDirection , q ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</tr><tr><td><input type=\"text\" id=\"host\" name=\"host\" value=\"" )
2024-11-03 09:15:01 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s" , q . Host ) )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 87 , Col : 41 }
2024-11-03 09:15:01 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var3 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-04 16:49:06 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" autocomplete=\"off\" class=\"frameless\" placeholder=\"Filter Host / IP\" hx-get=\"" )
2024-11-03 09:15:01 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s?%s" , "/remote-nodes" , paging . EncodedQuery ( q , [ ] string { "host" } ) ) )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 91 , Col : 96 }
2024-11-03 09:15:01 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var4 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-04 16:49:06 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" hx-push-url=\"true\" hx-trigger=\"keyup changed delay:0.4s\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\"></td><td><select id=\"nettype\" name=\"nettype\" class=\"frameless\" autocomplete=\"off\" hx-get=\"" )
2024-11-03 09:15:01 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s?%s" , "/remote-nodes" , paging . EncodedQuery ( q , [ ] string { "nettype" } ) ) )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 104 , Col : 99 }
2024-11-03 09:15:01 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var5 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" hx-trigger=\"change\" hx-push-url=\"true\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\"><option value=\"\">ANY</option> " )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _ , nettype := range nettypes {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<option value=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s" , nettype ) )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 112 , Col : 51 }
2024-11-03 09:15:01 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var6 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if nettype == q . Nettype {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( " selected" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( ">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7 , templ_7745c5c3_Err = templ . JoinStringErrs ( nettype )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 112 , Col : 98 }
2024-11-03 09:15:01 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var7 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</option>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
2024-11-04 16:49:06 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</select></td><td><select id=\"protocol\" name=\"protocol\" class=\"frameless\" autocomplete=\"off\" hx-get=\"" )
2024-11-03 09:33:50 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s?%s" , "/remote-nodes" , paging . EncodedQuery ( q , [ ] string { "protocol" } ) ) )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 122 , Col : 100 }
2024-11-03 09:33:50 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var8 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" hx-trigger=\"change\" hx-push-url=\"true\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\"><option value=\"\">ANY</option> " )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _ , protocol := range protocols {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<option value=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s" , protocol ) )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 130 , Col : 52 }
2024-11-03 09:33:50 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var9 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if protocol == q . Protocol {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( " selected" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( ">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10 , templ_7745c5c3_Err = templ . JoinStringErrs ( protocol )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 130 , Col : 102 }
2024-11-03 09:33:50 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var10 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</option>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
2024-11-04 16:49:06 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</select></td><td><select id=\"cc\" name=\"cc\" class=\"frameless\" autocomplete=\"off\" hx-get=\"" )
2024-11-03 10:37:11 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s?%s" , "/remote-nodes" , paging . EncodedQuery ( q , [ ] string { "cc" } ) ) )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 140 , Col : 94 }
2024-11-03 10:37:11 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var11 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" hx-trigger=\"change\" hx-push-url=\"true\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\"><option value=\"any\">ANY</option> " )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _ , country := range countries {
if country . CC == "" {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<option value=\"UNKNOWN\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if q . CC == "UNKNOWN" {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( " selected" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( ">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "UNKNOWN (%d)" , country . TotalNodes ) )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 149 , Col : 115 }
2024-11-03 10:37:11 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var12 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</option>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<option value=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s" , country . CC ) )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 151 , Col : 55 }
2024-11-03 10:37:11 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var13 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if country . CC == q . CC {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( " selected" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( ">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s (%d)" , country . Name , country . TotalNodes ) )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 151 , Col : 150 }
2024-11-03 10:37:11 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var14 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</option>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
}
2024-11-04 16:49:06 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</select></td><td colspan=\"2\"><select id=\"status\" name=\"status\" class=\"frameless\" autocomplete=\"off\" hx-get=\"" )
2024-11-03 11:03:13 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s?%s" , "/remote-nodes" , paging . EncodedQuery ( q , [ ] string { "status" } ) ) )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 162 , Col : 98 }
2024-11-03 11:03:13 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var15 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" hx-trigger=\"change\" hx-push-url=\"true\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _ , status := range nodeStatuses {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<option value=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d" , status . Code ) )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 169 , Col : 55 }
2024-11-03 11:03:13 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var16 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if status . Code == q . Status {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( " selected" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( ">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17 , templ_7745c5c3_Err = templ . JoinStringErrs ( status . Text )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 169 , Col : 109 }
2024-11-03 11:03:13 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var17 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</option>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
2024-11-03 13:24:55 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</select></td><td colspan=\"2\"><div class=\"flex justify-center\"><input type=\"checkbox\" id=\"cors\" name=\"cors\" autocomplete=\"off\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if q . CORS == "on" {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( " checked" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( " hx-get=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s?%s" , "/remote-nodes" , paging . EncodedQuery ( q , [ ] string { "cors" } ) ) )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 181 , Col : 97 }
2024-11-03 13:24:55 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var18 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" hx-trigger=\"change\" hx-push-url=\"true\" hx-target=\"#tbl_nodes\" hx-swap=\"outerHTML\" class=\"shrink-0 mt-0.5 text-orange-400 bg-neutral-800 border-neutral-700 rounded focus:ring-0 checked:bg-orange-400 checked:border-orange-400 focus:ring-offset-orange-500\"> <label for=\"cors\" class=\"text-sm ms-3 text-neutral-400\">CORS</label></div></td></tr></thead> <tbody>" )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _ , row := range data . Items {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<tr><td>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-04 09:36:22 +00:00
templ_7745c5c3_Err = cellHostPort ( row . ID , row . Port , row . Hostname , row . IPAddresses , row . IsTor , row . IPv6Only ) . Render ( ctx , templ_7745c5c3_Buffer )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td><td>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-31 20:05:29 +00:00
templ_7745c5c3_Err = cellNettype ( row . Nettype , row . Height ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td><td>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-01 12:50:56 +00:00
templ_7745c5c3_Err = cellProtocol ( row . Protocol , row . CORSCapable ) . Render ( ctx , templ_7745c5c3_Buffer )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-31 20:05:29 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td><td>" )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-01 13:16:01 +00:00
templ_7745c5c3_Err = cellCountry ( row . CountryCode , row . CountryName , row . City , row . ASNName , row . ASN ) . Render ( ctx , templ_7745c5c3_Buffer )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td><td>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-01 14:19:23 +00:00
templ_7745c5c3_Err = cellStatuses ( row . IsAvailable , monero . ParseNodeStatuses ( row . LastCheckStatus ) ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-05 09:40:14 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td><td class=\"text-right\">" )
2024-11-01 14:19:23 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-03 13:24:55 +00:00
var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d" , row . EstimateFee ) )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 211 , Col : 66 }
2024-10-31 15:45:26 +00:00
}
2024-11-03 13:24:55 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var19 ) )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-01 15:31:34 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td><td class=\"text-right\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = cellUptime ( row . Uptime ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 09:45:34 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<br><a href=\"" )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 09:45:34 +00:00
var templ_7745c5c3_Var20 templ . SafeURL = templ . URL ( fmt . Sprintf ( "/remote-nodes/id/%d" , row . ID ) )
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( string ( templ_7745c5c3_Var20 ) ) )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 09:45:34 +00:00
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\">[Logs]</a></td><td title=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var21 string
templ_7745c5c3_Var21 , templ_7745c5c3_Err = templ . JoinStringErrs ( time . Unix ( row . LastChecked , 0 ) . UTC ( ) . Format ( "Jan 2, 2006 15:04 MST" ) )
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 217 , Col : 86 }
2024-10-31 15:45:26 +00:00
}
2024-11-06 09:45:34 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var21 ) )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-01 16:03:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 09:45:34 +00:00
var templ_7745c5c3_Var22 string
2024-11-06 10:11:16 +00:00
templ_7745c5c3_Var22 , templ_7745c5c3_Err = templ . JoinStringErrs ( utils . TimeSince ( row . LastChecked ) )
2024-11-01 16:03:10 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 10:11:16 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 217 , Col : 123 }
2024-11-01 16:03:10 +00:00
}
2024-11-06 09:45:34 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var22 ) )
2024-11-01 16:03:10 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-31 20:05:29 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td></tr>" )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-31 20:05:29 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</tbody></table></div><div class=\"px-6 py-4 grid gap-3 md:flex md:justify-between md:items-center border-t border-neutral-700\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtRowCount ( p . CurrentPage , data . RowsPerPage , data . TotalRows ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtPagination ( "/remote-nodes" , "#tbl_nodes" , q , p ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</div></div>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
} )
}
2024-11-04 09:36:22 +00:00
func Node ( data monero . Node ) templ . Component {
2024-10-31 21:13:52 +00:00
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
2024-11-06 09:45:34 +00:00
templ_7745c5c3_Var23 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var23 == nil {
templ_7745c5c3_Var23 = templ . NopComponent
2024-10-31 21:13:52 +00:00
}
ctx = templ . ClearChildren ( ctx )
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<div class=\"space-y-3 text-neutral-200\"><dl class=\"flex flex-col sm:flex-row gap-1\"><dt class=\"min-w-40\"><span class=\"block text-white text-bold\">Host:</span></dt><dd><ul><li class=\"me-1 inline-flex items-center\">" )
2024-11-04 09:36:22 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 09:45:34 +00:00
var templ_7745c5c3_Var24 string
templ_7745c5c3_Var24 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s:%d" , data . Hostname , data . Port ) )
2024-11-04 09:36:22 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 239 , Col : 54 }
2024-11-04 09:36:22 +00:00
}
2024-11-06 09:45:34 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var24 ) )
2024-11-04 09:36:22 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</li><li class=\"me-1 inline-flex items-center\"><button type=\"button\" class=\"clipboard px-2 inline-flex items-center gap-x-2 text-sm font-bold rounded-lg border border-transparent bg-orange-600 text-white hover:bg-orange-500 focus:outline-none disabled:opacity-60 disabled:pointer-events-none\" data-clipboard-text=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var25 string
templ_7745c5c3_Var25 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s:%d" , data . Hostname , data . Port ) )
if templ_7745c5c3_Err != nil {
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 242 , Col : 320 }
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var25 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\">Copy</button></li></ul></dd></dl><dl class=\"flex flex-col sm:flex-row gap-1\"><dt class=\"min-w-40\"><span class=\"block text-white text-bold\">Net Type:</span></dt><dd><ul><li class=\"uppercase\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var26 string
templ_7745c5c3_Var26 , templ_7745c5c3_Err = templ . JoinStringErrs ( data . Nettype )
if templ_7745c5c3_Err != nil {
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 253 , Col : 41 }
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var26 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</li></ul></dd></dl><dl class=\"flex flex-col sm:flex-row gap-1\"><dt class=\"min-w-40\"><span class=\"block text-white text-bold\">Protocol:</span></dt><dd><ul><li class=\"uppercase\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var27 string
templ_7745c5c3_Var27 , templ_7745c5c3_Err = templ . JoinStringErrs ( data . Protocol )
if templ_7745c5c3_Err != nil {
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 263 , Col : 42 }
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var27 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</li></ul></dd></dl><dl class=\"flex flex-col sm:flex-row gap-1\"><dt class=\"min-w-40\"><span class=\"block text-white text-bold\">IP Addresses:</span></dt><dd><ul><li class=\"whitespace-break-spaces\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var28 string
templ_7745c5c3_Var28 , templ_7745c5c3_Err = templ . JoinStringErrs ( strings . ReplaceAll ( data . IPAddresses , "," , ", " ) )
if templ_7745c5c3_Err != nil {
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 273 , Col : 90 }
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var28 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</li></ul></dd></dl></div><!-- End List -->" )
2024-11-04 09:36:22 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
} )
}
2024-11-06 09:45:34 +00:00
func NodeDetails ( data monero . Node , logs monero . FetchLogs , q monero . QueryLogs , p paging . Pagination ) templ . Component {
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
2024-11-06 12:17:10 +00:00
templ_7745c5c3_Var29 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var29 == nil {
templ_7745c5c3_Var29 = templ . NopComponent
2024-11-06 09:45:34 +00:00
}
ctx = templ . ClearChildren ( ctx )
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<section class=\"relative overflow-hidden pt-6\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = heroGradient ( ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<div class=\"relative z-10\"><div class=\"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-10 lg:py-16\"><div class=\"text-center\"><!-- Title --><div class=\"mt-5\"><h1 class=\"block font-extrabold text-4xl md:text-5xl lg:text-6xl text-neutral-200\">Monero Node #" )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var30 string
templ_7745c5c3_Var30 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d" , data . ID ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 290 , Col : 48 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var30 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</h1></div><hr class=\"mt-6\"></div><div class=\"max-w-3xl mx-auto mt-8\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = Node ( data ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</div></div></div></section><!-- End Hero --><div class=\"flex flex-col max-w-6xl mx-auto mb-10\"><div class=\"my-6 text-center\"><div class=\"mt-5\"><h2 class=\"block font-extrabold text-4xl md:text-4xl lg:text-5xl text-neutral-200\">Probe Logs</h2></div></div><div class=\"min-w-full inline-block align-middle\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = TableLogs ( fmt . Sprintf ( "/remote-nodes/id/%d" , data . ID ) , logs , q , p ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</div></div>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
} )
}
func TableLogs ( hxPath string , data monero . FetchLogs , q monero . QueryLogs , p paging . Pagination ) templ . Component {
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
2024-11-06 12:17:10 +00:00
templ_7745c5c3_Var31 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var31 == nil {
templ_7745c5c3_Var31 = templ . NopComponent
2024-11-06 09:45:34 +00:00
}
ctx = templ . ClearChildren ( ctx )
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<div id=\"tbl_logs\" class=\"bg-neutral-800 border border-neutral-700 rounded-xl shadow-sm overflow-hidden\"><div class=\"px-6 py-4 grid gap-3 md:flex md:justify-between md:items-center border-b border-neutral-700\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtRowPerPage ( hxPath , "#tbl_logs" , q . Limit , q ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<div>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtRefreshInterval ( hxPath , "#tbl_logs" , q . Refresh , q ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</div>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtReload ( hxPath , "#tbl_logs" , q ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</div><div class=\"overflow-x-auto\"><table class=\"dt\"><thead><tr><th scope=\"col\">#ID</th><th scope=\"col\">Prober ID</th><th scope=\"col\">Status</th><th scope=\"col\">Height</th><th scope=\"col\">Adjusted Time</th><th scope=\"col\">DB Size</th><th scope=\"col\">Difficulty</th>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtThSort ( hxPath , "#tbl_logs" , "Est. Fee" , "estimate_fee" , q . SortBy , q . SortDirection , q ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtThSort ( hxPath , "#tbl_logs" , "Check" , "date_checked" , q . SortBy , q . SortDirection , q ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtThSort ( hxPath , "#tbl_logs" , "Runtime" , "fetch_runtime" , q . SortBy , q . SortDirection , q ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</tr><tr><td colspan=\"3\"><select id=\"status\" name=\"status\" class=\"frameless\" autocomplete=\"off\" hx-get=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var32 string
templ_7745c5c3_Var32 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s?%s" , hxPath , paging . EncodedQuery ( q , [ ] string { "status" } ) ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 345 , Col : 89 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var32 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" hx-trigger=\"change\" hx-push-url=\"true\" hx-target=\"#tbl_logs\" hx-swap=\"outerHTML\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _ , status := range nodeStatuses {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<option value=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var33 string
templ_7745c5c3_Var33 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d" , status . Code ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 352 , Col : 55 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var33 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if status . Code == q . Status {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( " selected" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( ">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var34 string
templ_7745c5c3_Var34 , templ_7745c5c3_Err = templ . JoinStringErrs ( status . Text )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 352 , Col : 109 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var34 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</option>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</select></td><td colspan=\"7\"><input type=\"text\" id=\"failed_reason\" name=\"failed_reason\" value=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var35 string
templ_7745c5c3_Var35 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s" , q . FailedReason ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 361 , Col : 49 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var35 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" autocomplete=\"off\" class=\"frameless\" placeholder=\"Filter reason\" hx-get=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var36 string
templ_7745c5c3_Var36 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s?%s" , hxPath , paging . EncodedQuery ( q , [ ] string { "failed_reason" } ) ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 365 , Col : 96 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var36 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" hx-push-url=\"true\" hx-trigger=\"keyup changed delay:0.4s\" hx-target=\"#tbl_logs\" hx-swap=\"outerHTML\"></td></tr></thead> <tbody>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _ , row := range data . Items {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<tr><td>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var37 string
templ_7745c5c3_Var37 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d" , row . ID ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 377 , Col : 38 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var37 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td><td>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var38 string
templ_7745c5c3_Var38 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d" , row . ProberID ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 378 , Col : 44 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var38 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if row . Status == 1 {
2024-11-06 10:34:41 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<td class=\"text-green-500\">OK</td><td class=\"text-right\">" )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var39 string
templ_7745c5c3_Var39 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d" , row . Height ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 381 , Col : 62 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var39 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td><td>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var40 string
templ_7745c5c3_Var40 , templ_7745c5c3_Err = templ . JoinStringErrs ( time . Unix ( row . AdjustedTime , 0 ) . UTC ( ) . Format ( "Jan 2, 2006 15:04 MST" ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 382 , Col : 82 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var40 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td><td>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var41 string
templ_7745c5c3_Var41 , templ_7745c5c3_Err = templ . JoinStringErrs ( utils . FormatBytes ( row . DatabaseSize , 0 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 383 , Col : 52 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var41 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td><td>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var42 string
templ_7745c5c3_Var42 , templ_7745c5c3_Err = templ . JoinStringErrs ( utils . FormatHashes ( float64 ( row . Difficulty ) ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 384 , Col : 57 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var42 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td><td class=\"text-right\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var43 string
templ_7745c5c3_Var43 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d" , row . EstimateFee ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 385 , Col : 67 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var43 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<td class=\"text-red-500\">ERR</td><td colspan=\"5\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var44 string
templ_7745c5c3_Var44 , templ_7745c5c3_Err = templ . JoinStringErrs ( row . FailedReason )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 388 , Col : 42 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var44 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<td title=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var45 string
templ_7745c5c3_Var45 , templ_7745c5c3_Err = templ . JoinStringErrs ( time . Unix ( row . DateChecked , 0 ) . UTC ( ) . Format ( "Jan 2, 2006 15:04 MST" ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 390 , Col : 86 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var45 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var46 string
templ_7745c5c3_Var46 , templ_7745c5c3_Err = templ . JoinStringErrs ( utils . TimeSince ( row . DateChecked ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 390 , Col : 123 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var46 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</td><td class=\"text-right\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var47 string
templ_7745c5c3_Var47 , templ_7745c5c3_Err = templ . JoinStringErrs ( utils . FormatFloat ( row . FetchRuntime ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 391 , Col : 67 }
2024-11-06 09:45:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var47 ) )
2024-11-06 09:45:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "s</td></tr>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</tbody></table></div><div class=\"px-6 py-4 grid gap-3 md:flex md:justify-between md:items-center border-t border-neutral-700\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtRowCount ( p . CurrentPage , data . RowsPerPage , data . TotalRows ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DtPagination ( hxPath , "#tbl_logs" , q , p ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</div></div>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
} )
}
2024-11-04 09:36:22 +00:00
func cellHostPort ( id , port uint , hostname , ips string , isTor , ipv6Only bool ) templ . Component {
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
2024-11-06 12:17:10 +00:00
templ_7745c5c3_Var48 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var48 == nil {
templ_7745c5c3_Var48 = templ . NopComponent
2024-11-04 09:36:22 +00:00
}
ctx = templ . ClearChildren ( ctx )
2024-10-31 21:13:52 +00:00
if isTor {
2024-11-04 09:36:22 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<button class=\"max-w-40 truncate text-orange-400\" hx-get=\"" )
2024-10-31 21:13:52 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var49 string
templ_7745c5c3_Var49 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "/remote-nodes/id/%d" , id ) )
2024-10-31 21:13:52 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 408 , Col : 50 }
2024-10-31 21:13:52 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var49 ) )
2024-11-04 09:36:22 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" hx-push-url=\"false\" hx-target=\"#modal-section\" aria-haspopup=\"dialog\" aria-expanded=\"false\" aria-controls=\"modal-section\" data-hs-overlay=\"#modal-section\">👁 " )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var50 string
templ_7745c5c3_Var50 , templ_7745c5c3_Err = templ . JoinStringErrs ( hostname )
2024-11-04 09:36:22 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 416 , Col : 18 }
2024-11-04 09:36:22 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var50 ) )
2024-10-31 21:13:52 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</button><br>.onion:<span class=\"text-indigo-400\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var51 string
templ_7745c5c3_Var51 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d" , port ) )
2024-10-31 21:13:52 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 419 , Col : 64 }
2024-10-31 21:13:52 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var51 ) )
2024-10-31 21:13:52 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</span> <span class=\"text-neutral-400\">(TOR)</span>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var52 string
templ_7745c5c3_Var52 , templ_7745c5c3_Err = templ . JoinStringErrs ( ip . FormatHostname ( hostname ) )
2024-10-31 21:13:52 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 422 , Col : 31 }
2024-10-31 21:13:52 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var52 ) )
2024-10-31 21:13:52 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( ":<span class=\"text-indigo-400\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var53 string
templ_7745c5c3_Var53 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d" , port ) )
2024-10-31 21:13:52 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 422 , Col : 89 }
2024-10-31 21:13:52 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var53 ) )
2024-10-31 21:13:52 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</span><br><div class=\"max-w-40 text-ellipsis overflow-x-auto md:overflow-hidden hover:overflow-visible\"><span class=\"whitespace-break-spaces text-gray-400\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var54 string
templ_7745c5c3_Var54 , templ_7745c5c3_Err = templ . JoinStringErrs ( strings . ReplaceAll ( ips , "," , " " ) )
2024-10-31 21:13:52 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 425 , Col : 90 }
2024-10-31 21:13:52 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var54 ) )
2024-10-31 21:13:52 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</span> " )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if ipv6Only {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"text-rose-400\">(IPv6 only)</span>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</div>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
return templ_7745c5c3_Err
} )
}
2024-10-31 20:05:29 +00:00
func cellNettype ( nettype string , height uint ) templ . Component {
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
2024-11-06 12:17:10 +00:00
templ_7745c5c3_Var55 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var55 == nil {
templ_7745c5c3_Var55 = templ . NopComponent
2024-10-31 20:05:29 +00:00
}
ctx = templ . ClearChildren ( ctx )
switch nettype {
case "stagenet" :
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"font-semibold uppercase text-sky-500\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var56 string
templ_7745c5c3_Var56 , templ_7745c5c3_Err = templ . JoinStringErrs ( nettype )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 436 , Col : 63 }
2024-10-31 15:45:26 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var56 ) )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-31 20:05:29 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</span>" )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-31 20:05:29 +00:00
case "testnet" :
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"font-semibold uppercase text-rose-500\">" )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
2024-10-31 20:05:29 +00:00
return templ_7745c5c3_Err
2024-10-31 15:45:26 +00:00
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var57 string
templ_7745c5c3_Var57 , templ_7745c5c3_Err = templ . JoinStringErrs ( nettype )
2024-10-31 20:05:29 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 438 , Col : 64 }
2024-10-31 20:05:29 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var57 ) )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-10-31 20:05:29 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</span>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
default :
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"font-semibold uppercase text-green-500\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var58 string
templ_7745c5c3_Var58 , templ_7745c5c3_Err = templ . JoinStringErrs ( nettype )
2024-10-31 20:05:29 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 440 , Col : 65 }
2024-10-31 20:05:29 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var58 ) )
2024-10-31 20:05:29 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</span>" )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
2024-10-31 20:05:29 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<br>" )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var59 string
templ_7745c5c3_Var59 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d" , height ) )
2024-10-31 15:45:26 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 443 , Col : 28 }
2024-10-31 15:45:26 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var59 ) )
2024-10-30 07:23:45 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
} )
}
2024-11-01 12:50:56 +00:00
func cellProtocol ( protocol string , cors bool ) templ . Component {
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
2024-11-06 12:17:10 +00:00
templ_7745c5c3_Var60 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var60 == nil {
templ_7745c5c3_Var60 = templ . NopComponent
2024-11-01 12:50:56 +00:00
}
ctx = templ . ClearChildren ( ctx )
switch protocol {
case "http" :
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"font-semibold uppercase text-sky-500\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var61 string
templ_7745c5c3_Var61 , templ_7745c5c3_Err = templ . JoinStringErrs ( protocol )
2024-11-01 12:50:56 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 449 , Col : 64 }
2024-11-01 12:50:56 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var61 ) )
2024-11-01 12:50:56 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</span> " )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
default :
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"font-semibold uppercase text-green-500\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var62 string
templ_7745c5c3_Var62 , templ_7745c5c3_Err = templ . JoinStringErrs ( protocol )
2024-11-01 12:50:56 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 451 , Col : 66 }
2024-11-01 12:50:56 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var62 ) )
2024-11-01 12:50:56 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</span> " )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if cors {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<br>(CORS 💪)" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
return templ_7745c5c3_Err
} )
}
2024-11-01 13:16:01 +00:00
func cellCountry ( cc , countryName , city , asnName string , asn uint ) templ . Component {
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
2024-11-06 12:17:10 +00:00
templ_7745c5c3_Var63 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var63 == nil {
templ_7745c5c3_Var63 = templ . NopComponent
2024-11-01 13:16:01 +00:00
}
ctx = templ . ClearChildren ( ctx )
if cc != "" {
if city != "" {
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var64 string
templ_7745c5c3_Var64 , templ_7745c5c3_Err = templ . JoinStringErrs ( city )
2024-11-01 13:16:01 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 462 , Col : 9 }
2024-11-01 13:16:01 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var64 ) )
2024-11-01 13:16:01 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "," )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( " " )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var65 string
templ_7745c5c3_Var65 , templ_7745c5c3_Err = templ . JoinStringErrs ( countryName )
2024-11-01 13:16:01 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 464 , Col : 15 }
2024-11-01 13:16:01 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var65 ) )
2024-11-01 13:16:01 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( " <img class=\"inline-block\" src=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var66 string
templ_7745c5c3_Var66 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "/assets/img/cf/%s.svg" , strings . ToLower ( cc ) ) )
2024-11-01 13:16:01 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 465 , Col : 91 }
2024-11-01 13:16:01 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var66 ) )
2024-11-01 13:16:01 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" alt=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var67 string
templ_7745c5c3_Var67 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%s Flag" , cc ) )
2024-11-01 13:16:01 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 465 , Col : 126 }
2024-11-01 13:16:01 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var67 ) )
2024-11-01 13:16:01 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" width=\"22px\"> " )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if asn != 0 {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<br><a class=\"external font-semibold underline !text-purple-400\" href=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var68 templ . SafeURL = templ . URL ( fmt . Sprintf ( "https://www.ditatompel.com/asn/%d" , asn ) )
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( string ( templ_7745c5c3_Var68 ) ) )
2024-11-01 13:16:01 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" target=\"_blank\" rel=\"noopener\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var69 string
templ_7745c5c3_Var69 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "AS%d" , asn ) )
2024-11-01 13:16:01 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 474 , Col : 29 }
2024-11-01 13:16:01 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var69 ) )
2024-11-01 13:16:01 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</a> (<span class=\"font-semibold text-green-500\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var70 string
templ_7745c5c3_Var70 , templ_7745c5c3_Err = templ . JoinStringErrs ( asnName )
2024-11-01 13:16:01 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 475 , Col : 55 }
2024-11-01 13:16:01 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var70 ) )
2024-11-01 13:16:01 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</span>)" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
return templ_7745c5c3_Err
} )
}
2024-11-01 14:19:23 +00:00
func cellStatuses ( isAvailable bool , statuses [ 5 ] int ) templ . Component {
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
2024-11-06 12:17:10 +00:00
templ_7745c5c3_Var71 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var71 == nil {
templ_7745c5c3_Var71 = templ . NopComponent
2024-11-01 14:19:23 +00:00
}
ctx = templ . ClearChildren ( ctx )
if isAvailable {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"font-semibold text-green-500\">Online</span>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"text-rose-400\">Offline</span>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<br>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _ , status := range statuses {
if status == 1 {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"text-green-400 mr-1\">•</span>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else if status == 0 {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"text-red-400 mr-1\">•</span>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"text-neutral-600 mr-1\">•</span>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
}
return templ_7745c5c3_Err
} )
}
2024-11-01 15:31:34 +00:00
func cellUptime ( uptime float64 ) templ . Component {
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
2024-11-06 12:17:10 +00:00
templ_7745c5c3_Var72 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var72 == nil {
templ_7745c5c3_Var72 = templ . NopComponent
2024-11-01 15:31:34 +00:00
}
ctx = templ . ClearChildren ( ctx )
if uptime >= 98 {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"text-green-500\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var73 string
templ_7745c5c3_Var73 , templ_7745c5c3_Err = templ . JoinStringErrs ( utils . FormatFloat ( uptime ) )
2024-11-01 15:31:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 499 , Col : 58 }
2024-11-01 15:31:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var73 ) )
2024-11-01 15:31:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "%</span>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else if uptime < 98 && uptime >= 80 {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"text-sky-500\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var74 string
templ_7745c5c3_Var74 , templ_7745c5c3_Err = templ . JoinStringErrs ( utils . FormatFloat ( uptime ) )
2024-11-01 15:31:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 501 , Col : 56 }
2024-11-01 15:31:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var74 ) )
2024-11-01 15:31:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "%</span>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else if uptime < 80 && uptime > 75 {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"text-orange-500\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var75 string
templ_7745c5c3_Var75 , templ_7745c5c3_Err = templ . JoinStringErrs ( utils . FormatFloat ( uptime ) )
2024-11-01 15:31:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 503 , Col : 59 }
2024-11-01 15:31:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var75 ) )
2024-11-01 15:31:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "%</span>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"text-rose-500\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-11-06 12:17:10 +00:00
var templ_7745c5c3_Var76 string
templ_7745c5c3_Var76 , templ_7745c5c3_Err = templ . JoinStringErrs ( utils . FormatFloat ( uptime ) )
2024-11-01 15:31:34 +00:00
if templ_7745c5c3_Err != nil {
2024-11-06 12:17:10 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` internal/handler/views/remote_nodes.templ ` , Line : 505 , Col : 57 }
2024-11-01 15:31:34 +00:00
}
2024-11-06 12:17:10 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var76 ) )
2024-11-01 15:31:34 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "%</span>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
return templ_7745c5c3_Err
} )
}
2024-10-30 07:23:45 +00:00
var _ = templruntime . GeneratedTemplate