query handling and server down message

This commit is contained in:
Annika Hannig 2022-07-12 13:03:13 +02:00
parent a67a04e5f3
commit bbd69e3d05
3 changed files with 13 additions and 6 deletions

View File

@ -9,6 +9,7 @@ import { FontAwesomeIcon }
from '@fortawesome/react-fontawesome'; from '@fortawesome/react-fontawesome';
import { faClock import { faClock
, faThumbsUp , faThumbsUp
, faThumbsDown
} }
from '@fortawesome/free-regular-svg-icons'; from '@fortawesome/free-regular-svg-icons';
import { faArrowsRotate } import { faArrowsRotate }
@ -84,10 +85,18 @@ const Status = () => {
<td>Last Reconfig: <b><DateTime value={lastReconfig} /></b></td> <td>Last Reconfig: <b><DateTime value={lastReconfig} /></b></td>
</tr>} </tr>}
{rsStatus.message &&
<tr> <tr>
<td><FontAwesomeIcon icon={faThumbsUp} /></td> <td><FontAwesomeIcon icon={faThumbsUp} /></td>
<td><b>{rsStatus.message}</b></td> <td><b>{rsStatus.message}</b></td>
</tr> </tr>}
{!rsStatus.message &&
<tr>
<td><FontAwesomeIcon icon={faThumbsDown} /></td>
<td>Route server is not reachable.</td>
</tr>}
<CacheStatus /> <CacheStatus />
</tbody> </tbody>
</table> </table>

View File

@ -13,6 +13,8 @@ import { useSearchParams
* useQuery is an extension to useLocation to handle * useQuery is an extension to useLocation to handle
* query parameters. Internally this uses URLSearchParams * query parameters. Internally this uses URLSearchParams
* for decoding but returns an object merged with the defaults. * for decoding but returns an object merged with the defaults.
* To prevent loops, the search parameters are only updated
* if they differ.
*/ */
export const useQuery = (defaults={}) => { export const useQuery = (defaults={}) => {
const [query, setQuery] = useSearchParams(defaults); const [query, setQuery] = useSearchParams(defaults);

View File

@ -38,11 +38,7 @@ import SearchInput
*/ */
const NeighborsPage = () => { const NeighborsPage = () => {
const routeServer = useSelectedRouteServer(); const routeServer = useSelectedRouteServer();
const [query, setQuery] = useQuery({ const [query, setQuery] = useQuery({q: ""});
s: "asn", // Sort
o: "asc", // Order
q: "", // Search
});
if (!routeServer) { return null; } // nothing to do here if (!routeServer) { return null; } // nothing to do here