-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Queries): new progress graph [YTFRONT-4112]
- Loading branch information
1 parent
b0c18e8
commit a445c06
Showing
49 changed files
with
1,668 additions
and
27 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
60 changes: 60 additions & 0 deletions
60
packages/ui/src/ui/pages/query-tracker/Plan/GraphEditor/DetailBlock/DetailBlock.scss
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,60 @@ | ||
.yt-detail-block { | ||
color: #000; | ||
padding: 10px 12px; | ||
min-height: 70px; | ||
min-width: 240px; | ||
box-sizing: border-box; | ||
background: #fff; | ||
border: 1px solid #ccc; | ||
border-radius: 8px; | ||
box-shadow: 0 1px 5px 0 #00000026; | ||
|
||
&__header { | ||
display: flex; | ||
align-items: center; | ||
gap: 0 8px; | ||
font-weight: 500; | ||
} | ||
|
||
&__content { | ||
margin-top: 8px; | ||
} | ||
|
||
&__details { | ||
font-size: 11px; | ||
height: auto; | ||
padding-bottom: 0; | ||
|
||
&_without-padding { | ||
padding-top: 0; | ||
} | ||
|
||
.node-details-info{ | ||
grid-gap: 10px; | ||
} | ||
|
||
.data-table__row { | ||
height: auto; | ||
} | ||
|
||
.g-text_variant_body-1 { | ||
font-size: 11px; | ||
} | ||
} | ||
|
||
.graph-block-wrapper{ | ||
border: none; | ||
} | ||
|
||
.data-table__foot { | ||
background: none; | ||
|
||
td { | ||
background: none; | ||
} | ||
} | ||
|
||
.data-table__head th:before { | ||
display: none; | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
packages/ui/src/ui/pages/query-tracker/Plan/GraphEditor/DetailBlock/DetailBlock.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,62 @@ | ||
import React, {CSSProperties, FC, useMemo} from 'react'; | ||
import './DetailBlock.scss'; | ||
import cn from 'bem-cn-lite'; | ||
import {NodeTBlock} from '../canvas/NodeBlock'; | ||
import {GRAPH_COLORS} from '../constants'; | ||
import OperationNodeInfo from '../../OperationNodeInfo'; | ||
import {hasDetailsInfo, hasJobsInfo, hasStagesInfo} from '../../utils'; | ||
import {DetailBlockHeader} from './DetailBlockHeader'; | ||
|
||
const b = cn('yt-detail-block'); | ||
|
||
type Props = { | ||
block: NodeTBlock; | ||
showHeader?: boolean; | ||
showInfo?: boolean; | ||
className?: string; | ||
}; | ||
|
||
export const DetailBlock: FC<Props> = ({block, showHeader, showInfo, className}) => { | ||
const {meta} = block; | ||
const {nodeProgress, details, schemas} = meta; | ||
|
||
const style = useMemo((): CSSProperties | undefined => { | ||
if (!nodeProgress || !nodeProgress.state) return undefined; | ||
|
||
const percent = | ||
nodeProgress.state === 'Finished' | ||
? 100 // node may not have a job | ||
: ((nodeProgress.completed || 0) / (nodeProgress.total || 1)) * 100; | ||
|
||
return { | ||
background: `linear-gradient(to right, ${GRAPH_COLORS.progressColor} ${percent}%, #fff ${percent}%)`, | ||
}; | ||
}, [nodeProgress]); | ||
|
||
const showNodeInfo = useMemo(() => { | ||
return ( | ||
showInfo && | ||
(schemas || | ||
hasStagesInfo(nodeProgress) || | ||
hasJobsInfo(nodeProgress) || | ||
hasDetailsInfo(details)) | ||
); | ||
}, [details, nodeProgress, schemas, showInfo]); | ||
|
||
if (!showNodeInfo && !showHeader) return null; | ||
|
||
return ( | ||
<div className={b(null, className)} style={style}> | ||
{showHeader && <DetailBlockHeader block={block} />} | ||
{showNodeInfo && ( | ||
<OperationNodeInfo | ||
progress={nodeProgress || undefined} | ||
schemas={schemas} | ||
details={details} | ||
radioWidth="max" | ||
className={b('details', {'without-padding': !showHeader})} | ||
/> | ||
)} | ||
</div> | ||
); | ||
}; |
40 changes: 40 additions & 0 deletions
40
packages/ui/src/ui/pages/query-tracker/Plan/GraphEditor/DetailBlock/DetailBlockHeader.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,40 @@ | ||
import React, {FC, useMemo} from 'react'; | ||
import {Flex, Text} from '@gravity-ui/uikit'; | ||
import {OperationContent} from './OperationContent'; | ||
import {NodeTBlock} from '../canvas/NodeBlock'; | ||
import {GraphBlockType} from '../enums'; | ||
import {DetailBlockTitle} from './DetailBlockTitle'; | ||
|
||
type Props = { | ||
block: NodeTBlock; | ||
}; | ||
|
||
export const DetailBlockHeader: FC<Props> = ({ | ||
block: { | ||
meta: {icon, bottomText, nodeProgress}, | ||
name, | ||
is, | ||
}, | ||
}) => { | ||
const isTable = is === GraphBlockType.Table; | ||
|
||
const showContent = useMemo(() => { | ||
if (isTable) return Boolean(bottomText); | ||
return nodeProgress && nodeProgress.total; | ||
}, [bottomText, isTable, nodeProgress]); | ||
|
||
return ( | ||
<Flex gap={2} direction="column"> | ||
<DetailBlockTitle icon={icon} name={name} /> | ||
{showContent && ( | ||
<> | ||
{isTable ? ( | ||
<Text variant="caption-2">{bottomText || ''}</Text> | ||
) : ( | ||
<OperationContent nodeProgress={nodeProgress} /> | ||
)} | ||
</> | ||
)} | ||
</Flex> | ||
); | ||
}; |
Oops, something went wrong.