Skip to content
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: Add long columns in status card #3324

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion docs/extensibility/30-details-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ In the **data.details** section you can provide configuration of four optional c

### **header**, **status**, **body** and **health** Parameters

This table lists the available parameters of the **data.details.header**, **data.details.status**, **data.details.health** and/or **data.details.body** section in your resource ConfigMap. You can learn whether each of the parameters is required and what purpose it serves. The **data.details.header**, **data.details.health** and **data.details.body** components are arrays of objects. The **data.details.status** component is an object that accepts the **header** and **details** parameters. Within **data.details.status**, the **header** component is an object, and the **details** component is an array of objects.
This table lists the available parameters of the **data.details.header**, **data.details.status**, **data.details.health** and/or **data.details.body** section in your resource ConfigMap. You can learn whether each of the parameters is required and what purpose it serves. The **data.details.header**, **data.details.health** and **data.details.body** components are arrays of objects. The **data.details.status** component is an object that accepts the **header** and **details** parameters. Within **data.details.status**, the **header** component is an object, and the **body** component is an array of objects.

| Parameter | Required | Type | Description |
| --------------------- | -------- | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -21,6 +21,46 @@ This table lists the available parameters of the **data.details.header**, **data

Extra parameters might be available for specific widgets.

#### Status Body

The **data.details.status.body** is an array of objects. By default listed values are displayed in two columns. Adding parameter **fullWidth: true** will display values in one column. The **data.details.status.body** accepts one widget (for example [ConditionList](./50-list-and-details-widgets.md#conditionList))

See the following examples:

```yaml
details:
status:
header:
- source: status.value1 & '/' & status.value2
widget: Badge
highlights:
positive: status.value1 = status.value2
critical: status.value1 != status.value2
description: 'Example description'
body:
- name: Replicas
source: status.replicas
- name: Containers
source: status.containers
fullWidth: true
- name: Condition details
widget: ConditionList
source: status.conditions
```

```yaml
details:
status:
- name: Replicas
source: status.replicas
- name: Containers
source: status.containers
fullWidth: true
- name: Condition details
widget: ConditionList
source: status.conditions
```

#### Status Header

The **data.details.status.header** accepts one widget (for example [Badge](./50-list-and-details-widgets.md#badge)), displayed on the right side of the **Status** section header. This widget is used to summarize the status of the resource.
Expand All @@ -45,6 +85,9 @@ details:
body:
- name: Replicas
source: status.replicas
- name: Containers
source: status.containers
fullWidth: true
- name: Condition details
widget: ConditionList
source: status.conditions
Expand Down
4 changes: 2 additions & 2 deletions docs/extensibility/50-list-and-details-widgets.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You can distinguish the following widget types:
- [Inline widgets](#inline-widgets) for simple values in **data.list**, **data.details.header**, **data.details.status** and **data.detail.bodies**
- [`Bagde`](#badge)
- [`ControlledBy`](#controlledby)
- [`ConditionList`](#conditionList) - used only in **data.details.status**
- [`ConditionList`](#conditionList) - used only in **data.details.status** or **data.details.status.body**
- [`ExternalLink`](#externallink)
- [`ExternalLinkButton`](#externallinkbutton)
- [`JoinedArray`](#joinedarray)
Expand Down Expand Up @@ -95,7 +95,7 @@ This is an exaple of kind only:

### `ConditionList`

The `ConditionList` widget renders the conditions as an expandable list with condition details. This widget is primarily designed for the overview section **data.details.status**
The `ConditionList` widget renders the conditions as an expandable list with condition details. This widget is primarily designed for the overview section **data.details.status** or **data.details.status.body**

See the following example:

Expand Down
1 change: 1 addition & 0 deletions src/components/Extensibility/ExtensibilityDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export const ExtensibilityDetailsCore = ({
.filter(def => def.widget !== 'ConditionList')
.map((def, i) => ({
header: widgetT(def),
fullWidth: def.fullWidth,
value: resource => (
<Widget
key={i}
Expand Down
19 changes: 19 additions & 0 deletions src/shared/components/ResourceDetails/ResourceDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,25 @@ function Resource({
{customStatusColumns
?.filter(filterColumns)
.filter(col => !col?.conditionComponent)
?.filter(col => !col?.fullWidth || col?.fullWidth === false)
?.map(col => (
<DynamicPageComponent.Column
key={col.header}
title={col.header}
>
{col.value(resource)}
</DynamicPageComponent.Column>
))}
</>
) : null
}
customColumnsLong={
customStatusColumns?.length ? (
<>
{customStatusColumns
?.filter(filterColumns)
.filter(col => !col?.conditionComponent)
?.filter(col => col?.fullWidth && col?.fullWidth === true)
?.map(col => (
<DynamicPageComponent.Column
key={col.header}
Expand Down
11 changes: 11 additions & 0 deletions src/shared/components/ResourceStatusCard/ResourceStatusCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ConditionList } from '../ConditionList/ConditionList';
export function ResourceStatusCard({
statusBadge,
customColumns,
customColumnsLong,
conditions,
customConditionsComponent,
}) {
Expand Down Expand Up @@ -34,6 +35,16 @@ export function ResourceStatusCard({
{customColumns}
</div>
)}
{customColumnsLong && (
<div
style={{
...spacing.sapUiSmallMargin,
...spacing.sapUiTinyMarginTop,
}}
>
{customColumnsLong}
</div>
)}
{conditions && (
<>
<div
Expand Down
Loading