1
0
Fork 0
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:
Marcelo Rydel 2022-02-14 11:44:55 -03:00 committed by GitHub
parent 37ca62eb06
commit 2bffba7371
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 16 deletions

View file

@ -0,0 +1,9 @@
.expand-button {
background: none;
color: inherit;
border: none;
padding: 0;
font: inherit;
cursor: pointer;
outline: inherit;
}

View file

@ -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) {