Skip to content

Commit

Permalink
webapp: Nicer cmt frequency input
Browse files Browse the repository at this point in the history
  • Loading branch information
tbnobody committed Apr 15, 2023
1 parent 50ce7f0 commit 1e7b16a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
1 change: 1 addition & 0 deletions webapp/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
"CmtPaLevelHint": "Verwendet für HMS/HMT-Wechselrichter. Stellen Sie sicher, dass Ihre Stromversorgung stabil genug ist, bevor Sie die Sendeleistung erhöhen.",
"CmtFrequency": "CMT2300A Frequenz:",
"CmtFrequencyHint": "Stelle sicher, dass du nur Frequenzen verwendet werden welche im entsprechenden Land erlaubt sind!",
"CmtFrequencyWarning": "Die ausgewählte Frequenz befindet außerhalb des in der EU zugelassenen Bereiches. Vergewissere dich, dass mit dieser Auswahl keine lokalen Regularien verletzt werden.",
"khz": "kHz",
"Save": "Speichern",
"Min": "Minimum ({db} dBm)",
Expand Down
1 change: 1 addition & 0 deletions webapp/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
"CmtPaLevelHint": "Used for HMS/HMT-Inverters. Make sure your power supply is stable enough before increasing the transmit power.",
"CmtFrequency": "CMT2300A Frequency:",
"CmtFrequencyHint": "Make sure to only use frequencies that are allowed in the respective country!",
"CmtFrequencyWarning": "The selected frequency is outside the range allowed in the EU. Make sure that this selection does not violate any local regulations.",
"khz": "kHz",
"Save": "Save",
"Min": "Minimum ({db} dBm)",
Expand Down
1 change: 1 addition & 0 deletions webapp/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
"CmtPaLevelHint": "Used for HMS/HMT-Inverters. Assurez-vous que votre alimentation est suffisamment stable avant d'augmenter la puissance d'émission.",
"CmtFrequency": "CMT2300A Frequency:",
"CmtFrequencyHint": "Stelle sicher, dass du nur Frequenzen verwendet werden welche im entsprechenden Land erlaubt sind!",
"CmtFrequencyWarning": "The selected frequency is outside the range allowed in the EU. Make sure that this selection does not violate any local regulations.",
"khz": "kHz",
"Save": "Sauvegarder",
"Min": "Minimum ({db} dBm)",
Expand Down
30 changes: 25 additions & 5 deletions webapp/src/views/DtuAdminView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,24 @@
</div>
</div>

<InputElement :label="$t('dtuadmin.CmtFrequency')"
<div class="row mb-3" v-if="dtuConfigList.cmt_enabled">
<label for="cmtFrequency" class="col-sm-2 col-form-label">
{{ $t('dtuadmin.CmtFrequency') }}
<BIconInfoCircle v-tooltip :title="$t('dtuadmin.CmtFrequencyHint')" />
</label>
<div class="col-sm-10">
<div class="input-group mb-3">
<input type="range" class="form-control form-range"
v-model="dtuConfigList.cmt_frequency"
type="number" min="860250" max="923500"
:postfix="$t('dtuadmin.khz')"
:tooltip="$t('dtuadmin.CmtFrequencyHint')"
v-if="dtuConfigList.cmt_enabled"/>
min="860250" max="923500" step="250"
id="cmtFrequency" aria-describedby="basic-addon2"
style="height: unset;" />
<span class="input-group-text" id="basic-addon2">{{ cmtFrequencyText }}</span>
</div>
<div class="alert alert-danger" role="alert" v-html="$t('dtuadmin.CmtFrequencyWarning')" v-if="cmtIsOutOfEu"></div>
</div>
</div>

</CardElement>
<button type="submit" class="btn btn-primary mb-3">{{ $t('dtuadmin.Save') }}</button>
</form>
Expand Down Expand Up @@ -98,6 +110,14 @@ export default defineComponent({
created() {
this.getDtuConfig();
},
computed: {
cmtFrequencyText() {
return this.$n(this.dtuConfigList.cmt_frequency / 1000, "decimalTwoDigits") + " MHz";
},
cmtIsOutOfEu() {
return this.dtuConfigList.cmt_frequency < 863000 || this.dtuConfigList.cmt_frequency > 870000;
}
},
methods: {
getDtuConfig() {
this.dataLoading = true;
Expand Down

0 comments on commit 1e7b16a

Please sign in to comment.