Skip to content
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: redesign query #1974

Merged
merged 54 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
3bfd8bc
eat: Editor controls buttons
astandrik Feb 18, 2025
5679ec3
fix
astandrik Feb 19, 2025
5de1a3a
feat: buttons
astandrik Feb 19, 2025
c6d7186
fix: loading statuses
astandrik Feb 20, 2025
d62660c
fix: remove backend time
astandrik Feb 20, 2025
8921243
fix: tabs
astandrik Feb 21, 2025
8f64bdf
fix: error state
astandrik Feb 21, 2025
13c3f89
fix: nanofixes
astandrik Feb 21, 2025
335588c
fix: issue with key
astandrik Feb 21, 2025
48c1f10
fix: error paddings
astandrik Feb 21, 2025
14218e5
fix: stopped state
astandrik Feb 21, 2025
2eb86a5
Merge branch 'main' into astandrik.redesign-query-1949
astandrik Feb 21, 2025
4f82207
fix: test
astandrik Feb 21, 2025
c2070d6
Revert "fix: issue with key"
astandrik Feb 21, 2025
9915098
Revert "Revert "fix: issue with key""
astandrik Feb 21, 2025
3b67518
Revert "Revert "Revert "fix: issue with key"""
astandrik Feb 21, 2025
51a8b67
fix: queryId
astandrik Feb 21, 2025
36e6c62
fix: tests fix
astandrik Feb 24, 2025
a21f370
Merge branch 'main' into astandrik.redesign-query-1949
astandrik Feb 24, 2025
9a8dec8
fix: fix tests
astandrik Feb 24, 2025
4c26d05
fix: add long running test
astandrik Feb 24, 2025
9f4b14a
fix: tests
astandrik Feb 24, 2025
0a080c6
Merge branch 'main' into astandrik.redesign-query-1949
astandrik Feb 24, 2025
b3d7f29
fix: remove indicator tests
astandrik Feb 24, 2025
d24374a
Merge branch 'main' into astandrik.redesign-query-1949
astandrik Feb 25, 2025
abd097d
fix: design fixes
astandrik Feb 25, 2025
0fc0dd4
fix: fontsize
astandrik Feb 25, 2025
b4785d5
fix: stop view
astandrik Feb 25, 2025
5b56781
fix: design fixes
astandrik Feb 25, 2025
9b3c146
fix: nanofix
astandrik Feb 25, 2025
633909d
Merge branch 'main' into astandrik.redesign-query-1949
astandrik Feb 26, 2025
107d06b
fix: review fixes
astandrik Feb 26, 2025
100f05a
fix: error handling
astandrik Feb 26, 2025
2bf5ffa
fix: tests
astandrik Feb 26, 2025
13a7375
Merge branch 'main' into astandrik.redesign-query-1949
astandrik Feb 27, 2025
1419447
fix: better error handling
astandrik Feb 27, 2025
40fc79b
fix: get rid of scroll
astandrik Feb 27, 2025
43358b3
fix: review fixes
astandrik Feb 27, 2025
23c3a54
Merge branch 'main' into astandrik.redesign-query-1949
astandrik Feb 27, 2025
2ffb97a
fix: stopped data
astandrik Feb 27, 2025
8fde82c
fix: stopped error illustration
astandrik Feb 27, 2025
e2d225a
fix: stop button animation
astandrik Feb 27, 2025
59cc269
feat: add test
astandrik Feb 27, 2025
99d00ef
fix: test
astandrik Feb 27, 2025
3e658be
fix: investigate test
astandrik Feb 28, 2025
2920be0
fix: try update playwright
astandrik Feb 28, 2025
7985a17
Merge branch 'main' into astandrik.redesign-query-1949
astandrik Feb 28, 2025
841a487
Merge branch 'main' into astandrik.redesign-query-1949
astandrik Feb 28, 2025
f45de0c
fix: try use CI variable
astandrik Feb 28, 2025
c225fa3
Revert "fix: try use CI variable"
astandrik Feb 28, 2025
ac86354
fix: remove only
astandrik Feb 28, 2025
5619802
Merge branch 'main' into astandrik.redesign-query-1949
astandrik Feb 28, 2025
ad3712a
fix: skip in safari
astandrik Feb 28, 2025
d21e055
fix: add comment
astandrik Feb 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 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
Expand Up @@ -130,7 +130,7 @@
"@gravity-ui/prettier-config": "^1.1.0",
"@gravity-ui/stylelint-config": "^4.0.1",
"@gravity-ui/tsconfig": "^1.0.0",
"@playwright/test": "^1.49.1",
"@playwright/test": "^1.50.1",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.2",
Expand Down
5 changes: 4 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ const config: PlaywrightTestConfig = {
? undefined
: {
command: 'npm run dev',
env: {
REACT_APP_DISABLE_CHECKS: 'true',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disabled rtk-immutability checks for tests (in prod its disabled by default)
drastically improves stream tables performance

},
port: 3000,
reuseExistingServer: true,
reuseExistingServer: !process.env.CI,
},
use: {
baseURL: baseUrl || 'http://localhost:3000/',
Expand Down
3 changes: 0 additions & 3 deletions src/components/ElapsedTime/ElapsedTime.scss

This file was deleted.

35 changes: 0 additions & 35 deletions src/components/ElapsedTime/ElapsedTime.tsx

This file was deleted.

12 changes: 0 additions & 12 deletions src/components/QueryExecutionStatus/QueryExecutionStatus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,4 @@
display: flex;
align-items: center;
gap: 4px;

color: var(--g-color-text-complementary);
&__result-status-icon {
color: var(--g-color-text-positive);
&_error {
color: var(--g-color-text-danger);
}
}

&__query-settings-icon {
color: var(--g-color-text-hint);
}
}
104 changes: 63 additions & 41 deletions src/components/QueryExecutionStatus/QueryExecutionStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import React from 'react';

import {
CircleCheck,
CircleInfo,
CircleQuestionFill,
CircleStop,
CircleXmark,
} from '@gravity-ui/icons';
import {Icon, Spin, Tooltip} from '@gravity-ui/uikit';
import {duration} from '@gravity-ui/date-utils';
import {CircleCheckFill, CircleQuestionFill, CircleStop, CircleXmark} from '@gravity-ui/icons';
import type {LabelProps, TextProps} from '@gravity-ui/uikit';
import {Icon, Label, Spin, Text} from '@gravity-ui/uikit';

import i18n from '../../containers/Tenant/Query/i18n';
import {isQueryCancelledError} from '../../containers/Tenant/Query/utils/isQueryCancelledError';
import {selectQueryDuration} from '../../store/reducers/query/query';
import {cn} from '../../utils/cn';
import {useChangedQuerySettings} from '../../utils/hooks/useChangedQuerySettings';
import {HOUR_IN_SECONDS, SECOND_IN_MS} from '../../utils/constants';
import {useTypedSelector} from '../../utils/hooks';
import {isAxiosError} from '../../utils/response';
import QuerySettingsDescription from '../QuerySettingsDescription/QuerySettingsDescription';

import './QueryExecutionStatus.scss';

Expand All @@ -26,57 +22,83 @@ interface QueryExecutionStatusProps {
loading?: boolean;
}

const QuerySettingsIndicator = () => {
const {isIndicatorShown, changedLastExecutionSettingsDescriptions} = useChangedQuerySettings();

if (!isIndicatorShown) {
return null;
}

return (
<Tooltip
openDelay={0}
content={
<QuerySettingsDescription
prefix={i18n('banner.query-settings.message')}
querySettings={changedLastExecutionSettingsDescriptions}
/>
}
>
<Icon data={CircleInfo} className={b('query-settings-icon')} />
</Tooltip>
);
};

export const QueryExecutionStatus = ({className, error, loading}: QueryExecutionStatusProps) => {
let icon: React.ReactNode;
let label: string;
let theme: LabelProps['theme'];
let textColor: TextProps['color'];
const {startTime, endTime} = useTypedSelector(selectQueryDuration);

const [queryDuration, setQueryDuration] = React.useState<number>(
startTime ? (endTime || Date.now()) - startTime : 0,
);

const isCancelled = isQueryCancelledError(error);

const setDuration = React.useCallback(() => {
if (startTime) {
const actualEndTime = endTime || Date.now();
setQueryDuration(actualEndTime - startTime);
}
}, [endTime, startTime]);

React.useEffect(() => {
let timerId: ReturnType<typeof setInterval> | undefined;
setDuration();

if (loading) {
timerId = setInterval(setDuration, SECOND_IN_MS);
} else {
clearInterval(timerId);
}
return () => {
clearInterval(timerId);
};
}, [loading, setDuration]);

const formattedQueryDuration = React.useMemo(() => {
return queryDuration > HOUR_IN_SECONDS * SECOND_IN_MS
? duration(queryDuration).format('hh:mm:ss')
: duration(queryDuration).format('mm:ss');
}, [queryDuration]);

if (loading) {
theme = 'info';
textColor = 'info-heavy';
icon = <Spin size="xs" />;
label = 'Running';
} else if (isAxiosError(error) && error.code === 'ECONNABORTED') {
theme = 'danger';
textColor = 'danger-heavy';
icon = <Icon data={CircleQuestionFill} />;
label = 'Connection aborted';
} else if (isQueryCancelledError(error)) {
icon = <Icon data={CircleStop} />;
} else if (isCancelled) {
theme = 'warning';
textColor = 'warning-heavy';
icon = <Icon data={CircleStop} className={b('result-status-icon', {error: true})} />;
label = 'Stopped';
} else {
const hasError = Boolean(error);
theme = hasError ? 'danger' : 'success';
textColor = hasError ? 'danger-heavy' : 'positive-heavy';
icon = (
<Icon
data={hasError ? CircleXmark : CircleCheck}
data={hasError ? CircleXmark : CircleCheckFill}
className={b('result-status-icon', {error: hasError})}
/>
);
label = hasError ? 'Failed' : 'Completed';
}

return (
<div className={b(null, className)}>
{icon}
{label}
{isQueryCancelledError(error) || loading ? null : <QuerySettingsIndicator />}
</div>
<Label
theme={theme}
size="m"
className={b(null, className)}
icon={icon}
value={formattedQueryDuration}
>
<Text color={textColor}>{label}</Text>
</Label>
);
};

This file was deleted.

27 changes: 0 additions & 27 deletions src/containers/Tenant/Query/QueryDuration/QueryDuration.scss

This file was deleted.

33 changes: 0 additions & 33 deletions src/containers/Tenant/Query/QueryDuration/QueryDuration.tsx

This file was deleted.

Loading
Loading