splunk / addonfactory-ucc-generator

A framework to generate UI-based Splunk Add-ons.
https://splunk.github.io/addonfactory-ucc-generator/
Apache License 2.0
62 stars 24 forks source link

BUG: UCC Import from Add On Builder does not work if you are using Global Account Settings Setup Parameters #1379

Open TTony5 opened 1 month ago

TTony5 commented 1 month ago

Description

Hello,

Running into what I think is a bug. I am trying to convert my add on builder app to a splunk packaged app using ucc. However, I am getting the following error:

ERROR: placeholder option found for configuration tab 'account' -> entity field 'username'. We recommend to use help instead (https://splunk.github.io/addonfactory-ucc-generator/entity/). Deprecation notice: https://github.com/splunk/addonfactory-ucc-generator/issues/831.

Recreation steps: Create an app using Splunk Add on Builder -> Add Global Account Settings to Set up Parameters -> use UCC import from AOB function

I could very well be missing something as I am new to using UCC. But, there does not look to be a way that I can stop using the placeholder option in username as this is a global account setting and doesnt really have a changeable option. Is there a way to fix this or to ignore the error?

Screenshot from 2024-10-15 08-21-57

image

What UCC version are you using?

splunk-add-on-ucc-framework=5.50.1

Additional System Info

Python Version: Python 3.8.16

vtsvetkov-splunk commented 1 month ago

@TTony5, thank you for the feedback!

Removing the placeholder is an intentional decision. This attribute is often overused in misleading UX patterns, so we dropped its support since it is frequently misused. Read about issues placeholders can cause.

Please help me understand your use case. Do you want to make a read-only field? If it is "very" static, you can set it's value in globalConfig.json via defaultValue. Here is an example:

image

Would this work for you?

TTony5 commented 1 month ago

It needs to be dynamic unfortunately as it will allow us to have multiple accounts with multiple tokens. I created a bash script that will automatically convert the add on builder app and move it into a Gitlab repository. Halfway into the script, it pops that error due to a placeholder being somewhere in the Global Account Settings. I am using the username as the holder of the account ID and the password as the holder for the bearer token. From Add On Builder, is there a way to change the username and password entities from placeholder?

vtsvetkov-splunk commented 1 month ago

@TTony5 To provide a more accurate response, additional context is needed regarding where username value is stored. Is it stored in a configuration file? If so, it can likely be retrieved using the same method as other field values.

In the absence of more details, here's a potential solution based on common patterns:

The common pattern is we allow users to create account with user-provided account name

image

but we don't allow to change the name during update

image

it can be achieved for any field with

"options": {
    "disableonEdit": true
},