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
create topology side panel using dynamic plugin extensions #9306
create topology side panel using dynamic plugin extensions #9306
Conversation
/retest |
84bcbcd
to
bae8517
Compare
? resurceLinkExtension | ||
.sort((a, b) => a.properties.priority - b.properties.priority) | ||
.find(({ properties: { link } }) => !!link(element)) | ||
.properties?.link?.(element) |
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.
link
function will be called twice on the last match instead of only once.
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.
yes, this is intentional as we need to find the callback that doesn't return null and undefined and get result from that callback.
Couldn't find a lodash utility that does this.
<div className="overview__sidebar-pane-head resource-overview__heading"> | ||
<h1 className="co-m-pane__heading"> | ||
<div className="co-m-pane__name co-resource-item">{resourceLink}</div> | ||
<div className="co-actions">{/** actions */}</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.
Is this a WIP for another PR? If so add a comment.
If not, you should make use of the actions extensions to populate a menu.
@@ -0,0 +1,3 @@ | |||
.topology-sidebar-alert { |
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.
Follow conventions.
useResourceAlertsContent?: (element: GraphElement) => DetailsResourceAlertContent; | ||
element: GraphElement; | ||
}> = ({ title, dismissible = false, useResourceAlertsContent, element }) => { | ||
const [showAlert, setShowAlert] = React.useState<boolean>(true); |
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.
Don't we store these values in user settings for health checks?
@@ -103,4 +103,5 @@ export type DetailsResourceAlertContent = { | |||
content: React.Component | undefined; | |||
variant?: 'success' | 'danger' | 'warning' | 'info' | 'default'; | |||
actionLinks?: React.ReactNode; | |||
onClose?: () => void; |
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 is this added to the API?
I don't think an alert needs to know when it is dismissed.
linkForResource?: (obj: K8sResourceKind) => React.ReactElement; | ||
linkForResource?: (obj) => React.ReactElement; |
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 remove the type?
<div key={model.kind}> | ||
<div key={'kind'}> |
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.
keys should be unique
import { TYPE_HELM_RELEASE } from '../../components/const'; | ||
import TopologyHelmReleaseNotesPanel from '../../TopologyHelmReleaseNotesPanel'; | ||
|
||
export const useHelmReleasePanelDetailsTabSection = (element: GraphElement) => { |
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're going to have a lot of sections.
The first check must be made efficiently to filter out all the sections which do not apply to the given element.
These should not be rendered as a hook.
After successfully passing the check, they should return a component which itself can use hooks within.
const resourceLink = useDetailsResourceLink(element); | ||
return ( | ||
<div className="overview__sidebar-pane-head resource-overview__heading"> | ||
<h1 className="co-m-pane__heading"> | ||
<div className="co-m-pane__name co-resource-item">{resourceLink}</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.
There needs to be a fallback resource link if one is not supplied via extension.
- extract the resource and create a ResourceLink
- render a non-linkable text based on the element's label
"insertAfter": "helm-release-panel-tab-section-details", | ||
"insertBefore": "helm-release-panel-tab-section-releaseNotes" |
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 both before and after properties?
Note that the order in which they are defined should remain in tact so long as they are defined by the same plugin.
Therefore if the helm plugin is contributing all help sections, we should not even need to define the before or after properties.
bcb77f4
to
7b8963f
Compare
7b8963f
to
61ac134
Compare
/assign |
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.
/approve
Changes looks good to me. Tested locally. Works as expected.
/lgtm |
/retest Please review the full test history for this PR and help us cut down flakes. |
4 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
7 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/hold CI is continuously failing. |
61ac134
to
d29c2e2
Compare
const { t } = useTranslation(); | ||
const actions = React.useMemo( | ||
() => [ | ||
getHelmUpgradeAction(scope, t), | ||
getHelmRollbackAction(scope, t), | ||
getHelmDeleteAction(scope, t), | ||
], | ||
[scope, t], | ||
); |
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 can actually re use the original provider.
const { t } = useTranslation(); | |
const actions = React.useMemo( | |
() => [ | |
getHelmUpgradeAction(scope, t), | |
getHelmRollbackAction(scope, t), | |
getHelmDeleteAction(scope, t), | |
], | |
[scope, t], | |
); | |
const actions = useHelmActionProvider(scope); |
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.
@rohitkrai03 fixed!
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rohitkrai03, sahil143 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 |
/retest |
/retest |
/hold cancel |
fixes: https://issues.redhat.com/browse/ODC-5845
This PR creates the topology side panel to use the dynamic plugin extensions