Skip to content

Commit ae07d11

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

File tree

11 files changed

+48
-16
lines changed

11 files changed

+48
-16
lines changed

public/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
window.systemSettings = {};
2424
window.userSettings = {};
2525
window.web_version = !'%REACT_APP_BACKEND%';
26-
window.custom_backend = '%NODE_ENV%' === 'development' && '%REACT_APP_BACKEND%';
26+
window.custom_backend = 'http://ydb-vla-dev02-000.search.yandex.net:8765';
2727
window.meta_backend = '%REACT_APP_META_BACKEND%'
2828
</script>
2929
</head>

src/components/DiskStateProgressBar/DiskStateProgressBar.scss

+4
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

+3
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/AppWithClusters/useClusterData.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ export function useClusterData() {
2828
};
2929
}
3030

31-
export function useAdditionalNodeProps({balancer}: {balancer?: string}) {
31+
export function useAdditionalNodeProps({balancer, groupId}: {balancer?: string; groupId?: string}) {
3232
const [useClusterBalancerAsBackend] = useSetting<boolean>(USE_CLUSTER_BALANCER_AS_BACKEND_KEY);
3333

34-
const additionalNodesProps = getAdditionalNodesProps(balancer, useClusterBalancerAsBackend);
34+
const additionalNodesProps = getAdditionalNodesProps({
35+
balancer,
36+
groupId,
37+
useClusterBalancerAsBackend,
38+
});
3539

3640
return {additionalNodesProps, useClusterBalancerAsBackend};
3741
}

src/containers/Storage/PDisk/PDisk.tsx

+8-4
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/PaginatedStorage.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@ import {useStorageNodesSelectedColumns} from './StorageNodes/columns/hooks';
1919
interface PaginatedStorageProps {
2020
database?: string;
2121
nodeId?: string;
22+
groupId: string;
2223
parentContainer?: Element | null;
2324
}
2425

25-
export const PaginatedStorage = ({database, nodeId, parentContainer}: PaginatedStorageProps) => {
26+
export const PaginatedStorage = ({
27+
database,
28+
nodeId,
29+
groupId,
30+
parentContainer,
31+
}: PaginatedStorageProps) => {
2632
const {balancer} = useClusterBaseInfo();
27-
const additionalNodesProps = useAdditionalNodeProps({balancer});
33+
const additionalNodesProps = useAdditionalNodeProps({balancer, groupId});
2834

2935
const [queryParams, setQueryParams] = useQueryParams({
3036
type: StringParam,

src/containers/Storage/Storage.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ interface StorageProps {
6767

6868
export const Storage = ({database, nodeId, groupId, pDiskId}: StorageProps) => {
6969
const {balancer} = useClusterBaseInfo();
70-
const additionalNodesProps = useAdditionalNodeProps({balancer});
70+
const additionalNodesProps = useAdditionalNodeProps({
71+
balancer,
72+
groupId: valueIsDefined(groupId) ? groupId.toString() : undefined,
73+
});
7174

7275
const capabilitiesLoaded = useCapabilitiesLoaded();
7376
const groupsHandlerAvailable = useStorageGroupsHandlerAvailable();

src/containers/Storage/StorageNodes/StorageNodes.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ interface StorageNodesProps {
1818
tableSettings: Settings;
1919
visibleEntities: VisibleEntities;
2020
nodesUptimeFilter: NodesUptimeFilterValues;
21-
onShowAll?: VoidFunction;
2221
sort?: SortOrder;
22+
onShowAll?: VoidFunction;
2323
handleSort?: HandleSort;
2424
}
2525

@@ -28,9 +28,9 @@ export function StorageNodes({
2828
columns,
2929
tableSettings,
3030
visibleEntities,
31-
onShowAll,
3231
nodesUptimeFilter,
3332
sort,
33+
onShowAll,
3434
handleSort,
3535
}: StorageNodesProps) {
3636
if (

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const getStorageNodesColumns = (
1919
database?: string,
2020
) => {
2121
const getNodeRef = additionalNodesProps?.getNodeRef;
22+
const groupId = additionalNodesProps?.groupId;
2223

2324
const columns: StorageNodesColumn[] = [
2425
{
@@ -81,7 +82,7 @@ const getStorageNodesColumns = (
8182

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

src/types/additionalProps.ts

+1
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
}

src/utils/additionalProps.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ import type {AdditionalNodesProps, NodeAddress} from '../types/additionalProps';
33

44
import {getBackendFromRawNodeData} from './prepareBackend';
55

6-
export const getAdditionalNodesProps = (
6+
export const getAdditionalNodesProps = ({
77
balancer = backend,
8-
useClusterBalancerAsBackend?: boolean,
9-
): AdditionalNodesProps => {
8+
useClusterBalancerAsBackend,
9+
groupId,
10+
}: {
11+
balancer?: string;
12+
useClusterBalancerAsBackend?: boolean;
13+
groupId?: string;
14+
}): AdditionalNodesProps => {
1015
return {
16+
groupId,
1117
getNodeRef: (node: NodeAddress = {}) =>
1218
getBackendFromRawNodeData(node, balancer ?? '', useClusterBalancerAsBackend),
1319
};

0 commit comments

Comments
 (0)