Bug 1702064 - Regex validation not working when using dialogs
Summary: Regex validation not working when using dialogs
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.9.0
Hardware: All
OS: All
Target Milestone: GA
: 5.10.4
Assignee: eclarizi
QA Contact: Niyaz Akhtar Ansari
Red Hat CloudForms Documentation
Depends On: 1694737
TreeView+ depends on / blocked
Reported: 2019-04-22 21:07 UTC by Satoe Imaishi
Modified: 2019-11-20 10:39 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1694737
Last Closed: 2019-05-21 05:46:54 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:

Attachments (Terms of Use)
datastore (954.92 KB, application/zip)
2019-05-02 18:00 UTC, Niyaz Akhtar Ansari
no flags Details
testing dialog (3.68 KB, text/plain)
2019-05-02 18:01 UTC, Niyaz Akhtar Ansari
no flags Details

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:1247 None None None 2019-05-21 05:47:00 UTC

Comment 2 Satoe Imaishi 2019-04-24 17:56:23 UTC
The fix is included in ui-components 1.1.23


Comment 3 CFME Bot 2019-04-24 19:48:16 UTC
New commit detected on ManageIQ/ui-components/hammer:

commit fb9f75d35468feb951991a4d3d6424769ed5ea21
Author:     Martin Hradil <himdel@seznam.cz>
AuthorDate: Tue Apr  2 10:45:01 2019 -0400
Commit:     Martin Hradil <himdel@seznam.cz>
CommitDate: Tue Apr  2 10:45:01 2019 -0400

    Merge pull request #378 from eclarizio/add_validator_rule_attribute_to_update

    Allow validator_rule to be updated in case of dynamic text boxes

    (cherry picked from commit 851569e401f83b1fc7d8fca2340ed3fefe1ea3c7)


 src/dialog-user/components/dialog-user/dialogField.spec.ts | 2 +-
 src/dialog-user/components/dialog-user/dialogUser.spec.ts | 20 +-
 src/dialog-user/components/dialog-user/dialogUser.ts | 1 +
 src/dialog-user/services/dialogData.spec.ts | 22 +
 src/dialog-user/services/dialogData.ts | 2 +-
 5 files changed, 36 insertions(+), 11 deletions(-)

Comment 6 Niyaz Akhtar Ansari 2019-05-02 18:00:48 UTC
Created attachment 1561884 [details]

I have tested this BZ with datastore and dialog and refresh works fine, but I am not able figure out regex to be used.

Could you please help.

Comment 7 Niyaz Akhtar Ansari 2019-05-02 18:01:27 UTC
Created attachment 1561885 [details]
testing dialog

Comment 8 eclarizi 2019-05-02 20:02:07 UTC
You'll just have to add something like:

$evm.object['validator_rule'] = "^1234" to the automate method that the text-box dialog field is using, but this just sets a single validator rule and doesn't ensure that it can be changed, so you'll have to do something like:

if ($evm.root['template'] == "Citrix10") {
  $evm.object['validator_rule'] = "^1234"
} else {
  $evm.object['validator_rule'] = "^4321"

Then when you pick Citrix10 from the dropdown, the validation should only pass with strings that start with "1234", and if you pick anything else, only strings that start with "4321" should pass validation.

Hopefully that helps!

Comment 9 myoder 2019-05-06 19:36:20 UTC
Niyaz, Iust configured your appliance with the same automate code and catalog/service dialog configurations, but the regex is still not working.

I noticed there is now a yes/no option for validator in the service dialog.  Perhaps this value needs to be explicitly set in the automate method that populates the 2 dynamic service dialog elements.

One thing I noticed, I manually set the validator option to "yes" and inputted a regex validator expression "^MAX[A-Za-z0-9\-\_]{1,40}$" from within the Web UI.  This worked.  However, I disabled the validator option, yet, the regex validator "^MAX[A-Za-z0-9\-\_]{1,40}$" is still being used despite my automate method populating the regex validator with another expression.

The only other thing, once you turn the validator option to "yes" save it, then edit it to "no" and save, any other time you edit it, the option is stuck between "yes" and "no".

The service catalog and service dialog are both named "regex-test".  I created a automate domain "Yoder", with namespace "DynamicDialogs" and class "Dialogs", otherwise, everything else should be the same as before.

Kind Regards,

Comment 12 CFME Bot 2019-05-08 02:05:43 UTC
New commit detected on ManageIQ/manageiq/hammer:

commit b739a7820ccec248a82111a32c8b095884094443
Author:     Madhu Kanoor <mkanoor@redhat.com>
AuthorDate: Tue May  7 14:40:00 2019 -0400
Commit:     Madhu Kanoor <mkanoor@redhat.com>
CommitDate: Tue May  7 14:40:00 2019 -0400

    Merge pull request #18743 from eclarizio/allow_textarea_dynamic_attributes

    Allow textarea boxes to dynamically set validator type and rule

    (cherry picked from commit 5bd2a9e8f2465282115ce843ce3b6d07e8efd551)

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1702064

 app/models/dialog_field_text_area_box.rb | 2 +-
 spec/models/dialog_field_text_area_box_spec.rb | 12 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

Comment 13 Niyaz Akhtar Ansari 2019-05-10 11:27:46 UTC
Verified in Version

Comment 15 errata-xmlrpc 2019-05-21 05:46:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.