aboutsummaryrefslogtreecommitdiffstats
path: root/static
diff options
context:
space:
mode:
Diffstat (limited to 'static')
-rw-r--r--static/dashboard.js5
-rw-r--r--static/settings.js41
-rw-r--r--static/style.css13
3 files changed, 59 insertions, 0 deletions
diff --git a/static/dashboard.js b/static/dashboard.js
new file mode 100644
index 0000000..6eb8274
--- /dev/null
+++ b/static/dashboard.js
@@ -0,0 +1,5 @@
+async function btn_dash_update(element_clicked, module, param) {
+ let value = element_clicked.parentElement.children[0].value;
+ let data = {'module': module, 'param': param, 'value': value};
+ await post('/api/set_rc', data);
+}
diff --git a/static/settings.js b/static/settings.js
new file mode 100644
index 0000000..287f6f6
--- /dev/null
+++ b/static/settings.js
@@ -0,0 +1,41 @@
+async function btn_settings_add_service() {
+ const template = document.getElementById('service_template');
+
+ let clon = template.content.cloneNode(true);
+ document.getElementById('services').appendChild(clon);
+}
+
+async function btn_settings_remove_service(element_clicked) {
+ element_clicked.parentElement.remove()
+}
+
+async function btn_settings_send() {
+ let data = {
+ 'instance_name': document.getElementById('instance_name').value,
+ 'tist': document.getElementById('tist').checked,
+ 'tist_offset': parseInt(document.getElementById('tist_offset').value, 10),
+ 'ensemble_id': parseInt(document.getElementById('ensemble_id').value, 16),
+ 'ensemble_ecc': parseInt(document.getElementById('ensemble_ecc').value, 16),
+ 'ensemble_label': document.getElementById('ensemble_label').value,
+ 'ensemble_shortlabel': document.getElementById('ensemble_shortlabel').value,
+ 'output_edi_port': parseInt(document.getElementById('output_edi_port').value, 10),
+ 'services': [],
+ };
+
+ const services = document.getElementById('services');
+ const destList = services.querySelectorAll("p.service");
+ for (let i = 0; i < destList.length; i++) {
+ data.services.push({
+ 'sid': parseInt(destList[i].querySelector("input.srv_sid").value, 16),
+ 'ecc': parseInt(destList[i].querySelector("input.srv_ecc").value, 16),
+ 'label': destList[i].querySelector("input.srv_label").value,
+ 'shortlabel': destList[i].querySelector("input.srv_shortlabel").value,
+ 'input_port': parseInt(destList[i].querySelector("input.srv_input_port").value, 10),
+ 'bitrate': parseInt(destList[i].querySelector("input.srv_bitrate").value, 10),
+ 'protection': parseInt(destList[i].querySelector("input.srv_protection").value, 10),
+ });
+ }
+
+ await post('/api/settings', data);
+}
+
diff --git a/static/style.css b/static/style.css
index dd43c7a..39ca359 100644
--- a/static/style.css
+++ b/static/style.css
@@ -29,6 +29,19 @@ nav {
flex: none;
}
+.section {
+ padding-left: 0.25rem;
+ padding-top: 0.25rem;
+ padding-bottom: 0.25rem;
+}
+
+.setting-entry {
+ padding-left: 0.25rem;
+ padding-top: 0.25rem;
+ padding-bottom: 0.25rem;
+}
+
+
.div-menu {
border-top-width: 1px;
border-bottom-width: 0px;