Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose allowed values for app settings exposed as enum types #160

Merged
merged 5 commits into from
Dec 1, 2020

Conversation

nblumhardt
Copy link
Member

See datalust/seq-tickets#1029

Allow Seq apps to use enum types for settings, which the Seq UI can expose as a select list.

enum GelfListenerProtocol
{
    [Display("TCP")]
    Tcp,

    [Display("UDP")]
    Udp
}

// Elsewhere...
[SeqAppSetting]
public GelfListenerProtocol Protocol { get; set; }

The two components of the change are:

  1. inputType: Select and allowedValues in the definition format:
    "settings": {
      "protocol": {
        "displayName": "GELF address",
        "inputType": "Select",
        "allowedValues": [
            {"value": "Tcp", "description": "TCP"},
            {"value": "Udp", "description": "UDP"}
        ]
      },

and 2., support for conversion from string values such as "Tcp" back to enum members when initializing the app object.

The change is implemented in such a way that the Seq.Apps package doesn't immediately need an update: app authors opt in by using enum types for app settings. Seq versions prior to 2020.5 won't be able to load these, however, so widely-used public apps will only be realistically able to depend on this after a transition period (perhaps, 6-12 months).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants