Skip to content

Commit

Permalink
feat(Queries): new progress graph [YTFRONT-4112]
Browse files Browse the repository at this point in the history
  • Loading branch information
SimbiozizV committed Dec 23, 2024
1 parent 61231db commit 5d77908
Show file tree
Hide file tree
Showing 48 changed files with 1,686 additions and 27 deletions.
88 changes: 80 additions & 8 deletions packages/ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"@gravity-ui/date-utils": "^2.5.3",
"@gravity-ui/dialog-fields": "^5.0.9",
"@gravity-ui/eslint-config": "^3.2.0",
"@gravity-ui/graph": "^0.1.2",
"@gravity-ui/icons": "^2.0.0",
"@gravity-ui/navigation": "^2.15.3",
"@gravity-ui/prettier-config": "^1.1.0",
Expand Down Expand Up @@ -135,6 +136,7 @@
"d3-scale": "4",
"d3-selection": "3",
"d3-shape": "3",
"elkjs": "^0.9.3",
"eslint": "^8.48.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-lodash": "^7.4.0",
Expand Down Expand Up @@ -183,7 +185,8 @@
"typescript": "^5.2.2",
"vis-data": "^7.1.7",
"vis-network": "^9.1.2",
"wc-react": "^0.5.1"
"wc-react": "^0.5.1",
"web-worker": "^1.3.0"
},
"engines": {
"node": ">=18"
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/shared/constants/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export const SettingName = {
STAGE: 'queryTrackerStage',
YQL_AGENT_STAGE: 'yqlAgentStage',
QUERIES_LIST_SIDEBAR_VISIBILITY_MODE: 'queriesListSidebarVisibilityMode',
NEW_GRAPH_TYPE: 'queryTrackerNewGraphType',
},
CHYT: {
LIST_COLUMNS: 'list_columns',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@ function useSettings(cluster: string, isAdmin: boolean): Array<SettingsPage> {
settingNS={NAMESPACES.QUERY_TRACKER}
/>,
),
makeItem(
'Query tracker graph',
'top',
<SettingsMenuItem
label="New graph type"
annotation="Shows the new graph type in the Progress tab for query tracker"
settingName={SettingName.QUERY_TRACKER.NEW_GRAPH_TYPE}
settingNS={NAMESPACES.QUERY_TRACKER}
/>,
),
]),
),

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.yt-detail-block {
display: grid;
grid-template-rows: 52px 1fr;
color: var(--g-color-text-primary);
padding: 10px 12px;
min-height: 70px;
min-width: 240px;
box-sizing: border-box;
background: var(--g-popup-background-color, var(--g-color-base-float));
border: 1px solid var(--g-popup-border-color, var(--g-color-line-generic-solid));
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;
overflow-y: auto;

&_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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React, {CSSProperties, FC, useMemo, useRef} from 'react';
import './DetailBlock.scss';
import cn from 'bem-cn-lite';
import {NodeBlock} from '../canvas/NodeBlock';
import OperationNodeInfo from '../../OperationNodeInfo';
import {hasDetailsInfo, hasJobsInfo, hasStagesInfo} from '../../utils';
import {DetailBlockHeader} from './DetailBlockHeader';
import {Graph} from '@gravity-ui/graph';

const b = cn('yt-detail-block');

type Props = {
block: NodeBlock;
graph: Graph;
showHeader?: boolean;
showInfo?: boolean;
className?: string;
style?: CSSProperties;
};

export const DetailBlock: FC<Props> = ({block, showHeader, showInfo, className, style}) => {
const detailBlockRef = useRef<HTMLDivElement>(null);
const {state} = block;
const {nodeProgress, details, schemas} = state.meta;

const showNodeInfo = useMemo(() => {
return (
showInfo &&
(schemas ||
hasStagesInfo(nodeProgress) ||
hasJobsInfo(nodeProgress) ||
hasDetailsInfo(details))
);
}, [details, nodeProgress, schemas, showInfo]);

if (!showNodeInfo && !showHeader) return null;

return (
<div
ref={detailBlockRef}
className={b(null, className)}
style={style}
onWheel={(e) => {
e.preventDefault();
e.stopPropagation();
}}
>
{showHeader && <DetailBlockHeader block={state} />}
{showNodeInfo && (
<OperationNodeInfo
progress={nodeProgress || undefined}
schemas={schemas}
details={details}
radioWidth="max"
className={b('details', {'without-padding': !showHeader})}
/>
)}
</div>
);
};
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>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.yt-detailed-block-title {
display: flex;
align-items: center;
gap: 0 8px;

&__icon {
height: 16px;
width: 16px;
color: #657B8F;
}

&__name {
font-size: 11px;
font-weight: bold;
}
}
Loading

0 comments on commit 5d77908

Please sign in to comment.