1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-03-18 00:19:49 +01:00

feat: info icon instances for 2 days (#6373)

This commit is contained in:
Mateusz Kwasniewski 2024-02-28 11:22:31 +01:00 committed by GitHub
parent ba2b90af42
commit 9a12257568
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 38 additions and 22 deletions

View File

@ -6,6 +6,7 @@ import { FC, useLayoutEffect, useRef, useState } from 'react';
import { ApplicationOverviewSchema } from '../../openapi'; import { ApplicationOverviewSchema } from '../../openapi';
import { useRequiredPathParam } from '../../hooks/useRequiredPathParam'; import { useRequiredPathParam } from '../../hooks/useRequiredPathParam';
import { WarningAmberRounded } from '@mui/icons-material'; import { WarningAmberRounded } from '@mui/icons-material';
import { HelpIcon } from '../common/HelpIcon/HelpIcon';
const StyledTable = styled('table')(({ theme }) => ({ const StyledTable = styled('table')(({ theme }) => ({
fontSize: theme.fontSizes.smallerBody, fontSize: theme.fontSizes.smallerBody,
@ -196,7 +197,18 @@ export const ApplicationChart = ({ data }: IApplicationChartProps) => {
<StyledTable> <StyledTable>
<tbody> <tbody>
<tr> <tr>
<StyledCell>Instances:</StyledCell> <StyledCell
sx={{ display: 'flex' }}
>
Instances:{' '}
<HelpIcon
size={
theme.fontSizes
.smallBody
}
tooltip='Active instances in the last 2 days'
/>
</StyledCell>
<StyledCell> <StyledCell>
{environment.instanceCount} {environment.instanceCount}
</StyledCell> </StyledCell>

View File

@ -2,7 +2,8 @@ import { styled, Tooltip, TooltipProps } from '@mui/material';
import { HelpOutline } from '@mui/icons-material'; import { HelpOutline } from '@mui/icons-material';
import { HtmlTooltip } from 'component/common/HtmlTooltip/HtmlTooltip'; import { HtmlTooltip } from 'component/common/HtmlTooltip/HtmlTooltip';
const StyledContainer = styled('span')(({ theme }) => ({ const StyledContainer = styled('span')<{ size: string | undefined }>(
({ theme, size }) => ({
display: 'inline-grid', display: 'inline-grid',
alignItems: 'center', alignItems: 'center',
outline: 0, outline: 0,
@ -16,17 +17,19 @@ const StyledContainer = styled('span')(({ theme }) => ({
color: theme.palette.primary.main, color: theme.palette.primary.main,
}, },
'& svg': { '& svg': {
fontSize: theme.fontSizes.mainHeader, fontSize: size || theme.fontSizes.mainHeader,
color: theme.palette.action.active, color: theme.palette.action.active,
marginLeft: theme.spacing(0.5), marginLeft: theme.spacing(0.5),
}, },
})); }),
);
interface IHelpIconProps { interface IHelpIconProps {
tooltip: React.ReactNode; tooltip: React.ReactNode;
htmlTooltip?: boolean; htmlTooltip?: boolean;
placement?: TooltipProps['placement']; placement?: TooltipProps['placement'];
children?: React.ReactNode; children?: React.ReactNode;
size?: string;
} }
export const HelpIcon = ({ export const HelpIcon = ({
@ -34,11 +37,12 @@ export const HelpIcon = ({
htmlTooltip, htmlTooltip,
placement, placement,
children, children,
size,
}: IHelpIconProps) => { }: IHelpIconProps) => {
if (htmlTooltip) { if (htmlTooltip) {
return ( return (
<HtmlTooltip title={tooltip} placement={placement} arrow> <HtmlTooltip title={tooltip} placement={placement} arrow>
<StyledContainer tabIndex={0} aria-label='Help'> <StyledContainer size={size} tabIndex={0} aria-label='Help'>
{children ?? <HelpOutline />} {children ?? <HelpOutline />}
</StyledContainer> </StyledContainer>
</HtmlTooltip> </HtmlTooltip>
@ -47,7 +51,7 @@ export const HelpIcon = ({
return ( return (
<Tooltip title={tooltip} placement={placement} arrow> <Tooltip title={tooltip} placement={placement} arrow>
<StyledContainer tabIndex={0} aria-label='Help'> <StyledContainer size={size} tabIndex={0} aria-label='Help'>
{children ?? <HelpOutline />} {children ?? <HelpOutline />}
</StyledContainer> </StyledContainer>
</Tooltip> </Tooltip>