Sfoglia il codice sorgente

HUE-3808 [core] Do not trigger any call on initialization

Also apply the binding only on the top main bar.
Romain Rigaux 9 anni fa
parent
commit
8e25f497d1
1 ha cambiato i file con 6 aggiunte e 4 eliminazioni
  1. 6 4
      desktop/core/src/desktop/templates/logs.mako

+ 6 - 4
desktop/core/src/desktop/templates/logs.mako

@@ -99,10 +99,12 @@ ${layout.menubar(section='log_view')}
   var LiveDebugging = function () {
   var LiveDebugging = function () {
     var self = this;
     var self = this;
 
 
-    self.forcedDebug = ko.observable(false);
+    self.forcedDebug = ko.observable();
     self.forcedDebug.subscribe(function(newValue) {
     self.forcedDebug.subscribe(function(newValue) {
-      self.toggleLogLevel();
-    });
+      if (newValue != null) {
+        self.toggleLogLevel();
+      }
+    }, this, "beforeChange");
 
 
     self.getDebugLevel = function() {
     self.getDebugLevel = function() {
       $.get("/desktop/get_debug_level", function(data) { self.forcedDebug(data.debug_all); });
       $.get("/desktop/get_debug_level", function(data) { self.forcedDebug(data.debug_all); });
@@ -130,7 +132,7 @@ ${layout.menubar(section='log_view')}
 
 
   $(document).ready(function () {
   $(document).ready(function () {
     viewModel = new LiveDebugging();
     viewModel = new LiveDebugging();
-    ko.applyBindings(viewModel);
+    ko.applyBindings(viewModel, $(".action-main-bar")[0]);
 
 
     viewModel.getDebugLevel();
     viewModel.getDebugLevel();