-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
221 lines (192 loc) · 6.09 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
211
212
213
214
215
216
217
218
219
220
221
<!DOCTYPE html>
<html>
<head>
<meta name="google-signin-scope" content="profile email">
<meta name="google-signin-client_id" content="597205692648-odmf1iggl3c7nul3469ctchmtocanbrv.apps.googleusercontent.com">
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script type="text/javascript" src="static/main.js"></script>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<style>
.g-signin2{
height:20%;
width:20%;
margin: 0 auto;
}
#mainPage {
display: none;
}
#progBarContainer{
visibility: hidden;
}
#Download{
visibility: hidden;
}
iframe {
display: none;
}
#configOptions {
padding: 50px 0;
text-align: left;
background-color: lightblue;
margin-top: 20px;
margin-left: 10px;
margin-right: 50px;
visibility: hidden;
}
form {
text-align: left;
}
#channel {
visibility: hidden;
}
#selection{
padding: 1%;
}
</style>
</head>
<body>
<div id="signin" class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"></div>
<div id="mainPage">
<button onclick="selectDevice()">Select</button>
<form id="config_details" method="post" target="#">
<div id="selection">
<label for="project">Select Project: </label>
<select id="project_select">
<option value="0">---</option>
</select>
<label for="device">Select Device: </label>
<select id="devSel" name="deviceName">
<option value="0">---</option>
</select><br><br>
</div>
<div id="configOptions">
<table id="config_details_table">
<tr>
<th><label for="chan">Select Channel Mask:</label></th>
<td>
<select align="right" id="chan" name="DEV_CHAN_MASK">
</select>
</td>
</tr>
<tr>
<th>Code version: </th>
<td>
<select align="right" id="versions" name="DEV_VERSION">
</select>
</td>
</tr>
<tr><td colspan=3>--------------------------------------------------------------------</td></tr>
<tr><td colspan=3>Please enter last 9 nibbles of the following device fields </td></tr>
<tr>
<tr>
<th>
<label for="panId">Extended Pan ID: </label>
</th>
<td id="fixedPan" align="right"></td>
<td>
<input type="text" id="panId" name="DEV_EXT_PAN" maxlength="9"></input>
</td>
</tr>
<th>
<label id="macStartLabel" for="macStart">MAC Start</label>
</th>
<td id="macStartBase" align="right"></td>
<td>
<input type="text" id="macStart" name="macStart" maxlength="9"></input>
</td>
</tr>
<tr>
<th>
<label id="macEndLabel" for="macEnd">MAC End</label>
</th>
<td id="macEndBase" align="right"></td>
<td>
<input type="text" id="macEnd" name="macEnd" maxlength="9"></input>
</td>
</tr>
</table>
<input type="submit" id="submitForm" value="Submit"/>
</form>
</div>
<p></p>
<div id="progBarContainer" class="w3-light-grey">
<div id="progBar" class="w3-container w3-green w3-center" style="width:0%">0%</div>
</div><br>
<p></p>
<p></p>
<a id="Download" download>Download</a>
<p></p>
<p></p>
<a href="#" onclick="signOut();">Sign out</a>
<script>
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
console.log('User signed out.');
});
}
</script>
<p></p>
<textarea id="dbgg">
</textarea>
<!--iframe name="frame"></iframe-->
</div>
<script>
function onSignIn(googleUser) {
var pp = document.getElementById("signin").style.display = "none";
var gg = document.getElementById("mainPage").style.display = "block";
// Useful data for your client-side scripts:
var profile = googleUser.getBasicProfile();
//console.log("ID: " + profile.getId()); // Don't send this directly to your server!
//console.log('Full Name: ' + profile.getName());
//console.log('Given Name: ' + profile.getGivenName());
//console.log('Family Name: ' + profile.getFamilyName());
//console.log("Image URL: " + profile.getImageUrl());
console.log("Email: " + profile.getEmail());
$.ajax({
url: '/api/sessionId',
type: 'POST',
data: JSON.stringify({email : profile.getEmail()}),
success: function(data){
alert(data);
}
});
// The ID token you need to pass to your backend:
//var id_token = googleUser.getAuthResponse().id_token;
//console.log("ID Token: " + id_token);
}
$("#config_details").submit(function(e) {
e.preventDefault();
var pp = document.getElementById("project_select");
document.getElementById("progBarContainer").style.visibility = "visible";
document.getElementById("progBar").style.visibility = "visible";
var fData = $("#config_details").serialize();
var mStart = document.getElementById("macStart");
//mStart.value = document.getElementById("macStartBase").value.concat(mStart.value);
var mEnd = document.getElementById("macEnd");
//mEnd.value = document.getElementById("macEndBase").value.concat(mEnd.value);
var extPan = document.getElementById("panId");
//extPan.value = panBase.concat(extPan.value);
var ffD = {
"macStart" : mStart.value,
"macEnd" : (mEnd.value),
"DEV_EXT_PAN" : panBase.concat(extPan.value),
"deviceName" : document.getElementById("devSel").value,
"project" : pp.value,
"DEV_VERSION" : document.getElementById("versions").value,
"DEV_CHAN_MASK" : document.getElementById("chan").value,
"projName" : pp.options[pp.selectedIndex].text
};
console.log(ffD);
$.ajax({
url: '/api/generate',
type: 'POST',
data: JSON.stringify(ffD)
});
refresh();
});
</script>
</body>
</html>