Bug 1866739 - description for boolean type field is not shown on form view
Summary: description for boolean type field is not shown on form view
Keywords:
Status: VERIFIED
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.6
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: 4.6.0
Assignee: Jon Jackson
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-06 08:56 UTC by Yadan Pei
Modified: 2020-09-14 07:18 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github openshift console pull 6474 None closed Bug 1866739: Filter incompatible x-descriptors before rendering operand form 2020-09-14 02:31:47 UTC

Description Yadan Pei 2020-08-06 08:56:08 UTC
Description of problem:
on operator creation form view, the description for some boolean fields is not shown, we only show a switch toggle to true or false

Version-Release number of selected component (if applicable):
4.6.0-0.nightly-2020-08-05-183436

How reproducible:
Always

Steps to Reproduce:
1. install ArgoCD Operator
2. goes to CR creation form view via Operators -> Installed Operators -> click on 'ArgoCD' in Provided APIs list of ArgoCD Operator  -> click 'Create ArgoCD' button
3. on the Form View,  expand to show all fields under 'Server' group

Actual results:
3. we can see there are some boolean switch but there are no descriptions shown for them so user don't know which field is this, copied some specdescriptors here
          - description: Selected if autoscaling should be enabled for the Argo CD server.
            displayName: Autoscale Enabled
            path: server.autoscale.enabled
            x-descriptors:
              - 'urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server'
              - 'urn:alm:descriptor:com.tectonic.ui:booleanSwitch'
          - description: The hostname to use for the GRPC Ingress/Route resource.
            displayName: GRPC Host
            path: server.grpc.host
            x-descriptors:
              - 'urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server'
              - 'urn:alm:descriptor:com.tectonic.ui:text'
          - description: Selected if a GRPC Ingress resource should be created.
            displayName: GRPC Ingress Enabled
            path: server.grpc.ingress
            x-descriptors:
              - 'urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server'
              - 'urn:alm:descriptor:com.tectonic.ui:booleanSwitch'
          - description: The hostname to use for Ingress/Route resources.
            displayName: Host
            path: server.host
            x-descriptors:
              - 'urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server'
              - 'urn:alm:descriptor:com.tectonic.ui:text'
          - description: Selected if an Ingress resource should be created.
            displayName: Ingress Enabled
            path: server.ingress
            x-descriptors:
              - 'urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server'
              - 'urn:alm:descriptor:com.tectonic.ui:booleanSwitch'
          - description: Selected if the Argo CD server should be run without TLS.
            displayName: Insecure
            path: server.insecure
            x-descriptors:
              - 'urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server'
              - 'urn:alm:descriptor:com.tectonic.ui:booleanSwitch'
          - description: >-
              The limits and requests requirements for the Argo CD server
              container.
            displayName: Resource Requirements
            path: server.resources
            x-descriptors:
              - 'urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server'
              - 'urn:alm:descriptor:com.tectonic.ui:resourceRequirements'
          - description: Selected if a Route resource should be created.
            displayName: Route Enabled
            path: server.route
            x-descriptors:
              - 'urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server'
              - 'urn:alm:descriptor:com.tectonic.ui:booleanSwitch'
          - description: The ServiceType to use for the Argo CD server Service resource.
            displayName: Service Type
            path: server.service.type
            x-descriptors:
              - 'urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server'
              - 'urn:alm:descriptor:com.tectonic.ui:text'


Expected results:
3. show description for all boolean type fields, it seems only the first boolean type in spec group is shown, all others boolean type description is not shown

Additional info:

Comment 2 Jon Jackson 2020-08-10 15:14:10 UTC
This is partly a problem with the CSV itself. 'server.ingress' is not a boolean type field in the ArgoCD CRD schema. That property is an object, which is handled very differently in form generation than primitive fields like booleans or strings. I still want to look into this and make sure we are handling this more gracefully, but in the meantime, this could be fixed by updating the descriptor path from `server.ingress` to `server.ingress.enabled`.

Comment 3 Yadan Pei 2020-08-11 01:55:43 UTC
Thanks for the explanation, I know what is the difference now

Comment 4 Jon Jackson 2020-08-21 19:22:59 UTC
I was able to reproduce this issue, but I haven't come up with a good solution for this problem yet. The problem is that the spec descriptors are applying a primitive type widget to an object type field, which is technically not a valid use case, but should probably be handled better. Initial thought is that we should add some logic to check that descriptor-defined widgets are compatible with the schema property they are pointing to, and if not, we just don't apply the custom widget or field. We can keep the rest of the descriptor behavior (sorting, description, displayName), but just let the default schema-generated components be rendered.

Comment 7 Yadan Pei 2020-09-14 03:41:36 UTC
In CSV, x-descriptors of `server.ingress` is booleanSwitch
    {
      "description": "Selected if an Ingress resource should be created.",
      "displayName": "Ingress Enabled",
      "path": "server.ingress",
      "x-descriptors": [
        "urn:alm:descriptor:com.tectonic.ui:fieldGroup:Server",
        "urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
      ]
    },


While in CRD schema, server.ingress is Object

                                            "ingress": {
                                                "description": "Ingress defines the desired state for an Ingress for the Argo CD Server component.",
                                                "properties": {
                                                    "annotations": {
                                                        "additionalProperties": {
                                                            "type": "string"
                                                        },
                                                        "description": "Annotations is the map of annotations to apply to the Ingress.",
                                                        "type": "object"
                                                    },
                                                    "enabled": {
                                                        "description": "Enabled will toggle the creation of the Ingress.",
                                                        "type": "boolean"
                                                    },
                                                    "path": {
                                                        "description": "Path used for the Ingress resource.",
                                                        "type": "string"
                                                    },
                                                    "tls": {
                                                        "description": "TLS configuration. Currently the Ingress only supports a single TLS port, 443. If multiple members of this list specify different hosts, they will be multiplexed on the same port according to the hostname specified through the SNI TLS extension, if the ingress controller fulfilling the ingress supports SNI.",
                                                        "items": {
                                                            "description": "IngressTLS describes the transport layer security associated with an Ingress.",
                                                            "properties": {
                                                                "hosts": {
                                                                    "description": "Hosts are a list of hosts included in the TLS certificate. The values in this list must match the name/s used in the tlsSecret. Defaults to the wildcard host setting for the loadbalancer controller fulfilling this Ingress, if left unspecified.",
                                                                    "items": {
                                                                        "type": "string"
                                                                    },
                                                                    "type": "array"
                                                                },
                                                                "secretName": {
                                                                    "description": "SecretName is the name of the secret used to terminate SSL traffic on 443. Field is left optional to allow SSL routing based on SNI hostname alone. If the SNI host in a listener conflicts with the \"Host\" header field used by an IngressRule, the SNI host is used for termination and value of the Host header is used for routing.",
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "type": "object"
                                                        },
                                                        "type": "array"
                                                    }
                                                },
                                                "required": [
                                                    "enabled"
                                                ],
                                                "type": "object"
                                            },

I see the description for each boolean type is shown correctly now. 

But according to the fix PR, it looks like `server.ingress` should be treated as incompatible x-descriptors and we should show some messages on form view, however I didn't see warning messages

@Jon,

Is this something expected?

Comment 8 Yadan Pei 2020-09-14 07:18:16 UTC
Sorry, I see these warning messages in console output.

since fields description is correctly shown, I will move this bug to VERIFIED

This is checked against 4.6.0-0.nightly-2020-09-12-230035


Note You need to log in before you can comment on or make changes to this bug.