Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://linear.app/unleash/issue/2-543/show-relevant-information-on-the-service-accounts-table Shows relevant information on the table, like total PATs and the last time a service account was active based on latest seen PAT for that account. Adapts to the latest related PR on enterprise. ![image](https://user-images.githubusercontent.com/14320932/211312719-c4ed940a-723b-4b2e-a79e-8e7cdbda7c58.png)
- Loading branch information
Showing
10 changed files
with
155 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...erviceAccounts/ServiceAccountsTable/ServiceAccountTokensCell/ServiceAccountTokensCell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { VFC } from 'react'; | ||
import { Link, styled, Typography } from '@mui/material'; | ||
import { TextCell } from 'component/common/Table/cells/TextCell/TextCell'; | ||
import { HtmlTooltip } from 'component/common/HtmlTooltip/HtmlTooltip'; | ||
import { Highlighter } from 'component/common/Highlighter/Highlighter'; | ||
import { useSearchHighlightContext } from 'component/common/Table/SearchHighlightContext/SearchHighlightContext'; | ||
import { IServiceAccount } from 'interfaces/service-account'; | ||
|
||
const StyledItem = styled(Typography)(({ theme }) => ({ | ||
fontSize: theme.fontSizes.smallerBody, | ||
})); | ||
|
||
const StyledLink = styled(Link, { | ||
shouldForwardProp: prop => prop !== 'highlighted', | ||
})<{ highlighted?: boolean }>(({ theme, highlighted }) => ({ | ||
backgroundColor: highlighted ? theme.palette.highlight : 'transparent', | ||
})); | ||
|
||
interface IServiceAccountTokensCellProps { | ||
row: { | ||
original: IServiceAccount; | ||
}; | ||
value: string; | ||
} | ||
|
||
export const ServiceAccountTokensCell: VFC<IServiceAccountTokensCellProps> = ({ | ||
row, | ||
value, | ||
}) => { | ||
const { searchQuery } = useSearchHighlightContext(); | ||
|
||
if (!row.original.tokens || row.original.tokens.length === 0) | ||
return <TextCell />; | ||
|
||
return ( | ||
<TextCell> | ||
<HtmlTooltip | ||
title={ | ||
<> | ||
{row.original.tokens?.map(({ id, description }) => ( | ||
<StyledItem key={id}> | ||
<Highlighter search={searchQuery}> | ||
{description} | ||
</Highlighter> | ||
</StyledItem> | ||
))} | ||
</> | ||
} | ||
> | ||
<StyledLink | ||
underline="always" | ||
highlighted={ | ||
searchQuery.length > 0 && | ||
value.toLowerCase().includes(searchQuery.toLowerCase()) | ||
} | ||
> | ||
{row.original.tokens?.length === 1 | ||
? '1 token' | ||
: `${row.original.tokens?.length} tokens`} | ||
</StyledLink> | ||
</HtmlTooltip> | ||
</TextCell> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.