-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathgui_easy_settings.js
292 lines (291 loc) · 10.5 KB
/
gui_easy_settings.js
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
/* GUIEasy Copyright (C) 2019-2020 Jimmy "Grovkillen" Westberg */
//HERE'S THE SETTINGS USED FOR THE SPA ENGINE = TRANSLATIONS ARE PUT IN ANOTHER FILE
/*
V.R.M.build.state
x.y.odd.odd = test builds
x.y.odd.even = beta builds
x.y.even.odd = RC build
x.y.even.even = released build
*/
const guiEasy = {
'logLevel': 0,
'name': 'GUI Easy',
'version': {
//--GRUNT-START--
'major': 0,
'minor': 1,
'revision': 6,
'development': true,
'releaseCandidate': 0
//--GRUNT-END--
,
'test': null, //this one should always be "null", we set it to a timestamp if a test build is made
'full': function () {
let x = guiEasy.version;
let testBuild = "";
if (x.test !== null) {
testBuild = "-test-" + x.test;
}
if (x.development === true && x.releaseCandidate > 0) {
return x.major + '.' + x.minor + '.rc' + x.releaseCandidate + '.' + x.revision + testBuild;
} else if (x.development === true) {
return x.major + '.' + x.minor + '.nightly.' + x.revision + testBuild;
} else {
return x.major + '.' + x.minor + '.' + x.revision + testBuild;
}
}
},
'geekName': function () {
return guiEasy.name.replace(/ /g, '-').toLowerCase();
},
'geekNameFull': function () {
return guiEasy.geekName() + '-' + guiEasy.version.full()
},
'current': {},
'fetchSettings':{ //to store in memory, DOM stuff will grow eternally
'maxToKeep': 5, //Minutes...
'minToKeep': 1,
'intervalGUIupdater': 1000, //ms
'intervalTimeKeeper': 700, //min period in-between fetches
'maxToKeepMs': function () {
return guiEasy.maxToKeep * 60 * 1000;
},
'minToKeepMs': function () {
return guiEasy.minToKeep * 60 * 1000;
},
},
'nodes': [],
'loops': {},
'startup': [
{
'id': 'curly',
'logText': 'HTML build up'
},
{
'id': 'scrubber',
'logText': 'HTML scrubbing'
},
{
'id': 'popper',
'logText': 'Adding event handlers'
},
{
'id': 'pitcher',
'logText': 'Getting data from unit plus setting up user preferences'
}
],
'silentStartup': [
{
'id': 'butler',
'logText': 'Fetching stuff from internet'
},
{
'id': 'tender',
'logText': 'The relay runner is being triggered'
}
],
'endpoints':{
'defaultTTL': function () {
return 60000 //Once a minute
},
'get':[
{'endpoint':'json', 'ttl_fallback':2000},
{'endpoint':'buildinfo', 'ttl_fallback':99999999}, //will not update very often...
{'endpoint':'logjson'}, //Fallback of 29999 will not be part of first boot fetch
{'endpoint':'sysinfo_json'},
{'endpoint':'node_list_json'},
{'endpoint':'filelist_json'},
{'endpoint':'i2cscanner_json'},
{'endpoint':'pinstates_json'},
{'endpoint':'timingstats_json', 'ttl_fallback':999999},
{'endpoint':'wifiscanner_json'}
],
'post':[
{'endpoint':'factoryreset_json'},
{'endpoint':'upload_json'}
]
},
'fetchingWait': "Fetching not yet completed, please wait...",
'maxTasks': function (board= 'ESP82XX') {
if (board === 'ESP82XX') {
return 12;
}
if (board === 'ESP32') {
return 48;
}
},
'maxValuesPerTask': function (board= 'ESP82XX') {
if (board === 'ESP82XX') {
return 4;
}
if (board === 'ESP32') {
return 8;
}
},
'maxNotification': function (board= 'ESP82XX') {
if (board === 'ESP82XX') {
return 3;
}
if (board === 'ESP32') {
return 3;
}
},
'maxController': function (board= 'ESP82XX') {
if (board === 'ESP82XX') {
return 3;
}
if (board === 'ESP32') {
return 3;
}
},
'maxPluginConfigVar': function (board= 'ESP82XX') {
if (board === 'ESP82XX') {
return 8;
}
if (board === 'ESP32') {
return 8;
}
},
'maxPluginConfigFloatVar': function (board= 'ESP82XX') {
if (board === 'ESP82XX') {
return 4;
}
if (board === 'ESP32') {
return 4;
}
},
'maxPluginConfigLongVar': function (board= 'ESP82XX') {
if (board === 'ESP82XX') {
return 4;
}
if (board === 'ESP32') {
return 4;
}
},
'maxPluginExtraConfigVar': function (board= 'ESP82XX') {
if (board === 'ESP82XX') {
return 16;
}
if (board === 'ESP32') {
return 16;
}
},
'maxFormulaLength': function (board= 'ESP82XX') {
if (board === 'ESP82XX') {
return 40;
}
if (board === 'ESP32') {
return 40;
}
},
'timelist': {
'week': [
{"text":"Last","value":0, "disabled":false, "note":""},
{"text":"1st","value":1, "disabled":false, "note":""},
{"text":"2nd","value":2, "disabled":false, "note":""},
{"text":"3rd","value":3, "disabled":false, "note":""},
{"text":"4th","value":4, "disabled":false, "note":""}
],
'day': [
{"text":"Sunday","value":1, "disabled":false, "note":""},
{"text":"Monday","value":2, "disabled":false, "note":""},
{"text":"Tuesday","value":3, "disabled":false, "note":""},
{"text":"Wednesday","value":4, "disabled":false, "note":""},
{"text":"Thursday","value":5, "disabled":false, "note":""},
{"text":"Friday","value":6, "disabled":false, "note":""},
{"text":"Saturday","value":7, "disabled":false, "note":""}
],
'month':[
{"text":"January","value":1, "disabled":false, "note":""},
{"text":"February","value":2, "disabled":false, "note":""},
{"text":"March","value":3, "disabled":false, "note":""},
{"text":"April","value":4, "disabled":false, "note":""},
{"text":"May","value":5, "disabled":false, "note":""},
{"text":"June","value":6, "disabled":false, "note":""},
{"text":"July","value":7, "disabled":false, "note":""},
{"text":"August","value":8, "disabled":false, "note":""},
{"text":"September","value":9, "disabled":false, "note":""},
{"text":"October","value":10, "disabled":false, "note":""},
{"text":"November","value":11, "disabled":false, "note":""},
{"text":"December","value":12, "disabled":false, "note":""}
]
},
'gpiolist': function (board = 'ESP82XX') {
if (board === 'ESP82XX') {
return [
{'text':'- None -', 'value':-1, 'disabled':false, 'note':''},
{'text':'GPIO 0 (D3)', 'value':0, 'disabled':false, 'note':'\u26A0'},
{'text':'GPIO 1 (D10)', 'value':1, 'disabled':true, 'note':'Tx0'},
{'text':'GPIO 2 (D4)', 'value':2, 'disabled':false, 'note':'\u26A0'},
{'text':'GPIO 3 (D9)', 'value':3, 'disabled':true, 'note':'Rx0'},
{'text':'GPIO 4 (D2)', 'value':4, 'disabled':false, 'note':''},
{'text':'GPIO 5 (D1)', 'value':5, 'disabled':false, 'note':''},
{'text':'GPIO 9 (D11)', 'value':9, 'disabled':false, 'note':'\u26A0'},
{'text':'GPIO 10 (D10)', 'value':10, 'disabled':false, 'note':'\u26A0'},
{'text':'GPIO 12 (D12)', 'value':12, 'disabled':false, 'note':''},
{'text':'GPIO 13 (D13)', 'value':13, 'disabled':false, 'note':''},
{'text':'GPIO 14 (D14)', 'value':14, 'disabled':false, 'note':''},
{'text':'GPIO 15 (D15)', 'value':15, 'disabled':false, 'note':'\u26A0'},
{'text':'GPIO 16 (D16)', 'value':16, 'disabled':false, 'note':''}
]
}
if (board === 'ESP32') {
return null;
}
},
'logLevels': function () {
return [
{'text':'- none -', 'value':0, 'disabled':false, 'note':''},
{'text':'error', 'value':1, 'disabled':false, 'note':''},
{'text':'info', 'value':2, 'disabled':false, 'note':''},
{'text':'debug', 'value':3, 'disabled':false, 'note':''},
{'text':'debug more', 'value':4, 'disabled':false, 'note':''},
{'text':'not used', 'value':5, 'disabled':true, 'note':'(5)'},
{'text':'not used', 'value':6, 'disabled':true, 'note':'(6)'},
{'text':'not used', 'value':7, 'disabled':true, 'note':'(7)'},
{'text':'not used', 'value':8, 'disabled':true, 'note':'(8)'},
{'text':'debug development', 'value':9, 'disabled':false, 'note':''}
]
},
'tabs': {
'left': ['main', 'config', 'hardware', 'tasks'],
'right': ['controllers', 'notification', 'tools', 'rules']
},
'guiStats': { //Not to be mistaken for the unit's stats, this is the queen bee gui buildup stats
'pageSize': 0, //the other is how the unit themselves are doing fetch-wise
'bootTime': 0,
'eventCalls': 0,
'eventCallsTotal': 0
},
'syntax': {
'curlyLC': 0, //USED TO SEE HOW MANY LOOPS ARE NEEDED TO REPLACE ALL CURLY
'curly': [
// PUT CURLY's WITH NO SUB-CURLY's FIRST FOR OPTIMIZATION
// FIRST LEVEL ONLY, the rest will dig down automatically
// We create this array manually for optimization purpose
'fetching',
'input',
'table',
'goto',
'button',
'version',
'tasktable',
'controllertable',
'notificationtable',
'setup',
'notifier',
'drawer',
'navbar',
'gamepad',
'unit',
'unitname',
'modal',
'info',
'menu',
'wave',
'page',
'logo',
'icon'
]
}
};