-
Notifications
You must be signed in to change notification settings - Fork 873
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboard): Refresh Rollouts dashboard UI (#2723)
* feat: Refresh Rollouts dashboard Signed-off-by: Remington Breeze <remington@breeze.software> * rearrange individual rollout view Signed-off-by: Remington Breeze <remington@breeze.software> * fix letter L bug Signed-off-by: Remington Breeze <remington@breeze.software> * fix single namespace display Signed-off-by: Remington Breeze <remington@breeze.software> * bug fixes Signed-off-by: Remington Breeze <remington@breeze.software> * remove all dependencies on argo-ui/v2 Signed-off-by: Remington Breeze <remington@breeze.software> * feat: Refresh Rollouts dashboard Signed-off-by: Remington Breeze <remington@breeze.software> * rearrange individual rollout view Signed-off-by: Remington Breeze <remington@breeze.software> * fix letter L bug Signed-off-by: Remington Breeze <remington@breeze.software> * fix single namespace display Signed-off-by: Remington Breeze <remington@breeze.software> * bug fixes Signed-off-by: Remington Breeze <remington@breeze.software> * remove all dependencies on argo-ui/v2 Signed-off-by: Remington Breeze <remington@breeze.software> * fix: make logo image path relative Signed-off-by: Remington Breeze <remington@breeze.software> --------- Signed-off-by: Remington Breeze <remington@breeze.software>
- Loading branch information
Showing
22 changed files
with
1,521 additions
and
596 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
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,72 @@ | ||
import * as React from 'react'; | ||
|
||
import {Button, Popconfirm, Tooltip} from 'antd'; | ||
import {ButtonProps} from 'antd/es/button/button'; | ||
import {useState} from 'react'; | ||
import { TooltipPlacement } from 'antd/es/tooltip'; | ||
|
||
interface ConfirmButtonProps extends ButtonProps { | ||
skipconfirm?: boolean; | ||
tooltip?: string; | ||
placement?: TooltipPlacement; | ||
} | ||
|
||
export const ConfirmButton = (props: ConfirmButtonProps) => { | ||
const [open, setOpen] = useState(false); | ||
const [buttonProps, setButtonProps] = useState(props); | ||
|
||
React.useEffect(() => { | ||
const tmp = {...props}; | ||
delete tmp.skipconfirm; | ||
delete tmp.children; | ||
delete tmp.onClick; | ||
setButtonProps(tmp); | ||
}, [props]); | ||
|
||
const confirm = () => { | ||
setOpen(false); | ||
if (props.onClick) { | ||
props.onClick(null); | ||
} | ||
}; | ||
|
||
const cancel = () => { | ||
setOpen(false); | ||
}; | ||
|
||
const handleOpenChange = (newOpen: boolean) => { | ||
if (!newOpen) { | ||
setOpen(newOpen); | ||
return; | ||
} | ||
if (props.skipconfirm) { | ||
confirm(); // next step | ||
} else { | ||
setOpen(newOpen); | ||
} | ||
}; | ||
|
||
return ( | ||
<div | ||
onClick={(e) => { | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
}}> | ||
<Popconfirm | ||
title='Are you sure?' | ||
open={open && !props.disabled} | ||
onConfirm={confirm} | ||
onCancel={cancel} | ||
okText='Yes' | ||
cancelText='No' | ||
onOpenChange={handleOpenChange} | ||
placement={props.placement || 'bottom'}> | ||
<div> | ||
<Tooltip title={props.tooltip}> | ||
<Button {...buttonProps}>{props.children}</Button> | ||
</Tooltip> | ||
</div> | ||
</Popconfirm> | ||
</div> | ||
); | ||
}; |
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,13 @@ | ||
import * as React from 'react'; | ||
import {Typography} from 'antd'; | ||
|
||
const {Text} = Typography; | ||
export const EllipsisMiddle: React.FC<{suffixCount: number; children: string; style: React.CSSProperties}> = ({suffixCount, children, style}) => { | ||
const start = children.slice(0, children.length - suffixCount).trim(); | ||
const suffix = children.slice(-suffixCount).trim(); | ||
return ( | ||
<Text style={{...style, maxWidth: '100%'}} ellipsis={{suffix}}> | ||
{start} | ||
</Text> | ||
); | ||
}; |
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.