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

fix(container): hide capabilities tab EE-6258 (#10540)

This commit is contained in:
cmeng 2023-10-26 15:44:31 +13:00 committed by GitHub
parent 403fdf7ce3
commit 3964852fda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 58 additions and 34 deletions

View file

@ -7,6 +7,7 @@ export interface Option<T extends string | number = string> {
label: ReactNode;
children?: ReactNode;
id: T;
hidden?: boolean;
}
interface Props<T extends string | number> {
@ -33,31 +34,34 @@ export function NavTabs<T extends string | number = string>({
<ul
className={clsx('nav', `nav-${type}`, { 'nav-justified': justified })}
>
{options.map((option) => (
<li
className={clsx({
active: option.id === selectedId,
[styles.parent]: !option.children,
disabled,
})}
key={option.id}
>
{/* rule disabled because `nav-tabs` requires an anchor */}
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
<a
onClick={() => handleSelect(option)}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
handleSelect(option);
}
}}
role="button"
tabIndex={0}
>
{option.label}
</a>
</li>
))}
{options.map(
(option) =>
!option.hidden && (
<li
className={clsx({
active: option.id === selectedId,
[styles.parent]: !option.children,
disabled,
})}
key={option.id}
>
{/* rule disabled because `nav-tabs` requires an anchor */}
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
<a
onClick={() => handleSelect(option)}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
handleSelect(option);
}
}}
role="button"
tabIndex={0}
>
{option.label}
</a>
</li>
)
)}
</ul>
{selected && selected.children && (
<div className="tab-content mt-3">{selected.children}</div>