-
Notifications
You must be signed in to change notification settings - Fork 50
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: enhance Ingress details view #3205
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { useTranslation } from 'react-i18next'; | ||
import { GenericList } from 'shared/components/GenericList/GenericList'; | ||
import { LayoutPanelRow } from 'shared/components/LayoutPanelRow/LayoutPanelRow'; | ||
import { UI5Panel } from 'shared/components/UI5Panel/UI5Panel'; | ||
import { EMPTY_TEXT_PLACEHOLDER } from 'shared/constants'; | ||
|
||
export const IngressSpecification = ({ resource }) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<> | ||
<UI5Panel title={t('common.headers.specification')}> | ||
{resource.spec.ingressClassName && ( | ||
<LayoutPanelRow | ||
name={t('ingresses.labels.ingress-class-name')} | ||
value={resource.spec.ingressClassName} | ||
/> | ||
)} | ||
{resource.spec?.tls && ( | ||
<GenericList | ||
title={t('ingresses.labels.tls')} | ||
headerRenderer={() => [ | ||
t('ingresses.labels.hosts'), | ||
t('ingresses.labels.secret-name'), | ||
]} | ||
rowRenderer={tls => [ | ||
tls?.hosts?.join(', ') ?? EMPTY_TEXT_PLACEHOLDER, | ||
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. I think it would make sense to use the |
||
tls?.secretName ?? EMPTY_TEXT_PLACEHOLDER, | ||
]} | ||
entries={resource.spec?.tls} | ||
searchSettings={{ | ||
showSearchField: false, | ||
}} | ||
/> | ||
)} | ||
</UI5Panel> | ||
</> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import { useMemo } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { ConditionList } from 'shared/components/ConditionList/ConditionList'; | ||
import { EMPTY_TEXT_PLACEHOLDER } from 'shared/constants'; | ||
import { spacing } from '@ui5/webcomponents-react-base'; | ||
import './IngressStatus.scss'; | ||
|
||
export const IngressStatus = ({ resource }) => { | ||
const { t } = useTranslation(); | ||
const ingresses = useMemo(() => { | ||
return resource?.status?.loadBalancer?.ingress?.map(ingress => ingress); | ||
}, [resource]); | ||
|
||
return ingresses ? ( | ||
<ConditionList | ||
className="load-balancers" | ||
conditions={ingresses.map(ingress => ({ | ||
header: { | ||
titleText: ingress.hostname ? ( | ||
<div> | ||
<span | ||
style={{ ...spacing.sapUiTinyMarginEnd }} | ||
className="title bsl-has-color-status-4" | ||
> | ||
{`${t('ingresses.labels.host-name')}:`} | ||
</span> | ||
{`${ingress.hostname}`} | ||
</div> | ||
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. can we replace this somehow with a UI5 component? 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. I don't think so, that's how we are doing it in metadata and status - Labels have slightly different color |
||
) : ( | ||
<div> | ||
<span | ||
style={{ ...spacing.sapUiTinyMarginEnd }} | ||
className="title bsl-has-color-status-4" | ||
> | ||
{`${t('ingresses.labels.ip')}:`} | ||
</span> | ||
{`${ingress.ip}`} | ||
</div> | ||
), | ||
}, | ||
customContent: [ | ||
...(ingress.hostname | ||
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. as far as I see we can remove those spread operators here and below and simply not place the resulting object inside of an array |
||
? [ | ||
{ | ||
header: t('ingresses.labels.host-name'), | ||
value: ingress.hostname, | ||
className: 'load-balancers__content', | ||
}, | ||
] | ||
: []), | ||
...(ingress.ip | ||
? [ | ||
{ | ||
header: t('ingresses.labels.ip'), | ||
value: ingress.ip, | ||
className: 'load-balancers__content', | ||
}, | ||
] | ||
: []), | ||
{ | ||
header: t('ingresses.labels.ports'), | ||
value: ingress.ports ? ( | ||
<ConditionList | ||
conditions={ingress?.ports?.map(port => { | ||
return { | ||
header: { | ||
titleText: port.port, | ||
status: port.error ? 'Error' : '', | ||
}, | ||
customContent: [ | ||
port.protocol | ||
? { | ||
header: t('ingresses.labels.protocol'), | ||
value: port.protocol, | ||
} | ||
: {}, | ||
...(port.error | ||
? [ | ||
{ | ||
header: 'Error', | ||
value: port.error, | ||
}, | ||
] | ||
: []), | ||
], | ||
}; | ||
})} | ||
/> | ||
) : ( | ||
EMPTY_TEXT_PLACEHOLDER | ||
), | ||
}, | ||
], | ||
}))} | ||
/> | ||
) : ( | ||
<div | ||
className="content bsl-has-color-text-1" | ||
style={{ | ||
...spacing.sapUiSmallMarginBegin, | ||
...spacing.sapUiSmallMarginBottom, | ||
}} | ||
> | ||
{EMPTY_TEXT_PLACEHOLDER} | ||
</div> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.load-balancers { | ||
.expandable-item__message:not(.load-balancers__content) { | ||
.title { | ||
margin-left: 0.5rem !important; | ||
} | ||
} | ||
|
||
&__content { | ||
margin-left: 1.5rem !important; | ||
} | ||
} |
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 merge these two methods, using a single loop for both
also, is the naming pods vs. ports intended?
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, it was a typo :)