-
Notifications
You must be signed in to change notification settings - Fork 641
CONSOLE-4580: Refactor PVCActionFactory to hook form. #15078
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: main
Are you sure you want to change the base?
Conversation
@Mylanos: This pull request references CONSOLE-4580 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
…sourceActionCreators, replace deprecated K8sKind type, introduce generic type for K8sResourceKind to make the type assertions explicite.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Mylanos The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…tions via hook provider.
3910a30
to
2c04374
Compare
@Mylanos: This pull request references CONSOLE-4580 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
@Mylanos: This pull request references CONSOLE-4580 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
@Mylanos: This pull request references CONSOLE-4580 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
…s, convert persistent-volume-claim.jsx to persistent-volume-claim.tsx, update i18n
…ourceProvider, consume actions from ActionsResourceProvider inside VolumeSnapshots, update i18n, remove PVC and VolumeSnapshot actions from kebabFactory.
2c04374
to
40e05c5
Compare
/retest |
@Mylanos: all tests passed! 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. |
|
||
const [columns] = useActiveColumns({ | ||
columns: getTableColumns(rowData.customData?.disableItems), | ||
const columns = getTableColumns(t, props.rowData.customData.disableItems); |
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.
we should make the getTableColumns an inner function to have the t
available through the closure. Or explore utilization of useMemo to memoize the columns.
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.
The getTableColumns
is used at multiple places - FilteredSnapshotTable
and VolumeSnapshotTable
, these components don't even share a shared parent, so passing it via props from parent is also not an option. Moving it inside of the both components won't by as DRY as having the function separated in the global scope, so I would opt in for keeping it in the scope outside the components @vojtechszocs
@@ -81,7 +81,7 @@ export type NodeMetrics = { | |||
}; | |||
|
|||
export type PVCMetrics = { | |||
usedCapacity: MetricValuesByName; | |||
usedCapacity?: MetricValuesByName; |
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.
revisit
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.
This has to be optional, as the pvcMetric
fallback value is {}
, which causes type errors when dispatching the created pvcMetric
. See code.
@@ -186,7 +174,7 @@ const Details_ = ({ flags, obj: pvc }) => { | |||
const totalCapacityMetric = convertToBaseValue(storage); | |||
const totalRequestMetric = convertToBaseValue(requestedStorage); | |||
const usedMetrics = response?.data?.result?.[0]?.value?.[1]; |
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.
fallback value to 0, to never have an empty value.
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.
As discussed, having no fallback value has not caused issues in the past, also the added cast to Number
inside of the availableMetrics
metrics is protected by fallback value. So I will opt in for keeping the changes, only replacing the casting part from the parseInt()
to Number()
PR needs rebase. 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. |
Review comments above are made on behalf of @vojtechszocs, @jon. |
Moved away from using the generic
kebabFactory
forPVC
actions that were used inside of thePVC
andVolumeSnapshot
page. Created hook providers that are being used in these two resource pages to accessPVC
actions instead. Convertedpersistent-volume-claim.jsx
to TS.after:
Screen.Recording.2025-05-22.at.11.38.55.mov
Possible tests:
PVC
s andVolumeSnapshot
list and details page behave as expected?PVC
andVolumeSnapshot
list and details page contain all of the expected actions?