Skip to content

Commit 7fa0358

Browse files
feat(Clusters): redesign table (#2495)
1 parent 6ed077e commit 7fa0358

File tree

7 files changed

+164
-171
lines changed

7 files changed

+164
-171
lines changed

src/components/Search/Search.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import React from 'react';
22

3+
import type {TextInputProps} from '@gravity-ui/uikit';
4+
35
import {cn} from '../../utils/cn';
46
import {DebouncedInput} from '../DebouncedInput/DebouncedTextInput';
57

68
import './Search.scss';
79

810
const b = cn('ydb-search');
911

10-
interface SearchProps {
12+
interface SearchProps extends Omit<TextInputProps, 'onUpdate' | 'onChange'> {
1113
onChange: (value: string) => void;
1214
value?: string;
1315
width?: React.CSSProperties['width'];
14-
className?: string;
1516
debounce?: number;
16-
placeholder?: string;
1717
inputRef?: React.RefObject<HTMLInputElement>;
1818
}
1919

@@ -23,8 +23,8 @@ export const Search = ({
2323
width,
2424
className,
2525
debounce,
26-
placeholder,
2726
inputRef,
27+
...props
2828
}: SearchProps) => {
2929
return (
3030
<DebouncedInput
@@ -34,9 +34,9 @@ export const Search = ({
3434
controlRef={inputRef}
3535
style={{width}}
3636
className={b(null, className)}
37-
placeholder={placeholder}
3837
value={value}
3938
onUpdate={onChange}
39+
{...props}
4040
/>
4141
);
4242
};

src/containers/Clusters/Clusters.scss

Lines changed: 12 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,6 @@
1717
&__autorefresh {
1818
margin-left: auto;
1919
}
20-
&__cluster-status {
21-
width: 18px;
22-
height: 18px;
23-
margin-right: 8px;
24-
25-
border-radius: 3px;
26-
27-
& span {
28-
display: flex;
29-
align-items: center;
30-
}
31-
32-
&_type_green {
33-
background-color: var(--ydb-color-status-green);
34-
}
35-
&_type_yellow {
36-
background-color: var(--ydb-color-status-yellow);
37-
}
38-
&_type_blue {
39-
background-color: var(--ydb-color-status-blue);
40-
}
41-
&_type_red {
42-
background: var(--ydb-color-status-red);
43-
}
44-
&_type_grey {
45-
background: var(--ydb-color-status-grey);
46-
}
47-
&_type_orange {
48-
background: var(--ydb-color-status-orange);
49-
}
50-
}
5120
&__cluster-name {
5221
white-space: normal;
5322
text-decoration: none;
@@ -71,29 +40,17 @@
7140
margin-right: 15px;
7241

7342
&_wide {
74-
width: 300px;
43+
width: 320px;
7544
}
7645
}
7746
&__empty-cell {
7847
color: var(--g-color-text-secondary);
7948
}
80-
&__tooltip-content {
81-
word-break: break-all;
82-
}
8349

8450
& .g-progress__item {
8551
transition: none;
8652
}
8753

88-
&__text {
89-
color: var(--g-color-text-primary);
90-
@include mixins.body-2-typography();
91-
92-
&::first-letter {
93-
color: var(--g-color-text-danger);
94-
}
95-
}
96-
9754
&__description {
9855
max-width: 200px;
9956

@@ -113,36 +70,25 @@
11370
}
11471

11572
&__table {
73+
--data-table-cell-align: top;
74+
--data-table-cell-vertical-padding: var(--g-spacing-3);
11675
@include mixins.freeze-nth-column(1);
11776
}
11877

119-
&__balancer-cell {
120-
display: flex;
121-
flex-direction: row;
122-
align-items: center;
123-
}
124-
125-
&__balancer-text {
126-
display: inline-block;
127-
overflow: hidden;
128-
129-
max-width: 92%;
130-
margin-right: 5px;
131-
132-
text-overflow: ellipsis;
133-
overflow-wrap: break-word !important;
134-
}
135-
&__balancer-icon {
136-
display: flex;
137-
align-items: center;
78+
&__balancer-copy-icon {
79+
color: var(--g-color-text-secondary);
13880
}
81+
&__search-icon {
82+
margin: 0 var(--g-spacing-1);
13983

140-
&__error {
141-
margin-left: 15px;
142-
@include mixins.body-2-typography();
84+
color: var(--g-color-text-secondary);
14385
}
14486

14587
&__remove-cluster {
14688
color: var(--ydb-color-status-red);
14789
}
90+
91+
&__progress {
92+
--g-progress-filled-background-color: var(--ydb-color-status-green);
93+
}
14894
}

src/containers/Clusters/Clusters.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from 'react';
22

3+
import {Magnifier} from '@gravity-ui/icons';
34
import DataTable from '@gravity-ui/react-data-table';
4-
import {Flex, Select, TableColumnSetup, Text} from '@gravity-ui/uikit';
5+
import {Flex, Icon, Select, TableColumnSetup, Text} from '@gravity-ui/uikit';
56
import {Helmet} from 'react-helmet-async';
67

78
import {AutoRefreshControl} from '../../components/AutoRefreshControl/AutoRefreshControl';
@@ -129,12 +130,7 @@ export function Clusters() {
129130
const renderPageTitle = () => {
130131
return (
131132
<Flex justifyContent="space-between" className={b('title-wrapper')}>
132-
<Flex gap={2}>
133-
<Text variant="header-1">{i18n('page_title')}</Text>
134-
<Text variant="header-1" color="secondary">
135-
{clusters?.length}
136-
</Text>
137-
</Flex>
133+
<Text variant="header-1">{uiFactory.clustersPageTitle ?? i18n('page_title')}</Text>
138134
<AutoRefreshControl className={b('autorefresh')} />
139135
</Flex>
140136
);
@@ -152,6 +148,7 @@ export function Clusters() {
152148
<div className={b('control', {wide: true})}>
153149
<Search
154150
placeholder={i18n('controls_search-placeholder')}
151+
endContent={<Icon data={Magnifier} className={b('search-icon')} />}
155152
onChange={changeClusterName}
156153
value={clusterName}
157154
/>
@@ -206,7 +203,12 @@ export function Clusters() {
206203
/>
207204
</div>
208205
</Flex>
209-
{query.isError ? <ResponseError error={query.error} className={b('error')} /> : null}
206+
{clusters?.length ? (
207+
<Text color="secondary">
208+
{i18n('clusters-count', {count: filteredClusters?.length})}
209+
</Text>
210+
) : null}
211+
{query.isError ? <ResponseError error={query.error} /> : null}
210212
{query.isLoading ? <Loader size="l" /> : null}
211213
{query.fulfilledTimeStamp ? (
212214
<div className={b('table-wrapper')}>

0 commit comments

Comments
 (0)