1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Don't cache api requests in the editor

Fixes #413
This commit is contained in:
Nick O'Leary 2014-09-24 09:57:45 +01:00
parent 8742bf354b
commit dbaa1ed59c
3 changed files with 77 additions and 68 deletions

View File

@ -151,7 +151,7 @@
var name = (o.name?o.name:o.id).toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"); var name = (o.name?o.name:o.id).toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
var topic = (o.topic||"").toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"); var topic = (o.topic||"").toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
var payload = (o.msg||"").toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"); var payload = (o.msg||"").toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
msg.className = 'debug-message'+(o.level?(' debug-message-level-'+o.level):'') msg.className = 'debug-message'+(o.level?(' debug-message-level-'+o.level):'');
msg.innerHTML = '<span class="debug-message-date">'+getTimestamp()+'</span>'+ msg.innerHTML = '<span class="debug-message-date">'+getTimestamp()+'</span>'+
'<span class="debug-message-name">['+name+']</span>'+ '<span class="debug-message-name">['+name+']</span>'+
(o.topic?'<span class="debug-message-topic">'+topic+'</span>':'')+ (o.topic?'<span class="debug-message-topic">'+topic+'</span>':'')+

View File

@ -153,6 +153,7 @@ var RED = (function() {
headers: { headers: {
"Accept":"application/json" "Accept":"application/json"
}, },
cache: false,
url: 'nodes', url: 'nodes',
success: function(data) { success: function(data) {
RED.nodes.setNodeList(data); RED.nodes.setNodeList(data);
@ -166,6 +167,7 @@ var RED = (function() {
headers: { headers: {
"Accept":"text/html" "Accept":"text/html"
}, },
cache: false,
url: 'nodes', url: 'nodes',
success: function(data) { success: function(data) {
$("body").append(data); $("body").append(data);
@ -178,7 +180,13 @@ var RED = (function() {
} }
function loadFlows() { function loadFlows() {
$.getJSON("flows",function(nodes) { $.ajax({
headers: {
"Accept":"application/json"
},
cache: false,
url: 'flows',
success: function(nodes) {
RED.nodes.import(nodes); RED.nodes.import(nodes);
RED.view.dirty(false); RED.view.dirty(false);
RED.view.redraw(); RED.view.redraw();
@ -247,6 +255,7 @@ var RED = (function() {
} }
} }
}); });
}
}); });
} }

View File

@ -108,7 +108,7 @@ RED.nodes = (function() {
getNodeType: function(nt) { getNodeType: function(nt) {
return nodeDefinitions[nt]; return nodeDefinitions[nt];
} }
} };
return exports; return exports;
})(); })();
@ -128,7 +128,7 @@ RED.nodes = (function() {
if (n._def.defaults.hasOwnProperty(d)) { if (n._def.defaults.hasOwnProperty(d)) {
var property = n._def.defaults[d]; var property = n._def.defaults[d];
if (property.type) { if (property.type) {
var type = registry.getNodeType(property.type) var type = registry.getNodeType(property.type);
if (type && type.category == "config") { if (type && type.category == "config") {
var configNode = configNodes[n[d]]; var configNode = configNodes[n[d]];
if (configNode) { if (configNode) {
@ -181,7 +181,7 @@ RED.nodes = (function() {
if (node._def.defaults.hasOwnProperty(d)) { if (node._def.defaults.hasOwnProperty(d)) {
var property = node._def.defaults[d]; var property = node._def.defaults[d];
if (property.type) { if (property.type) {
var type = registry.getNodeType(property.type) var type = registry.getNodeType(property.type);
if (type && type.category == "config") { if (type && type.category == "config") {
var configNode = configNodes[node[d]]; var configNode = configNodes[node[d]];
if (configNode) { if (configNode) {