upgrade some badge components to match EE (#10451)

pull/10464/head
Matt Hook 2023-10-13 03:10:16 +13:00 committed by GitHub
parent 57c45838d5
commit 7c4c985247
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 21 deletions

View File

@ -63,15 +63,15 @@ function Cell({ row }: CellContext<ConfigMapRowData, string>) {
</Link> </Link>
{isSystemConfigMap && ( {isSystemConfigMap && (
<Badge type="success" className="ml-2"> <Badge type="success" className="ml-2">
system System
</Badge> </Badge>
)} )}
{!isSystemToken && !hasConfigurationOwner && ( {!isSystemToken && !hasConfigurationOwner && (
<Badge className="ml-2">external</Badge> <Badge className="ml-2">External</Badge>
)} )}
{!row.original.inUse && !isSystemConfigMap && ( {!row.original.inUse && !isSystemConfigMap && (
<Badge type="warn" className="ml-2"> <Badge type="warn" className="ml-2">
unused Unused
</Badge> </Badge>
)} )}
</div> </div>

View File

@ -66,15 +66,15 @@ function Cell({ row }: CellContext<SecretRowData, string>) {
</Link> </Link>
{isSystemSecret && ( {isSystemSecret && (
<Badge type="success" className="ml-2"> <Badge type="success" className="ml-2">
system System
</Badge> </Badge>
)} )}
{!isSystemToken && !hasConfigurationOwner && ( {!isSystemToken && !hasConfigurationOwner && (
<Badge className="ml-2">external</Badge> <Badge className="ml-2">External</Badge>
)} )}
{!row.original.inUse && !isSystemSecret && ( {!row.original.inUse && !isSystemSecret && (
<Badge type="warn" className="ml-2"> <Badge type="warn" className="ml-2">
unused Unused
</Badge> </Badge>
)} )}
</div> </div>

View File

@ -22,7 +22,7 @@ function Cell({ row, getValue }: CellContext<Ingress, string>) {
const isSystemIngress = isSystemNamespace(namespace); const isSystemIngress = isSystemNamespace(namespace);
return ( return (
<div className="flex whitespace-nowrap"> <div className="flex flex-nowrap whitespace-nowrap">
<Authorized authorizations="K8sIngressesW" childrenUnauthorized={name}> <Authorized authorizations="K8sIngressesW" childrenUnauthorized={name}>
<Link <Link
to="kubernetes.ingresses.edit" to="kubernetes.ingresses.edit"
@ -38,7 +38,7 @@ function Cell({ row, getValue }: CellContext<Ingress, string>) {
</Authorized> </Authorized>
{isSystemIngress && ( {isSystemIngress && (
<Badge type="success" className="ml-2"> <Badge type="success" className="ml-2">
system System
</Badge> </Badge>
)} )}
</div> </div>

View File

@ -1,6 +1,8 @@
import { Authorized } from '@/react/hooks/useUser'; import { Authorized } from '@/react/hooks/useUser';
import { isSystemNamespace } from '@/react/kubernetes/namespaces/utils'; import { isSystemNamespace } from '@/react/kubernetes/namespaces/utils';
import { Badge } from '@@/Badge';
import { columnHelper } from './helper'; import { columnHelper } from './helper';
export const name = columnHelper.accessor( export const name = columnHelper.accessor(
@ -32,21 +34,21 @@ export const name = columnHelper.accessor(
!row.original.Labels['io.portainer.kubernetes.application.owner']; !row.original.Labels['io.portainer.kubernetes.application.owner'];
return ( return (
<Authorized authorizations="K8sServiceW" childrenUnauthorized={name}> <div className="flex">
{name} <Authorized authorizations="K8sServiceW" childrenUnauthorized={name}>
{name}
{isSystem && ( {isSystem && (
<span className="label label-info image-tag label-margins"> <Badge type="success" className="ml-2">
system System
</span> </Badge>
)} )}
{isExternal && !isSystem && ( {isExternal && !isSystem && (
<span className="label label-primary image-tag label-margins"> <Badge className="ml-2">External</Badge>
external )}
</span> </Authorized>
)} </div>
</Authorized>
); );
}, },
} }