-
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 all 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,44 @@ | ||
import { useTranslation } from 'react-i18next'; | ||
import { GenericList } from 'shared/components/GenericList/GenericList'; | ||
import { LayoutPanelRow } from 'shared/components/LayoutPanelRow/LayoutPanelRow'; | ||
import { Tokens } from 'shared/components/Tokens'; | ||
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 ? ( | ||
<Tokens tokens={tls?.hosts} /> | ||
) : ( | ||
EMPTY_TEXT_PLACEHOLDER | ||
), | ||
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,102 @@ | ||
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 | ||
? { | ||
header: t('ingresses.labels.host-name'), | ||
value: ingress.hostname, | ||
className: 'load-balancers__content', | ||
} | ||
: null, | ||
ingress.ip | ||
? { | ||
header: t('ingresses.labels.ip'), | ||
value: ingress.ip, | ||
className: 'load-balancers__content', | ||
} | ||
: null, | ||
{ | ||
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, | ||
} | ||
: null, | ||
port.error | ||
? { | ||
header: 'Error', | ||
value: port.error, | ||
} | ||
: null, | ||
], | ||
}; | ||
})} | ||
/> | ||
) : ( | ||
EMPTY_TEXT_PLACEHOLDER | ||
), | ||
className: ingress.ports ? '' : 'load-balancers__content', | ||
}, | ||
], | ||
}))} | ||
/> | ||
) : ( | ||
<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 :)