Commit | Line | Data |
---|---|---|
01cb2ab3 BA |
1 | <!DOCTYPE html> |
2 | <html> | |
3 | ||
4 | <head> | |
5 | <meta charset="utf-8"/> | |
6 | <title>erdiag tool</title> | |
7 | </head> | |
8 | ||
9 | <body> | |
10 | <h2>Graph description</h2> | |
11 | <button onClick="processGraphDesc()">Send</button> | |
12 | <div> | |
13 | <span>MCD graph type:</span> | |
04ccd4f6 BA |
14 | <input type="radio" name="mcd" value="compact" checked/> compact |
15 | <input type="radio" name="mcd" value="bubble"/> bubble | |
16 | </div> | |
17 | <div> | |
18 | <span>Output type:</span> | |
19 | <input type="radio" name="output" value="graph" checked/> drawn graph | |
20 | <input type="radio" name="output" value="text"/> graphviz input | |
01cb2ab3 | 21 | </div> |
40b4a9d2 BA |
22 | <div> |
23 | <span>Image type:</span> | |
24 | <input type="radio" name="image" value="svg" checked/> SVG | |
25 | <input type="radio" name="image" value="png"/> PNG | |
26 | </div> | |
01cb2ab3 BA |
27 | |
28 | <textarea id="graphDesc" rows="15" style="width:100%"></textarea> | |
29 | <div id="result" style="display:none"> | |
30 | <h2>MCD graph:</h3> | |
31 | <div id="mcd"></div> | |
32 | <h2>MLD graph:</h2> | |
33 | <div id="mld"></div> | |
34 | <h2>SQL instructions:</h2> | |
35 | <div id="sql"></div> | |
36 | </div> | |
37 | ||
38 | <script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script> | |
39 | <script src="parser.js"></script> | |
40 | <script> | |
41 | const result = document.getElementById("result"); | |
04ccd4f6 BA |
42 | function getRadioValue(name) { |
43 | for (let el of document.getElementsByName(name)) | |
01cb2ab3 BA |
44 | { |
45 | if (el.checked) | |
04ccd4f6 | 46 | return el.value; |
01cb2ab3 | 47 | } |
04ccd4f6 BA |
48 | } |
49 | function processGraphDesc() { | |
50 | const graphDesc = document.getElementById("graphDesc").value; | |
51 | const mcdType = getRadioValue("mcd"); | |
52 | const outputType = getRadioValue("output"); | |
40b4a9d2 BA |
53 | const imageType = getRadioValue("image"); |
54 | const er = new ErDiags(graphDesc, outputType, imageType); | |
04ccd4f6 | 55 | er.drawMcd("mcd", mcdType); |
01cb2ab3 BA |
56 | er.drawMld("mld"); |
57 | er.fillSql("sql"); | |
58 | result.style.display = "block"; | |
59 | //document.location.href = "#result"; //TODO: not working (auto-scroll) | |
60 | } | |
61 | </script> | |
62 | </body> |