-
Notifications
You must be signed in to change notification settings - Fork 605
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
Add NamespaceDashboard option to ConsoleLink #2698
Add NamespaceDashboard option to ConsoleLink #2698
Conversation
8266620
to
f2b7fb6
Compare
cc: @jhadvig |
FYI @sspeiche |
if (link.spec.location !== 'NamespaceDashboard') { | ||
return false; | ||
} | ||
const namespaces = _.get(link, ['spec', 'namespaceDashboard', 'namespaces']); |
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.
Do we also wanna cover case where the array is empty ?
/kind feature |
f2b7fb6
to
798e4f3
Compare
798e4f3
to
60dbd44
Compare
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.
Thanks, @rhamilto. A few comments
return false; | ||
} | ||
const namespaces = _.get(link, ['spec', 'namespaceDashboard', 'namespaces']); | ||
return !namespaces || _.includes(namespaces, ns.metadata.name); |
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.
You want to handle both empty arrays and null/undefined. _.isEmpty
works for both.
return !namespaces || _.includes(namespaces, ns.metadata.name); | |
return _.isEmpty(namsepaces) || _.includes(namespaces, ns.metadata.name); |
if (link.spec.location !== 'NamespaceDashboard') { | ||
return false; | ||
} | ||
const namespaces = _.get(link, ['spec', 'namespaceDashboard', 'namespaces']); |
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.
const namespaces = _.get(link, ['spec', 'namespaceDashboard', 'namespaces']); | |
const namespaces: string[] = _.get(link, ['spec', 'namespaceDashboard', 'namespaces']); |
|
||
export const ConsoleLinks: React.FC<ConsoleLinksProps> = ({consoleLinks}) => { | ||
return <ul className="list-unstyled"> | ||
{_.map(_.sortBy(consoleLinks, 'spec.text'), link => { |
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.
{_.map(_.sortBy(consoleLinks, 'spec.text'), link => { | |
{_.map(_.sortBy(consoleLinks, 'spec.text'), (link: K8sResourceKind) => { |
@@ -44,6 +45,38 @@ const OverviewNamespaceSummary = ({ns}) => <div className="group"> | |||
</div> | |||
</div>; | |||
|
|||
export const getNamespaceDashboardConsoleLinks = (ns, consoleLinks) => { |
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.
export const getNamespaceDashboardConsoleLinks = (ns, consoleLinks) => { | |
export const getNamespaceDashboardConsoleLinks = (ns: K8sResourceKind, consoleLinks: K8sResourceKind[]): K8sResourceKind[] => { |
<OverviewHealth ns={ns} /> | ||
<OverviewResourceQuotas ns={ns} /> | ||
<OverviewResourceUsage ns={ns} /> | ||
<OverviewLinks ns={ns} consoleLinks={consoleLinks} /> |
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.
It would be better to connect OverviewLinks
instead of the entire OverviewNamespaceDashboard
. You generally want to connect only the child component that needs the data when possible.
60dbd44
to
21c5707
Compare
Thanks, @spadgett. Updated. |
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
/hold
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhamilto, spadgett 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 |
/hold cancel |
/retest Please review the full test history for this PR and help us cut down flakes. |
2 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. |
@rhamilto Is this feature included in OpenShfit 4.2? |
No. This is a 4.3 feature. |
Replaces #2579 as this PR does not include Cluster dashboard per @beanh66.
Note: the Launcher sections only appear if
ConsoleLink
s with locationNamespaceDashboard
exist (and optionally match the current namespace).Updated ConsoleLink CRD: