mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
feat(system): path to upgrade standalone to BE [EE-4071] (#8095)
This commit is contained in:
parent
756ac034ec
commit
5cbf52377d
73 changed files with 1374 additions and 421 deletions
24
app/react/hooks/withHideOnExtension.tsx
Normal file
24
app/react/hooks/withHideOnExtension.tsx
Normal file
|
@ -0,0 +1,24 @@
|
|||
import { ComponentType } from 'react';
|
||||
|
||||
/**
|
||||
* Hides the wrapped component if portainer is running as a docker extension.
|
||||
*/
|
||||
export function withHideOnExtension<T>(
|
||||
WrappedComponent: ComponentType<T>
|
||||
): ComponentType<T> {
|
||||
// Try to create a nice displayName for React Dev Tools.
|
||||
const displayName =
|
||||
WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
||||
|
||||
function WrapperComponent(props: T) {
|
||||
if (window.ddExtension) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <WrappedComponent {...props} />;
|
||||
}
|
||||
|
||||
WrapperComponent.displayName = `withHideOnExtension(${displayName})`;
|
||||
|
||||
return WrapperComponent;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue