Skip to content

Commit f3a857b

Browse files
authored
feat(new-ui): clear input button
1 parent 0ab8430 commit f3a857b

File tree

14 files changed

+40
-17
lines changed

14 files changed

+40
-17
lines changed

lib/static/new-ui/components/NameFilter/index.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, {ChangeEvent, ReactNode, useCallback, useMemo, useState} from 'rea
22
import {debounce} from 'lodash';
33
import {useDispatch, useSelector} from 'react-redux';
44
import {Icon, TextInput} from '@gravity-ui/uikit';
5-
import {FontCase} from '@gravity-ui/icons';
5+
import {FontCase, Xmark} from '@gravity-ui/icons';
66
import * as actions from '@/static/modules/actions';
77
import {getIsInitialized} from '@/static/new-ui/store/selectors';
88
import {NameFilterButton} from './NameFilterButton';
@@ -31,6 +31,11 @@ export const NameFilter = (): ReactNode => {
3131
updateNameFilter(event.target.value);
3232
}, [setNameFilter, updateNameFilter]);
3333

34+
const onClear = useCallback((): void => {
35+
setNameFilter('');
36+
search('', useMatchCaseFilter, useRegexFilter, page, false, dispatch);
37+
}, [setNameFilter, useMatchCaseFilter, useRegexFilter, page]);
38+
3439
const isInitialized = useSelector(getIsInitialized);
3540

3641
const onCaseSensitiveClick = (): void => {
@@ -74,17 +79,27 @@ export const NameFilter = (): ReactNode => {
7479
qa="name-filter"
7580
/>
7681
<div className={styles['buttons-wrapper']}>
82+
{testNameFilter && (
83+
<NameFilterButton
84+
selected={false}
85+
tooltip="Clear filter"
86+
onClick={onClear}
87+
qa="clear-name-filter"
88+
>
89+
<Icon data={Xmark}/>
90+
</NameFilterButton>
91+
)}
7792
<NameFilterButton
7893
selected={useMatchCaseFilter}
79-
tooltip={'Match case'}
94+
tooltip="Match case"
8095
onClick={onCaseSensitiveClick}
8196
qa="match-case"
8297
>
8398
<Icon data={FontCase}/>
8499
</NameFilterButton>
85100
<NameFilterButton
86101
selected={useRegexFilter}
87-
tooltip={'Regex'}
102+
tooltip="Regex"
88103
onClick={onRegexClick}
89104
className={styles['buttons-wrapper__regex']}
90105
qa="regex"

lib/static/new-ui/components/SettingsPanel/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function SettingsPanel(): ReactNode {
5656

5757
return <AsidePanel title={'Settings'}>
5858
<PanelSection title={'Base Host'} description={<>URLs in Meta and in test steps&apos; commands are affected by this.</>}>
59-
<TextInput onChange={onBaseHostChange} value={baseHost}/>
59+
<TextInput onChange={onBaseHostChange} value={baseHost} hasClear />
6060
</PanelSection>
6161
<Divider orientation={'horizontal'} className={styles.divider}/>
6262
<PanelSection title={'New UI'} description={'Minimalistic yet informative, the new UI offers a cleaner look and optimised screen space usage.'}>

lib/static/new-ui/components/TabsSelect/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ interface TabsSelectOptionProps {
1414

1515
const TabsSelectOption = ({count, icon, title}: TabsSelectOptionProps): ReactNode => (
1616
<div className={styles['test-status-filter-option']}>
17-
{!icon ? <span>{title}</span> : icon}<span className={styles['test-status-filter-option__count']}>{count}</span>
17+
{!icon ? <span>{title}</span> : icon}
18+
<span data-qa={`${title.toLowerCase()}-count`} className={styles['test-status-filter-option__count']}>
19+
{count}
20+
</span>
1821
</div>
1922
);
2023

lib/static/new-ui/components/TreeViewItemSubtitle/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function TreeViewItemSubtitle(props: TreeViewItemSubtitleProps): ReactNod
8787

8888
if (props.item.errorStack) {
8989
return (
90-
<div className={classNames(styles['tree-view-item-subtitle__error-stack'], props.className)}>
90+
<div data-qa="error-stack-item" className={classNames(styles['tree-view-item-subtitle__error-stack'], props.className)}>
9191
{(props.item.errorTitle + '\n' + stripAnsi(props.item.errorStack)).trim()}
9292
</div>
9393
);

test/func/tests/common/new-ui/suites-page/name-filter.testplane.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,35 @@ if (process.env.TOOL === 'testplane') {
1313
regexButton = await browser.$('[data-qa="regex"]');
1414
});
1515

16-
it('usual search', async ({browser}) => {
16+
it('usual search', async () => {
1717
await searchInput.setValue('failed');
18-
await browser.pause(1000);
19-
await browser.assertView('body');
2018
});
2119

22-
it('empty result', async ({browser}) => {
20+
it('empty text', async () => {
21+
await searchInput.setValue('');
22+
});
23+
24+
it('empty result', async () => {
2325
await searchInput.setValue('not found');
24-
await browser.pause(1000);
25-
await browser.assertView('body');
2626
});
2727

28-
it('match case', async ({browser}) => {
28+
it('match case', async () => {
2929
await matchCaseButton.click();
3030
await searchInput.setValue('FAILED');
31-
await browser.pause(1000);
32-
await browser.assertView('body');
3331
});
3432

35-
it('regex', async ({browser}) => {
33+
it('regex', async () => {
3634
await searchInput.setValue('failed *');
3735
await regexButton.click();
36+
});
37+
38+
afterEach(async ({browser}) => {
3839
await browser.pause(1000);
39-
await browser.assertView('body');
40+
await browser.assertView(
41+
'sidebar',
42+
'[data-qa="suites-tree-card"]',
43+
{ignoreElements: ['img', 'div[data-qa="error-stack-item"]']}
44+
);
4045
});
4146
});
4247
});
-86.5 KB
Binary file not shown.
52 KB
Loading
-85.1 KB
Binary file not shown.
50.9 KB
Loading
-34.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)