forked from odigos-io/odigos
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #39 from alonkeyval/gen-1449-add-first-action-node
[GEN-1449] feat: add first action node
- Loading branch information
Showing
3 changed files
with
131 additions
and
8 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
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
90 changes: 90 additions & 0 deletions
90
frontend/webapp/reuseable-components/nodes-data-flow/nodes/add-action-node.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,90 @@ | ||
import Image from 'next/image'; | ||
import React, { memo } from 'react'; | ||
import styled from 'styled-components'; | ||
import { Text } from '@/reuseable-components'; | ||
import { Handle, Position } from '@xyflow/react'; | ||
|
||
const BaseNodeContainer = styled.div` | ||
display: flex; | ||
width: 296px; | ||
padding: 16px 24px 16px 16px; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 4px; | ||
align-self: stretch; | ||
cursor: pointer; | ||
background-color: transparent; | ||
border-radius: 16px; | ||
border: 1px dashed ${({ theme }) => theme.colors.border}; | ||
&:hover { | ||
background-color: ${({ theme }) => theme.colors.white_opacity['004']}; | ||
} | ||
`; | ||
|
||
const TitleWrapper = styled.div` | ||
display: flex; | ||
gap: 4px; | ||
align-items: center; | ||
`; | ||
|
||
const Title = styled(Text)` | ||
font-size: 14px; | ||
font-weight: 600; | ||
font-family: ${({ theme }) => theme.font_family.secondary}; | ||
text-decoration-line: underline; | ||
`; | ||
|
||
const SubTitle = styled(Text)` | ||
font-size: 12px; | ||
color: ${({ theme }) => theme.text.grey}; | ||
`; | ||
|
||
export interface NodeDataProps { | ||
type: 'source' | 'action' | 'destination'; | ||
title: string; | ||
subTitle: string; | ||
imageUri: string; | ||
monitors?: string[]; | ||
status: 'healthy' | 'unhealthy'; | ||
onClick: () => void; | ||
} | ||
|
||
interface BaseNodeProps { | ||
data: NodeDataProps; | ||
isConnectable: boolean; | ||
} | ||
|
||
export default memo(({ isConnectable, data }: BaseNodeProps) => { | ||
const { onClick } = data; | ||
|
||
return ( | ||
<BaseNodeContainer onClick={onClick}> | ||
<TitleWrapper> | ||
<Image | ||
src={'/icons/common/plus.svg'} | ||
width={16} | ||
height={16} | ||
alt="plus" | ||
/> | ||
<Title>{'ADD ACTION'}</Title> | ||
</TitleWrapper> | ||
<SubTitle>{'Add first action to modify the OpenTelemetry data'}</SubTitle> | ||
<Handle | ||
type="target" | ||
position={Position.Left} | ||
id="action-input" | ||
isConnectable={isConnectable} | ||
style={{ visibility: 'hidden' }} | ||
/> | ||
<Handle | ||
type="source" | ||
position={Position.Right} | ||
id="action-output" | ||
isConnectable={isConnectable} | ||
style={{ visibility: 'hidden' }} | ||
/> | ||
</BaseNodeContainer> | ||
); | ||
}); |