-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add storage group page #1289
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
016708d
feat: add storage group page
astandrik 6f7b800
fix: add group_id filter
astandrik 2256288
fix: overflow for table
astandrik 21c1e4c
fix: design fixes
astandrik 6e0eeb4
fix: review fixes
astandrik c6727c5
fix: lint
astandrik 6748c2d
fix: fix sticky header
astandrik 546bdeb
fix: review fixes
astandrik 963d74f
Merge branch 'main' into astandrik.add-storage-group-page-1159
astandrik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.ydb-storage-group-info { | ||
&__wrapper { | ||
display: flex; | ||
flex-flow: row wrap; | ||
gap: 7px; | ||
} | ||
} |
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,174 @@ | ||
import type {PreparedStorageGroup} from '../../store/reducers/storage/types'; | ||
import {valueIsDefined} from '../../utils'; | ||
import {cn} from '../../utils/cn'; | ||
import {formatStorageValuesToGb} from '../../utils/dataFormatters/dataFormatters'; | ||
import {bytesToSpeed} from '../../utils/utils'; | ||
import {EntityStatus} from '../EntityStatus/EntityStatus'; | ||
import {InfoViewer} from '../InfoViewer'; | ||
import type {InfoViewerProps} from '../InfoViewer/InfoViewer'; | ||
import {ProgressViewer} from '../ProgressViewer/ProgressViewer'; | ||
|
||
import {storageGroupInfoKeyset} from './i18n'; | ||
|
||
import './StorageGroupInfo.scss'; | ||
|
||
const b = cn('ydb-storage-group-info'); | ||
|
||
interface StorageGroupInfoProps extends Omit<InfoViewerProps, 'info'> { | ||
data?: PreparedStorageGroup; | ||
className?: string; | ||
} | ||
|
||
// eslint-disable-next-line complexity | ||
export function StorageGroupInfo({data, className, ...infoViewerProps}: StorageGroupInfoProps) { | ||
const { | ||
Encryption, | ||
Overall, | ||
DiskSpace, | ||
MediaType, | ||
ErasureSpecies, | ||
Used, | ||
Limit, | ||
Usage, | ||
Read, | ||
Write, | ||
GroupGeneration, | ||
Latency, | ||
AllocationUnits, | ||
State, | ||
MissingDisks, | ||
Available, | ||
LatencyPutTabletLog, | ||
LatencyPutUserData, | ||
LatencyGetFast, | ||
} = data || {}; | ||
|
||
const storageGroupInfoFirstColumn = []; | ||
|
||
if (valueIsDefined(GroupGeneration)) { | ||
storageGroupInfoFirstColumn.push({ | ||
label: storageGroupInfoKeyset('group-generation'), | ||
value: GroupGeneration, | ||
}); | ||
} | ||
if (valueIsDefined(ErasureSpecies)) { | ||
storageGroupInfoFirstColumn.push({ | ||
label: storageGroupInfoKeyset('erasure-species'), | ||
value: ErasureSpecies, | ||
}); | ||
} | ||
if (valueIsDefined(MediaType)) { | ||
storageGroupInfoFirstColumn.push({ | ||
label: storageGroupInfoKeyset('media-type'), | ||
value: MediaType, | ||
}); | ||
} | ||
if (valueIsDefined(Encryption)) { | ||
storageGroupInfoFirstColumn.push({ | ||
label: storageGroupInfoKeyset('encryption'), | ||
value: Encryption ? storageGroupInfoKeyset('yes') : storageGroupInfoKeyset('no'), | ||
}); | ||
} | ||
if (valueIsDefined(Overall)) { | ||
storageGroupInfoFirstColumn.push({ | ||
label: storageGroupInfoKeyset('overall'), | ||
value: <EntityStatus status={Overall} />, | ||
}); | ||
} | ||
if (valueIsDefined(State)) { | ||
storageGroupInfoFirstColumn.push({label: storageGroupInfoKeyset('state'), value: State}); | ||
} | ||
if (valueIsDefined(MissingDisks)) { | ||
storageGroupInfoFirstColumn.push({ | ||
label: storageGroupInfoKeyset('missing-disks'), | ||
value: MissingDisks, | ||
}); | ||
} | ||
|
||
const storageGroupInfoSecondColumn = []; | ||
|
||
if (valueIsDefined(Used) && valueIsDefined(Limit)) { | ||
storageGroupInfoSecondColumn.push({ | ||
label: storageGroupInfoKeyset('used-space'), | ||
value: ( | ||
<ProgressViewer | ||
value={Number(Used)} | ||
capacity={Number(Limit)} | ||
formatValues={formatStorageValuesToGb} | ||
colorizeProgress={true} | ||
/> | ||
), | ||
}); | ||
} | ||
if (valueIsDefined(Available)) { | ||
storageGroupInfoSecondColumn.push({ | ||
label: storageGroupInfoKeyset('available'), | ||
value: formatStorageValuesToGb(Number(Available)), | ||
}); | ||
} | ||
if (valueIsDefined(Usage)) { | ||
storageGroupInfoSecondColumn.push({ | ||
label: storageGroupInfoKeyset('usage'), | ||
value: `${Usage.toFixed(2)}%`, | ||
}); | ||
} | ||
if (valueIsDefined(DiskSpace)) { | ||
storageGroupInfoSecondColumn.push({ | ||
label: storageGroupInfoKeyset('disk-space'), | ||
value: <EntityStatus status={DiskSpace} />, | ||
}); | ||
} | ||
if (valueIsDefined(Latency)) { | ||
storageGroupInfoSecondColumn.push({ | ||
label: storageGroupInfoKeyset('latency'), | ||
value: <EntityStatus status={Latency} />, | ||
}); | ||
} | ||
if (valueIsDefined(LatencyPutTabletLog)) { | ||
storageGroupInfoSecondColumn.push({ | ||
label: storageGroupInfoKeyset('latency-put-tablet-log'), | ||
value: `${LatencyPutTabletLog} ms`, | ||
}); | ||
} | ||
if (valueIsDefined(LatencyPutUserData)) { | ||
storageGroupInfoSecondColumn.push({ | ||
label: storageGroupInfoKeyset('latency-put-user-data'), | ||
value: `${LatencyPutUserData} ms`, | ||
}); | ||
} | ||
if (valueIsDefined(LatencyGetFast)) { | ||
storageGroupInfoSecondColumn.push({ | ||
label: storageGroupInfoKeyset('latency-get-fast'), | ||
value: `${LatencyGetFast} ms`, | ||
}); | ||
} | ||
if (valueIsDefined(AllocationUnits)) { | ||
storageGroupInfoSecondColumn.push({ | ||
label: storageGroupInfoKeyset('allocation-units'), | ||
value: AllocationUnits, | ||
}); | ||
} | ||
if (valueIsDefined(Read)) { | ||
storageGroupInfoSecondColumn.push({ | ||
label: storageGroupInfoKeyset('read-throughput'), | ||
value: bytesToSpeed(Number(Read)), | ||
}); | ||
} | ||
if (valueIsDefined(Write)) { | ||
storageGroupInfoSecondColumn.push({ | ||
label: storageGroupInfoKeyset('write-throughput'), | ||
value: bytesToSpeed(Number(Write)), | ||
}); | ||
} | ||
|
||
return ( | ||
<div className={b('wrapper', className)}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets use |
||
<div className={b('col')}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need this wrapper? |
||
<InfoViewer info={storageGroupInfoFirstColumn} {...infoViewerProps} /> | ||
</div> | ||
<div className={b('col')}> | ||
<InfoViewer info={storageGroupInfoSecondColumn} {...infoViewerProps} /> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"encryption": "Encryption", | ||
"overall": "Overall", | ||
"disk-space": "Disk Space", | ||
"media-type": "Media Type", | ||
"erasure-species": "Erasure Species", | ||
"used-space": "Used Space", | ||
"usage": "Usage", | ||
"read-throughput": "Read Throughput", | ||
"write-throughput": "Write Throughput", | ||
"yes": "Yes", | ||
"no": "No", | ||
"group-generation": "Group Generation", | ||
"latency": "Latency", | ||
"allocation-units": "Units", | ||
"state": "State", | ||
"missing-disks": "Missing Disks", | ||
"available": "Available Space", | ||
"latency-put-tablet-log": "Latency (Put Tablet Log)", | ||
"latency-put-user-data": "Latency (Put User Data)", | ||
"latency-get-fast": "Latency (Get Fast)" | ||
} |
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,7 @@ | ||
import {registerKeysets} from '../../../utils/i18n'; | ||
|
||
import en from './en.json'; | ||
|
||
const COMPONENT = 'storage-group-info'; | ||
|
||
export const storageGroupInfoKeyset = registerKeysets(COMPONENT, {en}); |
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,29 @@ | ||
@import '../../styles/mixins.scss'; | ||
|
||
.ydb-storage-group-page { | ||
position: relative; | ||
|
||
display: flex; | ||
overflow: auto; | ||
flex-direction: column; | ||
gap: 20px; | ||
|
||
height: 100%; | ||
padding: 20px; | ||
|
||
&__meta, | ||
&__title, | ||
&__info, | ||
&__tabs { | ||
position: sticky; | ||
left: 0; | ||
} | ||
|
||
&__info { | ||
margin-top: var(--g-spacing-10); | ||
} | ||
|
||
&__tabs { | ||
@include tabs-wrapper-styles(); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and farther lets add spaces between the digits of the number (like it is done in
Available Space
field)