-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the component and utility for helm release group
initial implementation initial implementation remove styles for selected and fine tune
- Loading branch information
Showing
6 changed files
with
129 additions
and
6 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
11 changes: 11 additions & 0 deletions
11
frontend/packages/dev-console/src/components/topology/components/groups/HelmRelease.scss
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,11 @@ | ||
.odc-helm-release { | ||
fill: #e2e2e2; | ||
stroke: #bbbbbb; | ||
stroke-width: 4px; | ||
stroke-dasharray: 9; | ||
cursor: pointer; | ||
|
||
&__label { | ||
cursor: pointer; | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
frontend/packages/dev-console/src/components/topology/components/groups/HelmRelease.tsx
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,63 @@ | ||
import * as React from 'react'; | ||
import { | ||
WithSelectionProps, | ||
Layer, | ||
useHover, | ||
Node, | ||
createSvgIdUrl, | ||
useDragNode, | ||
observer, | ||
useCombineRefs, | ||
} from '@console/topology'; | ||
import NodeShadows, { NODE_SHADOW_FILTER_ID_HOVER, NODE_SHADOW_FILTER_ID } from '../NodeShadows'; | ||
import SvgBoxedText from '../../../svg/SvgBoxedText'; | ||
import './HelmRelease.scss'; | ||
|
||
export type HelmReleaseProps = { | ||
element: Node; | ||
dragging: boolean; | ||
} & WithSelectionProps; | ||
|
||
const HelmRelease: React.FC<HelmReleaseProps> = ({ element, dragging }) => { | ||
const [hover, hoverRef] = useHover(); | ||
const { x, y, width, height } = element.getBounds(); | ||
const dragNodeRef = useDragNode()[1]; | ||
const dragLabelRef = useDragNode()[1]; | ||
const refs = useCombineRefs(dragNodeRef, hoverRef); | ||
return ( | ||
<g> | ||
<NodeShadows /> | ||
<Layer id={dragging ? undefined : 'groups'}> | ||
<rect | ||
ref={refs} | ||
className="odc-helm-release" | ||
x={x} | ||
y={y} | ||
width={width} | ||
height={height} | ||
rx="5" | ||
ry="5" | ||
filter={createSvgIdUrl( | ||
hover || dragging ? NODE_SHADOW_FILTER_ID_HOVER : NODE_SHADOW_FILTER_ID, | ||
)} | ||
/> | ||
</Layer> | ||
{element.getLabel() && ( | ||
<SvgBoxedText | ||
className="odc-helm-release__label odc-base-node__label" | ||
x={x + width / 2} | ||
y={y + height + 20} | ||
paddingX={8} | ||
paddingY={4} | ||
kind="HelmRelease" | ||
truncate={16} | ||
dragRef={dragLabelRef} | ||
> | ||
{element.getLabel()} | ||
</SvgBoxedText> | ||
)} | ||
</g> | ||
); | ||
}; | ||
|
||
export default observer(HelmRelease); |
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