Fall back to page properties if no display fields are specified (#31769)

Closes keycloak/keycloak-quickstarts#587

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Co-authored-by: Jon Koops <jonkoops@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-07-30 16:12:13 +02:00 committed by GitHub
parent 07cfdac862
commit 1fe5082edd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View file

@ -60,8 +60,10 @@ export default function Page() {
<DeleteConfirm />
<ViewHeader
titleKey={
get(pageData, `config.${page.metadata.displayFields[0]}`)?.[0] ||
t("createItem")
get(
pageData,
`config.${page.metadata.displayFields?.[0] || page.properties[0].name}`,
)?.[0] || t("createItem")
}
dropdownItems={
id

View file

@ -116,7 +116,10 @@ export default function PageList() {
searchPlaceholderKey="searchItem"
loader={loader}
columns={[
...page.metadata.displayFields.map((name: string, index: number) => ({
...(
page.metadata.displayFields ||
page.properties.slice(0, 3).map((p) => p.name)
).map((name: string, index: number) => ({
name: `config.${name}[0]`,
displayKey: page.properties.find((p) => p.name === name)!.label,
cellRenderer: