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

[BUG] Unable to remove last element in settings list #328

Open
53A-1 opened this issue Jan 12, 2021 · 0 comments
Open

[BUG] Unable to remove last element in settings list #328

53A-1 opened this issue Jan 12, 2021 · 0 comments

Comments

@53A-1
Copy link

53A-1 commented Jan 12, 2021

Unable to remove last element in settings list

Request Type

Bug

Work Environment

Question Answer
OS version (server) Docker image: thehiveproject/cortex:3.0.1
OS version (client) Windows 10
Cortex version / git hash 3.01.x, hash of the commit
Package Type Docker
Browser type & version Edge Chromium

Problem Description

Disclaimer: I can't test 3.1.0-1 since the migration of my DB fails, but this problem does not seem to have been reported.

It is not possible to remove the last item in a settings list (i.e. an item with "multi": true):
settings_item

This is not only a UI bug, since this propagates down to e.g. Cortex Analyzers. One would expect to receive a empty list (or at least a None for the list itself) if no items are configured. Instead, Cortex creates a list with a None object in position 0 ([None]).

Steps to Reproduce

  1. Create a Analyzer config JSON with multi = true and required = false
  2. Create an instance of the config in Cortex
  3. Try to remove the last item of the configuration
  4. If you run it in debug or print it out, you will see a list that contains a None element

Possible Solutions

  1. Let users remove the last element in a list via the UI
  2. If no element are present, return an actual empty list
  3. If an empty string is present in a multi input field, actually pass it on as empty string, not as None (i.e. [""] instead of [None])
@53A-1 53A-1 changed the title Unable to remove last element in settings list [BUG] Unable to remove last element in settings list Jan 12, 2021
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

No branches or pull requests

1 participant