Bug in drop downs?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug in drop downs?

Mike Thomsen
 I have the following configuration property in a new processor, PutGridFS:

    static final AllowableValue NO_UNIQUE   = new AllowableValue("none",
"None", "No uniqueness will be enforced.");
    static final AllowableValue UNIQUE_NAME = new AllowableValue("name",
"Name", "Only the filename must " +
            "be unique.");
    static final AllowableValue UNIQUE_HASH = new AllowableValue("hash",
"Hash", "Only the file hash must be " +
            "unique.");
    static final AllowableValue UNIQUE_BOTH = new AllowableValue("both",
"Both", "Both the filename and hash " +
            "must be unique.");

    static final PropertyDescriptor ENFORCE_UNIQUENESS = new
PropertyDescriptor.Builder()
        .name("putgridfs-enforce-uniqueness")
        .displayName("Enforce Uniqueness")
        .description("When enabled, this option will ensure that uniqueness
is enforced on the bucket. It will do so by creating a MongoDB index " +
                "that matches your selection. It should ideally be
configured once when the bucket is created for the first time because " +
                "it could take a long time to build on an existing bucket
wit a lot of data.")
        .allowableValues(NO_UNIQUE, UNIQUE_BOTH, UNIQUE_NAME, UNIQUE_HASH)
        .defaultValue(NO_UNIQUE.getValue())

.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
        .required(true)
        .addValidator(Validator.VALID)
        .build();


When I load the configuration dialog, it shows "None" in the Enforce
Uniqueness property. When I click to change it opens a free text dialog
with "none" as the entry instead of giving me a drop down.

Any ideas of what is going on here? It looks like a UI bug to me. I've
compared the descriptor to ones that still behave fine and cannot find any
differences.

Thanks,

Mike
Reply | Threaded
Open this post in threaded view
|

Re: Bug in drop downs?

Mike Thomsen
I figured it out. It was this:

>
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)

It appears that that tricks the UI into flipping from a drop down to a text
box.

Is this "expected" or should it be considered a bug?

On Sat, Jul 7, 2018 at 11:16 AM Mike Thomsen <[hidden email]> wrote:

>  I have the following configuration property in a new processor, PutGridFS:
>
>     static final AllowableValue NO_UNIQUE   = new AllowableValue("none",
> "None", "No uniqueness will be enforced.");
>     static final AllowableValue UNIQUE_NAME = new AllowableValue("name",
> "Name", "Only the filename must " +
>             "be unique.");
>     static final AllowableValue UNIQUE_HASH = new AllowableValue("hash",
> "Hash", "Only the file hash must be " +
>             "unique.");
>     static final AllowableValue UNIQUE_BOTH = new AllowableValue("both",
> "Both", "Both the filename and hash " +
>             "must be unique.");
>
>     static final PropertyDescriptor ENFORCE_UNIQUENESS = new
> PropertyDescriptor.Builder()
>         .name("putgridfs-enforce-uniqueness")
>         .displayName("Enforce Uniqueness")
>         .description("When enabled, this option will ensure that
> uniqueness is enforced on the bucket. It will do so by creating a MongoDB
> index " +
>                 "that matches your selection. It should ideally be
> configured once when the bucket is created for the first time because " +
>                 "it could take a long time to build on an existing bucket
> wit a lot of data.")
>         .allowableValues(NO_UNIQUE, UNIQUE_BOTH, UNIQUE_NAME, UNIQUE_HASH)
>         .defaultValue(NO_UNIQUE.getValue())
>
> .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
>         .required(true)
>         .addValidator(Validator.VALID)
>         .build();
>
>
> When I load the configuration dialog, it shows "None" in the Enforce
> Uniqueness property. When I click to change it opens a free text dialog
> with "none" as the entry instead of giving me a drop down.
>
> Any ideas of what is going on here? It looks like a UI bug to me. I've
> compared the descriptor to ones that still behave fine and cannot find any
> differences.
>
> Thanks,
>
> Mike
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Bug in drop downs?

Matt Burgess
I would say it’s “expected”, properties with allowable values shouldn’t support EL per se, although there are properties in NiFi where one of the allowable values is “Use x.y.z attribute” which implies Flow File scope but isn’t documented via annotations or anything but the description.

Regards,
Matt

> On Jul 7, 2018, at 8:06 PM, Mike Thomsen <[hidden email]> wrote:
>
> I figured it out. It was this:
>
> .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
>
> It appears that that tricks the UI into flipping from a drop down to a text
> box.
>
> Is this "expected" or should it be considered a bug?
>
>> On Sat, Jul 7, 2018 at 11:16 AM Mike Thomsen <[hidden email]> wrote:
>>
>> I have the following configuration property in a new processor, PutGridFS:
>>
>>    static final AllowableValue NO_UNIQUE   = new AllowableValue("none",
>> "None", "No uniqueness will be enforced.");
>>    static final AllowableValue UNIQUE_NAME = new AllowableValue("name",
>> "Name", "Only the filename must " +
>>            "be unique.");
>>    static final AllowableValue UNIQUE_HASH = new AllowableValue("hash",
>> "Hash", "Only the file hash must be " +
>>            "unique.");
>>    static final AllowableValue UNIQUE_BOTH = new AllowableValue("both",
>> "Both", "Both the filename and hash " +
>>            "must be unique.");
>>
>>    static final PropertyDescriptor ENFORCE_UNIQUENESS = new
>> PropertyDescriptor.Builder()
>>        .name("putgridfs-enforce-uniqueness")
>>        .displayName("Enforce Uniqueness")
>>        .description("When enabled, this option will ensure that
>> uniqueness is enforced on the bucket. It will do so by creating a MongoDB
>> index " +
>>                "that matches your selection. It should ideally be
>> configured once when the bucket is created for the first time because " +
>>                "it could take a long time to build on an existing bucket
>> wit a lot of data.")
>>        .allowableValues(NO_UNIQUE, UNIQUE_BOTH, UNIQUE_NAME, UNIQUE_HASH)
>>        .defaultValue(NO_UNIQUE.getValue())
>>
>> .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
>>        .required(true)
>>        .addValidator(Validator.VALID)
>>        .build();
>>
>>
>> When I load the configuration dialog, it shows "None" in the Enforce
>> Uniqueness property. When I click to change it opens a free text dialog
>> with "none" as the entry instead of giving me a drop down.
>>
>> Any ideas of what is going on here? It looks like a UI bug to me. I've
>> compared the descriptor to ones that still behave fine and cannot find any
>> differences.
>>
>> Thanks,
>>
>> Mike
>>
>>