kyma-project / busola

Web based Kubernetes Dashboard with a focus on privacy that requires no active components or special privileges in your cluster.
Apache License 2.0
24 stars 48 forks source link

Details page fails to render spec fields with kebab-case #3127

Open kevin-kho opened 1 month ago

kevin-kho commented 1 month ago

Description

When rendering a CustomResource, if the spec has fields with kebab-case (example: spec.redisConfiguration.notify-keyspace-events). It will fail to render the values on Details page.

The field renders fine for the Form page (both UI and YAML).

Expected result

Detail page renders the values for kebab-case fields

Actual result

Detail page fails to render the values for kebab-case fields

Steps to reproduce

Detail page fails to render the kebab-case fields image

Form page renders it fine. image

This is the CustomResource's YAML view

image

Troubleshooting

I dove into the busola code base and I think I narrowed it down to ExtensibilityDetails.js line 113 where customComponents is defined.

kevin-kho commented 1 month ago

I've narrowed it down to the following code in useJsonata.ts; it fails to retrieve the value if the query is kebab-case

  const value = jsonataWrapper(query).evaluate(
    extras.scope || scope || extras.resource || resource,
    {
      ...mapValues(dataSourceFetchers, dsf => dsf.value),
      root: extras.resource || resource,
      parent: parent,
      embedResource: embedResource,
      items: extras?.arrayItems || arrayItems,
      item:
        last(extras?.arrayItems) ||
        last(arrayItems) ||
        extras.resource ||
        resource,
      ...extras,
    },
  );
kevin-kho commented 1 month ago

The jsonataWrapper(query) seems to split the key on - thinking it's a path. I think Jsonata is taking the - as an expression

image