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

Unable to set default boolean USER_INPUTS value to YES #5107

Closed
7 tasks
baby-gnu opened this issue Sep 28, 2020 · 5 comments
Closed
7 tasks

Unable to set default boolean USER_INPUTS value to YES #5107

baby-gnu opened this issue Sep 28, 2020 · 5 comments

Comments

@baby-gnu
Copy link
Contributor

Description

We set up some template with some boolean USER_INPUTS like explained in the documentation but sunstone eith:

  • always ask to select a value
  • freeze with the following error in the console
    Uncaught Error: Syntax error, unrecognized expression: :radio[name="bool_one98" value="]
        jQuery 4
            error
            tokenize
            Sizzle
            find
        validateRadio foundation.js:2162
        validateInput foundation.js:2043
        validateForm foundation.js:2098
        jQuery 2
            each
            each
        validateForm foundation.js:2097
        _events foundation.js:1824
        jQuery 8
            dispatch
            handle
            trigger
            trigger
            each
            each
            trigger
            name
        _submitFormPanel sunstone.js:1085
        setTimeout handler*_submitFormPanel sunstone.js:1082
        _insertButtonsInTab sunstone.js:545
        jQuery 2
            dispatch
            handle
    jquery.js:1468
        jQuery 4
        validateRadio foundation.js:2162
        validateInput foundation.js:2043
        validateForm foundation.js:2098
        jQuery 2
        validateForm foundation.js:2097
        _events foundation.js:1824
        jQuery 8
        _submitFormPanel sunstone.js:1085
        (Async: setTimeout handler)
        _submitFormPanel sunstone.js:1082
        _insertButtonsInTab sunstone.js:545
        jQuery 2
    

To Reproduce

  1. Download the Ubuntu-20.04 App
  2. Update the template to add the following USER_INPUTS, Sunstone produce the following:
    USER_INPUTS=[
      DEFTRUE="M|boolean|try default to yes| |YES" ]
    
  3. Instanciate the VM

Expected behavior

The VM should instanciate without any issue and the DEFTRUE context valiable should be set to YES

Details

  • Affected Component: Sunstone
  • Hypervisor: KVM
  • Version: 5.12.0.1-1.ce

Additional context

  • Everything is working fine when the default value is NO like:
    USER_INPUTS=[
      DEFTRUE="M|boolean|try default to yes| |YES" ]
    
  • There is an issue in the documentation, a | seems to be missing between <desc> and <default> since it describe the boolean as:
    <VAR>=”M|boolean| <desc>|<default>|”
    

Regards.

Progress Status

  • Branch created
  • Code committed to development branch
  • Testing - QA
  • Documentation
  • Release notes - resolved issues, compatibility, known issues
  • Code committed to upstream release/hotfix branches
  • Documentation committed to upstream release/hotfix branches
@baby-gnu
Copy link
Contributor Author

Note that I manually patched Sunstone to fix #4946, it may be related.

Regards.

@baby-gnu
Copy link
Contributor Author

baby-gnu commented Oct 1, 2020

I have a different behaviour between the cloud view and the user view:

  • in cloud view, sunstone wants me to select NO for the input, when NO is selected, the YES is displayed as selected too
  • in user view, sunstone just display Submitting at the top level and nothing more than what I described in the issue.

Regards.

tinova pushed a commit to OpenNebula/docs that referenced this issue Oct 1, 2020
@sbbarragan
Copy link

@sbbarragan
Copy link

That will be fixed in the next release, you can patch manually:

diff --git a/src/sunstone/public/app/utils/user-inputs.js b/src/sunstone/public/app/utils/user-inputs.js
index 8c83f8029..b70b12099 100644
--- a/src/sunstone/public/app/utils/user-inputs.js
+++ b/src/sunstone/public/app/utils/user-inputs.js
@@ -855,7 +855,7 @@ define(function(require) {
         var id = UniqueId.id();
         if(value == "YES"){
           input = "<br>" + Locale.tr("YES ") + "<input style='margin-right: 20px' checked type='radio' name='bool_" +id + "' value='YES'" + wizard_field + " " + required + "/>";
-          input += Locale.tr("NO ") + "<input type='radio' name='bool_" + id + "\" value='NO'" + wizard_field + " " + required + "/>";
+          input += Locale.tr("NO ") + "<input type='radio' name='bool_" + id + "' value='NO'" + wizard_field + " " + required + "/>";
         } else if(value == "NO"){
           input = "<br>" + Locale.tr("YES ") + "<input style='margin-right: 20px' type='radio' name='bool_" + id + "' value='YES'" + wizard_field + " " + required + "/>";
           input += Locale.tr("NO ") + "<input checked type='radio' name='bool_" + id + "' value='NO'" + wizard_field + " " + required + "/>"

@tinova tinova closed this as completed Oct 1, 2020
@baby-gnu
Copy link
Contributor Author

baby-gnu commented Oct 1, 2020

Thanks a lot @sbbarragan, @tinova.

I patched my Sunstone and it's working.

rsmontero pushed a commit that referenced this issue Oct 6, 2020
rsmontero pushed a commit that referenced this issue Oct 6, 2020
(cherry picked from commit 53300a1)
rsmontero pushed a commit that referenced this issue Oct 7, 2020
(cherry picked from commit 53300a1)
(cherry picked from commit e7f4d4d)
rsmontero pushed a commit that referenced this issue Jan 20, 2021
rsmontero pushed a commit that referenced this issue Apr 13, 2021
(cherry picked from commit 53300a1)
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

3 participants