-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add cache icons for cached tasks in graph view #400
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ const useStyles = makeStyles((theme: Theme) => { | |
position: 'relative', | ||
}, | ||
detailsContainer: { | ||
alignItems: 'center', | ||
alignItems: 'start', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||
display: 'flex', | ||
flex: '0 1 auto', | ||
paddingTop: theme.spacing(3), | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ import * as React from 'react'; | |
import { useState, useEffect } from 'react'; | ||
import { Handle, Position } from 'react-flow-renderer'; | ||
import { dTypes } from 'models/Graph/types'; | ||
import CachedOutlined from '@material-ui/icons/CachedOutlined'; | ||
import { CatalogCacheStatus } from 'models/Execution/enums'; | ||
import { PublishedWithChangesOutlined } from 'components/common/PublishedWithChanges'; | ||
import { | ||
COLOR_TASK_TYPE, | ||
COLOR_GRAPH_BACKGROUND, | ||
|
@@ -226,6 +229,12 @@ export const ReactFlowCustomTaskNode = ({ data }: any) => { | |
padding: '.1rem .2rem', | ||
fontSize: '.3rem', | ||
}; | ||
const cacheIconStyles: React.CSSProperties = { | ||
width: '8px', | ||
height: '8px', | ||
marginLeft: '4px', | ||
color: COLOR_GRAPH_BACKGROUND, | ||
}; | ||
|
||
const handleClick = (_e) => { | ||
setSelectedNode(true); | ||
|
@@ -238,10 +247,24 @@ export const ReactFlowCustomTaskNode = ({ data }: any) => { | |
</div> | ||
); | ||
}; | ||
|
||
const renderCacheIcon = (cacheStatus) => { | ||
if (cacheStatus === CatalogCacheStatus.CACHE_HIT) { | ||
return <CachedOutlined style={cacheIconStyles} />; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: switch could be a better choice from readability perspective There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rewrote it in switch this morning, but then decided to use ifs 😆 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated! |
||
} | ||
if (cacheStatus === CatalogCacheStatus.CACHE_POPULATED) { | ||
return <PublishedWithChangesOutlined style={cacheIconStyles} />; | ||
} | ||
return null; | ||
}; | ||
|
||
return ( | ||
<div onClick={handleClick}> | ||
{data.taskType ? renderTaskType() : null} | ||
<div style={styles}>{data.text}</div> | ||
<div style={styles}> | ||
{data.text} | ||
{renderCacheIcon(data.cacheStatus)} | ||
</div> | ||
{renderDefaultHandles( | ||
data.scopedId, | ||
getGraphHandleStyle('source'), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 👍