Skip to content

Commit

Permalink
Merge branch 'main' into memory-bars
Browse files Browse the repository at this point in the history
  • Loading branch information
kunga committed Jul 30, 2024
2 parents 96a92a1 + 27f7350 commit 07acdef
Show file tree
Hide file tree
Showing 28 changed files with 315 additions and 116 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,6 @@ on:
branches: ['**']

jobs:
commitlint:
name: Commit Naming
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci
- run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

verify_files:
name: Verify Files
runs-on: ubuntu-latest
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: PR Title

on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited

jobs:
verify_title:
name: Verify Title
runs-on: ubuntu-latest
if: ${{github.event.action != 'edited' || github.event.changes.title}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- name: Install Packages
run: npm ci
- name: Run Commitlint
run: echo "${{github.event.pull_request.title}}" | npx commitlint
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## [6.12.0](https://github.com/ydb-platform/ydb-embedded-ui/compare/v6.11.0...v6.12.0) (2024-07-29)


### Features

* add effective ACL ([#1036](https://github.com/ydb-platform/ydb-embedded-ui/issues/1036)) ([bce4e92](https://github.com/ydb-platform/ydb-embedded-ui/commit/bce4e926d6395dcfc53d14e6ea373073ef724145))
* cpu info toggle – display top queries for last hour ([#1049](https://github.com/ydb-platform/ydb-embedded-ui/issues/1049)) ([1fb9078](https://github.com/ydb-platform/ydb-embedded-ui/commit/1fb9078c8ea76c237a5397f74397663eb0b0f7d3))
* **PDiskPage:** add disk space distribution ([#1029](https://github.com/ydb-platform/ydb-embedded-ui/issues/1029)) ([82375c3](https://github.com/ydb-platform/ydb-embedded-ui/commit/82375c39b67a23046e673e4172aa29bbde659ab5))
* **PDiskPage:** add pdisk attributes, display in 2 columns ([#1069](https://github.com/ydb-platform/ydb-embedded-ui/issues/1069)) ([d3b3d9b](https://github.com/ydb-platform/ydb-embedded-ui/commit/d3b3d9bf77dbbe7966bbc072d64cb4c4b5c3d0c4))
* use date pickers from date-components ([#1031](https://github.com/ydb-platform/ydb-embedded-ui/issues/1031)) ([dbb5ba7](https://github.com/ydb-platform/ydb-embedded-ui/commit/dbb5ba797870d738423ebf2f7bfd688d9a9b6d75))
* use monaco-yql-languages for syntax highlight ([#1063](https://github.com/ydb-platform/ydb-embedded-ui/issues/1063)) ([96976aa](https://github.com/ydb-platform/ydb-embedded-ui/commit/96976aaa4f13a3287e3ee8283db77c96703e268e))


### Bug Fixes

* add margin for developer ui button ([#1041](https://github.com/ydb-platform/ydb-embedded-ui/issues/1041)) ([6fa1e0b](https://github.com/ydb-platform/ydb-embedded-ui/commit/6fa1e0bddaa40a972d2160959fba80773d567830))
* do not retry requests by user ([#1059](https://github.com/ydb-platform/ydb-embedded-ui/issues/1059)) ([f4af922](https://github.com/ydb-platform/ydb-embedded-ui/commit/f4af922491faf34e08022dd1e3c9af007a6765d1))
* mark follower is Leader is false ([#1055](https://github.com/ydb-platform/ydb-embedded-ui/issues/1055)) ([c668f52](https://github.com/ydb-platform/ydb-embedded-ui/commit/c668f52171bfc34db4c724341edc9c63a0498aa7))
* **ObjectSummary:** treat EPathTypeSubDomain as EPathTypeExtSubDomain ([#1064](https://github.com/ydb-platform/ydb-embedded-ui/issues/1064)) ([ce0c03e](https://github.com/ydb-platform/ydb-embedded-ui/commit/ce0c03ecfefdc752101b67ae2052e9c1f984ef96))
* pass database param to all handlers inside DB ([#1066](https://github.com/ydb-platform/ydb-embedded-ui/issues/1066)) ([4b34e05](https://github.com/ydb-platform/ydb-embedded-ui/commit/4b34e05ae53ce5c5cab811d37f3a7062ff2f7718))
* **PDiskPage:** move autorefresh to meta level ([#1058](https://github.com/ydb-platform/ydb-embedded-ui/issues/1058)) ([248e57d](https://github.com/ydb-platform/ydb-embedded-ui/commit/248e57de68684e86bb8aa688ac6cceeae45edc7d))
* **PDiskSpaceDistribution:** increase slot height, display 0 id ([#1071](https://github.com/ydb-platform/ydb-embedded-ui/issues/1071)) ([7b9adda](https://github.com/ydb-platform/ydb-embedded-ui/commit/7b9adda65395855625bbcd6a1bd08c0ece81f79b))
* ru.json for datepicker ([#1044](https://github.com/ydb-platform/ydb-embedded-ui/issues/1044)) ([f2dfacb](https://github.com/ydb-platform/ydb-embedded-ui/commit/f2dfacbf5f183dd3ffdb410d9d13acbc59009e74))
* **TableInfo:** update column table info ([#1056](https://github.com/ydb-platform/ydb-embedded-ui/issues/1056)) ([3305cdb](https://github.com/ydb-platform/ydb-embedded-ui/commit/3305cdbcef990ab846a953ae6cf06a88526c0cd3))

## [6.11.0](https://github.com/ydb-platform/ydb-embedded-ui/compare/v6.10.3...v6.11.0) (2024-07-19)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ydb-embedded-ui",
"version": "6.11.0",
"version": "6.12.0",
"files": [
"dist"
],
Expand Down
19 changes: 15 additions & 4 deletions src/components/ButtonWithConfirmDialog/ButtonWithConfirmDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import {CriticalActionDialog} from '../CriticalActionDialog';

interface ButtonWithConfirmDialogProps<T, K> {
children: React.ReactNode;
onConfirmAction: () => Promise<T>;
onConfirmAction: (isRetry?: boolean) => Promise<T>;
onConfirmActionSuccess?: (() => Promise<K>) | VoidFunction;
dialogContent: string;
retryButtonText?: string;
buttonDisabled?: ButtonProps['disabled'];
buttonView?: ButtonProps['view'];
buttonClassName?: ButtonProps['className'];
Expand All @@ -24,6 +25,7 @@ export function ButtonWithConfirmDialog<T, K>({
onConfirmAction,
onConfirmActionSuccess,
dialogContent,
retryButtonText,
buttonDisabled = false,
buttonView = 'action',
buttonClassName,
Expand All @@ -34,14 +36,17 @@ export function ButtonWithConfirmDialog<T, K>({
}: ButtonWithConfirmDialogProps<T, K>) {
const [isConfirmDialogVisible, setIsConfirmDialogVisible] = React.useState(false);
const [buttonLoading, setButtonLoading] = React.useState(false);
const [withRetry, setWithRetry] = React.useState(false);

const handleConfirmAction = async () => {
const handleConfirmAction = async (isRetry?: boolean) => {
setButtonLoading(true);
await onConfirmAction();
await onConfirmAction(isRetry);
setButtonLoading(false);
};

const handleConfirmActionSuccess = async () => {
setWithRetry(false);

if (onConfirmActionSuccess) {
setButtonLoading(true);

Expand All @@ -54,7 +59,11 @@ export function ButtonWithConfirmDialog<T, K>({
}
};

const handleConfirmActionError = () => {
const handleConfirmActionError = (error: unknown) => {
const isWithRetry = Boolean(
error && typeof error === 'object' && 'retryPossible' in error && error.retryPossible,
);
setWithRetry(isWithRetry);
setButtonLoading(false);
};

Expand Down Expand Up @@ -93,6 +102,8 @@ export function ButtonWithConfirmDialog<T, K>({
<CriticalActionDialog
visible={isConfirmDialogVisible}
text={dialogContent}
withRetry={withRetry}
retryButtonText={retryButtonText}
onConfirm={handleConfirmAction}
onConfirmActionSuccess={handleConfirmActionSuccess}
onConfirmActionError={handleConfirmActionError}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.ydb-critical-dialog {
width: 400px;
padding-top: 18px;

&__warning-icon {
margin-right: 16px;
Expand Down
27 changes: 18 additions & 9 deletions src/components/CriticalActionDialog/CriticalActionDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@ const parseError = (error: IResponseError) => {
interface CriticalActionDialogProps<T> {
visible: boolean;
text: string;
withRetry?: boolean;
retryButtonText?: string;
onClose: VoidFunction;
onConfirm: () => Promise<T>;
onConfirm: (isRetry?: boolean) => Promise<T>;
onConfirmActionSuccess: VoidFunction;
onConfirmActionError: VoidFunction;
onConfirmActionError: (error: unknown) => void;
}

export function CriticalActionDialog<T>({
visible,
text,
withRetry,
retryButtonText,
onClose,
onConfirm,
onConfirmActionSuccess,
Expand All @@ -43,17 +47,16 @@ export function CriticalActionDialog<T>({
const [isLoading, setIsLoading] = React.useState(false);
const [error, setError] = React.useState<IResponseError>();

const onSubmit = async (e: React.FormEvent) => {
e.preventDefault();
const onApply = async (isRetry?: boolean) => {
setIsLoading(true);

return onConfirm()
return onConfirm(isRetry)
.then(() => {
onConfirmActionSuccess();
onClose();
})
.catch((err) => {
onConfirmActionError();
onConfirmActionError(err);
setError(err);
})
.finally(() => {
Expand All @@ -75,15 +78,21 @@ export function CriticalActionDialog<T>({
<Dialog.Footer
loading={false}
preset="default"
textButtonApply={
withRetry
? retryButtonText || criticalActionDialogKeyset('button-retry')
: undefined
}
textButtonCancel={criticalActionDialogKeyset('button-close')}
onClickButtonApply={() => onApply(true)}
onClickButtonCancel={onClose}
/>
</React.Fragment>
);
}

return (
<form onSubmit={onSubmit}>
<React.Fragment>
<Dialog.Body className={b('body')}>
<span className={b('warning-icon')}>
<Icon data={TriangleExclamationFill} size={24} />
Expand All @@ -98,9 +107,9 @@ export function CriticalActionDialog<T>({
textButtonCancel={criticalActionDialogKeyset('button-cancel')}
propsButtonApply={{type: 'submit'}}
onClickButtonCancel={onClose}
onClickButtonApply={() => {}}
onClickButtonApply={() => onApply()}
/>
</form>
</React.Fragment>
);
};

Expand Down
1 change: 1 addition & 0 deletions src/components/CriticalActionDialog/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"no-rights-error": "You don't have enough rights to complete the operation",

"button-confirm": "Confirm",
"button-retry": "Retry",
"button-cancel": "Cancel",
"button-close": "Close"
}
57 changes: 57 additions & 0 deletions src/components/Graph/Graph.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React from 'react';

import {getTopology, getYdbPlanNodeShape} from '@gravity-ui/paranoid';
import type {Data, GraphNode, Options, Shapes} from '@gravity-ui/paranoid';

interface GraphProps<T> {
data: Data<T>;
opts?: Options;
shapes?: Shapes;
}

export function Graph<T>(props: GraphProps<T>) {
const containerRef = React.useRef<HTMLDivElement>(null);
const containerId = React.useId();

const {data, opts, shapes} = props;

React.useEffect(() => {
const graphRoot = containerRef.current;
if (!graphRoot) {
return undefined;
}

graphRoot.innerHTML = '';

const topology = getTopology(graphRoot.id, data, opts, shapes);
topology.render();
return () => {
topology.destroy();
};
}, [data, opts, shapes]);

return <div id={containerId} ref={containerRef} style={{height: '100vh'}} />;
}

export const renderExplainNode = (node: GraphNode): string => {
const parts = node.name.split('|');
return parts.length > 1 ? parts[1] : node.name;
};

const schemaOptions: Options = {
renderNodeTitle: renderExplainNode,
textOverflow: 'normal' as const,
initialZoomFitsCanvas: true,
};

const schemaShapes = {
node: getYdbPlanNodeShape,
};

interface YDBGraphProps<T> {
data: Data<T>;
}

export function YDBGraph<T>(props: YDBGraphProps<T>) {
return <Graph<T> {...props} opts={schemaOptions} shapes={schemaShapes} />;
}
7 changes: 4 additions & 3 deletions src/containers/PDiskPage/PDiskPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ export function PDiskPage() {
const pDiskData = pdiskDataQuery.currentData;
const {NodeHost, NodeId, NodeType, NodeDC, Severity} = pDiskData || {};

const handleRestart = async () => {
const handleRestart = async (isRetry?: boolean) => {
if (pDiskParamsDefined) {
return window.api.restartPDisk(nodeId, pDiskId).then((res) => {
return window.api.restartPDisk({nodeId, pDiskId, force: isRetry}).then((res) => {
if (res?.result === false) {
const err = {statusText: res.error};
const err = {statusText: res.error, retryPossible: res.forceRetryPossible};
throw err;
}
});
Expand Down Expand Up @@ -147,6 +147,7 @@ export function PDiskPage() {
buttonDisabled={!nodeId || !pDiskId || !isUserAllowedToMakeChanges}
buttonView="normal"
dialogContent={pDiskPageKeyset('restart-pdisk-dialog')}
retryButtonText={pDiskPageKeyset('force-restart-pdisk-button')}
withPopover
popoverContent={pDiskPageKeyset('restart-pdisk-not-allowed')}
popoverDisabled={isUserAllowedToMakeChanges}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

padding: 0 var(--g-spacing-2);

line-height: 13px;
line-height: 15px;
}

&__slot-id {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function SlotContent({id, title, used, total}: SlotContentProps) {
return (
<div className={b('slot-content')}>
<span>
{id ? <span className={b('slot-id')}>{id}</span> : null}
{valueIsDefined(id) ? <span className={b('slot-id')}>{id}</span> : null}
{title}
</span>
<span className={b('slot-size')}>{renderSize()}</span>
Expand Down
1 change: 1 addition & 0 deletions src/containers/PDiskPage/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"no-slots-data": "No slots data",

"restart-pdisk-button": "Restart PDisk",
"force-restart-pdisk-button": "Restart anyway",
"restart-pdisk-dialog": "PDisk will be restarted. Do you want to proceed?",
"restart-pdisk-not-allowed": "You don't have enough rights to restart PDisk"
}
7 changes: 7 additions & 0 deletions src/containers/Tenant/Query/ExecuteResult/ExecuteResult.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,11 @@
padding: 10px;
}
}

&__explain-canvas-container {
overflow-y: auto;

width: 100%;
height: 100%;
}
}
Loading

0 comments on commit 07acdef

Please sign in to comment.