Skip to content

Discuss: add config modal #20928

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

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft

Conversation

diddip21
Copy link
Contributor

@diddip21 diddip21 commented Apr 28, 2025

#18874
#18772

Erster versuch eine Erste-Hilfe Discussion in Github zu eröffnen.
In der UI ist bis jetzt noch nicht die api/config/live referenziert da diese einen vorherigen login benötigt.
Ansonsten ist es mein erster "armseliger" versuch eine Art von LiveConfig zu generieren.
Nehmt es auseinander 😎

Summary by Sourcery

Add a UI feature to assist users in creating GitHub support discussions and expose the live system configuration via a new API endpoint.

New Features:

  • Introduce a "Discuss" modal accessible from the Help menu to pre-fill a GitHub discussion with system state and optional logs.
  • Add a /api/live endpoint consolidating configuration from various sources (files, UI, database).

Enhancements:

  • Modify device and loadpoint configuration endpoints to return comprehensive data including YAML fields.

Copy link
Contributor

sourcery-ai bot commented Apr 28, 2025

Reviewer's Guide by Sourcery

Adds a UI feature to generate GitHub discussions with system data and introduces a new API endpoint /api/system/live to expose the full live configuration.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Implement a "First aid discussion" feature in the Help modal.
  • Add a "Discuss" button
  • Create a new modal for discussion content
  • Fetch system state and logs
  • Allow user to add description and include logs
  • Generate a GitHub discussion URL with pre-filled data
  • Provide a button to copy generated data
assets/js/components/HelpModal.vue
Add a new API endpoint to retrieve the live system configuration.
  • Register a new GET route /api/system/live
  • Implement a handler to collect and return site, device, and global settings configuration in JSON format
server/http.go
server/http_config_live_handler.go
Modify backend configuration handlers to include all YAML fields in the output.
  • Update loadpoint configuration handler to return a map including all YAML fields
  • Update generic device configuration handler to include all YAML fields
server/http_config_loadpoint_handler.go
server/http_config_device_handler.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

if err := jsonDecoder(r).Decode(&payload); err != nil {
return loadpoint.DynamicConfig{}, nil, err
// Hilfsfunktion: Struct zu map[string]any
func structToMap(s any) map[string]any {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das wäre

structs.Map

@andig
Copy link
Member

andig commented May 1, 2025

Ohne im Detail geschaut zu haben: schön wäre, wenn sich der Anwender per Roundtrip bei GH anmelden könnte so dass wir per API direkt in seinem User die Discussion öffnen könnten. Ich hab allerdings nicht geprüft, ob das ohne redirect URL überhaupt klappen kann.

@andig andig changed the title [DRAFT] Feat/discuss UI Discuss: add config modal May 1, 2025
@andig andig added the ux User experience/ interface label May 1, 2025
@github-actions github-actions bot added the stale Outdated and ready to close label May 8, 2025
@naltatis naltatis removed the stale Outdated and ready to close label May 8, 2025
"startup": importSettings("startup"),
"plant": importSettings("plant"),
"telemetry": importSettings("telemetry"),
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In vielen diese Entries können sensible Daten drin sein. Wir müssen hier auf jeden Fall sauber redact machen.

Hier ein paar stellen wo wir so etwas schon machen:

@@ -260,6 +260,7 @@ func (s *HTTPd) RegisterSystemHandler(site *core.Site, valueChan chan<- util.Par
"interval": {"POST", "/interval/{value:[0-9.]+}", settingsSetDurationHandler(keys.Interval)},
"updatesponsortoken": {"POST", "/sponsortoken", updateSponsortokenHandler},
"deletesponsortoken": {"DELETE", "/sponsortoken", deleteSponsorTokenHandler},
"liveconfig": {"GET", "/live", LiveConfigHandler(site)},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ich bin mit dem Namen noch nicht glücklich. Ich wäre dafür das in den /system Namespace zu hängen. Also GET /system/config analog zu GET /system/log.

@click="openDiscussModal"
>
{{ $t("help.discussButton") }}
</button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glaube den neuen Menüpunkt brauchen wir nicht. Es gibt ja bereits den "Bug melden" Menüpunkt. Der verlinkt momentan hart zu Github Issues. Der würde sich dafür ja super eigenen.

Bildschirmfoto 2025-05-09 um 13 40 46

return loadpoint.DynamicConfig{}, nil, err
}

return loadpoint.SplitConfig(payload)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bin mir nicht sicher wo hier der Fehler ist, aber mit dieser Umstellung funktioniert die Loadpoint API nicht mehr. Siehe Integrationstests:

  4 failed
    [chromium] › tests/config-loadpoint.spec.js:66:3 › loadpoint › create, update and delete ───────
    [chromium] › tests/config-loadpoint.spec.js:161:3 › loadpoint › priority ───────────────────────
    [chromium] › tests/config-loadpoint.spec.js:215:3 › loadpoint › vehicle ────────────────────────
    [chromium] › tests/config-loadpoint.spec.js:272:3 › loadpoint › keep mode ──────────────────────

@@ -166,6 +298,64 @@ export default {
async restartConfirmed() {
await performRestart();
},
async openDiscussModal() {
const modal = Modal.getOrCreateInstance(document.getElementById("discussModal"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Die Endpunkte hier erfordern Login. Hier müssen wir, analog Restart Modal, den Status prüfen.

if (!isLoggedIn()) {

generatedData: "",
includeLogs: false, // Neue Variable für die Checkbox
logData: "", // Neue Variable für die Log-Daten
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das DiscussModal sollte auf jeden Fall eine eigene Vue Komponenten werden. Da kommt ja einiges an State und Logik zusammen.

@naltatis
Copy link
Member

naltatis commented May 9, 2025

@diddip21 Danke für den PR. Ist ein großes Thema. Aber ist ein guter Start. Die Idee dem Nutzer die Daten strukturiert einmal in der evcc UI zu präsentieren bevor er sie zu Github rüberflankt ist gut. Gibt dem Nutzer mehr Kontrolle. Größtes Thema ist vmtl. die Redaktion/"Secrets schwärzen" sauber hinzubekommen.

Hätte auch noch einige Anmerkungen zum Ablauf. Bspw. würde ich den state nicht immer mitschicken. Ist aber gut, wenn der Nutzer das auf Anforderung einfach hinzufügen bzw. hier rauskopieren und nachreichen kann. Was aus dem State allerdings immer relevant ist, ist die Versionsnummer. Die sollten wir dediziert ins Template einbauen.

@github-actions github-actions bot added the stale Outdated and ready to close label May 16, 2025
@andig andig removed the stale Outdated and ready to close label May 17, 2025
@github-actions github-actions bot added the stale Outdated and ready to close label Jun 1, 2025
@github-actions github-actions bot closed this Jun 6, 2025
@naltatis naltatis added backlog Things to do later and removed stale Outdated and ready to close labels Jun 11, 2025
@naltatis naltatis reopened this Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Things to do later ux User experience/ interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy