File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -378,9 +378,7 @@ <h2>Prometheus scrape_config</h2>
378378 let formEl = $ ( el ) ;
379379 let fieldName = formEl . attr ( "id" ) ;
380380 let fieldValue = formEl . val ( ) ;
381- fieldValue = fieldValue . trim ( ) ;
382-
383- formData [ fieldName ] = fieldValue ;
381+ formData [ fieldName ] = fieldValue ? fieldValue . trim ( ) : ""
384382 } ) ;
385383
386384 let hashString = btoa ( JSON . stringify ( formData ) ) ;
@@ -408,7 +406,8 @@ <h2>Prometheus scrape_config</h2>
408406 } ;
409407
410408 let formSetVisibility = ( ) => {
411- let endpoint = $ ( "#endpoint:input" ) . val ( ) . trim ( ) ;
409+ let endpoint = $ ( "#endpoint:input" ) . val ( )
410+ endpoint = endpoint ? endpoint . trim ( ) : ""
412411 $ ( "form.query div.row" ) . removeClass ( "hidden" ) ;
413412 $ ( "form.query div.row[query-endpoint]:not([query-endpoint~=\"" + endpoint + "\"])" ) . addClass ( "hidden" ) ;
414413 $ ( "form.query div.row[query-endpoint-exclude][query-endpoint-exclude~=\"" + endpoint + "\"]" ) . addClass ( "hidden" ) ;
@@ -453,7 +452,7 @@ <h2>Prometheus scrape_config</h2>
453452 let formEl = $ ( el ) ;
454453 let fieldName = formEl . attr ( "id" ) ;
455454 let fieldValue = formEl . val ( ) ;
456- fieldValue = fieldValue . trim ( ) ;
455+ fieldValue = fieldValue ? fieldValue . trim ( ) : "" ;
457456
458457 switch ( fieldName ) {
459458 case "endpoint" :
You can’t perform that action at this time.
0 commit comments