@@ -26,6 +26,7 @@ export function NodeCheckerPage() {
2626 undefined ,
2727 ) ;
2828 const [ publicKeyRequired , setPublicKeyRequired ] = useState < boolean > ( true ) ;
29+ const [ metricsPortRequired , setMetricsPortRequired ] = useState < boolean > ( true ) ;
2930
3031 // Used for getting the text field values from the URL and updating the query params
3132 // when the user hits the "Check Node" button.
@@ -55,6 +56,14 @@ export function NodeCheckerPage() {
5556 validatePortInput : validateNoisePortInput ,
5657 } = usePortInput ( searchParams . get ( "noisePort" ) || "6180" ) ;
5758
59+ // Metrics port text input field.
60+ const {
61+ port : metricsPort ,
62+ setPort : setMetricsPort ,
63+ renderPortTextField : renderMetricsPortTextField ,
64+ validatePortInput : validateMetricsPortInput ,
65+ } = usePortInput ( searchParams . get ( "metricsPort" ) || "9101" ) ;
66+
5867 // Public key text input field.
5968 const {
6069 addr : publicKey ,
@@ -70,6 +79,9 @@ export function NodeCheckerPage() {
7079 const urlIsValid = validateUrlInput ( ) ;
7180 const apiPortIsValid = validateApiPortInput ( ) ;
7281 const noisePortIsValid = validateNoisePortInput ( ) ;
82+ const metricsPortIsValid = metricsPortRequired
83+ ? validateMetricsPortInput ( )
84+ : true ;
7385 const publicKeyIsValid = publicKeyRequired
7486 ? validatePublicKeyAddressInput ( )
7587 : true ;
@@ -78,6 +90,7 @@ export function NodeCheckerPage() {
7890 apiPortIsValid &&
7991 noisePortIsValid &&
8092 publicKeyIsValid &&
93+ metricsPortIsValid &&
8194 baselineConfiguration !== undefined
8295 ) ;
8396 } ;
@@ -90,6 +103,7 @@ export function NodeCheckerPage() {
90103 updateBaselineConfiguration ( configuration ) ;
91104 const evaluators = configuration ?. evaluators ?? [ ] ;
92105 setPublicKeyRequired ( evaluators . includes ( "noise_handshake" ) ) ;
106+ setMetricsPortRequired ( ( configuration ?. name ?? "" ) . includes ( "with_metrics" ) ) ;
93107 } ;
94108
95109 const onCheckNodeButtonClick = async ( ) => {
@@ -105,6 +119,7 @@ export function NodeCheckerPage() {
105119 url : url ,
106120 apiPort : apiPort ,
107121 noisePort : noisePort ,
122+ metricsPort : metricsPort ,
108123 publicKey : publicKey ,
109124 baselineConfiguration : baselineConfiguration ! . name ,
110125 } ) ;
@@ -116,6 +131,7 @@ export function NodeCheckerPage() {
116131 // TODO: Somehow make these port values numbers to begin with.
117132 apiPort : parseInt ( apiPort ) ,
118133 noisePort : parseInt ( noisePort ) ,
134+ metricsPort : metricsPortRequired ? parseInt ( metricsPort ) : undefined ,
119135 publicKey : publicKey == "" ? undefined : publicKey ,
120136 } ) ;
121137 updateEvaluationSummary ( evaluationSummary ) ;
@@ -138,6 +154,7 @@ export function NodeCheckerPage() {
138154 setUrl ( searchParams . get ( "url" ) || "" ) ;
139155 setApiPort ( searchParams . get ( "apiPort" ) || "443" ) ;
140156 setNoisePort ( searchParams . get ( "noisePort" ) || "6180" ) ;
157+ setMetricsPort ( searchParams . get ( "metricsPort" ) || "9101" ) ;
141158 setPublicKey ( searchParams . get ( "publicKey" ) || "" ) ;
142159 } , [ state . network_name , searchParams ] ) ;
143160
@@ -152,6 +169,16 @@ export function NodeCheckerPage() {
152169 ) ;
153170 }
154171
172+ // Same for the metrics port input.
173+ let metricsPortInput = null ;
174+ if ( metricsPortRequired ) {
175+ metricsPortInput = (
176+ < Grid item md = { 1.1 } xs = { 12 } >
177+ { renderMetricsPortTextField ( "Metrics Port" ) }
178+ </ Grid >
179+ ) ;
180+ }
181+
155182 // Build the check node button, which could be disabled if we're actively
156183 // waiting for a response from the server.
157184 const checkNodeButton = (
@@ -190,19 +217,20 @@ export function NodeCheckerPage() {
190217 < Grid item md = { 5 } xs = { 12 } >
191218 { renderUrlTextField ( "Node URL" ) }
192219 </ Grid >
193- < Grid item md = { 1.5 } xs = { 12 } >
220+ < Grid item md = { 1.1 } xs = { 12 } >
194221 { renderApiPortTextField ( "API Port" ) }
195222 </ Grid >
196- < Grid item md = { 1.5 } xs = { 12 } >
223+ < Grid item md = { 1.1 } xs = { 12 } >
197224 { renderNoisePortTextField ( "Noise Port" ) }
198225 </ Grid >
199- < Grid item md = { 4 } xs = { 12 } >
226+ < Grid item md = { 3.5 } xs = { 12 } >
200227 < ConfigurationSelect
201228 baselineConfiguration = { baselineConfiguration }
202229 updateBaselineConfiguration = { updateBaselineConfigurationWrapper }
203230 updateErrorMessage = { updateErrorMessage }
204231 />
205232 </ Grid >
233+ { metricsPortInput }
206234 { publicKeyInput }
207235 < Grid item xs = { 12 } >
208236 { checkNodeButton }
0 commit comments