1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-21 06:19:41 +02:00

fix(stacks): conditionally hide node and namespace stacks [EE-6949] (#11527)
Some checks failed
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
ci / build_images (map[arch:arm platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:s390x platform:linux version:]) (push) Has been cancelled
/ triage (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
Test / test-client (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:linux]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
Test / test-server (map[arch:arm64 platform:linux]) (push) Has been cancelled
ci / build_manifests (push) Has been cancelled

Co-authored-by: testa113 <testa113>
This commit is contained in:
Ali 2024-04-19 17:33:22 +12:00 committed by GitHub
parent 7e9dd01265
commit 3ccbd40232
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 74 additions and 49 deletions

View file

@ -1,19 +1,25 @@
import { useMemo } from 'react';
import _ from 'lodash';
import { useMemo } from 'react';
import { humanize, truncate } from '@/portainer/filters/filters';
import { usePublicSettings } from '@/react/portainer/settings/queries';
import { Link } from '@@/Link';
import { helper } from './columns.helper';
import { name } from './columns.name';
export function useColumns(areStacksVisible: boolean) {
export function useColumns() {
const hideStacksQuery = usePublicSettings<boolean>({
select: (settings) =>
settings.GlobalDeploymentOptions.hideStacksFunctionality,
});
return useMemo(
() =>
_.compact([
name,
areStacksVisible &&
!hideStacksQuery.data &&
helper.accessor('StackName', {
header: 'Stack',
cell: ({ getValue }) => getValue() || '-',
@ -53,6 +59,6 @@ export function useColumns(areStacksVisible: boolean) {
cell: ({ getValue }) => humanize(getValue()),
}),
]),
[areStacksVisible]
[hideStacksQuery.data]
);
}