-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): Helm/Container/Git Repository is shown in DAG (#735)
Signed-off-by: Rafal Pelczar <rafal@akuity.io>
- Loading branch information
Showing
9 changed files
with
293 additions
and
146 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
ui/src/features/project/project-details/nodes/repo-node.module.less
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,31 @@ | ||
.node { | ||
background-color: #ddd; | ||
border-radius: 10px; | ||
display: flex; | ||
flex-direction: column; | ||
padding: 2px; | ||
|
||
h3 { | ||
padding: 0.4em 0.5em; | ||
color: #333; | ||
font-size: 15px; | ||
font-weight: 600; | ||
margin-left: 0.25em; | ||
margin-bottom: 0; | ||
} | ||
} | ||
|
||
.body { | ||
background-color: white; | ||
border-bottom-left-radius: 10px; | ||
border-bottom-right-radius: 10px; | ||
padding: 8px; | ||
font-size: 12px; | ||
flex: 1; | ||
} | ||
|
||
.value { | ||
margin-top: 3px; | ||
color: #777; | ||
font-size: 11px; | ||
} |
54 changes: 54 additions & 0 deletions
54
ui/src/features/project/project-details/nodes/repo-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,54 @@ | ||
import { faDocker, faGit } from '@fortawesome/free-brands-svg-icons'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { Tooltip } from 'antd'; | ||
|
||
import { NodeType, NodesRepoType } from '../types'; | ||
|
||
import * as styles from './repo-node.module.less'; | ||
|
||
const MAX_CHARS = 19; | ||
|
||
type Props = { | ||
nodeData: NodesRepoType; | ||
height: number; | ||
}; | ||
|
||
const name = { | ||
[NodeType.REPO_IMAGE]: 'Image', | ||
[NodeType.REPO_GIT]: 'Git', | ||
[NodeType.REPO_CHART]: 'Chart' | ||
}; | ||
|
||
const ico = { | ||
[NodeType.REPO_IMAGE]: faDocker, | ||
[NodeType.REPO_GIT]: faGit | ||
}; | ||
|
||
export const RepoNode = ({ nodeData, height }: Props) => ( | ||
<div style={{ height }} className={styles.node}> | ||
<h3 className='flex justify-between'> | ||
<span>{name[nodeData.type]}</span> | ||
{nodeData.type !== NodeType.REPO_CHART && <FontAwesomeIcon icon={ico[nodeData.type]} />} | ||
</h3> | ||
<div className={styles.body}> | ||
{(nodeData.type === NodeType.REPO_IMAGE || nodeData.type === NodeType.REPO_GIT) && ( | ||
<RepoNodeBody label='Repo URL' value={nodeData.data.repoUrl} /> | ||
)} | ||
{nodeData.type === NodeType.REPO_CHART && ( | ||
<RepoNodeBody label='Registry URL' value={nodeData.data.registryUrl} /> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
|
||
const RepoNodeBody = ({ label, value }: { label: string; value: string }) => ( | ||
<> | ||
<div className={styles.label}>{label}</div> | ||
<Tooltip title={value}> | ||
<div className={styles.value}> | ||
{value.length > MAX_CHARS && '...'} | ||
{value.substring(value.length - MAX_CHARS)} | ||
</div> | ||
</Tooltip> | ||
</> | ||
); |
File renamed without changes.
85 changes: 85 additions & 0 deletions
85
ui/src/features/project/project-details/nodes/stage-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,85 @@ | ||
import { faGear } from '@fortawesome/free-solid-svg-icons'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { Space, Tooltip } from 'antd'; | ||
import { generatePath, useNavigate } from 'react-router-dom'; | ||
|
||
import { paths } from '@ui/config/paths'; | ||
import { HealthStatusIcon } from '@ui/features/common/health-status/health-status-icon'; | ||
import { Stage } from '@ui/gen/v1alpha1/types_pb'; | ||
|
||
import * as styles from './stage-node.module.less'; | ||
|
||
export const StageNode = ({ | ||
stage, | ||
color, | ||
height, | ||
projectName, | ||
onPromoteSubscribersClick | ||
}: { | ||
stage: Stage; | ||
color: string; | ||
height: number; | ||
projectName?: string; | ||
onPromoteSubscribersClick: () => void; | ||
}) => { | ||
const navigate = useNavigate(); | ||
return ( | ||
<div | ||
className={styles.node} | ||
style={{ backgroundColor: color, position: 'relative', cursor: 'pointer' }} | ||
onClick={() => | ||
navigate(generatePath(paths.stage, { name: projectName, stageName: stage.metadata?.name })) | ||
} | ||
> | ||
<h3 className='flex items-center text-white'> | ||
<div>{stage.metadata?.name}</div> | ||
<Space className='absolute right-1'> | ||
{stage.status?.currentPromotion && ( | ||
<Tooltip | ||
title={`Freight ${stage.status?.currentPromotion.freight?.id} is being promoted`} | ||
> | ||
<FontAwesomeIcon icon={faGear} spin={true} /> | ||
</Tooltip> | ||
)} | ||
{stage.status?.health && ( | ||
<HealthStatusIcon | ||
health={stage.status?.health} | ||
style={{ marginLeft: 'auto', fontSize: '14px' }} | ||
hideColor={true} | ||
/> | ||
)} | ||
</Space> | ||
</h3> | ||
<div className={styles.body}> | ||
<h3>Current Freight</h3> | ||
<p className='font-mono text-sm font-semibold'> | ||
{stage.status?.currentFreight?.id?.slice(0, 7) || 'N/A'}{' '} | ||
</p> | ||
</div> | ||
<Nodule nodeHeight={height} onClick={onPromoteSubscribersClick} /> | ||
</div> | ||
); | ||
}; | ||
|
||
const Nodule = (props: { begin?: boolean; nodeHeight: number; onClick?: () => void }) => { | ||
const noduleHeight = 16; | ||
const top = props.nodeHeight / 2 - noduleHeight / 2; | ||
return ( | ||
<div | ||
onClick={(e) => { | ||
e.stopPropagation(); | ||
if (props.onClick) { | ||
props.onClick(); | ||
} | ||
}} | ||
style={{ | ||
top: top, | ||
height: noduleHeight, | ||
width: noduleHeight | ||
}} | ||
className={`z-10 bg-gray-400 hover:bg-blue-400 absolute ${ | ||
props.begin ? '-left-2' : '-right-2' | ||
} rounded-md`} | ||
/> | ||
); | ||
}; |
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
9 changes: 0 additions & 9 deletions
9
ui/src/features/project/project-details/stage-item.module.less
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.