-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1000 from yaacov/plan-vms-tab
🐾 Plan details page vms tab
- Loading branch information
Showing
60 changed files
with
1,738 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
Table as PfTable, | ||
TableComposable as PfTableComposable, | ||
Tbody as PfTbody, | ||
Td as PfTd, | ||
Th as PfTh, | ||
Thead as PfThead, | ||
Tr as PfTr, | ||
} from '@patternfly/react-table'; | ||
|
||
/* | ||
* This wrappers workaround a bug in @patternfly/react-table types, | ||
* they can be safely removed once this but is fixed. | ||
*/ | ||
|
||
type PfTableComposableProps = React.ComponentProps<typeof PfTableComposable>; | ||
type TableComposableProps = Omit< | ||
PfTableComposableProps, | ||
'onPointerEnterCapture' | 'onPointerLeaveCapture' | ||
> & { | ||
onPointerEnterCapture?: PfTableComposableProps['onPointerEnterCapture']; | ||
onPointerLeaveCapture?: PfTableComposableProps['onPointerLeaveCapture']; | ||
}; | ||
|
||
type PfTdProps = React.ComponentProps<typeof PfTd>; | ||
type TdProps = Omit<PfTdProps, 'onPointerEnterCapture' | 'onPointerLeaveCapture'> & { | ||
onPointerEnterCapture?: PfTdProps['onPointerEnterCapture']; | ||
onPointerLeaveCapture?: PfTdProps['onPointerLeaveCapture']; | ||
}; | ||
|
||
type PfThProps = React.ComponentProps<typeof PfTh>; | ||
type ThProps = Omit<PfThProps, 'onPointerEnterCapture' | 'onPointerLeaveCapture'> & { | ||
onPointerEnterCapture?: PfThProps['onPointerEnterCapture']; | ||
onPointerLeaveCapture?: PfThProps['onPointerLeaveCapture']; | ||
}; | ||
|
||
type PfTrProps = React.ComponentProps<typeof PfTr>; | ||
type TrProps = Omit<PfTrProps, 'onPointerEnterCapture' | 'onPointerLeaveCapture'> & { | ||
onPointerEnterCapture?: PfTrProps['onPointerEnterCapture']; | ||
onPointerLeaveCapture?: PfTrProps['onPointerLeaveCapture']; | ||
}; | ||
|
||
type PfTheadProps = React.ComponentProps<typeof PfThead>; | ||
type TheadProps = Omit<PfTheadProps, 'onPointerEnterCapture' | 'onPointerLeaveCapture'> & { | ||
onPointerEnterCapture?: PfTheadProps['onPointerEnterCapture']; | ||
onPointerLeaveCapture?: PfTheadProps['onPointerLeaveCapture']; | ||
}; | ||
|
||
type PfTbodyProps = React.ComponentProps<typeof PfTbody>; | ||
type TbodyProps = Omit<PfTbodyProps, 'onPointerEnterCapture' | 'onPointerLeaveCapture'> & { | ||
onPointerEnterCapture?: PfTbodyProps['onPointerEnterCapture']; | ||
onPointerLeaveCapture?: PfTbodyProps['onPointerLeaveCapture']; | ||
}; | ||
|
||
type PfTableProps = React.ComponentProps<typeof PfTable>; | ||
type TableProps = Omit<PfTableProps, 'onPointerEnterCapture' | 'onPointerLeaveCapture'>; | ||
|
||
export const Td: React.FC<TdProps> = (props) => ( | ||
<PfTd | ||
{...props} | ||
onPointerEnterCapture={props?.onPointerEnterCapture} | ||
onPointerLeaveCapture={props.onPointerLeaveCapture} | ||
/> | ||
); | ||
|
||
export const Tr: React.FC<TrProps> = (props) => ( | ||
<PfTr | ||
{...props} | ||
onPointerEnterCapture={props?.onPointerEnterCapture} | ||
onPointerLeaveCapture={props.onPointerLeaveCapture} | ||
/> | ||
); | ||
|
||
export const Th: React.FC<ThProps> = (props) => ( | ||
<PfTh | ||
{...props} | ||
onPointerEnterCapture={props?.onPointerEnterCapture} | ||
onPointerLeaveCapture={props.onPointerLeaveCapture} | ||
/> | ||
); | ||
|
||
export const Thead: React.FC<TheadProps> = (props) => ( | ||
<PfThead | ||
{...props} | ||
onPointerEnterCapture={props?.onPointerEnterCapture} | ||
onPointerLeaveCapture={props.onPointerLeaveCapture} | ||
/> | ||
); | ||
|
||
export const Tbody: React.FC<TbodyProps> = (props) => ( | ||
<PfTbody | ||
{...props} | ||
onPointerEnterCapture={props?.onPointerEnterCapture} | ||
onPointerLeaveCapture={props.onPointerLeaveCapture} | ||
/> | ||
); | ||
|
||
export const TableComposable: React.FC<TableComposableProps> = (props) => ( | ||
<PfTableComposable | ||
{...props} | ||
onPointerEnterCapture={props?.onPointerEnterCapture} | ||
onPointerLeaveCapture={props.onPointerLeaveCapture} | ||
/> | ||
); | ||
|
||
export const Table: React.FC<TableProps> = (props) => <PfTable {...props} />; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,51 @@ | ||
import React from 'react'; | ||
|
||
import { Tr } from '@patternfly/react-table'; | ||
import { ExpandableRowContent, Td, Tr } from '@patternfly/react-table'; | ||
|
||
import { RowProps } from './types'; | ||
|
||
export function withTr<T>(Component: React.FC<RowProps<T>>) { | ||
const Enhanced = (props: RowProps<T>) => ( | ||
<Tr> | ||
<Component {...props} /> | ||
</Tr> | ||
); | ||
export function withTr<T>( | ||
Component: React.FC<RowProps<T>>, | ||
ExpandedComponent?: React.FC<RowProps<T>>, | ||
) { | ||
const Enhanced = (props: RowProps<T>) => { | ||
const { isExpanded, length } = props; | ||
|
||
if (ExpandedComponent) { | ||
return ( | ||
<> | ||
<Tr onPointerEnterCapture={undefined} onPointerLeaveCapture={undefined}> | ||
<Component {...props} /> | ||
</Tr> | ||
<Tr | ||
isExpanded={isExpanded} | ||
onPointerEnterCapture={undefined} | ||
onPointerLeaveCapture={undefined} | ||
> | ||
<Td onPointerEnterCapture={undefined} onPointerLeaveCapture={undefined} /> | ||
<Td | ||
noPadding | ||
colSpan={length} | ||
onPointerEnterCapture={undefined} | ||
onPointerLeaveCapture={undefined} | ||
> | ||
{isExpanded && ( | ||
<ExpandableRowContent> | ||
<ExpandedComponent {...props} /> | ||
</ExpandableRowContent> | ||
)} | ||
</Td> | ||
</Tr> | ||
</> | ||
); | ||
} | ||
|
||
return ( | ||
<Tr onPointerEnterCapture={undefined} onPointerLeaveCapture={undefined}> | ||
<Component {...props} /> | ||
</Tr> | ||
); | ||
}; | ||
Enhanced.displayName = `${Component.displayName || 'Component'}WithTr`; | ||
return Enhanced; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.