From 42d7b642bde167a064334620f43461ffa6ea9dc1 Mon Sep 17 00:00:00 2001 From: Marc Lichtman Date: Sun, 26 May 2024 02:23:21 -0400 Subject: [PATCH] Misc client cleanups (#880) * make windowfunctions into for loop * zoom levels * cleanups * hide one of the two GET plugin errors * comment out reportWebVitals console log * autocomplete attribute warning --- client/src/api/plugin/queries.tsx | 5 +- client/src/index.tsx | 4 +- .../src/pages/browser/custom-azure-form.tsx | 1 + .../components/settings-pane.tsx | 61 ++++++------------- .../hooks/use-spectrogram-context.tsx | 6 +- 5 files changed, 28 insertions(+), 49 deletions(-) diff --git a/client/src/api/plugin/queries.tsx b/client/src/api/plugin/queries.tsx index 8c46c2735..6e24aaf8b 100644 --- a/client/src/api/plugin/queries.tsx +++ b/client/src/api/plugin/queries.tsx @@ -27,7 +27,10 @@ export function useGetPlugin(plugin: PluginDefinition) { return useQuery( ['plugin', plugin.name], async () => { - const response = await axios.get(plugin.url); + const response = await axios.get(plugin.url).catch((err) => { + console.info('Plugin server ' + plugin.url + ' not reachable'); + return { data: [] }; + }); // make sure we only return in case of a string array if (!Array.isArray(response.data)) throw new Error(`Plugin ${plugin.name} does not return a string array`); return response.data; diff --git a/client/src/index.tsx b/client/src/index.tsx index 37a284c24..c00d900bf 100644 --- a/client/src/index.tsx +++ b/client/src/index.tsx @@ -42,5 +42,5 @@ root.render( ); -// If you want to start measuring performance in your app, pass a function to log results (for example: reportWebVitals(console.log)) or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals -reportWebVitals(console.log); +// For measuring performance uncomment the following. see https://create-react-app.dev/docs/measuring-performance/ +//reportWebVitals(console.log); diff --git a/client/src/pages/browser/custom-azure-form.tsx b/client/src/pages/browser/custom-azure-form.tsx index dff584a5d..846824b54 100644 --- a/client/src/pages/browser/custom-azure-form.tsx +++ b/client/src/pages/browser/custom-azure-form.tsx @@ -120,6 +120,7 @@ export const CustomAzureForm = ({ placeholder="SAS Token (optional)" onChange={onSasTokenChange} className="input input-bordered input-success w-full max-w-xs mb-2 pl-2" + autoComplete="off" /> @@ -290,21 +273,11 @@ const SettingsPane = ({ currentFFT }) => { Window diff --git a/client/src/pages/recording-view/hooks/use-spectrogram-context.tsx b/client/src/pages/recording-view/hooks/use-spectrogram-context.tsx index 6c87893e0..8e42d77fc 100644 --- a/client/src/pages/recording-view/hooks/use-spectrogram-context.tsx +++ b/client/src/pages/recording-view/hooks/use-spectrogram-context.tsx @@ -3,6 +3,7 @@ import { useMeta } from '@/api/metadata/queries'; import { INITIAL_PYTHON_SNIPPET } from '@/utils/constants'; import { SigMFMetadata } from '@/utils/sigmfMetadata'; import React, { createContext, useContext, useEffect, useState } from 'react'; +import { COLORMAP_DEFAULT } from '@/utils/constants'; interface SpectrogramContextProperties { type: string; @@ -43,6 +44,7 @@ interface SpectrogramContextProperties { export const SpectrogramContext = createContext(null); +// Initial settings export function SpectrogramContextProvider({ children, type, @@ -52,8 +54,8 @@ export function SpectrogramContextProvider({ seedValues = { magnitudeMin: -30, magnitudeMax: 5, - colmap: 'viridis', - windowFunction: 'hann', + colmap: COLORMAP_DEFAULT, + windowFunction: 'rectangle', fftSize: 1024, spectrogramHeight: 800, spectrogramWidth: 1024,