mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53:33 -06:00
Users: OSS not using Orgs for users table showing (#80719)
* fix: for removing column * linting
This commit is contained in:
parent
59d997e5a5
commit
ef0dfff756
@ -1,4 +1,5 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { UseTableRowProps } from 'react-table';
|
||||
|
||||
import {
|
||||
Avatar,
|
||||
@ -38,6 +39,7 @@ export const UsersTable = ({
|
||||
fetchData,
|
||||
}: UsersTableProps) => {
|
||||
const showLicensedRole = useMemo(() => users.some((user) => user.licensedRole), [users]);
|
||||
const showBelongsTo = useMemo(() => users.some((user) => user.orgs), [users]);
|
||||
const columns: Array<Column<UserDTO>> = useMemo(
|
||||
() => [
|
||||
{
|
||||
@ -63,6 +65,8 @@ export const UsersTable = ({
|
||||
cell: ({ cell: { value } }: Cell<'name'>) => value,
|
||||
sortType: 'string',
|
||||
},
|
||||
...(showBelongsTo
|
||||
? [
|
||||
{
|
||||
id: 'orgs',
|
||||
header: 'Belongs to',
|
||||
@ -78,8 +82,11 @@ export const UsersTable = ({
|
||||
</Stack>
|
||||
);
|
||||
},
|
||||
sortType: (a, b) => (a.original.orgs?.length || 0) - (b.original.orgs?.length || 0),
|
||||
sortType: (a: UseTableRowProps<UserDTO>, b: UseTableRowProps<UserDTO>) =>
|
||||
(a.original.orgs?.length || 0) - (b.original.orgs?.length || 0),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(showLicensedRole
|
||||
? [
|
||||
{
|
||||
@ -140,7 +147,7 @@ export const UsersTable = ({
|
||||
},
|
||||
},
|
||||
],
|
||||
[showLicensedRole]
|
||||
[showLicensedRole, showBelongsTo]
|
||||
);
|
||||
return (
|
||||
<Stack direction={'column'} gap={2}>
|
||||
|
Loading…
Reference in New Issue
Block a user