-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add resources graph into overview page (#63)
Jira: EPMDEDP-12704 Related: #63 Change-Id: I8a9f2db0aea41dca35751ebba759b7b5de7ea857
- Loading branch information
1 parent
f735b0b
commit 4d0f0c9
Showing
17 changed files
with
535 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Icon } from '@iconify/react'; | ||
import { Tooltip } from '@material-ui/core'; | ||
import clsx from 'clsx'; | ||
import React from 'react'; | ||
import { useStyles } from './styles'; | ||
import { StatusIconProps } from './types'; | ||
|
||
const stopPropagation = (e: React.SyntheticEvent) => e.stopPropagation(); | ||
|
||
export const NewStatusIcon = ({ | ||
Title, | ||
icon, | ||
color, | ||
isRotating = false, | ||
width = 25, | ||
}: StatusIconProps) => { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions | ||
<div onClick={stopPropagation}> | ||
<Tooltip title={Title} interactive> | ||
<Icon | ||
icon={icon} | ||
color={color} | ||
width={width} | ||
className={clsx(classes.icon, { | ||
[classes.rotateIcon]: isRotating, | ||
})} | ||
/> | ||
</Tooltip> | ||
</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,20 @@ | ||
import { makeStyles } from '@material-ui/core'; | ||
|
||
export const useStyles = makeStyles(() => ({ | ||
icon: { | ||
willChange: 'transform', | ||
display: 'block', | ||
lineHeight: 0, | ||
}, | ||
rotateIcon: { | ||
animation: '$spin 2s linear infinite', | ||
}, | ||
'@keyframes spin': { | ||
'0%': { | ||
transform: 'rotate(360deg)', | ||
}, | ||
'100%': { | ||
transform: 'rotate(0deg)', | ||
}, | ||
}, | ||
})); |
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,9 @@ | ||
import React from 'react'; | ||
|
||
export interface StatusIconProps { | ||
Title: string | React.ReactElement; | ||
icon: string; | ||
color: string; | ||
isRotating?: boolean; | ||
width?: number; | ||
} |
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,33 @@ | ||
import { SelectOption } from '../../types/forms'; | ||
|
||
export const PIPELINE_RUN_REASON = { | ||
STARTED: 'Started', | ||
RUNNING: 'Running', | ||
CANCELLED: 'Cancelled', | ||
SUCCEEDED: 'Succeeded', | ||
COMPLETED: 'Completed', | ||
FAILED: 'Failed', | ||
PIPELINE_RUN_TIMEOUT: 'PipelineRunTimeout', | ||
CREATE_RUN_FAILED: 'CreateRunFailed', | ||
} as const; | ||
|
||
export const PIPELINE_RUN_STATUS = { | ||
TRUE: 'True', | ||
FALSE: 'False', | ||
UNKNOWN: 'Unknown', | ||
} as const; | ||
|
||
export const PIPELINE_RUN_STATUS_SELECT_OPTIONS: SelectOption[] = [ | ||
{ | ||
label: 'Success', | ||
value: PIPELINE_RUN_STATUS.TRUE, | ||
}, | ||
{ | ||
label: 'Failure', | ||
value: PIPELINE_RUN_STATUS.FALSE, | ||
}, | ||
{ | ||
label: PIPELINE_RUN_STATUS.UNKNOWN, | ||
value: PIPELINE_RUN_STATUS.UNKNOWN, | ||
}, | ||
]; |
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,27 @@ | ||
import { ICONS } from '../../../../icons/iconify-icons-mapping'; | ||
import { STATUSES_COLORS } from '../../../../utils/styling/getCustomResourceStatusIconByStatusName'; | ||
import { PIPELINE_RUN_REASON, PIPELINE_RUN_STATUS } from '../../constants'; | ||
|
||
export const getStatusIcon = (status: string, reason: string): [string, string, boolean?] => { | ||
switch (status) { | ||
case PIPELINE_RUN_STATUS.UNKNOWN: | ||
if (reason === PIPELINE_RUN_REASON.STARTED) { | ||
return [ICONS.LOADER_CIRCLE, STATUSES_COLORS.IN_PROGRESS, true]; | ||
} | ||
|
||
if (reason === PIPELINE_RUN_REASON.RUNNING) { | ||
return [ICONS.LOADER_CIRCLE, STATUSES_COLORS.IN_PROGRESS, true]; | ||
} | ||
|
||
if (reason === PIPELINE_RUN_REASON.CANCELLED) { | ||
return [ICONS.CROSS_CIRCLE, STATUSES_COLORS.ERROR]; | ||
} | ||
break; | ||
case PIPELINE_RUN_STATUS.TRUE: | ||
return [ICONS.CHECK_CIRCLE, STATUSES_COLORS.SUCCESS]; | ||
case PIPELINE_RUN_STATUS.FALSE: | ||
return [ICONS.CROSS_CIRCLE, STATUSES_COLORS.ERROR]; | ||
default: | ||
return [ICONS.UNKNOWN, STATUSES_COLORS.UNKNOWN]; | ||
} | ||
}; |
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
Oops, something went wrong.