Преглед изворни кода

HUE4907 [editor] Provide a default value to parameters

jdesjean пре 8 година
родитељ
комит
9bc6790
1 измењених фајлова са 2 додато и 8 уклоњено
  1. 2 8
      desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

+ 2 - 8
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -688,7 +688,7 @@ var EditorViewModel = (function() {
     self.variableNames.subscribe(function (newVal) {
       var toDelete = [];
       var toAdd = [];
-      var toUpdate = [];
+
       if (newVal.length == self.variables().length) { // Just rename one of the variable
         $.each(newVal, function(i, item) {
           self.variables()[i].name(item.name);
@@ -702,8 +702,6 @@ var EditorViewModel = (function() {
           });
           if (! match) {
             toAdd.push(item);
-          } else {
-            toUpdate.push(item);
           }
         });
         $.each(self.variables(), function (key, _var) {
@@ -714,12 +712,8 @@ var EditorViewModel = (function() {
             toDelete.push(_var);
           }
         });
-        $.each(toUpdate, function (i, item) {
-          self.variables()[i].name(item.name);
-          self.variables()[i].defaultValue(item.defaultValue);
-        });
         $.each(toDelete, function (index, item) {
-          self.variables.remove(item.name);
+          self.variables.remove(item);
         });
         $.each(toAdd, function (index, item) {
           self.variables.push(ko.mapping.fromJS({'name': item.name, 'value': '', defaultValue: item.defaultValue}));