mirror of https://github.com/portainer/portainer
fix(edge/updates): allow group search [EE-6179] (#10408)
parent
5a73605df2
commit
57c45838d5
@ -1,27 +1,18 @@
|
|||||||
import _ from 'lodash';
|
|
||||||
import { CellContext } from '@tanstack/react-table';
|
import { CellContext } from '@tanstack/react-table';
|
||||||
|
|
||||||
import { EdgeGroup } from '@/react/edge/edge-groups/types';
|
import { DecoratedItem } from '../types';
|
||||||
import { useEdgeGroups } from '@/react/edge/edge-groups/queries/useEdgeGroups';
|
|
||||||
|
|
||||||
import { EdgeUpdateListItemResponse } from '../../queries/list';
|
|
||||||
|
|
||||||
import { columnHelper } from './helper';
|
import { columnHelper } from './helper';
|
||||||
|
|
||||||
export const groups = columnHelper.accessor('edgeGroupIds', {
|
export const groups = columnHelper.accessor('edgeGroupNames', {
|
||||||
header: 'Groups',
|
header: 'Edge Groups',
|
||||||
cell: GroupsCell,
|
cell: GroupsCell,
|
||||||
});
|
});
|
||||||
|
|
||||||
export function GroupsCell({
|
export function GroupsCell({
|
||||||
getValue,
|
getValue,
|
||||||
}: CellContext<EdgeUpdateListItemResponse, Array<EdgeGroup['Id']>>) {
|
}: CellContext<DecoratedItem, Array<string>>) {
|
||||||
const groupsIds = getValue();
|
const groups = getValue();
|
||||||
const groupsQuery = useEdgeGroups();
|
|
||||||
|
|
||||||
const groups = _.compact(
|
|
||||||
groupsIds.map((id) => groupsQuery.data?.find((g) => g.Id === id))
|
|
||||||
);
|
|
||||||
|
|
||||||
return groups.map((g) => g.Name).join(', ');
|
return groups.join(', ');
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createColumnHelper } from '@tanstack/react-table';
|
import { createColumnHelper } from '@tanstack/react-table';
|
||||||
|
|
||||||
import { EdgeUpdateListItemResponse } from '../../queries/list';
|
import { DecoratedItem } from '../types';
|
||||||
|
|
||||||
export const columnHelper = createColumnHelper<EdgeUpdateListItemResponse>();
|
export const columnHelper = createColumnHelper<DecoratedItem>();
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
import { EdgeUpdateListItemResponse } from '../queries/list';
|
||||||
|
|
||||||
|
export type DecoratedItem = EdgeUpdateListItemResponse & {
|
||||||
|
edgeGroupNames: string[];
|
||||||
|
};
|
Loading…
Reference in new issue