-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Storage): add advanced disks view
- Loading branch information
1 parent
cf5e090
commit 1282052
Showing
24 changed files
with
324 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
.ydb-storage-disks { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
gap: 20px; | ||
|
||
width: max-content; | ||
|
||
&__vdisks-wrapper { | ||
display: flex; | ||
flex-grow: 1; | ||
flex-direction: row; | ||
gap: 4px; | ||
|
||
width: 300px; | ||
} | ||
|
||
&__pdisks-wrapper { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: left; | ||
gap: 6px; | ||
|
||
width: max-content; | ||
} | ||
|
||
&__vdisk-item { | ||
flex-basis: 8px; | ||
flex-shrink: 0; | ||
} | ||
&__vdisk-progress-bar { | ||
--progress-bar-height: 18px; | ||
|
||
border-radius: 4px; | ||
} | ||
|
||
&__pdisk-item { | ||
width: 80px; | ||
} | ||
&__pdisk-progress-bar { | ||
--progress-bar-height: 20px; | ||
padding-left: var(--g-spacing-2); | ||
|
||
text-align: left; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React from 'react'; | ||
|
||
import {VDiskWithDonorsStack} from '../../../components/VDisk/VDiskWithDonorsStack'; | ||
import type {NodesMap} from '../../../types/store/nodesList'; | ||
import {cn} from '../../../utils/cn'; | ||
import {stringifyVdiskId} from '../../../utils/dataFormatters/dataFormatters'; | ||
import type {PreparedVDisk} from '../../../utils/disks/types'; | ||
import {PDisk} from '../PDisk'; | ||
|
||
import './Disks.scss'; | ||
|
||
const b = cn('ydb-storage-disks'); | ||
|
||
interface DisksProps { | ||
vDisks?: PreparedVDisk[]; | ||
nodes?: NodesMap; | ||
} | ||
|
||
export function Disks({vDisks = [], nodes}: DisksProps) { | ||
const [highlightedVDisk, setHighlightedVDisk] = React.useState<string | undefined>(); | ||
|
||
return ( | ||
<div className={b(null)}> | ||
<div className={b('vdisks-wrapper')}> | ||
{vDisks?.map((vDisk) => { | ||
// Do not show PDisk popup for VDisk | ||
const vDiskToShow = {...vDisk, PDisk: undefined}; | ||
|
||
const vDiskId = stringifyVdiskId(vDisk.VDiskId); | ||
|
||
return ( | ||
<div | ||
key={stringifyVdiskId(vDisk.VDiskId)} | ||
style={{ | ||
flexGrow: Number(vDisk.AllocatedSize) || 1, | ||
}} | ||
className={b('vdisk-item')} | ||
> | ||
<VDiskWithDonorsStack | ||
data={vDiskToShow} | ||
nodes={nodes} | ||
compact={true} | ||
showPopup={highlightedVDisk === vDiskId} | ||
onShowPopup={() => setHighlightedVDisk(vDiskId)} | ||
onHidePopup={() => setHighlightedVDisk(undefined)} | ||
progressBarClassName={b('vdisk-progress-bar')} | ||
/> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
|
||
<div className={b('pdisks-wrapper')}> | ||
{vDisks?.map((vDisk) => { | ||
const vDiskId = stringifyVdiskId(vDisk.VDiskId); | ||
|
||
if (!vDisk.PDisk) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<PDisk | ||
key={vDisk.PDisk.PDiskId} | ||
className={b('pdisk-item')} | ||
progressBarClassName={b('pdisk-progress-bar')} | ||
data={vDisk.PDisk} | ||
showPopup={highlightedVDisk === vDiskId} | ||
onShowPopup={() => setHighlightedVDisk(vDiskId)} | ||
onHidePopup={() => setHighlightedVDisk(undefined)} | ||
/> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.