-
Notifications
You must be signed in to change notification settings - Fork 33
Add utilization info on storage pool list page #2144
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
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: weirdwiz The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
ea22dc6
to
4429cfe
Compare
Signed-off-by: Divyansh Kamboj <[email protected]>
@weirdwiz: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
@weirdwiz u also need to update status card on main overview dashboard: https://github.com/red-hat-storage/odf-console/blob/master/packages/odf/components/overview/storage-cluster-card/StorageClusterCard.tsx#L178 |
import { global_danger_color_100 as dangerColor } from '@patternfly/react-tokens/dist/js/global_danger_color_100'; | ||
import { global_warning_color_100 as warningColor } from '@patternfly/react-tokens/dist/js/global_warning_color_100'; |
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.
import { global_danger_color_100 as dangerColor } from '@patternfly/react-tokens/dist/js/global_danger_color_100'; | |
import { global_warning_color_100 as warningColor } from '@patternfly/react-tokens/dist/js/global_warning_color_100'; | |
import { global_danger_color_100 as dangerColor } from '@patternfly/react-tokens'; | |
import { global_warning_color_100 as warningColor } from '@patternfly/react-tokens'; |
<div className="odf-pool-utilization-popover"> | ||
<div className="odf-pool-utilization-popover__header"> | ||
<Icon style={{ color: iconColor }} className="pf-v5-u-mr-sm" /> | ||
<span className="odf-pool-utilization-popover__pool-name"> | ||
{pool.metadata.name} | ||
</span> | ||
</div> | ||
<div className="odf-pool-utilization-popover__body"> | ||
<div className="odf-pool-utilization-popover__item"> | ||
<strong>{t('Used:')}</strong> {pool.usedCapacity} | ||
<Label | ||
variant="filled" | ||
color={pool.type === PoolType.BLOCK ? 'blue' : 'green'} | ||
className="pf-v5-u-ml-sm" | ||
> | ||
{volumeMode} | ||
</Label> | ||
</div> | ||
<div className="odf-pool-utilization-popover__item"> | ||
<strong>{t('Maximum available:')}</strong> {pool.totalCapacity} | ||
</div> | ||
{pool.critical && ( | ||
<div className="odf-pool-utilization-popover__message"> | ||
{t( | ||
'Storage pool critically full. Add capacity to avoid disruptions' | ||
)} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; |
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.
nits: use https://v5-archive.patternfly.org/components/description-list#horizontal for better styling...
.odf-pool-utilization-card { | ||
&__alert { | ||
display: flex; | ||
align-items: center; | ||
gap: var(--pf-v5-global--spacer--sm); | ||
margin-bottom: var(--pf-v5-global--spacer--sm); | ||
|
||
&-icon { | ||
color: var(--pf-v5-global--warning-color--100); | ||
font-size: var(--pf-v5-global--icon--FontSize--lg); | ||
} | ||
|
||
&-count { | ||
font-size: var(--pf-v5-global--FontSize--2xl); | ||
font-weight: var(--pf-v5-global--FontWeight--bold); | ||
color: var(--pf-v5-global--warning-color--100); | ||
} | ||
} | ||
|
||
&__description { | ||
color: var(--pf-v5-global--Color--200); | ||
margin-bottom: var(--pf-v5-global--spacer--md); | ||
} | ||
|
||
&__usage { | ||
display: flex; | ||
align-items: center; | ||
cursor: pointer; | ||
} | ||
|
||
&__highlighted-row { | ||
border-left: 3px solid var(--pf-v5-global--primary-color--100); | ||
padding-left: var(--pf-v5-global--spacer--md); | ||
} | ||
|
||
&__no-issues, | ||
&__loading, | ||
&__error { | ||
text-align: center; | ||
padding: var(--pf-v5-global--spacer--xl) var(--pf-v5-global--spacer--md); | ||
color: var(--pf-v5-global--Color--200); | ||
} | ||
|
||
&__healthy-state { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
padding: var(--pf-v5-global--spacer--2xl) var(--pf-v5-global--spacer--md); | ||
min-height: 200px; | ||
} | ||
|
||
&__healthy-icon { | ||
margin-bottom: var(--pf-v5-global--spacer--md); | ||
} | ||
|
||
&__healthy-message { | ||
font-size: var(--pf-v5-global--FontSize--xl); | ||
color: var(--pf-v5-global--Color--100); | ||
margin: 0; | ||
} | ||
|
||
&__error { | ||
color: var(--pf-v5-global--danger-color--100); | ||
} | ||
} | ||
|
||
.odf-pool-utilization-popover { | ||
&__header { | ||
display: flex; | ||
align-items: center; | ||
margin-bottom: var(--pf-v5-global--spacer--sm); | ||
font-weight: var(--pf-v5-global--FontWeight--bold); | ||
} | ||
|
||
&__pool-name { | ||
color: var(--pf-v5-global--Color--100); | ||
} | ||
|
||
&__body { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--pf-v5-global--spacer--sm); | ||
} | ||
|
||
&__item { | ||
display: flex; | ||
align-items: center; | ||
gap: var(--pf-v5-global--spacer--sm); | ||
} | ||
|
||
&__message { | ||
margin-top: var(--pf-v5-global--spacer--sm); | ||
padding-top: var(--pf-v5-global--spacer--sm); | ||
color: var(--pf-v5-global--Color--200); | ||
} | ||
} |
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.
most of this won't be needed if u use https://v5-archive.patternfly.org/components/description-list#horizontal from PF5...
.odf-pool-utilization-card { | ||
&__alert { | ||
display: flex; | ||
align-items: center; | ||
gap: var(--pf-v5-global--spacer--sm); | ||
margin-bottom: var(--pf-v5-global--spacer--sm); | ||
|
||
&-icon { | ||
color: var(--pf-v5-global--warning-color--100); | ||
font-size: var(--pf-v5-global--icon--FontSize--lg); | ||
} | ||
|
||
&-count { | ||
font-size: var(--pf-v5-global--FontSize--2xl); | ||
font-weight: var(--pf-v5-global--FontWeight--bold); | ||
color: var(--pf-v5-global--warning-color--100); | ||
} | ||
} | ||
|
||
&__description { | ||
color: var(--pf-v5-global--Color--200); | ||
margin-bottom: var(--pf-v5-global--spacer--md); | ||
} | ||
|
||
&__usage { | ||
display: flex; | ||
align-items: center; | ||
cursor: pointer; | ||
} | ||
|
||
&__highlighted-row { | ||
border-left: 3px solid var(--pf-v5-global--primary-color--100); | ||
padding-left: var(--pf-v5-global--spacer--md); | ||
} | ||
|
||
&__no-issues, | ||
&__loading, | ||
&__error { | ||
text-align: center; | ||
padding: var(--pf-v5-global--spacer--xl) var(--pf-v5-global--spacer--md); | ||
color: var(--pf-v5-global--Color--200); | ||
} | ||
|
||
&__error { | ||
color: var(--pf-v5-global--danger-color--100); | ||
} | ||
} | ||
|
||
.odf-pool-utilization-popover { | ||
&__header { | ||
display: flex; | ||
align-items: center; | ||
margin-bottom: var(--pf-v5-global--spacer--sm); | ||
font-weight: var(--pf-v5-global--FontWeight--bold); | ||
} | ||
|
||
&__pool-name { | ||
color: var(--pf-v5-global--Color--100); | ||
} | ||
|
||
&__body { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--pf-v5-global--spacer--sm); | ||
} | ||
|
||
&__item { | ||
display: flex; | ||
align-items: center; | ||
gap: var(--pf-v5-global--spacer--sm); | ||
} | ||
|
||
&__message { | ||
margin-top: var(--pf-v5-global--spacer--sm); | ||
padding-top: var(--pf-v5-global--spacer--sm); | ||
color: var(--pf-v5-global--Color--200); | ||
} | ||
} |
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.
I can see multiple classes been repeated (copy-pasted) here from other file... keep same classes at a single common scss file and import from there...
@@ -0,0 +1 @@ | |||
export * from './PoolUtilizationPopoverContent'; |
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.
move all the files under this folder to pool-utilization-card
folder directly... it's a helper component only used in that card, we don't need entire new folder for this under components...
}: CustomData = rowData; | ||
|
||
const poolType = obj.type; | ||
const hideItems = | ||
poolType === PoolType.FILESYSTEM | ||
? [ModalKeys.EDIT_LABELS, ModalKeys.EDIT_ANN] | ||
: []; | ||
const replica = obj.spec?.replicated?.size; |
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.
why have we removed this ??
const rawCapacity: string = poolRawCapacity?.[name] | ||
? humanizeBinaryBytes(poolRawCapacity?.[name])?.string | ||
: '-'; |
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.
same here...
<div | ||
className="odf-pool-utilization-card__usage" | ||
style={{ cursor: 'pointer' }} | ||
> | ||
{isCritical ? ( | ||
<ExclamationCircleIcon | ||
style={{ color: dangerColor.value }} | ||
className="pf-v5-u-mr-sm" | ||
/> | ||
) : ( | ||
<ExclamationTriangleIcon | ||
style={{ color: warningColor.value }} | ||
className="pf-v5-u-mr-sm" | ||
/> | ||
)} | ||
<span> | ||
{usedCapacityDisplay} ({utilizationPercentage.toFixed(1)}%) | ||
</span> | ||
</div> |
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.
use Button
with variant as "link"
import { global_danger_color_100 as dangerColor } from '@patternfly/react-tokens/dist/js/global_danger_color_100'; | ||
import { global_success_color_100 as successColor } from '@patternfly/react-tokens/dist/js/global_success_color_100'; | ||
import { global_warning_color_100 as warningColor } from '@patternfly/react-tokens/dist/js/global_warning_color_100'; |
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.
no need to import from dist
export const POOL_NEAR_FULL_THRESHOLD = 70; // percent | ||
export const POOL_FULL_THRESHOLD = 90; // percent | ||
|
||
export enum PoolUtilizationState { | ||
NORMAL = 'NORMAL', | ||
NEAR_FULL = 'NEAR_FULL', | ||
FULL = 'FULL', | ||
} |
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.
move to constants
@@ -36,6 +36,10 @@ | |||
"{{count}} results found for {{clusterName}}_other": "{{count}} results found for {{clusterName}}", | |||
"{{count}} selected_one": "{{count}} selected", | |||
"{{count}} selected_other": "{{count}} selected", | |||
"{{count}} storage pools critically full_one": "{{count}} storage pools critically full", |
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.
"{{count}} storage pools critically full_one": "{{count}} storage pools critically full", | |
"{{count}} storage pools critically full_one": "{{count}} storage pool critically full", |
@@ -36,6 +36,10 @@ | |||
"{{count}} results found for {{clusterName}}_other": "{{count}} results found for {{clusterName}}", | |||
"{{count}} selected_one": "{{count}} selected", | |||
"{{count}} selected_other": "{{count}} selected", | |||
"{{count}} storage pools critically full_one": "{{count}} storage pools critically full", | |||
"{{count}} storage pools critically full_other": "{{count}} storage pools critically full", | |||
"{{count}} storage pools need attention_one": "{{count}} storage pools need attention", |
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.
"{{count}} storage pools need attention_one": "{{count}} storage pools need attention", | |
"{{count}} storage pools need attention_one": "{{count}} storage pool needs attention", |
@@ -267,6 +269,21 @@ export const getPoolQuery = ( | |||
[StorageDashboardQuery.POOL_COMPRESSION_ELIGIBILITY]: `(((ceph_pool_compress_under_bytes{managedBy='${managedByOCS}'} > 0) / ceph_pool_stored_raw{managedBy='${managedByOCS}'}) * 100) * on (pool_id) group_left(name)ceph_pool_metadata{name=~'${names}',managedBy='${managedByOCS}'}`, | |||
[StorageDashboardQuery.POOL_COMPRESSION_RATIO]: `((ceph_pool_compress_under_bytes{managedBy='${managedByOCS}'} / ceph_pool_compress_bytes_used{managedBy='${managedByOCS}'} > 0) and on(pool_id) (((ceph_pool_compress_under_bytes{managedBy='${managedByOCS}'} > 0) / ceph_pool_stored_raw{managedBy='${managedByOCS}'}) * 100 > 0.5)) * on (pool_id) group_left(name)ceph_pool_metadata{name=~'${names}',managedBy='${managedByOCS}'}`, | |||
[StorageDashboardQuery.POOL_MIRRORING_IMAGE_HEALTH]: `max by (namespace, managedBy, rados_namespace, name) (ocs_pool_mirroring_image_health{managedBy='${managedByOCS}', name=~'${names}'}) * on (namespace, managedBy, rados_namespace, name) group_left () (max by (namespace, managedBy, rados_namespace, name) (ocs_pool_mirroring_status{managedBy='${managedByOCS}', name=~'${names}'}))`, | |||
[StorageDashboardQuery.POOL_UTILIZATION_PERCENTAGE]: `((ceph_pool_bytes_used{managedBy='${managedByOCS}'} / (ceph_pool_bytes_used{managedBy='${managedByOCS}'} + ceph_pool_avail_raw{managedBy='${managedByOCS}'})) * 100) * on (pool_id) group_left(name)ceph_pool_metadata{name=~'${names}',managedBy='${managedByOCS}'}`, |
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.
@aruniiird can you PTAL at the queries?
Uh oh!
There was an error while loading. Please reload this page.