diff --git a/front-generator/render-params.json b/front-generator/render-params.json index 83dd6bf..ea710c2 100644 --- a/front-generator/render-params.json +++ b/front-generator/render-params.json @@ -1,41 +1,32 @@ { - "monitoring-params": {}, "modem_types": { "tdma": { "modem_name": "RCSM-101 TDMA", + "dangerousParamGroups": { + "buclnb": "Применение неправильных настроек может вывести из строя оборудование! Продолжить?", + "network": "Применение этих настроек может сделать модем недоступным! Продолжить?" + }, "params": { "rxtx": [ - { - "widget": "h2", - "label": "Настройки приема/передачи" - }, + {"widget": "h2", "label": "Настройки приема/передачи"}, { "widget": "flex-container", "childs": [ { "widget": "settings-container", "childs": [ - { "widget": "h3", "label": "Настройки передатчика" }, + {"widget": "h3", "label": "Настройки передатчика"}, + {"widget": "checkbox", "label": "Включить передатчик", "name": "txEn"}, { - "widget": "checkbox", - "label": "Включить передатчик", - "name": "txEn" - }, - { - "widget": "select", - "label": "Входные данные", - "name": "txIsTestInput", + "widget": "select", "label": "Входные данные", "name": "txIsTestInput", "values": [ - { - "label": "Тест", - "value": "true" - }, - { - "label": "SCPC", - "value": "false" - } + {"label": "SCPC", "value": "false"}, + {"label": "Тест", "value": "true"} ] - } + }, + {"widget": "number", "label": "Центральная частота, КГц", "name": "txCentralFreq", "min": 900000, "step": 1}, + {"widget": "number", "label": "Символьная скорость, Бод", "name": "txBaudrate", "min": 0, "step": 1}, + {"widget": "number", "label": "Ослабление, дБ", "name": "txAttenuation", "min": 0, "step": 1} ] }, { @@ -43,29 +34,77 @@ "childs": [ { "widget": "h3", "label": "Настройки приемника" }, { - "widget": "select", - "label": "Режим управления усилением", - "name": "rxAgcEn", + "widget": "select", "label": "Режим управления усилением", "name": "rxAgcEn", "values": [ - { - "label": "АРУ", - "value": "true" - }, - { - "label": "РРУ", - "value": "false" - } + {"label": "АРУ", "value": "true"}, + {"label": "РРУ", "value": "false"} ] }, + {"widget": "checkbox", "label": "Инверсия спектра", "name": "rxSpectrumInversion"}, + {"widget": "number", "label": "Ручное усиление, дБ", "name": "rxManualGain", "v_show": "!paramRxtx.rxAgcEn", "min": -40}, + {"widget": "number", "label": "Центральная частота, КГц", "name": "rxCentralFreq", "min": 900000, "step": 1}, + {"widget": "number", "label": "Символьная скорость, Бод", "name": "rxBaudrate", "min": 0, "step": 1}, { - "widget": "checkbox", - "label": "Инверсия спектра", - "name": "rxSpectrumInversion" + "widget": "select", "label": "Roll-off", "name": "rxRolloff", + "values": [ + {"label": "0.02", "value": "2"}, + {"label": "0.05", "value": "5"}, + {"label": "0.10", "value": "10"}, + {"label": "0.15", "value": "15"}, + {"label": "0.20", "value": "20"}, + {"label": "0.25", "value": "25"} + ] } ] } ] } + ], + "buclnb": [ + {"widget": "h2", "label": "Настройки питания и опорного генератора"}, + { + "widget": "flex-container", + "childs": [ + { + "widget": "settings-container", + "childs": [ + {"widget": "h3", "label": "Настройки BUC"}, + {"widget": "checkbox", "label": "Подача опоры 10МГц", "name": "bucRefClk10M"}, + { + "widget": "select", "label": "Питание BUC", "name": "bucPowering", + "values": [ + {"label": "Выкл", "value": "0"}, + {"label": "24В", "value": "24"} + ] + } + ] + }, + { + "widget": "settings-container", + "childs": [ + {"widget": "h3", "label": "Настройки LNB"}, + {"widget": "checkbox", "label": "Подача опоры 10МГц", "name": "lnbRefClk10M"}, + { + "widget": "select", "label": "Питание LNB", "name": "lnbPowering", + "values": [ + {"label": "Выкл", "value": "0"}, + {"label": "13В", "value": "13"}, + {"label": "18В", "value": "18"}, + {"label": "24В", "value": "24"} + ] + } + ] + }, + { + "widget": "settings-container", + "childs": [ + {"widget": "h3", "label": "Сервисные настройки"}, + {"widget": "checkbox", "label": "Подача опоры 10МГц на 'Выход 10МГц'", "name": "srvRefClk10M"}, + {"widget": "checkbox", "label": "Автозапуск BUC и LNB при включении", "name": "bucLnbAutoStart"} + ] + } + ] + } ] }, "tabs": [ @@ -87,10 +126,7 @@ "modem_name": "RCSM-101", "params": { "rxtx": [ - { - "widget": "h2", - "label": "Настройки приема/передачи" - }, + {"widget": "h2", "label": "Настройки приема/передачи"}, { "widget": "settings-container", "childs": [ @@ -99,13 +135,13 @@ "label": "Режим работы", "name": "isCinC", "values": [ - { - "label": "CinC", - "value": "true" - }, { "label": "SCPC", "value": "false" + }, + { + "label": "CinC", + "value": "true" } ] } @@ -137,6 +173,70 @@ } ] } + ], + "cinc": [ + {"widget": "h2", "label": "Настройки режима CinC", "v_show": "paramRxtx.isCinC"}, + { + "widget": "settings-container", "v_show": "paramRxtx.isCinC", + "childs": [ + { + "widget": "select", "label": "Метод расчета задержки", "name": "cincIsPositional", + "values": [ + {"label": "Позиционированием", "value": "true"}, + {"label": "Окном задержки", "value": "false"} + ] + }, + {"widget": "number", "label": "Полоса поиска, КГц ±", "name": "cincSearchBandwidth", "min": 0, "step": 1, "max": 100} + + ] + } + ], + "buclnb": [ + {"widget": "h2", "label": "Настройки питания и опорного генератора"}, + { + "widget": "flex-container", + "childs": [ + { + "widget": "settings-container", + "childs": [ + {"widget": "h3", "label": "Настройки BUC"}, + {"widget": "checkbox", "label": "Подача опоры 10МГц", "name": "bucRefClk10M"}, + { + "widget": "select", "label": "Питание BUC", "name": "bucPowering", + "values": [ + {"label": "Выкл", "value": "0"}, + {"label": "24В", "value": "24"}, + {"label": "48В", "value": "48"} + ] + } + ] + }, + { + "widget": "settings-container", + "childs": [ + {"widget": "h3", "label": "Настройки LNB"}, + {"widget": "checkbox", "label": "Подача опоры 10МГц", "name": "lnbRefClk10M"}, + { + "widget": "select", "label": "Питание LNB", "name": "lnbPowering", + "values": [ + {"label": "Выкл", "value": "0"}, + {"label": "13В", "value": "13"}, + {"label": "18В", "value": "18"}, + {"label": "24В", "value": "24"} + ] + } + ] + }, + { + "widget": "settings-container", + "childs": [ + {"widget": "h3", "label": "Сервисные настройки"}, + {"widget": "checkbox", "label": "Подача опоры 10МГц на 'Выход 10МГц'", "name": "srvRefClk10M"}, + {"widget": "checkbox", "label": "Автозапуск BUC и LNB при включении", "name": "bucLnbAutoStart"} + ] + } + ] + } ] }, "tabs": [ diff --git a/front-generator/render.py b/front-generator/render.py index d1f3881..1990b70 100644 --- a/front-generator/render.py +++ b/front-generator/render.py @@ -5,7 +5,34 @@ import os def extract_param_names(mc): - result = {} + result = [] + + def helper_extract(widget): + if 'childs' in widget: + r = [] + for child in widget['childs']: + r += helper_extract(child) + return r + elif 'name' in widget: + match widget['widget']: + case 'select': return [{"name": widget['name'], "initValue": widget['values'][0]['value']}] + case 'checkbox': return [{"name": widget['name'], "initValue": 'false'}] + case 'number': return [{"name": widget['name'], "initValue": widget['min'] if widget['min'] else '0'}] + + return [{"name": widget['name'], "initValue": 'null'}] + return [] + + for cat in mc['params']: + ws = [] + for w in mc['params'][cat]: + ws += helper_extract(w) + ws.sort(key=lambda k: k['name']) + result.append({ + "group": cat, + "params": ws + }) + + return result @@ -27,7 +54,8 @@ def build_modem_env(modem): "header_tabs": mc['tabs'], "tab_names_array": [t['name'] for t in mc['tabs']], "params": mc["params"], - "paramGroupsWithNames": extract_param_names(mc), + "dangerousParamGroups": mc["dangerousParamGroups"] if 'dangerousParamGroups' in mc else {}, + "paramGroups": extract_param_names(mc), "paramGroupsList": extract_param_groups(mc), } diff --git a/front-generator/template/common/all-params-data.js.j2 b/front-generator/template/common/all-params-data.js.j2 new file mode 100644 index 0000000..02445a9 --- /dev/null +++ b/front-generator/template/common/all-params-data.js.j2 @@ -0,0 +1,7 @@ +{% for g in paramGroups %} + param{{ g['group'] | title }}: { + {% for p in g['params'] %} + {{ p['name'] }}: {{ p['initValue'] }}, + {% endfor %} + }, +{% endfor %} \ No newline at end of file diff --git a/front-generator/template/common/all-params-methods.js.j2 b/front-generator/template/common/all-params-methods.js.j2 new file mode 100644 index 0000000..82d61cd --- /dev/null +++ b/front-generator/template/common/all-params-methods.js.j2 @@ -0,0 +1,29 @@ + {% for g in paramGroups %} + settingsSubmit{{ g['group'] | title }}() { + if (this.submitStatus.{{ g['group'] }}) { return } + {% if g['group'] in dangerousParamGroups %} + { if (!confirm("{{ dangerousParamGroups[g['group']] }}")) return } + {% endif %} + + let query = { + {% for p in g['params'] %} + "{{ p['name'] }}": this.param{{ g['group'] | title }}.{{ p['name'] }}, + {% endfor %} + } + + this.submitStatus.{{ g['group'] }} = true + fetch('/api/set/{{ g["group"] }}', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(query) }) + .then(async (resp) => { this.update{{ g['group'] | title }}Settings(await resp.json()) }) + .catch((reason) => { alert(`Ошибка при применении настроек: ${reason}`) }) + .finally(() => { this.submitStatus.{{ g['group'] }} = false }) + }, + {% endfor %} + + {% for g in paramGroups %} + update{{ g['group'] | title }}Settings(vals) { + this.submitStatus.{{ g['group'] }} = false + {% for p in g['params'] %} + this.param{{ g['group'] | title }}.{{ p['name'] }} = vals["settings"]["{{ p['name'] }}"] + {% endfor %} + }, + {% endfor %} \ No newline at end of file diff --git a/front-generator/template/common/setup-data.js.j2 b/front-generator/template/common/setup-data.js.j2 deleted file mode 100644 index e978c42..0000000 --- a/front-generator/template/common/setup-data.js.j2 +++ /dev/null @@ -1,55 +0,0 @@ -{% if 'rxtx' in params.paramGroupsList %} -paramsRxtx: { - isCinC: Boolean, - txEn: Boolean, // включен/выключен - modulatorMode: 'normal', // режим работы модулятора - autoStartTx: Boolean, // было "режим работы передатчика" - isTestInputData: Boolean, // входные данные: eth или test - txAttenuation: Number, // ослабление - txRolloff: Number, - txCymRate: Number, - txCenterFreq: Number, - txMode: null, // ccm/acm - txFrameSizeNormal: null, // 'normal' / 'short' - txIsPilots: false, - txCcmModulation: null, - txCcmSpeed: null, - txAcmMaxModulation: null, - txAcmMaxSpeed: null, - txAcmMinModulation: null, - txAcmMinSpeed: null, - txSnrReserve: null, - txServicePacketPeriod: null, - txAcmEn: false, - txAcmMaxAttenuation: null, - txAcmMinAttenuation: null, - txAcmRequiredSnr: null, - - rxGainMode: null, // 'auto'/'manual' режим управления усилением - rxManualGain: 0, // усиление, только для ручного режима - rxSpectrumInversion: false, - rxRolloff: 0, - rxCymRate: 100000, - rxCenterFreq: 1200000.0, -}, -{% endif %} -{% if 'cinc' in params.paramGroupsList %} -paramsCinc: { - cincMode: null, // 'positional' | 'delay' - cincSearchBandwidth: 0, // полоса поиска в кГц - cincPosition: {station: {latitude: 0, longitude: 0}, satelliteLongitude: 0}, - cincDelayMin: 0, - cincDelayMax: 0 -}, -{% endif %} -{% if 'buclnb' in params.paramGroupsList %} -paramsBuclnb: { - bucRefClk10M: false, // подача опоры 10MHz - bucPowering: 0, // 0, 24, 48 - lnbRefclk10m: false, // подача опоры 10MHz - lnbPowering: 0 // 0, 13, 18, 24 - sysRefClk10M: false, // подача опоры 10MHz - sysAutoStart: false -}, -{% endif %} - diff --git a/front-generator/template/common/setup-methods.js.j2 b/front-generator/template/common/setup-methods.js.j2 deleted file mode 100644 index 3ae6070..0000000 --- a/front-generator/template/common/setup-methods.js.j2 +++ /dev/null @@ -1,180 +0,0 @@ - {% if 'rxtx' in params.paramGroupsList %} - settingsSubmitRxtx() { - if (this.submitStatus.rxTx) { return } - // потом добавить: "dvbs2.isPilots": this.param.dvbs2.isPilots - let query = { - "general.isCinC": this.param.general.isCinC, - "general.txEn": this.param.general.txEn, - "general.modulatorMode": this.param.general.modulatorMode, - "general.autoStartTx": this.param.general.autoStartTx, - "general.isTestInputData": this.param.general.isTestInputData, - "tx.attenuation": this.param.tx.attenuation, - "tx.rolloff": this.param.tx.rolloff, - "tx.cymRate": this.param.tx.cymRate, - "tx.centerFreq": this.param.tx.centerFreq, - "dvbs2.isAcm": this.param.dvbs2.mode === 'acm', - "dvbs2.frameSizeNormal": this.param.dvbs2.frameSizeNormal, - "dvbs2.ccm_modcod": toModcod(this.param.dvbs2.ccm_modulation, this.param.dvbs2.ccm_speed), - "dvbs2.acm_minModcod": toModcod(this.param.dvbs2.acm_minModulation, this.param.dvbs2.acm_minSpeed), - "dvbs2.acm_maxModcod": toModcod(this.param.dvbs2.acm_maxModulation, this.param.dvbs2.acm_maxSpeed), - "dvbs2.snrReserve": this.param.dvbs2.snrReserve, - "dvbs2.servicePacketPeriod": this.param.dvbs2.servicePacketPeriod, - "acm.en": this.param.acm.en, - "acm.maxAttenuation": this.param.acm.maxAttenuation, - "acm.minAttenuation": this.param.acm.minAttenuation, - "acm.requiredSnr": this.param.acm.requiredSnr, - "rx.gainMode": this.param.rx.gainMode, - "rx.manualGain": this.param.rx.manualGain, - "rx.spectrumInversion": this.param.rx.spectrumInversion, - "rx.rolloff": this.param.rx.rolloff, - "rx.cymRate": this.param.rx.cymRate, - "rx.centerFreq": this.param.rx.centerFreq - } - - this.submitStatus.rxTx = true - fetch('/api/set/rxtx', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(query) - }).then(async (resp) => { - this.submitStatus.rxTx = false - this.updateRxTxSettings(await resp.json()) - }).catch((reason) => { - this.submitStatus.rxTx = false - alert(`Ошибка при применении настроек: ${reason}`) - }) - }, - updateRxtxSettings(vals) { - this.submitStatus.rxTx = false - this.param.general.isCinC = vals["settings"]["general.isCinC"] - this.param.general.txEn = vals["settings"]["general.txEn"] - this.param.general.modulatorMode = vals["settings"]["general.modulatorMode"] - this.param.general.autoStartTx = vals["settings"]["general.autoStartTx"] - this.param.general.isTestInputData = vals["settings"]["general.isTestInputData"] - - this.param.tx.attenuation = vals["settings"]["tx.attenuation"] - this.param.tx.rolloff = vals["settings"]["tx.rolloff"] - this.param.tx.cymRate = vals["settings"]["tx.cymRate"] - this.param.tx.centerFreq = vals["settings"]["tx.centerFreq"] - - this.param.dvbs2.mode = (vals["settings"]["dvbs2.isAcm"] ? 'acm' : 'ccm') - this.param.dvbs2.frameSizeNormal = vals["settings"]["dvbs2.frameSizeNormal"] - // this.param.dvbs2.isPilots = vals["settings"]["dvbs2.isPilots"] - - let m = extractModulationAndSpeedFromModcod(vals["settings"]["dvbs2.ccm_modcod"]) - this.param.dvbs2.ccm_modulation = m.modulation - this.param.dvbs2.ccm_speed = m.speed - m = extractModulationAndSpeedFromModcod(vals["settings"]["dvbs2.acm_maxModcod"]) - this.param.dvbs2.acm_maxModulation = m.modulation - this.param.dvbs2.acm_maxSpeed = m.speed - m = extractModulationAndSpeedFromModcod(vals["settings"]["dvbs2.acm_minModcod"]) - this.param.dvbs2.acm_minModulation = m.modulation - this.param.dvbs2.acm_minSpeed = m.speed - - this.param.dvbs2.snrReserve = vals["settings"]["dvbs2.snrReserve"] - this.param.dvbs2.servicePacketPeriod = vals["settings"]["dvbs2.servicePacketPeriod"] - - this.param.acm.en = vals["settings"]["acm.en"] - this.param.acm.maxAttenuation = vals["settings"]["acm.maxAttenuation"] - this.param.acm.minAttenuation = vals["settings"]["acm.minAttenuation"] - this.param.acm.requiredSnr = vals["settings"]["acm.requiredSnr"] - - this.param.rx.gainMode = vals["settings"]["rx.gainMode"] - this.param.rx.manualGain = vals["settings"]["rx.manualGain"] - this.param.rx.spectrumInversion = vals["settings"]["rx.spectrumInversion"] - this.param.rx.rolloff = vals["settings"]["rx.rolloff"] - this.param.rx.cymRate = vals["settings"]["rx.cymRate"] - this.param.rx.centerFreq = vals["settings"]["rx.centerFreq"] - }, - {% endif %} - - settingsSubmitCinC() { - if (this.submitStatus.cinc) { return } - - let query = { - "cinc.mode": this.param.cinc.mode, - "cinc.searchBandwidth": this.param.cinc.searchBandwidth, - "cinc.position.station.latitude": this.param.cinc.position.station.latitude, - "cinc.position.station.longitude": this.param.cinc.position.station.longitude, - "cinc.position.satelliteLongitude": this.param.cinc.position.satelliteLongitude, - "cinc.delayMin": this.param.cinc.delayMin, - "cinc.delayMax": this.param.cinc.delayMax - } - this.submitStatus.cinc = true - fetch('/api/set/cinc', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(query) - }).then(async (resp) => { - this.submitStatus.cinc = false - this.updateCincSettings(await resp.json()) - }).catch((reason) => { - this.submitStatus.cinc = false - alert(`Ошибка при применении настроек: ${reason}`) - }) - }, - - settingsSubmitBucLnb() { - if (this.submitStatus.bucLnb) { return } - let query = { - "buc.refClk10M": this.param.buc.refClk10M, - "buc.powering": parseInt(this.param.buc.powering), - "lnb.refClk10M": this.param.lnb.refClk10M, - "lnb.powering": parseInt(this.param.lnb.powering), - "serviceSettings.refClk10M": this.param.serviceSettings.refClk10M, - "serviceSettings.autoStart": this.param.serviceSettings.autoStart - } - if (confirm('Вы уверены, что хотите сохранить настройки BUC и LNB?')) { - this.submitStatus.bucLnb = true - fetch('/api/set/bucLnb', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(query) - }).then(async (resp) => { - this.submitStatus.bucLnb = false - this.updateBucLnbSettings(await resp.json()) - }).catch((reason) => { - this.submitStatus.bucLnb = false - alert(`Ошибка при применении настроек: ${reason}`) - }) - } - }, - - - - updateCincSettings(vals) { - this.submitStatus.cinc = false - this.param.cinc.mode = vals["settings"]["cinc.mode"] - this.param.cinc.searchBandwidth = vals["settings"]["cinc.searchBandwidth"] - this.param.cinc.position.station.latitude = vals["settings"]["cinc.position.station.latitude"] - this.param.cinc.position.station.longitude = vals["settings"]["cinc.position.station.longitude"] - this.param.cinc.position.satelliteLongitude = vals["settings"]["cinc.position.satelliteLongitude"] - this.param.cinc.delayMin = vals["settings"]["cinc.delayMin"] - this.param.cinc.delayMax = vals["settings"]["cinc.delayMax"] - }, - - updateBucLnbSettings(vals) { - this.submitStatus.bucLnb = false - this.param.buc.refClk10M = vals["settings"]["buc.refClk10M"] - this.param.buc.powering = vals["settings"]["buc.powering"] - this.param.lnb.refClk10M = vals["settings"]["lnb.refClk10M"] - this.param.lnb.powering = vals["settings"]["lnb.powering"] - this.param.serviceSettings.refClk10M = vals["settings"]["serviceSettings.refClk10M"] - this.param.serviceSettings.autoStart = vals["settings"]["serviceSettings.autoStart"] - }, - - updateSettings(vals) { - this.settingFetchComplete = true - this.updateRxTxSettings(vals) - this.updateCincSettings(vals) - this.updateBucLnbSettings(vals) - this.updateQosSettings(vals) - this.updateNetworkSettings(vals) - this.updateDebugSendSettings(vals) - }, \ No newline at end of file diff --git a/front-generator/template/common/setup.html.j2 b/front-generator/template/common/setup.html.j2 index 8a1b2af..4cd0ecb 100644 --- a/front-generator/template/common/setup.html.j2 +++ b/front-generator/template/common/setup.html.j2 @@ -2,8 +2,8 @@
{% for cat in ['rxtx', 'cinc', 'buclnb'] %} {% if cat in params %} - {% for w in params[cat] %}{{ build_widget(cat, w) }}{% endfor %} - + {% for w in params[cat] %}{{ build_widget(cat, w) | indent(12, true) }}{% endfor %} + {% endif %} {% endfor %}
\ No newline at end of file diff --git a/front-generator/template/common/widgets.j2 b/front-generator/template/common/widgets.j2 index 35a2d3c..1d67ea5 100644 --- a/front-generator/template/common/widgets.j2 +++ b/front-generator/template/common/widgets.j2 @@ -1,32 +1,25 @@ {% macro build_widget_checkbox(param_group, widget) %} {{ widget.label }} - - - - + {% endmacro %} -{% macro build_widget_number(param_group, widget) %} -{% endmacro %} +{% macro build_widget_number(param_group, widget) %}{{ widget.label }}{% endmacro %} {% macro build_widget_select(param_group, widget) %} {{ widget.label }} {% endmacro %} {% macro build_widget_flex_container(param_group, widget) %}
-{% for w in widget.childs %}{{ build_widget(param_group, w) }}{% endfor %} -
-{% endmacro %} +{% for w in widget.childs %}{{ build_widget(param_group, w) | indent(4, true) }}{% endfor %} +{% endmacro %} {% macro build_widget_settings_container(param_group, widget) %}
-{% for w in widget.childs %}{{ build_widget(param_group, w) }}{% endfor %} -
-{% endmacro %} +{% for w in widget.childs %}{{ build_widget(param_group, w) | indent(4, true) }}{% endfor %} +{% endmacro %} {% macro build_widget(param_group, widget) %}{% if widget.widget == 'flex-container' %}{{ build_widget_flex_container(param_group, widget) }} diff --git a/front-generator/template/main.html b/front-generator/template/main.html index a149fd0..e700f83 100644 --- a/front-generator/template/main.html +++ b/front-generator/template/main.html @@ -83,9 +83,13 @@ modemReboot: null }, + // ========== include from 'common/all-params-data.js.j2' + {% include 'common/all-params-data.js.j2' %} + // ========== include end from 'common/all-params-data.js.j2' + {% for tab in header_tabs %} // ========== include from '{{ 'common/' ~ tab.name ~ '-data.js.j2' }}' - {% include 'common/' ~ tab.name ~ '-data.js.j2' %} + {% include 'common/' ~ tab.name ~ '-data.js.j2' ignore missing %} // ========== include end from '{{ 'common/' ~ tab.name ~ '-data.js.j2' }}' {% endfor %} @@ -129,9 +133,13 @@ return "" }, + // ========== include from 'common/all-params-methods.js.j2' + {% include 'common/all-params-methods.js.j2' %} + // ========== include end from 'common/all-params-methods.js.j2' + {% for tab in header_tabs %} // ========== include from '{{ 'common/' ~ tab.name ~ '-methods.js.j2' }}' - {% include 'common/' ~ tab.name ~ '-methods.js.j2' %} + {% include 'common/' ~ tab.name ~ '-methods.js.j2' ignore missing %} // ========== include end from '{{ 'common/' ~ tab.name ~ '-methods.js.j2' }}' {% endfor %} diff --git a/static/main-scpc.html b/static/main-scpc.html index 7e3048c..1f57f5a 100644 --- a/static/main-scpc.html +++ b/static/main-scpc.html @@ -123,32 +123,87 @@
-

Настройки приема/передачи

-
- -
- -
-
-

Настройки приема/передачи

- -
- -
- - +

Настройки приема/передачи

+
+ +
+
+
+

Настройки приема/передачи

+ +
+
+ +

Настройки режима CinC

+
+ + +
+ +

Настройки питания и опорного генератора

+
+
+

Настройки BUC

+ + +
+
+

Настройки LNB

+ + +
+
+

Сервисные настройки

+ + +
+
+

Настройки QoS

@@ -413,6 +468,25 @@ modemReboot: null }, + // ========== include from 'common/all-params-data.js.j2' + paramRxtx: { + isCinC: false, + isCinC: true, + }, + paramCinc: { + cincIsPositional: true, + cincSearchBandwidth: 0, + }, + paramBuclnb: { + bucLnbAutoStart: false, + bucPowering: 0, + bucRefClk10M: false, + lnbPowering: 0, + lnbRefClk10M: false, + srvRefClk10M: false, + }, + // ========== include end from 'common/all-params-data.js.j2' + // ========== include from 'common/monitoring-data.js.j2' statRx: { // индикаторы @@ -509,6 +583,75 @@ return "" }, + // ========== include from 'common/all-params-methods.js.j2' + settingsSubmitRxtx() { + if (this.submitStatus.rxtx) { return } + + let query = { + "isCinC": this.paramRxtx.isCinC, + "isCinC": this.paramRxtx.isCinC, + } + + this.submitStatus.rxtx = true + fetch('/api/set/rxtx', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(query) }) + .then(async (resp) => { this.updateRxtxSettings(await resp.json()) }) + .catch((reason) => { alert(`Ошибка при применении настроек: ${reason}`) }) + .finally(() => { this.submitStatus.rxtx = false }) + }, + settingsSubmitCinc() { + if (this.submitStatus.cinc) { return } + + let query = { + "cincIsPositional": this.paramCinc.cincIsPositional, + "cincSearchBandwidth": this.paramCinc.cincSearchBandwidth, + } + + this.submitStatus.cinc = true + fetch('/api/set/cinc', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(query) }) + .then(async (resp) => { this.updateCincSettings(await resp.json()) }) + .catch((reason) => { alert(`Ошибка при применении настроек: ${reason}`) }) + .finally(() => { this.submitStatus.cinc = false }) + }, + settingsSubmitBuclnb() { + if (this.submitStatus.buclnb) { return } + + let query = { + "bucLnbAutoStart": this.paramBuclnb.bucLnbAutoStart, + "bucPowering": this.paramBuclnb.bucPowering, + "bucRefClk10M": this.paramBuclnb.bucRefClk10M, + "lnbPowering": this.paramBuclnb.lnbPowering, + "lnbRefClk10M": this.paramBuclnb.lnbRefClk10M, + "srvRefClk10M": this.paramBuclnb.srvRefClk10M, + } + + this.submitStatus.buclnb = true + fetch('/api/set/buclnb', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(query) }) + .then(async (resp) => { this.updateBuclnbSettings(await resp.json()) }) + .catch((reason) => { alert(`Ошибка при применении настроек: ${reason}`) }) + .finally(() => { this.submitStatus.buclnb = false }) + }, + + updateRxtxSettings(vals) { + this.submitStatus.rxtx = false + this.paramRxtx.isCinC = vals["settings"]["isCinC"] + this.paramRxtx.isCinC = vals["settings"]["isCinC"] + }, + updateCincSettings(vals) { + this.submitStatus.cinc = false + this.paramCinc.cincIsPositional = vals["settings"]["cincIsPositional"] + this.paramCinc.cincSearchBandwidth = vals["settings"]["cincSearchBandwidth"] + }, + updateBuclnbSettings(vals) { + this.submitStatus.buclnb = false + this.paramBuclnb.bucLnbAutoStart = vals["settings"]["bucLnbAutoStart"] + this.paramBuclnb.bucPowering = vals["settings"]["bucPowering"] + this.paramBuclnb.bucRefClk10M = vals["settings"]["bucRefClk10M"] + this.paramBuclnb.lnbPowering = vals["settings"]["lnbPowering"] + this.paramBuclnb.lnbRefClk10M = vals["settings"]["lnbRefClk10M"] + this.paramBuclnb.srvRefClk10M = vals["settings"]["srvRefClk10M"] + }, + // ========== include end from 'common/all-params-methods.js.j2' + // ========== include from 'common/monitoring-methods.js.j2' updateStatistics(vals) { this.lastUpdateTime = new Date(); @@ -583,95 +726,7 @@ }, // ========== include end from 'common/monitoring-methods.js.j2' // ========== include from 'common/setup-methods.js.j2' - - settingsSubmitCinC() { - if (this.submitStatus.cinc) { return } - - let query = { - "cinc.mode": this.param.cinc.mode, - "cinc.searchBandwidth": this.param.cinc.searchBandwidth, - "cinc.position.station.latitude": this.param.cinc.position.station.latitude, - "cinc.position.station.longitude": this.param.cinc.position.station.longitude, - "cinc.position.satelliteLongitude": this.param.cinc.position.satelliteLongitude, - "cinc.delayMin": this.param.cinc.delayMin, - "cinc.delayMax": this.param.cinc.delayMax - } - this.submitStatus.cinc = true - fetch('/api/set/cinc', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(query) - }).then(async (resp) => { - this.submitStatus.cinc = false - this.updateCincSettings(await resp.json()) - }).catch((reason) => { - this.submitStatus.cinc = false - alert(`Ошибка при применении настроек: ${reason}`) - }) - }, - - settingsSubmitBucLnb() { - if (this.submitStatus.bucLnb) { return } - let query = { - "buc.refClk10M": this.param.buc.refClk10M, - "buc.powering": parseInt(this.param.buc.powering), - "lnb.refClk10M": this.param.lnb.refClk10M, - "lnb.powering": parseInt(this.param.lnb.powering), - "serviceSettings.refClk10M": this.param.serviceSettings.refClk10M, - "serviceSettings.autoStart": this.param.serviceSettings.autoStart - } - if (confirm('Вы уверены, что хотите сохранить настройки BUC и LNB?')) { - this.submitStatus.bucLnb = true - fetch('/api/set/bucLnb', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(query) - }).then(async (resp) => { - this.submitStatus.bucLnb = false - this.updateBucLnbSettings(await resp.json()) - }).catch((reason) => { - this.submitStatus.bucLnb = false - alert(`Ошибка при применении настроек: ${reason}`) - }) - } - }, - - - - updateCincSettings(vals) { - this.submitStatus.cinc = false - this.param.cinc.mode = vals["settings"]["cinc.mode"] - this.param.cinc.searchBandwidth = vals["settings"]["cinc.searchBandwidth"] - this.param.cinc.position.station.latitude = vals["settings"]["cinc.position.station.latitude"] - this.param.cinc.position.station.longitude = vals["settings"]["cinc.position.station.longitude"] - this.param.cinc.position.satelliteLongitude = vals["settings"]["cinc.position.satelliteLongitude"] - this.param.cinc.delayMin = vals["settings"]["cinc.delayMin"] - this.param.cinc.delayMax = vals["settings"]["cinc.delayMax"] - }, - - updateBucLnbSettings(vals) { - this.submitStatus.bucLnb = false - this.param.buc.refClk10M = vals["settings"]["buc.refClk10M"] - this.param.buc.powering = vals["settings"]["buc.powering"] - this.param.lnb.refClk10M = vals["settings"]["lnb.refClk10M"] - this.param.lnb.powering = vals["settings"]["lnb.powering"] - this.param.serviceSettings.refClk10M = vals["settings"]["serviceSettings.refClk10M"] - this.param.serviceSettings.autoStart = vals["settings"]["serviceSettings.autoStart"] - }, - - updateSettings(vals) { - this.settingFetchComplete = true - this.updateRxTxSettings(vals) - this.updateCincSettings(vals) - this.updateBucLnbSettings(vals) - this.updateQosSettings(vals) - this.updateNetworkSettings(vals) - this.updateDebugSendSettings(vals) - }, // ========== include end from 'common/setup-methods.js.j2' + // ========== include end from 'common/setup-methods.js.j2' // ========== include from 'common/qos-methods.js.j2' settingsSubmitQoS() { diff --git a/static/main-tdma.html b/static/main-tdma.html index a6e3cec..afde2b3 100644 --- a/static/main-tdma.html +++ b/static/main-tdma.html @@ -110,47 +110,100 @@
-

Настройки приема/передачи

-
-
-

Настройки передатчика

- - -
- -
-

Настройки приемника

- - -
- -
- - +

Настройки приема/передачи

+
+
+

Настройки передатчика

+ + + + + +
+
+

Настройки приемника

+ + + + + + +
+
+ +

Настройки питания и опорного генератора

+
+
+

Настройки BUC

+ + +
+
+

Настройки LNB

+ + +
+
+

Сервисные настройки

+ + +
+
+

Настройки сети

@@ -398,6 +451,30 @@ modemReboot: null }, + // ========== include from 'common/all-params-data.js.j2' + paramRxtx: { + rxAgcEn: true, + rxBaudrate: 0, + rxCentralFreq: 900000, + rxManualGain: -40, + rxRolloff: 2, + rxSpectrumInversion: false, + txAttenuation: 0, + txBaudrate: 0, + txCentralFreq: 900000, + txEn: false, + txIsTestInput: false, + }, + paramBuclnb: { + bucLnbAutoStart: false, + bucPowering: 0, + bucRefClk10M: false, + lnbPowering: 0, + lnbRefClk10M: false, + srvRefClk10M: false, + }, + // ========== include end from 'common/all-params-data.js.j2' + // ========== include from 'common/monitoring-data.js.j2' statRx: { // индикаторы @@ -480,6 +557,75 @@ return "" }, + // ========== include from 'common/all-params-methods.js.j2' + settingsSubmitRxtx() { + if (this.submitStatus.rxtx) { return } + + let query = { + "rxAgcEn": this.paramRxtx.rxAgcEn, + "rxBaudrate": this.paramRxtx.rxBaudrate, + "rxCentralFreq": this.paramRxtx.rxCentralFreq, + "rxManualGain": this.paramRxtx.rxManualGain, + "rxRolloff": this.paramRxtx.rxRolloff, + "rxSpectrumInversion": this.paramRxtx.rxSpectrumInversion, + "txAttenuation": this.paramRxtx.txAttenuation, + "txBaudrate": this.paramRxtx.txBaudrate, + "txCentralFreq": this.paramRxtx.txCentralFreq, + "txEn": this.paramRxtx.txEn, + "txIsTestInput": this.paramRxtx.txIsTestInput, + } + + this.submitStatus.rxtx = true + fetch('/api/set/rxtx', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(query) }) + .then(async (resp) => { this.updateRxtxSettings(await resp.json()) }) + .catch((reason) => { alert(`Ошибка при применении настроек: ${reason}`) }) + .finally(() => { this.submitStatus.rxtx = false }) + }, + settingsSubmitBuclnb() { + if (this.submitStatus.buclnb) { return } + { if (!confirm("Применение неправильных настроек может вывести из строя оборудование! Продолжить?")) return } + + let query = { + "bucLnbAutoStart": this.paramBuclnb.bucLnbAutoStart, + "bucPowering": this.paramBuclnb.bucPowering, + "bucRefClk10M": this.paramBuclnb.bucRefClk10M, + "lnbPowering": this.paramBuclnb.lnbPowering, + "lnbRefClk10M": this.paramBuclnb.lnbRefClk10M, + "srvRefClk10M": this.paramBuclnb.srvRefClk10M, + } + + this.submitStatus.buclnb = true + fetch('/api/set/buclnb', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(query) }) + .then(async (resp) => { this.updateBuclnbSettings(await resp.json()) }) + .catch((reason) => { alert(`Ошибка при применении настроек: ${reason}`) }) + .finally(() => { this.submitStatus.buclnb = false }) + }, + + updateRxtxSettings(vals) { + this.submitStatus.rxtx = false + this.paramRxtx.rxAgcEn = vals["settings"]["rxAgcEn"] + this.paramRxtx.rxBaudrate = vals["settings"]["rxBaudrate"] + this.paramRxtx.rxCentralFreq = vals["settings"]["rxCentralFreq"] + this.paramRxtx.rxManualGain = vals["settings"]["rxManualGain"] + this.paramRxtx.rxRolloff = vals["settings"]["rxRolloff"] + this.paramRxtx.rxSpectrumInversion = vals["settings"]["rxSpectrumInversion"] + this.paramRxtx.txAttenuation = vals["settings"]["txAttenuation"] + this.paramRxtx.txBaudrate = vals["settings"]["txBaudrate"] + this.paramRxtx.txCentralFreq = vals["settings"]["txCentralFreq"] + this.paramRxtx.txEn = vals["settings"]["txEn"] + this.paramRxtx.txIsTestInput = vals["settings"]["txIsTestInput"] + }, + updateBuclnbSettings(vals) { + this.submitStatus.buclnb = false + this.paramBuclnb.bucLnbAutoStart = vals["settings"]["bucLnbAutoStart"] + this.paramBuclnb.bucPowering = vals["settings"]["bucPowering"] + this.paramBuclnb.bucRefClk10M = vals["settings"]["bucRefClk10M"] + this.paramBuclnb.lnbPowering = vals["settings"]["lnbPowering"] + this.paramBuclnb.lnbRefClk10M = vals["settings"]["lnbRefClk10M"] + this.paramBuclnb.srvRefClk10M = vals["settings"]["srvRefClk10M"] + }, + // ========== include end from 'common/all-params-methods.js.j2' + // ========== include from 'common/monitoring-methods.js.j2' updateStatistics(vals) { this.lastUpdateTime = new Date(); @@ -545,95 +691,7 @@ }, // ========== include end from 'common/monitoring-methods.js.j2' // ========== include from 'common/setup-methods.js.j2' - - settingsSubmitCinC() { - if (this.submitStatus.cinc) { return } - - let query = { - "cinc.mode": this.param.cinc.mode, - "cinc.searchBandwidth": this.param.cinc.searchBandwidth, - "cinc.position.station.latitude": this.param.cinc.position.station.latitude, - "cinc.position.station.longitude": this.param.cinc.position.station.longitude, - "cinc.position.satelliteLongitude": this.param.cinc.position.satelliteLongitude, - "cinc.delayMin": this.param.cinc.delayMin, - "cinc.delayMax": this.param.cinc.delayMax - } - this.submitStatus.cinc = true - fetch('/api/set/cinc', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(query) - }).then(async (resp) => { - this.submitStatus.cinc = false - this.updateCincSettings(await resp.json()) - }).catch((reason) => { - this.submitStatus.cinc = false - alert(`Ошибка при применении настроек: ${reason}`) - }) - }, - - settingsSubmitBucLnb() { - if (this.submitStatus.bucLnb) { return } - let query = { - "buc.refClk10M": this.param.buc.refClk10M, - "buc.powering": parseInt(this.param.buc.powering), - "lnb.refClk10M": this.param.lnb.refClk10M, - "lnb.powering": parseInt(this.param.lnb.powering), - "serviceSettings.refClk10M": this.param.serviceSettings.refClk10M, - "serviceSettings.autoStart": this.param.serviceSettings.autoStart - } - if (confirm('Вы уверены, что хотите сохранить настройки BUC и LNB?')) { - this.submitStatus.bucLnb = true - fetch('/api/set/bucLnb', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(query) - }).then(async (resp) => { - this.submitStatus.bucLnb = false - this.updateBucLnbSettings(await resp.json()) - }).catch((reason) => { - this.submitStatus.bucLnb = false - alert(`Ошибка при применении настроек: ${reason}`) - }) - } - }, - - - - updateCincSettings(vals) { - this.submitStatus.cinc = false - this.param.cinc.mode = vals["settings"]["cinc.mode"] - this.param.cinc.searchBandwidth = vals["settings"]["cinc.searchBandwidth"] - this.param.cinc.position.station.latitude = vals["settings"]["cinc.position.station.latitude"] - this.param.cinc.position.station.longitude = vals["settings"]["cinc.position.station.longitude"] - this.param.cinc.position.satelliteLongitude = vals["settings"]["cinc.position.satelliteLongitude"] - this.param.cinc.delayMin = vals["settings"]["cinc.delayMin"] - this.param.cinc.delayMax = vals["settings"]["cinc.delayMax"] - }, - - updateBucLnbSettings(vals) { - this.submitStatus.bucLnb = false - this.param.buc.refClk10M = vals["settings"]["buc.refClk10M"] - this.param.buc.powering = vals["settings"]["buc.powering"] - this.param.lnb.refClk10M = vals["settings"]["lnb.refClk10M"] - this.param.lnb.powering = vals["settings"]["lnb.powering"] - this.param.serviceSettings.refClk10M = vals["settings"]["serviceSettings.refClk10M"] - this.param.serviceSettings.autoStart = vals["settings"]["serviceSettings.autoStart"] - }, - - updateSettings(vals) { - this.settingFetchComplete = true - this.updateRxTxSettings(vals) - this.updateCincSettings(vals) - this.updateBucLnbSettings(vals) - this.updateQosSettings(vals) - this.updateNetworkSettings(vals) - this.updateDebugSendSettings(vals) - }, // ========== include end from 'common/setup-methods.js.j2' + // ========== include end from 'common/setup-methods.js.j2' // ========== include from 'common/admin-methods.js.j2' settingsSubmitNetwork() {