Sfoglia il codice sorgente

HUE-9288 [editor] Fix selection type variable substitution in the editor

Johan Ahlen 5 anni fa
parent
commit
611ad1b12b

+ 15 - 3
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -1196,7 +1196,7 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
           <!-- ko if: path() -->
           <a href="javascript:void(0);" data-bind="click: $root.showContextPopover" style="float: left"> <span class="muted add-on" data-bind="text: name"></span></a>
           <!-- /ko -->
-          <!-- ko if: meta.type() == 'text' -->
+          <!-- ko if: meta.type() === 'text' -->
             <!-- ko if: meta.placeholder() -->
               <input class="input-medium" type="text" data-bind="value: value, attr: { value: value, type: type, placeholder: meta.placeholder() || '${ _ko('Variable value') }' }, valueUpdate: 'afterkeydown', event: { 'keydown': $parent.onKeydownInVariable }, autogrowInput: { minWidth: 150, maxWidth: 270, comfortZone: 15 }">
             <!-- /ko -->
@@ -1215,8 +1215,20 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
               <!-- /ko -->
             <!-- /ko -->
           <!-- /ko -->
-          <!-- ko if: meta.type() == 'select' -->
-          <select data-bind="selectize: sample, optionsText: 'text', optionsValue: 'value', selectizeOptions: { create: function (input) { sampleUser().push({ text: ko.observable(input), value: ko.observable(input) }); return { text: input, value: input }; } }, value: value, event: { 'keydown': $parent.onKeydownInVariable }"/>
+          <!-- ko if: meta.type() === 'select' -->
+            <select data-bind="
+                selectize: sample,
+                optionsText: 'text',
+                optionsValue: 'value',
+                selectizeOptions: {
+                  create: function (input) {
+                    sampleUser().push({ text: ko.observable(input), value: ko.observable(input) });
+                    return { text: input, value: input };
+                  }
+                },
+                value: value,
+                event: { 'keydown': $parent.onKeydownInVariable }
+              "></select>
           <!-- /ko -->
         </div>
       </li>

+ 15 - 3
desktop/libs/notebook/src/notebook/templates/editor_components2.mako

@@ -993,7 +993,7 @@
             <!-- ko if: path() -->
             <a href="javascript:void(0);" data-bind="click: $root.showContextPopover" style="float: left"> <span class="muted add-on" data-bind="text: name"></span></a>
             <!-- /ko -->
-            <!-- ko if: meta.type() == 'text' -->
+            <!-- ko if: meta.type() === 'text' -->
             <!-- ko if: meta.placeholder() -->
             <input class="input-medium" type="text" data-bind="value: value, attr: { value: value, type: type, placeholder: meta.placeholder() || '${ _ko('Variable value') }' }, valueUpdate: 'afterkeydown', event: { 'keydown': $parent.onKeydownInVariable }, autogrowInput: { minWidth: 150, maxWidth: 270, comfortZone: 15 }">
             <!-- /ko -->
@@ -1012,8 +1012,20 @@
             <!-- /ko -->
             <!-- /ko -->
             <!-- /ko -->
-            <!-- ko if: meta.type() == 'select' -->
-            <select data-bind="selectize: sample, optionsText: 'text', optionsValue: 'value', selectizeOptions: { create: function (input) { sampleUser().push({ text: ko.observable(input), value: ko.observable(input) }); return { text: input, value: input }; } }, value: value, event: { 'keydown': $parent.onKeydownInVariable }"/>
+            <!-- ko if: meta.type() === 'select' -->
+            <select data-bind="
+                selectize: sample,
+                optionsText: 'text',
+                optionsValue: 'value',
+                selectizeOptions: {
+                  create: function (input) {
+                    sampleUser().push({ text: ko.observable(input), value: ko.observable(input) });
+                    return { text: input, value: input };
+                  }
+                },
+                value: value,
+                event: { 'keydown': $parent.onKeydownInVariable }
+              "></select>
             <!-- /ko -->
           </div>
         </li>