-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Config UI: visualize Modbusproxy #24015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
1595193
remove yaml
Maschga d085c0b
rewrite
Maschga 2390833
wip
Maschga a7627ed
fix ids
Maschga 01086eb
wip
Maschga 251c809
lint
Maschga 98a7b93
read json
Maschga 8b76300
Merge branch 'master' into config-ui/modbusproxy
Maschga 2fcb73a
add ascii diagram to clarify configuratoin and flow
naltatis 530626d
add props
Maschga 1b23c68
wip
Maschga d3649b8
fix reference bugs
Maschga 7f80980
Merge branch 'master' into config-ui/modbusproxy
Maschga 5bb2b0d
split host and port
Maschga 7ac6d99
Merge branch 'config-ui/modbusproxy' of https://github.com/Maschga/ev…
Maschga 8688e41
use columns
Maschga 16abc0a
Merge branch 'master' into config-ui/modbusproxy
Maschga 2791de9
use top alignment; better remove button position; show divider
Maschga 828889a
suport small devices
Maschga fc64d73
Merge branch 'master' into config-ui/modbusproxy
naltatis c7775e8
ui optimize; sponsor; wording; translations
naltatis ddf8fed
move readonly to left; reduce diff in modbus.vue; translation; defaul…
naltatis 76e6411
readd translation texts
naltatis 9e4f8c3
Merge branch 'master' into config-ui/modbusproxy
naltatis 2b3a77c
add migration strategy
Maschga 646a290
use enums; fix protocol/connection switch
Maschga da81e7a
fix; simplify
Maschga d1e255f
fix mapping
Maschga 92f1f83
add tests
Maschga e6b89da
lint
Maschga 1033606
Update cmd/setup.go
Maschga 7b4758c
migration: remove mapping
Maschga 93024ca
use afterEach
Maschga abb057f
improve locators; add restart
Maschga a452bab
use modbus; use enum; simplify
Maschga 8755156
remove logs
Maschga 2bc3c2c
restore deviceHint
Maschga 7e0cd9e
Merge branch 'master' into config-ui/modbusproxy
Maschga 07f09de
refactor/test migrate; small fixes; proper form ids
naltatis 33d7fd2
Merge branch 'master' into config-ui/modbusproxy
naltatis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,117 @@ | ||
| <template> | ||
| <YamlModal | ||
| <JsonModal | ||
| id="modbusProxyModal" | ||
| :title="$t('config.modbusproxy.title')" | ||
| :description="$t('config.modbusproxy.description')" | ||
| docs="/docs/reference/configuration/modbusproxy" | ||
| :defaultYaml="defaultYaml" | ||
| endpoint="/config/modbusproxy" | ||
| removeKey="modbusproxy" | ||
| size="md" | ||
| state-key="modbusproxy" | ||
| :store-values-in-array="true" | ||
| disable-remove | ||
| data-testid="modbusproxy-modal" | ||
| @changed="$emit('changed')" | ||
| /> | ||
| > | ||
| <template #default="{ values }: { values: ModbusProxy[] }"> | ||
| <div class="mb-3"> | ||
| <pre class="text-monospace">{{ ASCII_DIAGRAM }}</pre> | ||
| <div v-for="(connection, index) in values"> | ||
| <div class="d-none d-lg-block"> | ||
| <hr class="mt-5" /> | ||
| <h5> | ||
| <div class="inner mb-3">Connection #{{ index + 1 }}</div> | ||
| </h5> | ||
| </div> | ||
| <Modbus | ||
| :capabilities="['rs485', 'tcpip']" | ||
| :host="connection.Settings.URI" | ||
| :port="connection.Port" | ||
| :baudrate="connection.Settings.Baudrate" | ||
| :comset="connection.Settings.Comset" | ||
| :device="connection.Settings.Device" | ||
| :read-only="connection.ReadOnly" | ||
| :is-proxy="true" | ||
| /> | ||
| <div class="align-items-center d-flex mb-4"> | ||
| <button | ||
| type="button" | ||
| class="btn btn-sm btn-outline-secondary border-0 ms-auto" | ||
| aria-label="Remove" | ||
| tabindex="0" | ||
| @click="values.splice(index, 1)" | ||
| > | ||
| <shopicon-regular-trash | ||
| size="s" | ||
| class="flex-shrink-0" | ||
| ></shopicon-regular-trash> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| <button | ||
| type="button" | ||
| class="d-flex btn btn-sm btn-outline-secondary border-0 align-items-center gap-2 evcc-gray" | ||
| data-testid="networkconnection-add" | ||
| tabindex="0" | ||
| @click="addConnection(values)" | ||
| > | ||
| <shopicon-regular-plus size="s" class="flex-shrink-0"></shopicon-regular-plus> | ||
| Add network connection | ||
| </button> | ||
| </div> | ||
| </template> | ||
| </JsonModal> | ||
| </template> | ||
|
|
||
| <script> | ||
| import YamlModal from "./YamlModal.vue"; | ||
| import defaultYaml from "./defaultYaml/modbusproxy.yaml?raw"; | ||
| <script lang="ts"> | ||
| import "@h2d2/shopicons/es/regular/plus"; | ||
| import "@h2d2/shopicons/es/regular/trash"; | ||
| import JsonModal from "./JsonModal.vue"; | ||
| import { MODBUS_PROXY_READONLY, type ModbusProxy } from "@/types/evcc"; | ||
| import ASCII_DIAGRAM from "./modbus-diagram.txt?raw"; | ||
| import Modbus from "./DeviceModal/Modbus.vue"; | ||
| import deepClone from "@/utils/deepClone"; | ||
|
|
||
| const DEFAULT_MODBUS_PROXY: ModbusProxy = { | ||
| Port: 502, | ||
| ReadOnly: MODBUS_PROXY_READONLY.DENY, | ||
| Settings: {}, | ||
| }; | ||
|
|
||
| export default { | ||
| name: "ModbusProxyModal", | ||
| components: { YamlModal }, | ||
| components: { JsonModal, Modbus }, | ||
| emits: ["changed"], | ||
| data() { | ||
| return { defaultYaml: defaultYaml.trim() }; | ||
| return { | ||
| ASCII_DIAGRAM, | ||
| MODBUS_PROXY_READONLY, | ||
| DEFAULT_MODBUS_PROXY, | ||
| deepClone, | ||
| }; | ||
| }, | ||
| methods: { | ||
| addConnection(values: ModbusProxy[]) { | ||
| const newConnection = { ...deepClone(DEFAULT_MODBUS_PROXY) }; // Ensures reactivity with spread | ||
| values.push(newConnection); | ||
| }, | ||
| }, | ||
| }; | ||
| </script> | ||
|
|
||
| <style scoped> | ||
| h5 { | ||
| position: relative; | ||
| display: flex; | ||
| top: -25px; | ||
| margin-bottom: -0.5rem; | ||
| padding: 0 0.5rem; | ||
| justify-content: center; | ||
| } | ||
| h5 .inner { | ||
| padding: 0 0.5rem; | ||
| background-color: var(--evcc-box); | ||
| font-weight: normal; | ||
| color: var(--evcc-gray); | ||
| text-transform: uppercase; | ||
| text-align: center; | ||
| } | ||
| </style> | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| ┌────────┐ | ||
| ┌─ network ─> │ device │ | ||
| ┌────────┐ ┌──────┐ └────────┘ | ||
| │ client │ --port--> │ evcc │ | ||
| └────────┘ └──────┘ ┌────────┐ | ||
| └─ serial --> │ device │ | ||
| └────────┘ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.