summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-01-11 19:35:42 +0200
committerAlon Levy <alon@pobox.com>2015-01-11 19:35:44 +0200
commitec7cbd350ca29e03b4d5dd554b3aa051c851bf3e (patch)
tree414662cf396c591d8d1f4f4712391ebd2484aac6 /src
parent22d8f75dab43ec3f291bf53eb400b9306f0314cb (diff)
client: json loading: don't send invalid dates
i.e. start/end on node. It raises a scala error in neo4j (and isn't nice).
Diffstat (limited to 'src')
-rw-r--r--src/client/model/graph.js31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/client/model/graph.js b/src/client/model/graph.js
index 7141c61c..17a2d63b 100644
--- a/src/client/model/graph.js
+++ b/src/client/model/graph.js
@@ -798,19 +798,26 @@ function Graph(spec) {
old_id_to_new_id = {};
diff = model_diff.new_topo_diff();
- diff.node_set_add = nodes.map(function(spec) {
- var node = model_core.create_node__set_random_id({
- name: spec.name ? spec.name : spec.id,
- type: spec.type,
+ diff.node_set_add = nodes.map(function(ext_spec) {
+ var node_spec = {
+ name: ext_spec.name ? ext_spec.name : ext_spec.id,
+ type: ext_spec.type,
state: "perm",
- start: new Date(spec.start),
- end: new Date(spec.end),
- status: spec.status,
- url: spec.url,
- x: spec.x,
- y: spec.y,
- });
- old_id_to_new_id[spec.id] = node.id,
+ status: ext_spec.status,
+ url: ext_spec.url,
+ x: ext_spec.x,
+ y: ext_spec.y,
+ },
+ node;
+
+ if (ext_spec.start) {
+ node_spec.start = new Date(ext_spec.start);
+ }
+ if (ext_spec.end) {
+ node_spec.end = new Date(ext_spec.end);
+ }
+ node = model_core.create_node__set_random_id(node_spec);
+ old_id_to_new_id[ext_spec.id] = node.id,
node_by_id[node.id] = node;
return node;
});