работающая генерация базовых полей (числа, select, checkbox) + законченные настройки для TDMA
This commit is contained in:
7
front-generator/template/common/all-params-data.js.j2
Normal file
7
front-generator/template/common/all-params-data.js.j2
Normal file
@@ -0,0 +1,7 @@
|
||||
{% for g in paramGroups %}
|
||||
param{{ g['group'] | title }}: {
|
||||
{% for p in g['params'] %}
|
||||
{{ p['name'] }}: {{ p['initValue'] }},
|
||||
{% endfor %}
|
||||
},
|
||||
{% endfor %}
|
29
front-generator/template/common/all-params-methods.js.j2
Normal file
29
front-generator/template/common/all-params-methods.js.j2
Normal file
@@ -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 %}
|
@@ -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 %}
|
||||
|
@@ -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)
|
||||
},
|
@@ -2,8 +2,8 @@
|
||||
<div class="tabs-body-item" v-if="activeTab === 'setup' && settingFetchComplete">
|
||||
{% for cat in ['rxtx', 'cinc', 'buclnb'] %}
|
||||
{% if cat in params %}
|
||||
{% for w in params[cat] %}{{ build_widget(cat, w) }}{% endfor %}
|
||||
<button class="action-button" @click="settingsSubmitBucLnb()">Сохранить <span class="submit-spinner" v-show="submitStatus.bucLnb"></span></button>
|
||||
{% for w in params[cat] %}{{ build_widget(cat, w) | indent(12, true) }}{% endfor %}
|
||||
<button class="action-button" @click="settingsSubmit{{ cat | title }}()">Сохранить <span class="submit-spinner" v-show="submitStatus.{{ cat }}"></span></button>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
@@ -1,32 +1,25 @@
|
||||
{% macro build_widget_checkbox(param_group, widget) %}<label{% if widget.v_show %} v-show="{{ widget.v_show }}"{% endif %}>
|
||||
<span>{{ widget.label }}</span>
|
||||
<span class="toggle-input">
|
||||
<input type="checkbox" v-model="param{{ param_group | title }}.{{ widget.name }}" />
|
||||
<span class="slider"></span>
|
||||
</span>
|
||||
<span class="toggle-input"><input type="checkbox" v-model="param{{ param_group | title }}.{{ widget.name }}" /><span class="slider"></span></span>
|
||||
</label>{% endmacro %}
|
||||
|
||||
{% macro build_widget_number(param_group, widget) %}<label{% if widget.v_show %} v-show="{{ widget.v_show }}"{% endif %}>
|
||||
</label>{% endmacro %}
|
||||
{% macro build_widget_number(param_group, widget) %}<label{% if widget.v_show %} v-show="{{ widget.v_show }}"{% endif %}><span>{{ widget.label }}</span><input type="number" v-model="param{{ param_group | title }}.{{ widget.name }}"{% if widget['min'] %} min="{{ widget['min'] }}"{% endif %}{% if widget['max'] %} max="{{ widget['max'] }}"{% endif %}{% if widget['step'] %} step="{{ widget['step'] }}"{% endif %}/></label>{% endmacro %}
|
||||
|
||||
{% macro build_widget_select(param_group, widget) %}<label{% if widget.v_show %} v-show="{{ widget.v_show }}"{% endif %}>
|
||||
<span>{{ widget.label }}</span>
|
||||
<select v-model="param{{ param_group | title }}.{{ widget.name }}">
|
||||
{% for opt in widget['values'] %}
|
||||
<option :value="{{ opt.value }}">{{ opt.label }}</option>
|
||||
{% for opt in widget['values'] %} <option :value="{{ opt.value }}">{{ opt.label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>{% endmacro %}
|
||||
|
||||
{% macro build_widget_flex_container(param_group, widget) %}<div class="tabs-item-flex-container"{% if widget.v_show %} v-show="{{ widget.v_show }}"{% endif %}>
|
||||
{% for w in widget.childs %}{{ build_widget(param_group, w) }}{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
{% for w in widget.childs %}{{ build_widget(param_group, w) | indent(4, true) }}{% endfor %}
|
||||
</div>{% endmacro %}
|
||||
|
||||
{% macro build_widget_settings_container(param_group, widget) %}<div class="settings-set-container"{% if widget.v_show %} v-show="{{ widget.v_show }}"{% endif %}>
|
||||
{% for w in widget.childs %}{{ build_widget(param_group, w) }}{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
{% for w in widget.childs %}{{ build_widget(param_group, w) | indent(4, true) }}{% endfor %}
|
||||
</div>{% endmacro %}
|
||||
|
||||
|
||||
{% macro build_widget(param_group, widget) %}{% if widget.widget == 'flex-container' %}{{ build_widget_flex_container(param_group, widget) }}
|
||||
|
Reference in New Issue
Block a user