start-os icon indicating copy to clipboard operation
start-os copied to clipboard

[feat]: List of objects not displaying properly in config

Open chrisguida opened this issue 3 years ago • 11 comments

Prerequisites

  • [X] I have searched for existing issues that already report this problem, without success.

EmbassyOS Version

72cb451f5a4be02ad651e2c0bf4973dd8f36f9b1

Device

Laptop/Desktop

Device OS

Linux

Device OS Version

Ubuntu 20.04

Browser

Firefox

Browser Version

98.0.1

Current Behavior

This config spec:

        addnode:
          name: Add Nodes
          description: Add addresses of nodes to connect to.
          type: list
          subtype: object
          range: "[0,*)"
          default: []
          spec:
            type: object
            nullable: false
            name: "Peer"
            description: "Peer to connect to"
            spec:
              hostname:
                type: string
                nullable: false
                name: "Hostname"
                description: "Domain or IP address of bitcoin peer"
                masked: true
                pattern: "(^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$)|((^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$)|(^[a-z2-7]{16}\\.onion$)|(^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$))"
                pattern-description: Must be either a domain name, or an IPv4 or IPv6 address. Do not include protocol scheme (eg 'http://') or port.
              port:
                type: number
                # nullable: false
                nullable: true
                name: "Port"
                description: "Port that peer is listening on for inbound p2p connections"
                # default: 8333
                range: "[0,65535]"
                integral: true

Renders like this:

Screenshot from 2022-03-18 16-21-05

Expected Behavior

The user should be able to see the port field. The port is inaccessible no matter what I do.

Steps to Reproduce

  1. Package s9pk with config spec as above
  2. Go to configure it
  3. Cannot access second field in object, when object is nested inside a list.

Anything else?

This is blocking https://github.com/Start9Labs/bitcoind-wrapper/issues/53

chrisguida avatar Mar 18 '22 23:03 chrisguida

Looking at the posted config spec, there are some elements that are incorrect for lists of objects. See a working implementation of this type here. I recognize that the documentation for this type is wrong and will correct.

Does the issue persist with those adjustments to the config spec?

elvece avatar Mar 21 '22 21:03 elvece

Updated to try:

        addnode:
          type: list
          name: Add Nodes
          description: Add addresses of nodes to connect to.
          default: []
          range: "[0,*)"
          # subtype: string
          subtype: object
          spec:
            unique-by: hostname
            display-as: "{{hostname}}"
            spec:
              hostname:
                type: string
                nullable: false
                name: "Hostname"
                description: "Domain or IP address of bitcoin peer"
                masked: true
                pattern: "(^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:[0-9]{1,5})?$)|((^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))(:[0-9]{1,5})?$)|(^[a-z2-7]{16}\\.onion(:[0-9]{1,5})?$)|(^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9](:[0-9]{1,5})?$))"
                pattern-description: Must be either a domain name, or an IPv4 or IPv6 address. Do not include protocol scheme (eg 'http://') or port.
              port:
                type: number
                # nullable: false
                nullable: true
                name: "Port"
                description: "Port that peer is listening on for inbound p2p connections"
                # default: 8333
                range: "[0,65535]"
                integral: true

Not seeing any meaningful difference: Screenshot from 2022-03-21 17-04-47

Actually now the hostname is covered up, too.

chrisguida avatar Mar 21 '22 23:03 chrisguida

That makes no sense. What's in the console?

MattDHill avatar Mar 22 '22 02:03 MattDHill

No errors in the console Screen Shot 2022-03-22 at 8 33 53 AM

chrisguida avatar Mar 22 '22 14:03 chrisguida

@MattDHill more info: the full config spec type for this nested configuration is actually an object of objects which has a list of objects. I can input this into mocks and test it out, letting you know if I have questions.

elvece avatar Mar 22 '22 18:03 elvece

Seems very relevant, I'll look into it.

MattDHill avatar Mar 22 '22 19:03 MattDHill

Looks great, thanks!

Screenshot from 2022-03-24 10-28-53

chrisguida avatar Mar 24 '22 16:03 chrisguida

Looks like this bug is back, on commit d2195411a64592054e0cdaa3713fbd172f79a46d

Steps to reproduce:

  1. install Bitcoin Core
  2. Config -> Advanced -> Peers -> Add Nodes -> +Add
  3. see this:
Screen Shot 2022-06-23 at 3 44 08 PM

chrisguida avatar Jun 23 '22 20:06 chrisguida

I can see from the screenshot this is not the latest code. We have since gotten rid of those red warning icons. Test on latest code.

MattDHill avatar Jun 24 '22 01:06 MattDHill

You can see from the included git hash that this is not the latest code ;)

But this code is 4 days old, so I figured I'd report.

chrisguida avatar Jun 24 '22 14:06 chrisguida

So this is definitely an improvement, but still not ideal. Now when I add a new node, it gives me this:

Screen Shot 2022-06-24 at 2 51 56 PM

Then if I click to expand "Entry 1", the new fields are displayed: Screen Shot 2022-06-24 at 2 55 49 PM

My question is: why require the user to expand "Entry 1"? They've just added a new entry; this makes it feel like they've done something wrong. Ideally the first (required) field in the new entry (or just the first field with an error, which would be the same in this case) should be visible and selected, that way the user can quickly understand what they're supposed to do. The way it currently is, they have to stare at the screen for a moment and wonder why everything turned red, then just start clicking things until they see what the issue is.

chrisguida avatar Jun 24 '22 20:06 chrisguida

Still happening Screen Shot 2022-12-16 at 12 30 42 PM

chrisguida avatar Dec 16 '22 18:12 chrisguida

The accordions should automatically expand to the first entry with an error

chrisguida avatar Dec 16 '22 18:12 chrisguida

The accordions should automatically expand to the first entry with an error

This is a separate feature request, please open a new issue.

elvece avatar Jan 09 '23 18:01 elvece

Seems easier to just use this issue, but here you go: https://github.com/Start9Labs/embassy-os/issues/2107

chrisguida avatar Jan 10 '23 03:01 chrisguida