1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-14 00:19:16 +01:00

3111-1: Wires up stale data from the API (#8752)

Builds on the backend code added in
https://github.com/Unleash/unleash/pull/8751

This wires up the front end to use the data returned from the API
This commit is contained in:
Thomas Heartman 2024-11-14 15:23:05 +01:00 committed by GitHub
parent 5d32d149cd
commit 7e96033c4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,8 @@
import { Typography } from '@mui/material';
import { styled } from '@mui/material';
import { PrettifyLargeNumber } from 'component/common/PrettifyLargeNumber/PrettifyLargeNumber';
import { useProjectStatus } from 'hooks/api/getters/useProjectStatus/useProjectStatus';
import useLoading from 'hooks/useLoading';
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
import type { FC } from 'react';
import { Link } from 'react-router-dom';
@ -19,7 +21,7 @@ const BigText = styled('span')(({ theme }) => ({
const BigNumber: FC<{ value?: number }> = ({ value }) => {
return (
<BigText>
<BigText data-loading-stale-flags>
<PrettifyLargeNumber
value={value ?? 0}
threshold={1000}
@ -31,10 +33,13 @@ const BigNumber: FC<{ value?: number }> = ({ value }) => {
export const StaleFlags = () => {
const projectId = useRequiredPathParam('projectId');
const { data, loading } = useProjectStatus(projectId);
const loadingRef = useLoading(loading, '[data-loading-stale-flags=true]');
return (
<Wrapper>
<Wrapper ref={loadingRef}>
<Typography component='h4'>
<BigNumber value={6} />{' '}
<BigNumber value={data?.staleFlags.total ?? 0} />{' '}
<Link to={`/projects/${projectId}?state=IS%3Astale`}>
stale flags
</Link>