Просмотр исходного кода

HUE-3496 [editor] Query variables are not persisted

Romain Rigaux 9 лет назад
Родитель
Сommit
b303a4b5b8

+ 1 - 1
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -317,7 +317,7 @@
       }, 100);
     });
 
-    self.variables = ko.observableArray([]);
+    self.variables = ko.mapping.fromJS(typeof snippet.variables != "undefined" && snippet.variables != null ? snippet.variables : []);
     self.variableNames = ko.computed(function () {
       var re = /(?:^|\W)\${(\w+)(?!\w)}/g;
 

+ 1 - 1
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -733,7 +733,7 @@ ${ hueIcons.symbols() }
         <li>
           <div class="input-prepend margin-top-10">
             <span class="muted add-on" data-bind="text: name"></span>
-            <input class="input-medium" type="text" placeholder="${ _("Variable value") }" data-bind="autogrowInput: { minWidth: 150, maxWidth: 270, comfortZone: 15 }">
+            <input class="input-medium" type="text" placeholder="${ _("Variable value") }" data-bind="value: value, autogrowInput: { minWidth: 150, maxWidth: 270, comfortZone: 15 }">
           </div>
         </li>
       </ul>