benchlab-pytools 3.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- benchlab/__init__.py +14 -0
- benchlab/__main__.py +21 -0
- benchlab/config/README.md +325 -0
- benchlab/config/__init__.py +9 -0
- benchlab/config/config_client.py +631 -0
- benchlab/config/config_manager.py +495 -0
- benchlab/config/config_tool.py +358 -0
- benchlab/config/diff.py +163 -0
- benchlab/config/examples/complete_config.json +56 -0
- benchlab/config/examples/rgb_lighting.json +24 -0
- benchlab/config/examples/simple_fan.json +32 -0
- benchlab/config/schema.py +138 -0
- benchlab/core/README.md +154 -0
- benchlab/core/__init__.py +78 -0
- benchlab/core/config.py +145 -0
- benchlab/core/datasource.py +1209 -0
- benchlab/core/datasource_manager.py +418 -0
- benchlab/core/device_registry.py +206 -0
- benchlab/core/discovery.py +92 -0
- benchlab/core/infrastructure.py +309 -0
- benchlab/core/process_manager.py +356 -0
- benchlab/core/retry.py +85 -0
- benchlab/core/shared_serial.py +235 -0
- benchlab/core/statistics.py +224 -0
- benchlab/csv_log/README.md +206 -0
- benchlab/csv_log/__init__.py +5 -0
- benchlab/csv_log/csv_logger_enhanced.py +416 -0
- benchlab/csv_log/message_batcher.py +361 -0
- benchlab/csv_log/requirements.txt +3 -0
- benchlab/csv_log/smart_retry.py +466 -0
- benchlab/graph/README.md +117 -0
- benchlab/graph/__init__.py +5 -0
- benchlab/graph/app.py +353 -0
- benchlab/graph/requirements.txt +2 -0
- benchlab/graph/runner.py +42 -0
- benchlab/graph/ui.py +288 -0
- benchlab/hwinfo/README.md +135 -0
- benchlab/hwinfo/__init__.py +5 -0
- benchlab/hwinfo/hwinfo_export.py +386 -0
- benchlab/hwinfo/requirements.txt +1 -0
- benchlab/launcher.py +387 -0
- benchlab/link/.env.EXAMPLE +10 -0
- benchlab/link/README.md +172 -0
- benchlab/link/__init__.py +1 -0
- benchlab/link/link_main.py +479 -0
- benchlab/main.py +462 -0
- benchlab/menu.py +729 -0
- benchlab/menu_classic.py +410 -0
- benchlab/mqtt/README.md +201 -0
- benchlab/mqtt/__init__.py +5 -0
- benchlab/mqtt/mqtt.config_template +2 -0
- benchlab/mqtt/mqtt_publisher.py +540 -0
- benchlab/mqtt/requirements.txt +3 -0
- benchlab/prefs.py +67 -0
- benchlab/restapi/.env.example +17 -0
- benchlab/restapi/__init__.py +5 -0
- benchlab/restapi/favicon.ico +0 -0
- benchlab/restapi/readme.md +202 -0
- benchlab/restapi/requirements.txt +5 -0
- benchlab/restapi/telemetry_api.py +808 -0
- benchlab/sources.py +515 -0
- benchlab/tools.py +147 -0
- benchlab/tui/README.md +266 -0
- benchlab/tui/__init__.py +5 -0
- benchlab/tui/config.py +477 -0
- benchlab/tui/requirements.txt +2 -0
- benchlab/tui/tui_core.py +1298 -0
- benchlab/tui/tui_main.py +418 -0
- benchlab/vu/README.md +64 -0
- benchlab/vu/VU-Server/NOTICE.md +13 -0
- benchlab/vu/VU-Server/README.md +80 -0
- benchlab/vu/VU-Server/Running_from_source_on_linux.md +97 -0
- benchlab/vu/VU-Server/__init__.py +0 -0
- benchlab/vu/VU-Server/assets/vu1_hello_world.png +0 -0
- benchlab/vu/VU-Server/community_applications.md +13 -0
- benchlab/vu/VU-Server/config.yaml +9 -0
- benchlab/vu/VU-Server/database.py +256 -0
- benchlab/vu/VU-Server/dial_driver.py +534 -0
- benchlab/vu/VU-Server/dials/Comms_Hub_Gauge.py +78 -0
- benchlab/vu/VU-Server/dials/Comms_Hub_Server.py +100 -0
- benchlab/vu/VU-Server/dials/__init__.py +0 -0
- benchlab/vu/VU-Server/dials/base_logger.py +100 -0
- benchlab/vu/VU-Server/installer/inc/icon.ico +0 -0
- benchlab/vu/VU-Server/installer/install.nsi +148 -0
- benchlab/vu/VU-Server/make_version.py +40 -0
- benchlab/vu/VU-Server/pylintrc +628 -0
- benchlab/vu/VU-Server/requirements.txt +9 -0
- benchlab/vu/VU-Server/serial_driver.py +244 -0
- benchlab/vu/VU-Server/server.py +670 -0
- benchlab/vu/VU-Server/server_config.py +255 -0
- benchlab/vu/VU-Server/server_dial_handler.py +334 -0
- benchlab/vu/VU-Server/vu_notifications.py +24 -0
- benchlab/vu/VU-Server/www/android-chrome-192x192.png +0 -0
- benchlab/vu/VU-Server/www/android-chrome-512x512.png +0 -0
- benchlab/vu/VU-Server/www/apple-touch-icon.png +0 -0
- benchlab/vu/VU-Server/www/assets/css/demo.css +291 -0
- benchlab/vu/VU-Server/www/assets/css/demo.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/demo.rtl.css +276 -0
- benchlab/vu/VU-Server/www/assets/css/demo.rtl.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-flags.css +1084 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-flags.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-flags.rtl.css +1084 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-flags.rtl.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-payments.css +528 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-payments.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-payments.rtl.css +528 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-payments.rtl.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-social.css +10 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-social.min.css +8 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-social.rtl.css +10 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-social.rtl.min.css +8 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-vendors.css +1504 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-vendors.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-vendors.rtl.css +1504 -0
- benchlab/vu/VU-Server/www/assets/css/tabler-vendors.rtl.min.css +9 -0
- benchlab/vu/VU-Server/www/assets/css/tabler.css +25813 -0
- benchlab/vu/VU-Server/www/assets/css/tabler.min.css +13 -0
- benchlab/vu/VU-Server/www/assets/css/tabler.rtl.css +25777 -0
- benchlab/vu/VU-Server/www/assets/css/tabler.rtl.min.css +13 -0
- benchlab/vu/VU-Server/www/assets/css/theme.min.css +261 -0
- benchlab/vu/VU-Server/www/assets/img/header.png +0 -0
- benchlab/vu/VU-Server/www/assets/img/logo.png +0 -0
- benchlab/vu/VU-Server/www/assets/js/dark-theme.js +35 -0
- benchlab/vu/VU-Server/www/assets/js/dark-theme.min.js +9 -0
- benchlab/vu/VU-Server/www/assets/js/demo.js +132 -0
- benchlab/vu/VU-Server/www/assets/js/demo.min.js +9 -0
- benchlab/vu/VU-Server/www/assets/js/jquery.min.js +2 -0
- benchlab/vu/VU-Server/www/assets/js/tabler.esm.js +7482 -0
- benchlab/vu/VU-Server/www/assets/js/tabler.esm.min.js +15 -0
- benchlab/vu/VU-Server/www/assets/js/tabler.js +7543 -0
- benchlab/vu/VU-Server/www/assets/js/tabler.min.js +15 -0
- benchlab/vu/VU-Server/www/assets/js/vu1_api.js +68 -0
- benchlab/vu/VU-Server/www/assets/js/vu1_gui_api_key_settings.js +167 -0
- benchlab/vu/VU-Server/www/assets/js/vu1_gui_api_keys.js +138 -0
- benchlab/vu/VU-Server/www/assets/js/vu1_gui_dial.js +179 -0
- benchlab/vu/VU-Server/www/assets/js/vu1_gui_home.js +60 -0
- benchlab/vu/VU-Server/www/assets/js/vu1_gui_root.js +125 -0
- benchlab/vu/VU-Server/www/favicon-16x16.png +0 -0
- benchlab/vu/VU-Server/www/favicon-32x32.png +0 -0
- benchlab/vu/VU-Server/www/favicon.ico +0 -0
- benchlab/vu/VU-Server/www/favicon.png +0 -0
- benchlab/vu/VU-Server/www/index.html +47 -0
- benchlab/vu/VU-Server/www/views/api_keys.html +151 -0
- benchlab/vu/VU-Server/www/views/dial.html +286 -0
- benchlab/vu/VU-Server/www/views/footer.html +27 -0
- benchlab/vu/VU-Server/www/views/header.html +86 -0
- benchlab/vu/VU-Server/www/views/key_settings.html +132 -0
- benchlab/vu/VU-Server/www/views/start.html +124 -0
- benchlab/vu/__init__.py +5 -0
- benchlab/vu/assets/Barlow-Bold.ttf +0 -0
- benchlab/vu/assets/bl_dial_144x200.png +0 -0
- benchlab/vu/assets/bl_logo_144x200.png +0 -0
- benchlab/vu/devices.py +166 -0
- benchlab/vu/requirements.txt +24 -0
- benchlab/vu/sensors.py +18 -0
- benchlab/vu/vu_dial.config_template +90 -0
- benchlab/vu/vu_logo_gen.py +97 -0
- benchlab/vu/vu_server.config_template +5 -0
- benchlab/vu/vu_server_config.py +40 -0
- benchlab/vu/vu_server_manager.py +192 -0
- benchlab/vu/vu_tui.py +919 -0
- benchlab/vu/vu_updater.py +540 -0
- benchlab/wigidash/README.md +182 -0
- benchlab/wigidash/__init__.py +5 -0
- benchlab/wigidash/assets/Inter-Bold.ttf +0 -0
- benchlab/wigidash/assets/Inter.ttf +0 -0
- benchlab/wigidash/assets/benchlab.png +0 -0
- benchlab/wigidash/benchlab_fleet.py +150 -0
- benchlab/wigidash/benchlab_graph.py +517 -0
- benchlab/wigidash/benchlab_overview.py +426 -0
- benchlab/wigidash/benchlab_telemetry.py +105 -0
- benchlab/wigidash/benchlab_ui.py +190 -0
- benchlab/wigidash/benchlab_utils.py +182 -0
- benchlab/wigidash/requirements.txt +9 -0
- benchlab/wigidash/wigidash_device.py +541 -0
- benchlab/wigidash/wigidash_manager.py +342 -0
- benchlab/wigidash/wigidash_session.py +355 -0
- benchlab/wigidash/wigidash_usb.py +247 -0
- benchlab/wigidash/wigidash_widget.py +88 -0
- benchlab_pytools-3.0.0.dist-info/METADATA +239 -0
- benchlab_pytools-3.0.0.dist-info/RECORD +184 -0
- benchlab_pytools-3.0.0.dist-info/WHEEL +4 -0
- benchlab_pytools-3.0.0.dist-info/entry_points.txt +2 -0
- benchlab_pytools-3.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
|
|
2
|
+
// When page is loaded
|
|
3
|
+
$(function() {
|
|
4
|
+
// Handler for .ready() called.
|
|
5
|
+
gui_update_api_key_ui();
|
|
6
|
+
triggerTooltipGen();
|
|
7
|
+
triggerPopoverGen();
|
|
8
|
+
|
|
9
|
+
$("#nav-api").addClass("active");
|
|
10
|
+
gui_update_modal_available_dials();
|
|
11
|
+
triggerModalGen();
|
|
12
|
+
|
|
13
|
+
$("#modal-select-all").click(function(){
|
|
14
|
+
gui_modal_select_all_dials(true);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
$("#modal-deselect-all").click(function(){
|
|
18
|
+
gui_modal_select_all_dials(false);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
$("#modal-add-new-key").click(function(){
|
|
22
|
+
gui_handle_modal_submit();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
function gui_handle_modal_submit()
|
|
28
|
+
{
|
|
29
|
+
var dial_list = [];
|
|
30
|
+
|
|
31
|
+
// Get Key name
|
|
32
|
+
const key_name = $('#modal-new-key-name').val();
|
|
33
|
+
if (key_name.length === 0)
|
|
34
|
+
{
|
|
35
|
+
$('#modal-new-key-name').addClass('is-invalid');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
else
|
|
39
|
+
{
|
|
40
|
+
$('#modal-new-key-name').removeClass('is-invalid');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Get all selected dials
|
|
44
|
+
$('#modal-dials-list input:checkbox').each(function(){
|
|
45
|
+
if (this.checked)
|
|
46
|
+
{
|
|
47
|
+
dial_list.push(this.value);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
if (dial_list.length < 1 )
|
|
52
|
+
{
|
|
53
|
+
$('#modal-select-header').addClass('alert alert-warning ');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
else
|
|
57
|
+
{
|
|
58
|
+
$('#modal-select-header').removeClass('alert alert-warning ');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
const dial_access_str = dial_list.join(";");
|
|
63
|
+
|
|
64
|
+
var url = '/api/v0/admin/keys/create?admin_key='+ API_MASTER_KEY +'&name='+ key_name +'&dials='+ dial_access_str;
|
|
65
|
+
var jqxhr = $.post(url, function() {
|
|
66
|
+
})
|
|
67
|
+
.done(function(e) {
|
|
68
|
+
const status = e['status'];
|
|
69
|
+
if (status == 'ok')
|
|
70
|
+
{
|
|
71
|
+
location.reload();
|
|
72
|
+
}
|
|
73
|
+
else
|
|
74
|
+
{
|
|
75
|
+
alert('Failed to create API key');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
function gui_modal_select_all_dials(checked)
|
|
83
|
+
{
|
|
84
|
+
$('#modal-dials-list input:checkbox').each(function(){ this.checked = checked; });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function gui_update_modal_available_dials()
|
|
88
|
+
{
|
|
89
|
+
const available_dials = vu1_get_dial_list(false);
|
|
90
|
+
|
|
91
|
+
$('#modal-dials-list').text("");
|
|
92
|
+
|
|
93
|
+
$.each( available_dials, function( key, val ) {
|
|
94
|
+
let dial_name = val['dial_name'];
|
|
95
|
+
if (dial_name == 'Not set')
|
|
96
|
+
{
|
|
97
|
+
dial_name = val['uid'];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
$('#modal-dials-list').append('\
|
|
101
|
+
<label class="form-selectgroup-item">\
|
|
102
|
+
<input type="checkbox" name="modal-dial-checkbox" value="'+ val['uid'] +'" class="form-selectgroup-input" />\
|
|
103
|
+
<span class="form-selectgroup-label">'+ dial_name +'</span>\
|
|
104
|
+
</label>\
|
|
105
|
+
');
|
|
106
|
+
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
function gui_update_dial_name(name)
|
|
112
|
+
{
|
|
113
|
+
const dial_uid = $.urlParam('uid');
|
|
114
|
+
$.get( '/api/v0/dial/' + dial_uid + '/name?name='+ name +'&key='+ API_MASTER_KEY );
|
|
115
|
+
$('#dial-title').text('Name: '+ name);
|
|
116
|
+
$('#dial-name').text(name);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
function gui_update_api_key_ui()
|
|
121
|
+
{
|
|
122
|
+
const api_keys = vu1_get_api_keys(false);
|
|
123
|
+
|
|
124
|
+
$.each( api_keys, function( key, val ) {
|
|
125
|
+
$('#table_api_keys').append('<tr>\
|
|
126
|
+
<td></td>\
|
|
127
|
+
<td><span class="text-secondary">'+ val['key_name'] + '</span></td>\
|
|
128
|
+
<td><p class="user-select-all"><kbd>'+ val['key_uid'] + '</kbd></p</td>\
|
|
129
|
+
<td class="text-end">\
|
|
130
|
+
<span class="dropdown">\
|
|
131
|
+
<a href="index.html?page=key_settings&key_id='+ val['key_uid'] +'" class="btn" role="button">Settings</a>\
|
|
132
|
+
</span>\
|
|
133
|
+
</td>\
|
|
134
|
+
</tr>\
|
|
135
|
+
');
|
|
136
|
+
|
|
137
|
+
});
|
|
138
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
|
|
2
|
+
// When page is loaded
|
|
3
|
+
$(function() {
|
|
4
|
+
// Handler for .ready() called.
|
|
5
|
+
gui_update_dial_ui();
|
|
6
|
+
|
|
7
|
+
// re-trigger
|
|
8
|
+
triggerTooltipGen();
|
|
9
|
+
triggerPopoverGen();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
$("#btn-change-name").on( "click", function() {
|
|
14
|
+
const new_name = $("#new-dial-name").val();
|
|
15
|
+
|
|
16
|
+
if (
|
|
17
|
+
(new_name != undefined) &&
|
|
18
|
+
(new_name !== "") &&
|
|
19
|
+
(new_name.length >= 3) &&
|
|
20
|
+
(new_name.length <= 30)
|
|
21
|
+
)
|
|
22
|
+
{
|
|
23
|
+
$("#new-dial-name").removeClass("is-invalid");
|
|
24
|
+
$("#dial-name-rules").hide();
|
|
25
|
+
gui_update_dial_name(new_name);
|
|
26
|
+
}
|
|
27
|
+
else
|
|
28
|
+
{
|
|
29
|
+
$("#dial-name-rules").show();
|
|
30
|
+
$("#new-dial-name").removeClass("is-valid");
|
|
31
|
+
$("#new-dial-name").addClass("is-invalid");
|
|
32
|
+
}
|
|
33
|
+
} );
|
|
34
|
+
|
|
35
|
+
// Identify buttons
|
|
36
|
+
$(".vu1-identify-button").on( "click", function() {
|
|
37
|
+
const r = $(this).data('sk-red');
|
|
38
|
+
const g = $(this).data('sk-green');
|
|
39
|
+
const b = $(this).data('sk-blue');
|
|
40
|
+
const v = $(this).data('sk-value');
|
|
41
|
+
|
|
42
|
+
gui_update_dial_backlight(r,g,b);
|
|
43
|
+
gui_update_dial_value(v);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Behaviour buttons
|
|
47
|
+
$(".vu1-behaviour-button").on( "click", function() {
|
|
48
|
+
const dial_period = $(this).data('sk-dial-period');
|
|
49
|
+
const dial_step = $(this).data('sk-dial-step');
|
|
50
|
+
const bl_period = $(this).data('sk-backlight-period');
|
|
51
|
+
const bl_step = $(this).data('sk-backlight-step');
|
|
52
|
+
|
|
53
|
+
gui_set_dial_easing(dial_period, dial_step);
|
|
54
|
+
gui_set_backlight_easing(bl_period, bl_step);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
//Dial info buttons
|
|
59
|
+
$("#dial-reload-info").on( "click", function() {
|
|
60
|
+
$("#dial-reload-container").html('<span class="status status-indigo"><span class="status-dot status-dot-animated"></span>Loading...</span>');
|
|
61
|
+
gui_reload_dial_info();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
function gui_set_dial_easing(period, step)
|
|
67
|
+
{
|
|
68
|
+
const dial_uid = $.urlParam('uid');
|
|
69
|
+
$.get( '/api/v0/dial/' + dial_uid + '/easing/dial?step='+ step +'&period='+ period +'&key='+ API_MASTER_KEY )
|
|
70
|
+
.done(function( data ) {
|
|
71
|
+
window.location.reload(true);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function gui_set_backlight_easing(period, step)
|
|
76
|
+
{
|
|
77
|
+
const dial_uid = $.urlParam('uid');
|
|
78
|
+
$.get( '/api/v0/dial/' + dial_uid + '/easing/backlight?step='+ step +'&period='+ period +'&key='+ API_MASTER_KEY )
|
|
79
|
+
.done(function( data ) {
|
|
80
|
+
window.location.reload(true);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function gui_reload_dial_info()
|
|
85
|
+
{
|
|
86
|
+
const dial_uid = $.urlParam('uid');
|
|
87
|
+
$.get( '/api/v0/dial/' + dial_uid + '/reload?key='+ API_MASTER_KEY )
|
|
88
|
+
.done(function( data ) {
|
|
89
|
+
window.location.reload(true);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function gui_update_dial_backlight(r, g, b)
|
|
94
|
+
{
|
|
95
|
+
const dial_uid = $.urlParam('uid');
|
|
96
|
+
$.get( '/api/v0/dial/' + dial_uid + '/backlight?red='+ r +'&green='+ g +'&blue='+ b +'&key='+ API_MASTER_KEY );
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function gui_update_dial_value(v)
|
|
100
|
+
{
|
|
101
|
+
const dial_uid = $.urlParam('uid');
|
|
102
|
+
$.get( '/api/v0/dial/' + dial_uid + '/set?value='+ v +'&key='+ API_MASTER_KEY );
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function gui_update_dial_name(name)
|
|
106
|
+
{
|
|
107
|
+
const dial_uid = $.urlParam('uid');
|
|
108
|
+
|
|
109
|
+
$.ajax({
|
|
110
|
+
url : '/api/v0/dial/' + dial_uid + '/name?name='+ name +'&key='+ API_MASTER_KEY,
|
|
111
|
+
type : 'GET',
|
|
112
|
+
})
|
|
113
|
+
.done(function(data, statusText, xhr){
|
|
114
|
+
var status = xhr.status; //200
|
|
115
|
+
if (status == 201)
|
|
116
|
+
{
|
|
117
|
+
$('#dial-title').text('Name: '+ name);
|
|
118
|
+
$('#dial-name').text(name);
|
|
119
|
+
$("#dial-server-issue").hide();
|
|
120
|
+
$("#new-dial-name").addClass("is-valid");
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
.fail(function(data, statusText, xhr){
|
|
124
|
+
$("#dial-server-issue-message").text(statusText + ': '+ data['responseJSON']['message']);
|
|
125
|
+
$("#dial-server-issue").show();
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// $.get( '/api/v0/dial/' + dial_uid + '/name?name='+ name +'&key='+ API_MASTER_KEY );
|
|
129
|
+
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function gui_update_dial_ui()
|
|
133
|
+
{
|
|
134
|
+
const dial_uid = $.urlParam('uid');
|
|
135
|
+
|
|
136
|
+
$.when( vu1_get_dial_info(dial_uid) ).then(function(dial_info) {
|
|
137
|
+
if (Array.isArray(dial_info) == false || !('uid' in dial_info))
|
|
138
|
+
{
|
|
139
|
+
console.log("No dial information. Using default values");
|
|
140
|
+
// Dial does not exist. Create dummy dial data
|
|
141
|
+
var easing = [];
|
|
142
|
+
easing['dial_step'] = "??";
|
|
143
|
+
easing['dial_period'] = "??";
|
|
144
|
+
easing['backlight_step'] = "??";
|
|
145
|
+
easing['backlight_period'] = "??";
|
|
146
|
+
|
|
147
|
+
dial_info['dial_name'] = "Unknown (Invalid/Missing dial?)";
|
|
148
|
+
dial_info['uid'] = "NO-UID";
|
|
149
|
+
dial_info['fw_version'] = "??";
|
|
150
|
+
dial_info['fw_hash'] = "??";
|
|
151
|
+
dial_info['hw_version'] = "??";
|
|
152
|
+
dial_info['protocol_version'] = "??";
|
|
153
|
+
dial_info['easing'] = easing;
|
|
154
|
+
var dial_type = '?unknown?';
|
|
155
|
+
}
|
|
156
|
+
else
|
|
157
|
+
{
|
|
158
|
+
var dial_type = (dial_info['index'] == 0) ? 'HUB+Dial' : 'Dial';
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
$('#dial-title').text('Name: '+ dial_info['dial_name']);
|
|
163
|
+
$('#dial-name').text(dial_info['dial_name']);
|
|
164
|
+
$('#dial-uid').text(dial_info['uid']);
|
|
165
|
+
$('#dial-type').text(dial_type);
|
|
166
|
+
$('#dial-fw-version').text(dial_info['fw_version']);
|
|
167
|
+
$('#dial-fw-build').text(dial_info['fw_hash']);
|
|
168
|
+
$('#dial-hw-version').text(dial_info['hw_version']);
|
|
169
|
+
$('#dial-protocol-version').text(dial_info['protocol_version']);
|
|
170
|
+
$('#dial-easing-step').text(dial_info['easing']['dial_step']);
|
|
171
|
+
$('#dial-easing-period').text(dial_info['easing']['dial_period']);
|
|
172
|
+
$('#backlight-easing-step').text(dial_info['easing']['backlight_step']);
|
|
173
|
+
$('#backlight-easing-period').text(dial_info['easing']['backlight_period']);
|
|
174
|
+
$("#dial-background-img").attr("src","/api/v0/dial/"+dial_uid+"/image/get");
|
|
175
|
+
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
// When page is loaded
|
|
3
|
+
$(function() {
|
|
4
|
+
// Handler for .ready() called.
|
|
5
|
+
gui_update_dial_ui();
|
|
6
|
+
gui_update_api_ui();
|
|
7
|
+
|
|
8
|
+
$("#nav-home").addClass("active");
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
$("#btn-search-for-dials").on( "click", function() {
|
|
12
|
+
gui_search_for_dials();
|
|
13
|
+
} );
|
|
14
|
+
|
|
15
|
+
function gui_update_dial_ui()
|
|
16
|
+
{
|
|
17
|
+
const dials = vu1_get_dial_list(false);
|
|
18
|
+
|
|
19
|
+
$.each( dials, function( key, val ) {
|
|
20
|
+
$('#table_dials').append('<tr>\
|
|
21
|
+
<td><span class="text-secondary">'+ val['uid'] + '</span></td>\
|
|
22
|
+
<td>'+ val['dial_name'] + '</td>\
|
|
23
|
+
<td class="text-end">\
|
|
24
|
+
<span class="dropdown">\
|
|
25
|
+
<a href="index.html?page=dial&uid='+ val['uid'] +'" class="btn" role="button">Settings</a>\
|
|
26
|
+
</span>\
|
|
27
|
+
</td>\
|
|
28
|
+
</tr>\
|
|
29
|
+
');
|
|
30
|
+
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
$('#card-dial-count').text(dials.length + ' Online')
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function gui_update_api_ui()
|
|
37
|
+
{
|
|
38
|
+
const api_keys = vu1_get_api_keys();
|
|
39
|
+
$('#card-api-count').text(Object.keys(api_keys).length + ' API keys')
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
function gui_search_for_dials()
|
|
44
|
+
{
|
|
45
|
+
$("#btn-search-for-dials").text("Searching... Please wait...");
|
|
46
|
+
|
|
47
|
+
$.get( "/api/v0/dial/provision?admin_key=" + API_MASTER_KEY)
|
|
48
|
+
.done(function( e ) {
|
|
49
|
+
const status = e['status'];
|
|
50
|
+
if (status == 'ok')
|
|
51
|
+
{
|
|
52
|
+
window.location.replace("/index.html");
|
|
53
|
+
}
|
|
54
|
+
else
|
|
55
|
+
{
|
|
56
|
+
alert('Failed to provision new dial. ' + e['message']);
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
const API_MASTER_KEY = 'cTpAWYuRpA2zx75Yh961Cg';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
$.urlParam = function(name){
|
|
5
|
+
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
|
|
6
|
+
if (results==null) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return decodeURI(results[1]) || 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// When page is loaded
|
|
13
|
+
$(function () {
|
|
14
|
+
|
|
15
|
+
// Handle dynamic includes
|
|
16
|
+
var includes = $('[data-include]')
|
|
17
|
+
$.each(includes, function () {
|
|
18
|
+
var file = 'views/' + $(this).data('include') + '.html'
|
|
19
|
+
$(this).load(file)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
// Check requested page
|
|
23
|
+
if($.urlParam('page') == 'dial')
|
|
24
|
+
{
|
|
25
|
+
$("#content").load("views/dial.html");
|
|
26
|
+
}
|
|
27
|
+
else if($.urlParam('page') == 'api_keys')
|
|
28
|
+
{
|
|
29
|
+
$("#content").load("views/api_keys.html");
|
|
30
|
+
}
|
|
31
|
+
else if($.urlParam('page') == 'key_settings')
|
|
32
|
+
{
|
|
33
|
+
$("#content").load("views/key_settings.html");
|
|
34
|
+
}
|
|
35
|
+
else
|
|
36
|
+
{
|
|
37
|
+
$("#content").load("views/start.html");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
function create_toast(toast_title, toast_message)
|
|
44
|
+
{
|
|
45
|
+
var toast = '\
|
|
46
|
+
<div class="toast show" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="false" data-bs-toggle="toast">\
|
|
47
|
+
<div class="toast-header">\
|
|
48
|
+
<strong class="me-auto">'+ toast_title +'</strong>\
|
|
49
|
+
<button type="button" class="ms-2 btn-close" data-bs-dismiss="toast" aria-label="Close"></button>\
|
|
50
|
+
</div>\
|
|
51
|
+
<div class="toast-body">\
|
|
52
|
+
'+ toast_message +'\
|
|
53
|
+
</div>\
|
|
54
|
+
</div>';
|
|
55
|
+
$("#content").append(toast);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
function triggerTooltipGen()
|
|
60
|
+
{
|
|
61
|
+
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
|
|
62
|
+
tooltipTriggerList.map(function (tooltipTriggerEl) {
|
|
63
|
+
var _ref, _tooltipTriggerEl$get;
|
|
64
|
+
var options = {
|
|
65
|
+
delay: {
|
|
66
|
+
show: 50,
|
|
67
|
+
hide: 50
|
|
68
|
+
},
|
|
69
|
+
html: (_ref = tooltipTriggerEl.getAttribute("data-bs-html") === "true") !== null && _ref !== void 0 ? _ref : false,
|
|
70
|
+
placement: (_tooltipTriggerEl$get = tooltipTriggerEl.getAttribute('data-bs-placement')) !== null && _tooltipTriggerEl$get !== void 0 ? _tooltipTriggerEl$get : 'auto'
|
|
71
|
+
};
|
|
72
|
+
return new $.fn['tooltip'].Constructor(tooltipTriggerEl, options);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
function triggerPopoverGen()
|
|
78
|
+
{
|
|
79
|
+
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
|
|
80
|
+
popoverTriggerList.map(function (popoverTriggerEl) {
|
|
81
|
+
var _ref, _popoverTriggerEl$get;
|
|
82
|
+
var options = {
|
|
83
|
+
delay: {
|
|
84
|
+
show: 50,
|
|
85
|
+
hide: 50
|
|
86
|
+
},
|
|
87
|
+
html: (_ref = popoverTriggerEl.getAttribute('data-bs-html') === "true") !== null && _ref !== void 0 ? _ref : false,
|
|
88
|
+
placement: (_popoverTriggerEl$get = popoverTriggerEl.getAttribute('data-bs-placement')) !== null && _popoverTriggerEl$get !== void 0 ? _popoverTriggerEl$get : 'auto'
|
|
89
|
+
};
|
|
90
|
+
return new $.fn['popover'].Constructor(popoverTriggerEl, options);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function triggerModalGen()
|
|
95
|
+
{
|
|
96
|
+
// console.log("triggerModalGen");
|
|
97
|
+
|
|
98
|
+
// $('*[data-bs-toggle="modal"]').on('click', function(event) {
|
|
99
|
+
// console.log('Click!');
|
|
100
|
+
// console.log(this);
|
|
101
|
+
// });
|
|
102
|
+
|
|
103
|
+
// EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
|
|
104
|
+
// const target = SelectorEngine.getElementFromSelector(this);
|
|
105
|
+
// if (['A', 'AREA'].includes(this.tagName)) {
|
|
106
|
+
// event.preventDefault();
|
|
107
|
+
// }
|
|
108
|
+
// EventHandler.one(target, EVENT_SHOW$4, showEvent => {
|
|
109
|
+
// if (showEvent.defaultPrevented) {
|
|
110
|
+
// return;
|
|
111
|
+
// }
|
|
112
|
+
// EventHandler.one(target, EVENT_HIDDEN$4, () => {
|
|
113
|
+
// if (isVisible(this)) {
|
|
114
|
+
// this.focus();
|
|
115
|
+
// }
|
|
116
|
+
// });
|
|
117
|
+
// });
|
|
118
|
+
// const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
|
|
119
|
+
// if (alreadyOpen) {
|
|
120
|
+
// Modal.getInstance(alreadyOpen).hide();
|
|
121
|
+
// }
|
|
122
|
+
// const data = Modal.getOrCreateInstance(target);
|
|
123
|
+
// data.toggle(this);
|
|
124
|
+
// });
|
|
125
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<!--
|
|
3
|
+
* Tabler - Premium and Open Source dashboard template with responsive and high quality UI.
|
|
4
|
+
* @version 1.0.0-beta20
|
|
5
|
+
* @link https://tabler.io
|
|
6
|
+
* Copyright 2018-2023 The Tabler Authors
|
|
7
|
+
* Copyright 2018-2023 codecalm.net Paweł Kuna
|
|
8
|
+
* Licensed under MIT (https://github.com/tabler/tabler/blob/master/LICENSE)
|
|
9
|
+
-->
|
|
10
|
+
<html lang="en">
|
|
11
|
+
<head>
|
|
12
|
+
<meta charset="utf-8"/>
|
|
13
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/>
|
|
14
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
|
|
15
|
+
<title>VU1 Server - Administration</title>
|
|
16
|
+
<!-- CSS files -->
|
|
17
|
+
<link href="assets/css/tabler.min.css" rel="stylesheet"/>
|
|
18
|
+
<link href="assets/css/demo.css" rel="stylesheet"/>
|
|
19
|
+
<style>
|
|
20
|
+
@import url('https://rsms.me/inter/inter.css');
|
|
21
|
+
:root {
|
|
22
|
+
--tblr-font-sans-serif: 'Inter Var', -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
|
|
23
|
+
}
|
|
24
|
+
body {
|
|
25
|
+
font-feature-settings: "cv03", "cv04", "cv11";
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
28
|
+
</head>
|
|
29
|
+
<body >
|
|
30
|
+
<script src="assets/js/jquery.min.js" defer></script>
|
|
31
|
+
<script src="assets/js/dark-theme.js"></script>
|
|
32
|
+
<div class="page">
|
|
33
|
+
<div id="pageheader" data-include="header"></div>
|
|
34
|
+
<div class="page-wrapper" id="content"></div>
|
|
35
|
+
<div id="pagefooter" data-include="footer"></div>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<!-- Tabler Core -->
|
|
39
|
+
|
|
40
|
+
<script src="assets/js/tabler.js" defer></script>
|
|
41
|
+
<!-- <script src="assets/js/demo.js" defer></script> -->
|
|
42
|
+
<script src="assets/js/vu1_api.js" defer></script>
|
|
43
|
+
<script src="assets/js/vu1_gui_root.js" defer></script>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</body>
|
|
47
|
+
</html>
|