This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmainWindow.html
62 lines (48 loc) · 1.7 KB
/
mainWindow.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>nMon Agent</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
</head>
<body>
<nav>
<div class="nav-wrapper teal">
<a class="brand-logo center">nMon Agent</a>
</div>
</nav>
<div class="container">
<br>
<form>
<div>
<label>Server Key</label>
<input type="text" id="serverkey">
</div>
<div>
<label>Gateway Address</label>
<input type="text" id="gateway">
</div>
<button type="submit" class="btn waves-effect waves-light right">Save</button>
</form>
</div>
<script>
const electron = require('electron');
const {ipcRenderer} = electron;
const form = document.querySelector('form');
ipcRenderer.on('config:save', function(e, [serverkey, gateway]){
document.querySelector("#serverkey").value = serverkey;
document.querySelector("#gateway").value = gateway;
});
ipcRenderer.on('config:show', function(e, [serverkey, gateway]){
document.querySelector("#serverkey").value = serverkey;
document.querySelector("#gateway").value = gateway;
});
form.addEventListener('submit', submitForm);
function submitForm(e) {
e.preventDefault();
const serverkey = document.querySelector('#serverkey').value;
const gateway = document.querySelector('#gateway').value;
ipcRenderer.send("config:save", [serverkey, gateway]);
}
</script>
</body>
</html>