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: Frontend forms fail to load numbers with the value 0, or enter a negative number #3640

Closed ogenstad closed 3 weeks ago

ogenstad commented 1 month ago

Component

Frontend UI

Current Behavior

When you create an object using the frontend it's not possible to enter a negative number, also when you enter a 0 the "0" is displayed to the right side of the value input field.

While it's possible to save a node with a 0 value for the number when you try to edit the object the 0 is removed so it looks like the value isn't set.

Expected Behavior

It should be possible to edit nodes with a value of 0 and create and edit nodes with a negative value for a Number kind. When entering 0, this value should not be displayed beside the input box.

Steps to Reproduce

  1. Load this schema in Infrahub:
# yaml-language-server: $schema=https://schema.infrahub.app/develop/schema.schema.json
---
version: '1.0'
nodes:
  - name: Number
    namespace: Test
    label: "number"
    display_labels:
      - primary__value
    attributes:
      - name: primary
        kind: Number
        optional: false
      - name: secondary
        kind: Number
        optional: true
  1. Try to create an object of this kind, first note that it's not possible to enter a negative value
  2. Enter 0 as the value for both fields
  3. Edit the object you created and note that the values that should have had 0 as the previous value doesn't have a value at all.

Additional Information

No response

bilalabbad commented 3 weeks ago

PR open to fix when default value is 0.

But I could not reproduce the negative value issue. Do you still encounters it?

ogenstad commented 3 weeks ago

Thanks the issue with 0 got fixed in #3678, and the new forms probably fixed the issue with the negative numbers.