Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const KeyViz = () => {
const [chartState, setChartState] = useState()
const [getSelection, setSelection] = useGetSet(null)
const [isLoading, setLoading] = useState(true)
const [getAutoRefreshSeconds, setAutoRefreshSeconds] = useGetSet(0)
const [getRemainingRefreshSeconds, setRemainingRefreshSeconds] = useGetSet(0)
const [getOnBrush, setOnBrush] = useGetSet(false)
const [getDateRange, setDateRange] = useGetSet(3600 * 6)
const [getBrightLevel, setBrightLevel] = useGetSet(1)
const [getMetricType, setMetricType] = useGetSet('written_bytes')
const [config, setConfig] = useState(null)
const {
state: shouldShowSettings,
setTrue: openSettings,
setFalse: closeSettings,
} = useBoolean(false)
const { t } = useTranslation()
const enabled = config?.auto_collection_enabled === true
const updateServiceStatus = useCallback(async function () {
setLoading(true)
try {
const resp = await client.getInstance().keyvisualConfigGet()
const config = resp.data
const enabled = config?.auto_collection_enabled === true
if (!enabled) {
setAutoRefreshSeconds(0)
}
setConfig(config)
} catch (e) {}
setLoading(false)