mirror of
https://github.com/portainer/portainer.git
synced 2025-08-09 07:45:22 +02:00
fix(edge): only show expand row for Edge Devices with AMT activated [EE-2489] (#6519)
This commit is contained in:
parent
37ca62eb06
commit
2bffba7371
5 changed files with 46 additions and 16 deletions
|
@ -0,0 +1,9 @@
|
|||
.expand-button {
|
||||
background: none;
|
||||
color: inherit;
|
||||
border: none;
|
||||
padding: 0;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
outline: inherit;
|
||||
}
|
|
@ -1,20 +1,30 @@
|
|||
import { PropsWithChildren } from 'react';
|
||||
import { Row, TableInstance } from 'react-table';
|
||||
import { Row } from 'react-table';
|
||||
|
||||
interface Props {
|
||||
row: Row<TableInstance>;
|
||||
import styles from './ExpandingCell.module.css';
|
||||
|
||||
interface Props<D extends Record<string, unknown> = Record<string, unknown>> {
|
||||
row: Row<D>;
|
||||
showExpandArrow: boolean;
|
||||
}
|
||||
|
||||
export function ExpandingCell({ children, row }: PropsWithChildren<Props>) {
|
||||
export function ExpandingCell<
|
||||
D extends Record<string, unknown> = Record<string, unknown>
|
||||
>({ row, showExpandArrow, children }: PropsWithChildren<Props<D>>) {
|
||||
return (
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
<div {...row.getToggleRowExpandedProps()}>
|
||||
<i
|
||||
className={`fas ${arrowClass(row.isExpanded)} space-right`}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<>
|
||||
{showExpandArrow && (
|
||||
<button type="button" className={styles.expandButton}>
|
||||
<i
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
{...row.getToggleRowExpandedProps()}
|
||||
className={`fas ${arrowClass(row.isExpanded)} space-right`}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</button>
|
||||
)}
|
||||
{children}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
function arrowClass(isExpanded: boolean) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue