Skip to content

Commit cf442ad

Browse files
committed
feat: how vdisks of selected group in a special color
1 parent d448ace commit cf442ad

File tree

6 files changed

+19
-5
lines changed

6 files changed

+19
-5
lines changed

src/components/DiskStateProgressBar/DiskStateProgressBar.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
background-color: unset;
3636
}
3737

38+
&#{&}_compact#{&}_faded {
39+
opacity: 0.5;
40+
}
41+
3842
&_empty {
3943
color: var(--g-color-text-hint);
4044
border-style: dashed;

src/components/VDisk/VDisk.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export interface VDiskProps {
2121
data?: PreparedVDisk;
2222
nodes?: NodesMap;
2323
compact?: boolean;
24+
faded?: boolean;
2425
showPopup?: boolean;
2526
onShowPopup?: VoidFunction;
2627
onHidePopup?: VoidFunction;
@@ -31,6 +32,7 @@ export const VDisk = ({
3132
data = {},
3233
nodes,
3334
compact,
35+
faded,
3436
showPopup,
3537
onShowPopup,
3638
onHidePopup,
@@ -87,6 +89,7 @@ export const VDisk = ({
8789
diskAllocatedPercent={data.AllocatedPercent}
8890
severity={data.Severity}
8991
compact={compact}
92+
faded={faded}
9093
className={progressBarClassName}
9194
/>
9295
</InternalLink>

src/containers/Storage/PDisk/PDisk.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ import {PDiskPopup} from '../../../components/PDiskPopup/PDiskPopup';
66
import {VDiskWithDonorsStack} from '../../../components/VDisk/VDiskWithDonorsStack';
77
import routes, {createHref, getPDiskPagePath} from '../../../routes';
88
import {useDiskPagesAvailable} from '../../../store/reducers/capabilities/hooks';
9-
import type {TVDiskStateInfo} from '../../../types/api/vdisk';
109
import {valueIsDefined} from '../../../utils';
1110
import {cn} from '../../../utils/cn';
1211
import {stringifyVdiskId} from '../../../utils/dataFormatters/dataFormatters';
13-
import type {PreparedPDisk} from '../../../utils/disks/types';
12+
import type {PreparedPDisk, PreparedVDisk} from '../../../utils/disks/types';
1413
import {STRUCTURE} from '../../Node/NodePages';
1514

1615
import './PDisk.scss';
@@ -19,12 +18,13 @@ const b = cn('pdisk-storage');
1918

2019
interface PDiskProps {
2120
data?: PreparedPDisk;
22-
vDisks?: TVDiskStateInfo[];
21+
vDisks?: PreparedVDisk[];
2322
showPopup?: boolean;
2423
onShowPopup?: VoidFunction;
2524
onHidePopup?: VoidFunction;
2625
className?: string;
2726
progressBarClassName?: string;
27+
groupId?: string;
2828
}
2929

3030
export const PDisk = ({
@@ -35,6 +35,7 @@ export const PDisk = ({
3535
onHidePopup,
3636
className,
3737
progressBarClassName,
38+
groupId,
3839
}: PDiskProps) => {
3940
const [isPopupVisible, setIsPopupVisible] = React.useState(false);
4041

@@ -75,8 +76,11 @@ export const PDisk = ({
7576
>
7677
<VDiskWithDonorsStack
7778
data={vdisk}
78-
compact={true}
79+
faded={
80+
groupId ? groupId !== vdisk.VDiskId?.GroupID?.toString() : false
81+
}
7982
stackClassName={b('donors-stack')}
83+
compact
8084
/>
8185
</div>
8286
);

src/containers/Storage/StorageNodes/columns/columns.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const getStorageNodesColumns = (
2020
database?: string,
2121
) => {
2222
const getNodeRef = additionalNodesProps?.getNodeRef;
23+
const groupId = additionalNodesProps?.groupId;
2324

2425
const columns: StorageNodesColumn[] = [
2526
{
@@ -82,7 +83,7 @@ const getStorageNodesColumns = (
8283

8384
return (
8485
<div className={b('pdisks-item')} key={pDisk.PDiskId}>
85-
<PDisk data={pDisk} vDisks={vDisks} />
86+
<PDisk data={pDisk} vDisks={vDisks} groupId={groupId} />
8687
</div>
8788
);
8889
})}

src/containers/StorageGroupPage/StorageGroupPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ export function StorageGroupPage() {
172172
tableSettings={DEFAULT_TABLE_SETTINGS}
173173
visibleEntities="all"
174174
nodesUptimeFilter={NodesUptimeFilterValues.All}
175+
additionalNodesProps={{groupId: groupId || undefined}}
175176
/>
176177
) : null;
177178
}

src/types/additionalProps.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ export type NodeAddress = Pick<TSystemStateInfo, 'Host' | 'Endpoints' | 'NodeId'
2828
export type GetNodeRefFunc = (node?: NodeAddress) => string | null;
2929

3030
export interface AdditionalNodesProps extends Record<string, unknown> {
31+
groupId?: string;
3132
getNodeRef?: GetNodeRefFunc;
3233
}

0 commit comments

Comments
 (0)