opsmill / infrahub

Infrahub - A new approach to Infrastructure Management
https://opsmill.com/
GNU Affero General Public License v3.0
150 stars 7 forks source link

bug: Unexpected behaviour in UI if schema attribute kind is boolean #3646

Closed Untersander closed 4 weeks ago

Untersander commented 1 month ago

Component

Frontend UI

Current Behavior

Attributes of kind: Boolean are per default requiered to be enabled in the UI. If i create the objects via graphql it allows me to create the object not only with true as value but also with false.

Expected Behavior

I would expect that i'm not forced to set attributes of kind boolean to true via the UI, so it has the same behaviour as via the graphql api.

Steps to Reproduce

Create schema with attribute kind boolean and apply it. E.g.:

  - name: Interface
    namespace: Network
    include_in_menu: true
    icon: "mdi:ethernet"
    display_labels:
      - "name__value"
    attributes:
      - name: name
        kind: Text
      - name: description
        kind: Text
        optional: true
      - name: management
        kind: Boolean
        description: "Management interface"

Try to edit or create a device via the UI, now if you want to create this object it will throw an error if you don't set the management field to true

image

Additional Information

No response

ogenstad commented 1 month ago

Thank you for the bug report, yes this is clearly problematic. As a temporary workaround you could set a default value:

      - name: management
        kind: Boolean
        description: "Management interface"
        default_value: false

Alternatively mark it as optional.

      - name: management
        kind: Boolean
        description: "Management interface"
        optional: true

But this is something that needs to be fixed.