summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json2
-rw-r--r--public/js/extra.js33
2 files changed, 13 insertions, 22 deletions
diff --git a/package.json b/package.json
index 1ed81c98..1c043184 100644
--- a/package.json
+++ b/package.json
@@ -115,7 +115,7 @@
"validator": "^6.2.0",
"velocity-animate": "^1.4.0",
"visibilityjs": "^1.2.4",
- "viz.js": "^1.4.1",
+ "viz.js": "^1.7.0",
"winston": "^2.3.0",
"xss": "^0.3.3"
},
diff --git a/public/js/extra.js b/public/js/extra.js
index b651d9e6..b0a4bdcb 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -345,30 +345,21 @@ export function finishView(view) {
});
//graphviz
var graphvizs = view.find("div.graphviz.raw").removeClass("raw");
- function parseGraphviz(key, value) {
- var $value = $(value);
- var $ele = $(value).parent().parent();
-
- var graphviz = Viz($value.text());
- if (!graphviz) throw Error('viz.js output empty graph');
- $value.html(graphviz);
-
- $ele.addClass('graphviz');
- $value.children().unwrap().unwrap();
- }
graphvizs.each(function (key, value) {
try {
- parseGraphviz(key, value);
+ var $value = $(value);
+ var $ele = $(value).parent().parent();
+
+ var graphviz = Viz($value.text());
+ if (!graphviz) throw Error('viz.js output empty graph');
+ $value.html(graphviz);
+
+ $ele.addClass('graphviz');
+ $value.children().unwrap().unwrap();
} catch (err) {
- // workaround for graphviz not recover from error
- try {
- parseGraphviz(key, value);
- } catch (err) {
- var $value = $(value);
- $value.unwrap();
- $value.parent().append('<div class="alert alert-warning">' + err + '</div>');
- console.warn(err);
- }
+ $value.unwrap();
+ $value.parent().append('<div class="alert alert-warning">' + err + '</div>');
+ console.warn(err);
}
});
//mermaid