X-Git-Url: https://git.auder.net/rpsls.js?a=blobdiff_plain;f=parser.js;fp=parser.js;h=eeafa08392cd615565e6bb6a51a3bd6b1248f3ec;hb=55eb65a256cca97da913831fe50263910ab93f30;hp=5ef2b3f25ba7ebb72fe58a6e0c93e3b30fdcc8e9;hpb=01cb2ab3fccbc8e9fb6afd23db54c5e2613c24c5;p=erdiag.git diff --git a/parser.js b/parser.js index 5ef2b3f..eeafa08 100644 --- a/parser.js +++ b/parser.js @@ -1,7 +1,7 @@ // ER diagram description parser class ErDiags { - constructor(description) + constructor(description, callDot) { this.entities = { }; this.inheritances = [ ]; @@ -9,9 +9,13 @@ class ErDiags this.tables = { }; this.mcdParsing(description); this.mldParsing(); - // Cache SVG graphs returned by server (in addition to server cache = good perfs) - this.mcdGraph = ""; - this.mldGraph = ""; + this.callDot = !!callDot; + if (this.callDot) + { + // Cache SVG graphs returned by server (in addition to server cache = good perfs) + this.mcdGraph = ""; + this.mldGraph = ""; + } this.sqlText = ""; } @@ -302,7 +306,7 @@ class ErDiags { let element = document.getElementById(id); mcdStyle = mcdStyle || "compact"; - if (this.mcdGraph.length > 0) + if (!!this.mcdGraph) { element.innerHTML = this.mcdGraph; return; @@ -420,19 +424,23 @@ class ErDiags }); }); mcdDot += '}'; - //console.log(mcdDot); - ErDiags.AjaxGet(mcdDot, graphSvg => { - this.mcdGraph = graphSvg; - element.innerHTML = graphSvg; - }); + if (this.callDot) + { + // Draw graph in element + ErDiags.AjaxGet(mcdDot, graphSvg => { + this.mcdGraph = graphSvg; + element.innerHTML = graphSvg; + }); + } + else //just show dot input + element.innerHTML = mcdDot.replace(//g,">"); } // "Modèle logique des données", from MCD without anomalies - // TODO: this one should draw links from foreign keys to keys (port=... in
" + sqlText + "
";
}