Compare commits

...

3 Commits

Author SHA1 Message Date
cheloRydel
cb821e5a3b change TableInstance to Environment 2022-02-03 11:54:32 -03:00
cheloRydel
47dbdcc5ed yarn install 2022-02-03 10:32:12 -03:00
cheloRydel
d115fa5ccd fix(edge): only show expand row for Edge Devices with AMT activated 2022-02-03 10:29:02 -03:00
3 changed files with 24 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
import { CellProps, Column, TableInstance } from 'react-table';
import { CellProps, Column } from 'react-table';
import { Environment } from '@/portainer/environments/types';
import { Link } from '@/portainer/components/Link';
@@ -15,9 +15,12 @@ export const name: Column<Environment> = {
sortType: 'string',
};
export function NameCell({ value: name, row }: CellProps<TableInstance>) {
export function NameCell({ value: name, row }: CellProps<Environment>) {
const showExpandedRow = !!(
row.original.AMTDeviceGUID && row.original.AMTDeviceGUID.length > 0
);
return (
<ExpandingCell row={row}>
<ExpandingCell row={row} showExpandArrow={showExpandedRow}>
<Link
to="portainer.endpoints.endpoint"
params={{ id: row.original.Id }}

View File

@@ -1,20 +1,26 @@
import { PropsWithChildren } from 'react';
import { Row, TableInstance } from 'react-table';
import { Row } from 'react-table';
interface Props {
row: Row<TableInstance>;
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 && (
<i
// eslint-disable-next-line react/jsx-props-no-spreading
{...row.getToggleRowExpandedProps()}
className={`fas ${arrowClass(row.isExpanded)} space-right`}
aria-hidden="true"
/>
)}
{children}
</div>
</>
);
function arrowClass(isExpanded: boolean) {

View File

@@ -12587,7 +12587,7 @@ locate-path@^6.0.0:
dependencies:
p-locate "^5.0.0"
lodash-es@^4.17.15, lodash-es@^4.17.21:
lodash-es@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==