Skip to content

[PUI] Choice settings cast as string types #7542

Closed

Description

@LavissaWoW

Please verify that this bug has NOT been raised before.

  • I checked and didn't find a similar issue

Describe the bug*

Any setting with associated choices, aka. a select dropdown get represented as string input sin PUI.

Steps to Reproduce

  1. System Settings
  2. Pricing
  3. Default Currency
  4. Click to edit
  5. See string input

Expected behaviour

These should be selects/dropdowns

Deployment Method

  • Docker
  • Package
  • Bare metal
  • Other - added info in Steps to Reproduce

Version Information

0.16-dev

Please verify if you can reproduce this bug on the demo site.

  • I can reproduce this bug on the demo site.

Relevant log output

No response

Activity

  1. added
    bug
    question
    triage:not-checked
    on Jul 1, 2024
  2. LavissaWoW commented on Jul 1, 2024

    @LavissaWoW
    ContributorAuthor

    This seems to be a logic fault starting as deep as the API.
    The type of a given choice-based setting is defined as "string" from the API.

    This type isn't changed at any point when passing the Setting typed prop from a to b to c, and so on.
    The SettingItem component will then render a string.
    As a bonus, the aforementioned component doesn't even have a render option beside bool and string.

    http://localhost:8000/api/settings/global/INVENTREE_DEFAULT_CURRENCY/

    {
        "pk": 1,
        "key": "INVENTREE_DEFAULT_CURRENCY",
        "value": "USD",
        "name": "Default Currency",
        "description": "Select base currency for pricing calculations",
        "type": "string",
        "units": "",
        "choices": [
            {
                "value": "AUD",
                "display_name": "Australian Dollar"
            },
            {
                "value": "CAD",
                "display_name": "Canadian Dollar"
            },
            {
                "value": "CNY",
                "display_name": "Chinese Yuan"
            },
            {
                "value": "EUR",
                "display_name": "Euro"
            },
            {
                "value": "GBP",
                "display_name": "British Pound"
            },
            {
                "value": "JPY",
                "display_name": "Japanese Yen"
            },
            {
                "value": "NZD",
                "display_name": "New Zealand Dollar"
            },
            {
                "value": "USD",
                "display_name": "US Dollar"
            }
        ],
        "model_name": null,
        "api_url": null,
        "typ": "inventree"
    }
  3. added
    User Interface
    and removed
    triage:not-checked
    on Jul 2, 2024
  4. added this to the 0.16.0 milestone on Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    User Interfacebugquestion

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions