@@ -10,7 +10,9 @@ import HistoryIcon from "@mui/icons-material/History";
10
10
import styled from "@emotion/styled" ;
11
11
import setHistoryOpen from "../../actions/setHistoryOpen" ;
12
12
import { Tooltip } from "@mui/material" ;
13
- import Badge from '@mui/material/Badge' ;
13
+ import { decodeQuery } from "../UpdateStateFromQueryParams" ;
14
+ import localUrl from "../../services/localUrl" ;
15
+
14
16
15
17
const HistoryButton = styled . button `
16
18
background: none;
@@ -27,6 +29,7 @@ export const QueryBar = () => {
27
29
const labelsBrowserOpen = useSelector ( ( store ) => store . labelsBrowserOpen ) ;
28
30
const debug = useSelector ( ( store ) => store . debug ) ;
29
31
const query = useSelector ( ( store ) => store . query ) ;
32
+ const apiUrl = useSelector ( ( store ) => store . apiUrl )
30
33
const isSubmit = useSelector ( ( store ) => store . isSubmit ) ;
31
34
const historyOpen = useSelector ( ( store ) => store . historyOpen )
32
35
const [ queryInput , setQueryInput ] = useState ( query ) ;
@@ -36,7 +39,7 @@ export const QueryBar = () => {
36
39
const LOG_BROWSER = "Log Browser" ;
37
40
const queryHistory = useSelector ( ( store ) => store . queryHistory )
38
41
const [ historyItems , setHistoryItems ] = useState ( queryHistory . length > 0 )
39
-
42
+ const saveUrl = localUrl ( )
40
43
useEffect ( ( ) => {
41
44
setHistoryItems ( queryHistory . length > 0 )
42
45
} , [ queryHistory ] )
@@ -60,7 +63,6 @@ export const QueryBar = () => {
60
63
) ;
61
64
// here
62
65
dispatch ( setLoading ( true ) ) ;
63
-
64
66
dispatch ( loadLogs ( ) ) ;
65
67
66
68
setTimeout ( ( ) => {
@@ -107,15 +109,17 @@ export const QueryBar = () => {
107
109
108
110
dispatch ( setQuery ( queryInput ) ) ;
109
111
110
- if ( onQueryValid ( query ) ) {
112
+ if ( onQueryValid ( queryInput ) ) {
111
113
try {
112
114
const historyUpdated = historyService . add ( {
113
- data : query ,
115
+ data : queryInput ,
114
116
url : window . location . hash ,
115
117
} ) ;
116
118
dispatch ( setQueryHistory ( historyUpdated ) ) ;
117
119
dispatch ( setLabelsBrowserOpen ( false ) ) ;
120
+ decodeQuery ( query , apiUrl )
118
121
dispatch ( loadLogs ( ) ) ;
122
+ saveUrl . add ( { data : window . location . href , description :'From Query Submit' } )
119
123
} catch ( e ) {
120
124
console . log ( e ) ;
121
125
}
0 commit comments