|
46 | 46 | </script> |
47 | 47 |
|
48 | 48 | <script type="text/javascript"> |
49 | | - |
| 49 | +(function() { |
| 50 | + var subWindow = null; |
50 | 51 | RED.nodes.registerType('debug',{ |
51 | 52 | category: 'output', |
52 | 53 | defaults: { |
|
104 | 105 | '<a class="sidebar-header-button-toggle selected" id="debug-tab-filter-all" href="#"><span data-i18n="node-red:debug.sidebar.filterAll"></span></a>'+ |
105 | 106 | '<a class="sidebar-header-button-toggle" id="debug-tab-filter-current" href="#"><span data-i18n="node-red:debug.sidebar.filterCurrent"></span></a> '+ |
106 | 107 | '</span>'+ |
107 | | - '<span><a id="debug-tab-clear" title="clear log" class="sidebar-header-button" href="#"><i class="fa fa-trash"></i></a></span></div>').appendTo(content); |
| 108 | + '<span class="button-group"><a id="debug-tab-open" title="open in new window" class="sidebar-header-button" href="#"><i class="fa fa-desktop"></i></a></span> ' + |
| 109 | + '<span class="button-group"><a id="debug-tab-clear" title="clear log" class="sidebar-header-button" href="#"><i class="fa fa-trash"></i></a></span></div>').appendTo(content); |
108 | 110 |
|
109 | 111 | var messages = $('<div id="debug-content"/>').appendTo(content); |
110 | 112 | content.i18n(); |
|
143 | 145 | } |
144 | 146 |
|
145 | 147 | this.handleDebugMessage = function(t,o) { |
| 148 | + |
| 149 | + if (subWindow) { |
| 150 | + try { |
| 151 | + subWindow.postMessage(JSON.stringify(o),"*") |
| 152 | + } catch(err) { |
| 153 | + console.log(err); |
| 154 | + } |
| 155 | + } |
146 | 156 | var msg = document.createElement("div"); |
147 | 157 |
|
148 | 158 | var sourceNode = RED.nodes.node(o.id) || RED.nodes.node(o.z); |
|
245 | 255 | } |
246 | 256 | }); |
247 | 257 | RED.events.on("workspace:change", refreshMessageList); |
248 | | - |
| 258 | + $("#debug-tab-open").click(function(e) { |
| 259 | + e.preventDefault(); |
| 260 | + subWindow = window.open(document.location.toString().replace(/#$/,"")+"debug/view/view.html","nodeREDDebugView","menubar=no,location=no,toolbar=no,chrome,height=500,width=600"); |
| 261 | + }); |
249 | 262 | }, |
250 | 263 | onpaletteremove: function() { |
251 | 264 | RED.comms.unsubscribe("debug",this.handleDebugMessage); |
|
282 | 295 | } |
283 | 296 |
|
284 | 297 | }); |
| 298 | +})(); |
285 | 299 | </script> |
286 | 300 |
|
287 | | -<style> |
288 | | - #debug-content { |
289 | | - position: absolute; |
290 | | - top: 43px; |
291 | | - bottom: 0px; |
292 | | - left:0px; |
293 | | - right: 0px; |
294 | | - overflow-y: scroll; |
295 | | - } |
296 | | - .debug-message { |
297 | | - cursor: pointer; |
298 | | - border-bottom: 1px solid #eee; |
299 | | - border-left: 8px solid #eee; |
300 | | - border-right: 8px solid #eee; |
301 | | - padding: 2px; |
302 | | - } |
303 | | - .debug-message-date { |
304 | | - background: #fff; |
305 | | - font-size: 9px; |
306 | | - color: #aaa; |
307 | | - padding: 1px 5px 1px 1px; |
308 | | - } |
309 | | - .debug-message-topic { |
310 | | - display: block; |
311 | | - background: #fff; |
312 | | - padding: 1px; |
313 | | - font-size: 10px; |
314 | | - color: #a66; |
315 | | - } |
316 | | - .debug-message-name { |
317 | | - background: #fff; |
318 | | - padding: 1px 5px; |
319 | | - font-size: 9px; |
320 | | - color: #aac; |
321 | | - } |
322 | | - .debug-message-payload { |
323 | | - display: block; |
324 | | - padding: 2px; |
325 | | - background: #fff; |
326 | | - } |
327 | | - .debug-message-level-log { |
328 | | - border-left-color: #eee; |
329 | | - border-right-color: #eee; |
330 | | - } |
331 | | - .debug-message-level-30 { |
332 | | - border-left-color: #ffdf9d; |
333 | | - border-right-color: #ffdf9d; |
334 | | - } |
335 | | - .debug-message-level-20 { |
336 | | - border-left-color: #f99; |
337 | | - border-right-color: #f99; |
338 | | - } |
339 | | -</style> |
| 301 | +<link rel="stylesheet" href="debug/view/style.css"> |
0 commit comments