forked from electron/electron-quick-start
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
210 lines (194 loc) · 8.05 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic Page Needs
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta charset="utf-8">
<title>EMRS-2-Easymed</title>
<meta name="description" content="A simple Electron-based tool to convert data from the EMRS to Easymed-compatible SQL INSERT queries">
<meta name="author" content="HKUST 2015-2016 CSE FYP Group 43">
<!-- Mobile Specific Metas
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- FONT
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<!-- CSS
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/skeleton.css">
<!-- Favicon
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="icon" type="image/png" href="/images/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="/images/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/images/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/images/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/images/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/images/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/images/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/images/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/images/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/images/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/images/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png">
<link rel="manifest" href="/images/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/images/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<style type="text/css">
/*
* Usage:
*
<div class="sk-three-bounce">
<div class="sk-child sk-bounce1"></div>
<div class="sk-child sk-bounce2"></div>
<div class="sk-child sk-bounce3"></div>
</div>
*
*/
.sk-three-bounce {
margin: 40px auto;
width: 80px;
text-align: center; }
.sk-three-bounce .sk-child {
width: 20px;
height: 20px;
background-color: #333;
border-radius: 100%;
display: inline-block;
-webkit-animation: sk-three-bounce 1.4s ease-in-out 0s infinite both;
animation: sk-three-bounce 1.4s ease-in-out 0s infinite both; }
.sk-three-bounce .sk-bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s; }
.sk-three-bounce .sk-bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s; }
@-webkit-keyframes sk-three-bounce {
0%, 80%, 100% {
-webkit-transform: scale(0);
transform: scale(0); }
40% {
-webkit-transform: scale(1);
transform: scale(1); } }
@keyframes sk-three-bounce {
0%, 80%, 100% {
-webkit-transform: scale(0);
transform: scale(0); }
40% {
-webkit-transform: scale(1);
transform: scale(1); } }
</style>
</head>
<body>
<script src="emrsMySQL.js"></script>
<script>
//put functions here
function getAllInputs(callback) {
var input = {};
input.host = document.getElementById('hostInput').value;
if (!input.host) {
callback('Host cannot be empty', null);
} else {
input.database = document.getElementById('databaseInput').value;
if (!input.database) {
callback("Database cannot be empty", null);
} else {
input.username = document.getElementById('usernameInput').value;
if (!input.username) {
callback("Username cannot be empty", null);
} else {
input.password = document.getElementById('passwordInput').value;
if (!input.password) {
callback("Password cannot be empty", null);
} else
callback(null, input);
}
}
}
}
function testConnection() {
//find all values
//set error if some of them are empty
// call testMySQLConnection() with all params
getAllInputs(function (err, results) {
const {dialog} = require('electron').remote;
if (err) {
dialog.showErrorBox('An Error Message', err);
} else {
console.log(JSON.stringify(results));
testMySQLConnection(results, function (err, tof) {
if (err) {
dialog.showErrorBox('Failed to connect to the database', JSON.stringify(err));
} else if (tof) {
dialog.showMessageBox({ message: "Something", buttons: ["OK"] });
}
});
}
});
}
function startConversion() {
}
</script>
<!-- Primary Page Layout
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="container">
<div class="row" style="margin-top: 5%">
<div class="twelve column">
<div class="sk-three-bounce">
<div class="sk-child sk-bounce1"></div>
<div class="sk-child sk-bounce2"></div>
<div class="sk-child sk-bounce3"></div>
</div>
<h5>Connect to EMRS:</h5>
<form>
<div class="row">
<div class="six columns">
<label for="hostInput">Host (IP Address)</label>
<input class="u-full-width" type="url" placeholder="e.g. 192.168.0.123" id="hostInput">
</div>
<div class="six columns">
<label for="databaseInput">Database</label>
<input class="u-full-width" type="text" placeholder="SIGHT" id="databaseInput">
</div>
</div>
<div class="row">
<div class="six columns">
<label for="usernameInput">Username</label>
<input class="u-full-width" type="text" id="usernameInput">
</div>
<div class="six columns">
<label for="passwordInput">Password</label>
<input class="u-full-width" type="password" id="passwordInput">
</div>
</div>
</form>
<div class="row">
<div class="six columns">
<div style="text-align: center;"><a class="button" onclick="testConnection()">Test connection</a></div>
</div>
<div class="six columns">
<div style="text-align: center;"><a class="button button-primary" onclick="startConversion()">Convert</a></div>
</div>
</div>
</div>
</div>
<div class="row" style="margin-top: 5%">
<h5>Output:</h5>
<textarea class="u-full-width" placeholder="e.g. INSERT INTO v2.patients ..." id="exampleMessage"></textarea>
</div>
<div class="row">
<div class="six columns">
<div style="text-align: center;"><a class="button button-primary" href="#">Copy all</a></div>
</div>
<div class="six columns">
<div style="text-align: center;"><a class="button button-primary" href="#">Save as</a></div>
</div>
</div>
</div>
<!-- End Document
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
</body>
</html>