|
1 | 1 | <!DOCTYPE html>
|
2 | 2 | <html>
|
3 |
| - <head> |
4 |
| - <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> |
5 |
| - <link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection" /> |
6 |
| - <link type="text/css" rel="stylesheet" href="css/index.css" /> |
7 |
| - <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
8 |
| - <title>PineSQL</title> |
9 |
| - </head> |
10 |
| - <body> |
11 |
| - <header> |
12 |
| - <div class="row"> |
13 |
| - <div class="input-field col s12"> |
14 |
| - <div id="ping">Connect to server first</div> |
15 |
| - <div class="divider"></div> |
16 |
| - <div class="row"></div> |
17 |
| - <input name="run" placeholder="PineSQL-friendly commands only" id="cmd" type="text" style="color: black; -webkit-app-region: no-drag;"> |
18 |
| - <input name="param" placeholder="Function parameter" id="param" type="text" style="color: black; display: none;"> |
19 |
| - <input id="prevValue" name="prevValue" type="hidden"> |
20 |
| - <a class="waves-effect waves-light btn" id="run" name="run">Run</a> |
21 |
| - <a class="waves-effect waves-teal btn-flat" id="prevButton" name="prevButton">Previous command</a> |
22 |
| - <!-- <a class="waves-effect waves-teal btn-flat" id="assistantButton" name="assistantButton">Assistant</a> --> |
23 |
| - <div class="chip right" id="chip_cmd" title="Use 'help' to get available commands"> |
| 3 | + |
| 4 | +<head> |
| 5 | + <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> |
| 6 | + <link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection" /> |
| 7 | + <link type="text/css" rel="stylesheet" href="css/index.css" /> |
| 8 | + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 9 | + <title>PineSQL</title> |
| 10 | +</head> |
| 11 | + |
| 12 | +<body> |
| 13 | + <header> |
| 14 | + <div class="row"> |
| 15 | + <div class="input-field col s12"> |
| 16 | + <div id="ping">Connect to server first</div> |
| 17 | + <div class="divider"></div> |
| 18 | + <div class="row"></div> |
| 19 | + <input name="run" placeholder="PineSQL-friendly commands only" id="cmd" type="text" style="color: black; -webkit-app-region: no-drag;"> |
| 20 | + <input name="param" placeholder="Function parameter" id="param" type="text" style="color: black; display: none;"> |
| 21 | + <input id="prevValue" name="prevValue" type="hidden"> |
| 22 | + <a class="waves-effect waves-light btn" id="run" name="run">Run</a> |
| 23 | + <a class="waves-effect waves-teal btn-flat" id="prevButton" name="prevButton">Previous command</a> |
| 24 | + <!-- <a class="waves-effect waves-teal btn-flat" id="assistantButton" name="assistantButton">Assistant</a> --> |
| 25 | + <div class="chip right" id="chip_cmd" title="Use 'help' to get available commands"> |
24 | 26 | No command assigned
|
25 |
| - </div> |
26 |
| - </div> |
27 |
| - </div> |
28 |
| - </header> |
29 |
| - <main> |
30 |
| - <div class="row"> |
31 |
| - <form class="col s12"> |
32 |
| - <div class="row"> |
33 |
| - <div class="input-field col s12"> |
34 |
| - <textarea id="log" class="materialize-textarea" readonly></textarea> |
| 27 | + </div> |
| 28 | + </div> |
35 | 29 | </div>
|
36 |
| - </div> |
37 |
| - </form> |
38 |
| - </div> |
39 |
| - </main> |
40 |
| - <script>if (typeof module === 'object') {window.module = module; module = undefined;}</script> |
41 |
| - <script src="js/base.js"></script> |
42 |
| - <script> |
43 |
| - const mysql = require('mysql') |
44 |
| - const electron = require('electron') |
45 |
| - const ipc = require('electron').ipcRenderer |
46 |
| - const run = document.getElementById('run') |
47 |
| - const cmd = document.getElementById('cmd') |
48 |
| - const log = document.getElementById('log') |
49 |
| - const chip = document.getElementById('chip_cmd') |
50 |
| - const paraminput = document.getElementById('param') |
51 |
| - const prevValue = document.getElementById('prevValue') |
52 |
| - const prevButton = document.getElementById('prevButton') |
53 |
| - const assistantButton = document.getElementById('assistantButton') |
54 |
| - const pingObj = document.getElementById("ping") |
55 |
| - const pjson = require('./package.json'); |
| 30 | + </header> |
| 31 | + <main> |
| 32 | + <div class="row"> |
| 33 | + <form class="col s12"> |
| 34 | + <div class="row"> |
| 35 | + <div class="input-field col s12"> |
| 36 | + <textarea id="log" class="materialize-textarea" readonly></textarea> |
| 37 | + </div> |
| 38 | + </div> |
| 39 | + </form> |
| 40 | + </div> |
| 41 | + </main> |
| 42 | + <script> |
| 43 | + if (typeof module === 'object') { |
| 44 | + window.module = module; |
| 45 | + module = undefined; |
| 46 | + } |
| 47 | + </script> |
| 48 | + <script src="js/base.js"></script> |
| 49 | + <script> |
| 50 | + const mysql = require('mysql') |
| 51 | + const electron = require('electron') |
| 52 | + const ipc = require('electron').ipcRenderer |
| 53 | + const run = document.getElementById('run') |
| 54 | + const cmd = document.getElementById('cmd') |
| 55 | + const log = document.getElementById('log') |
| 56 | + const chip = document.getElementById('chip_cmd') |
| 57 | + const paraminput = document.getElementById('param') |
| 58 | + const prevValue = document.getElementById('prevValue') |
| 59 | + const prevButton = document.getElementById('prevButton') |
| 60 | + const assistantButton = document.getElementById('assistantButton') |
| 61 | + const pingObj = document.getElementById("ping") |
| 62 | + const pjson = require('./package.json'); |
56 | 63 |
|
57 |
| - console.log("PineSQL " + pjson.version) |
| 64 | + console.log("PineSQL " + pjson.version) |
58 | 65 |
|
59 |
| - run.addEventListener('click', function (event) { |
60 |
| - var split = cmd.value.split(" "); |
61 |
| - switch (split[0]) { |
62 |
| - case "connect": |
63 |
| - appendLog("Connecting to " + split[1] + " " + split[2], "CONNECT") |
64 |
| - connect(split[1], split[2], split[3]) |
65 |
| - break; |
66 |
| - case "exit": |
67 |
| - ipc.send('exit'); |
68 |
| - break; |
69 |
| - case "query": |
70 |
| - appendLog("Executing " + paraminput.value + " " + "on " + split[1], "QUERY") |
71 |
| - query(split[1], split[2], split[3], paraminput.value) |
72 |
| - break; |
73 |
| - case "querydb": |
74 |
| - appendLog("Executing " + paraminput.value + " " + "on " + split[4] + " in " + split[1], "QUERYDB") |
75 |
| - querydb(split[1], split[2], split[3], paraminput.value, split[4]) |
76 |
| - break; |
77 |
| - case "ping": |
78 |
| - appendLog("Sending ping to " + split[1] + " " + split[2], "CONNECT") |
79 |
| - ping(split[1], split[2], split[3]) |
80 |
| - break; |
81 |
| - case "clear": |
82 |
| - log.value = ""; |
83 |
| - M.textareaAutoResize($('#log')); |
84 |
| - break; |
85 |
| - default: |
86 |
| - appendLog("Error! Command not found.", "ERROR") |
87 |
| - break; |
88 |
| - } |
89 |
| - prevValue.value = cmd.value; |
90 |
| - cmd.value = "" |
91 |
| - paraminput.value = "" |
92 |
| - chip.innerText = "No command assigned" |
93 |
| - chip.title = "Use 'help' to get available commands" |
94 |
| - }) |
| 66 | + run.addEventListener('click', function(event) { |
| 67 | + var split = cmd.value.split(" "); |
| 68 | + switch (split[0]) { |
| 69 | + case "connect": |
| 70 | + appendLog("Connecting to " + split[1] + " " + split[2], "CONNECT") |
| 71 | + connect(split[1], split[2], split[3]) |
| 72 | + break; |
| 73 | + case "exit": |
| 74 | + ipc.send('exit'); |
| 75 | + break; |
| 76 | + case "query": |
| 77 | + appendLog("Executing " + paraminput.value + " " + "on " + split[1], "QUERY") |
| 78 | + query(split[1], split[2], split[3], paraminput.value) |
| 79 | + break; |
| 80 | + case "querydb": |
| 81 | + appendLog("Executing " + paraminput.value + " " + "on " + split[4] + " in " + split[1], "QUERYDB") |
| 82 | + querydb(split[1], split[2], split[3], paraminput.value, split[4]) |
| 83 | + break; |
| 84 | + case "ping": |
| 85 | + appendLog("Sending ping to " + split[1] + " " + split[2], "CONNECT") |
| 86 | + ping(split[1], split[2], split[3]) |
| 87 | + break; |
| 88 | + case "clear": |
| 89 | + log.value = ""; |
| 90 | + M.textareaAutoResize($('#log')); |
| 91 | + break; |
| 92 | + default: |
| 93 | + appendLog("Error! Command not found.", "ERROR") |
| 94 | + break; |
| 95 | + } |
| 96 | + prevValue.value = cmd.value; |
| 97 | + cmd.value = "" |
| 98 | + paraminput.value = "" |
| 99 | + chip.innerText = "No command assigned" |
| 100 | + chip.title = "Use 'help' to get available commands" |
| 101 | + }) |
95 | 102 |
|
96 |
| - prevButton.addEventListener('click', function (event) { |
97 |
| - cmd.value = prevValue.value |
98 |
| - }) |
| 103 | + prevButton.addEventListener('click', function(event) { |
| 104 | + cmd.value = prevValue.value |
| 105 | + }) |
99 | 106 |
|
100 |
| - document.addEventListener("keydown", function (e) { |
101 |
| - if (e.which === 123) { |
102 |
| - ipc.send('developer') |
| 107 | + document.addEventListener("keydown", function(e) { |
| 108 | + if (e.which === 123) { |
| 109 | + ipc.send('developer') |
103 | 110 | }
|
104 |
| - }); |
| 111 | + }); |
105 | 112 |
|
106 |
| - cmd.addEventListener("keydown", function (e) { |
107 |
| - if (e.which === 13) { |
108 |
| - run.click() |
| 113 | + cmd.addEventListener("keydown", function(e) { |
| 114 | + if (e.which === 13) { |
| 115 | + run.click() |
109 | 116 | }
|
110 |
| - }); |
| 117 | + }); |
111 | 118 |
|
112 |
| - cmd.addEventListener("keydown", function (e) { |
113 |
| - if (e.which === 38) { |
114 |
| - cmd.value = prevValue.value |
| 119 | + cmd.addEventListener("keydown", function(e) { |
| 120 | + if (e.which === 38) { |
| 121 | + cmd.value = prevValue.value |
115 | 122 | }
|
116 |
| - }); |
| 123 | + }); |
117 | 124 |
|
118 |
| - paraminput.addEventListener("keydown", function (e) { |
119 |
| - if (e.which === 13) { |
120 |
| - run.click() |
| 125 | + paraminput.addEventListener("keydown", function(e) { |
| 126 | + if (e.which === 13) { |
| 127 | + run.click() |
121 | 128 | }
|
122 |
| - }); |
| 129 | + }); |
123 | 130 |
|
124 |
| - /* assistantButton.addEventListener("click" , function (e) { |
125 |
| - ipc.send('assistant') |
126 |
| - }) */ |
| 131 | + /* assistantButton.addEventListener("click" , function (e) { |
| 132 | + ipc.send('assistant') |
| 133 | + }) */ |
127 | 134 |
|
128 |
| - cmd.addEventListener("keyup", function (e) { |
| 135 | + cmd.addEventListener("keyup", function(e) { |
129 | 136 | var split = cmd.value.split(" ");
|
130 |
| - switch(split[0]) { |
131 |
| - case "connect": |
132 |
| - chip.title = "'connect hostname username password'" |
133 |
| - paraminput.style.display = "none" |
134 |
| - chip.innerText = "Connect to server" |
135 |
| - break; |
136 |
| - case "exit": |
137 |
| - chip.title = "'exit'" |
138 |
| - paraminput.style.display = "none" |
139 |
| - chip.innerText = "Quit PineSQL" |
140 |
| - break; |
141 |
| - case "query": |
142 |
| - chip.title = "'query hostname username password'" |
143 |
| - paraminput.style.display = "inline" |
144 |
| - chip.innerText = "Execute SQL" |
145 |
| - break; |
146 |
| - case "querydb": |
147 |
| - chip.title = "'querydb hostname username password database'" |
148 |
| - paraminput.style.display = "inline" |
149 |
| - chip.innerText = "Execute SQL on database" |
150 |
| - break; |
151 |
| - case "ping": |
152 |
| - chip.title = "'ping hostname username password'" |
153 |
| - paraminput.style.display = "none" |
154 |
| - chip.innerText = "Send ping to server" |
155 |
| - break; |
156 |
| - case "clear": |
157 |
| - chip.title = "'clear'" |
158 |
| - paraminput.style.display = "none" |
159 |
| - chip.innerText = "Clear logs" |
160 |
| - break; |
161 |
| - default: |
162 |
| - chip.title = "Use 'help' to get available commands" |
163 |
| - paraminput.style.display = "none" |
164 |
| - chip.innerText = "No command assigned" |
165 |
| - break; |
| 137 | + switch (split[0]) { |
| 138 | + case "connect": |
| 139 | + chip.title = "'connect hostname username password'" |
| 140 | + paraminput.style.display = "none" |
| 141 | + chip.innerText = "Connect to server" |
| 142 | + break; |
| 143 | + case "exit": |
| 144 | + chip.title = "'exit'" |
| 145 | + paraminput.style.display = "none" |
| 146 | + chip.innerText = "Quit PineSQL" |
| 147 | + break; |
| 148 | + case "query": |
| 149 | + chip.title = "'query hostname username password'" |
| 150 | + paraminput.style.display = "inline" |
| 151 | + chip.innerText = "Execute SQL" |
| 152 | + break; |
| 153 | + case "querydb": |
| 154 | + chip.title = "'querydb hostname username password database'" |
| 155 | + paraminput.style.display = "inline" |
| 156 | + chip.innerText = "Execute SQL on database" |
| 157 | + break; |
| 158 | + case "ping": |
| 159 | + chip.title = "'ping hostname username password'" |
| 160 | + paraminput.style.display = "none" |
| 161 | + chip.innerText = "Send ping to server" |
| 162 | + break; |
| 163 | + case "clear": |
| 164 | + chip.title = "'clear'" |
| 165 | + paraminput.style.display = "none" |
| 166 | + chip.innerText = "Clear logs" |
| 167 | + break; |
| 168 | + default: |
| 169 | + chip.title = "Use 'help' to get available commands" |
| 170 | + paraminput.style.display = "none" |
| 171 | + chip.innerText = "No command assigned" |
| 172 | + break; |
166 | 173 | }
|
167 |
| - }); |
168 |
| - </script> |
169 |
| - <script src="js/commands.js"></script> |
170 |
| - <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> |
171 |
| - <script type="text/javascript" src="js/materialize.min.js"></script> |
172 |
| - <script>if (window.module) module = window.module;</script> |
173 |
| - </body> |
| 174 | + }); |
| 175 | + </script> |
| 176 | + <script src="js/commands.js"></script> |
| 177 | + <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> |
| 178 | + <script type="text/javascript" src="js/materialize.min.js"></script> |
| 179 | + <script> |
| 180 | + if (window.module) module = window.module; |
| 181 | + </script> |
| 182 | +</body> |
| 183 | + |
174 | 184 | </html>
|
0 commit comments