Skip to content

gui: Show internal config and state paths (fixes #8323) - #8324

Merged
calmh merged 37 commits into
syncthing:mainfrom
acolomb:show-gui-paths
Aug 10, 2022
Merged

calmh merged 37 commits into
syncthing:mainfrom
acolomb:show-gui-paths

Conversation

@acolomb

@acolomb acolomb commented May 4, 2022 •

Copy link
Copy Markdown
Member

Purpose

Make the information shown by the --paths command line option accessible through the GUI, under a new tab in the Logs modal. Should help e.g. finding the config file on exotic platforms that set some unexpected home directory through the package integrations.

This is exposed through a new API endpoint, together with some cleanup in the locations package. Some more detailed explanations to be found in the commit messages.

Testing

No new tests added.

Screenshots

image

Documentation

acolomb added 7 commits May 4, 2022 21:27
Previously the locations package was used to provide default paths,
possibly with an overridden home directory.  Extra paths supplied on
the command line were handled and passed around in the options object.

To make the changed paths available to any other interested package,
override the location setting from the option if supplied, instead of
vice versa when not supplied.  Adapt code using this to read from the
locations package instead of passing through the options object.
Generate a reusable string in locations.PrettyPrintPaths().
Enumerating all possible locations in different packages is error
prone, so add a new public function to generate the listing as a
string in the locations package.  Adapt cmd/syncthing --paths to use
that instead of its own console output.
The paths should be available for troubleshooting from a running
instance.  Using the --paths CLI option is not easy in some
environments, so expose the locations mapping to a JSON endpoint.

Add utility function ListExpandedPaths() that also filters out any
entries which still contain variable placeholders.
@acolomb

acolomb commented May 4, 2022 •

Copy link
Copy Markdown
Member Author

Some ideas that didn't make it into this proposal:

  • Extending the Starting event to show all paths besides the home directory. Theoretically sufficient to announce this once, but doesn't help if the GUI is opened after the backend.
  • Adding a paths attribute to the /rest/system/status endpoint instead.
  • Adding descriptive titles for each entry as translations for the LocationEnum keys. Didn't seem worth the trouble as this is mainly needed to diagnose technical problems. So a simple uncamel seems good enough.
  • Other places where to hide this info in the GUI. Suggestions welcome!

The unused FailuresFile enum value was introduced in #7150.

@acolomb acolomb linked an issue May 4, 2022 that may be closed by this pull request
@calmh

calmh commented May 5, 2022 •

Copy link
Copy Markdown
Member

This is a great addition, long overdue. However, I think we should do it a bit more manually, and the --paths output is maybe not a great model. Looking at each of the items listed,

  • config file: clearly useful, always in the config dir
  • csrf tokens: never useful to the user
  • cert file, key file, https cert file, https key file: potentially useful, but always live in the config directory
  • database: potentially useful, can be separate from the config directory
  • default folder path: never useful, I think
  • gui assets: potentially useful (though always in the config directory)
  • log file: certainly useful

So I think we could boil this down to showing "Configuration directory (contains configuration and keys)", "Database location" (the database is a directory, but that's kind of an implementation detail), "GUI overrides directory" (or something like that) and "Log file", each with localization...

So technically that would be GetBaseDir(ConfigBaseDir), plus the specific locations for the others...?

@acolomb

acolomb commented May 5, 2022

Copy link
Copy Markdown
Member Author

Thanks for your comments, I'm fine with going that route in general.

gui assets: potentially useful (though always in the config directory)

Not quite true, STGUIASSETS can be set to anything.

So I think we could boil this down to showing "Configuration directory (contains configuration and keys)", [...]

I don't think hard-coding that assertion into the GUI code is a good idea. That's the last place one would think of adjusting when something like the conf / data split ever happens again. Better print full paths to each item, that's safer for the situations I'm thinking about where people are already in trouble because of something. Combining a directory path with a file name might be just one bit too much to handle correctly.

My primary goal was to mirror the --paths output in machine readable form, but UI wise I guess we can streamline it and possibly improve --paths output as well to match the GUI.

@calmh

calmh commented May 5, 2022

Copy link
Copy Markdown
Member

Okay fair enough, in that case how about grouping by directory?

In /home/acolomb/src/syncthing/devtest-home:
  Cert File: cert.pem
  Config: config.xml
  ...
In /home/acolomb/src:
  Gui Assets: gui
  ...

I'm trying to drive focus towards the one or two directories where almost always everything will be, rather than every little individual key file as if they are ever spread out in random places.

@imsodin

imsodin commented May 5, 2022 •

Copy link
Copy Markdown
Member

Looks very useful. Just a general remark on UI: I'd put it into it's own modal/actions menu item - under logs it's not very discoverable. Or maybe putting it in "about", that'd make more sense to me than logs (has information on the build already).

@acolomb

acolomb commented May 5, 2022

Copy link
Copy Markdown
Member Author

I had thought about the "About" dialog, but found it to have an overwhelming amount of information already. I don't prefer making an own modal for two reasons: 1) not cluttering the Actions menu further with very seldomly used, but prominent stuff and 2) it's such a small piece of info that it just doesn't warrant a separate dialog. The idea behind putting it in the Logs modal was that most people will need it during troubleshooting, where the first thing they will be sent to check are the logs.

Other opinions on this?

@tomasz1986

tomasz1986 commented May 5, 2022 •

Copy link
Copy Markdown
Member

Other opinions on this?

Maybe rename "Logs" to "Troubleshooting" and then put it there (as this PR already does)? I'd also put the tab right after "Logs" and move "Debugging" to the end as the most "advanced" of the three (similarly to the "advanced" tab in the folder settings).

The current name of the modal, i.e. "Logs", isn't exactly correct right now already, as it contains both logs and debugging, so I think it'd fit well. Just my opinion, of course 🙂.

@bt90

bt90 commented May 6, 2022

Copy link
Copy Markdown
Contributor

I might be murdering someones baby for asking but can't we shrink the current About page? The list of contributors could be maintained on the Github readme for example.

@imsodin

imsodin commented May 6, 2022

Copy link
Copy Markdown
Member

The current name of the modal, i.e. "Logs", isn't exactly correct right now already, as it contains both logs and debugging, so I think it'd fit well. Just my opinion, of course slightly_smiling_face.

Well "Debugging" there is strictly about logging debug facilities, so that fits well in my opinion.

I don't think the action menu is very cluttered. If we want to keep the number of entries down, then a proposed "Troubleshooting" that replaces/incorporates the "Support Bundle" would make most sense to me. "Logs" is likely to be often used already, removing it might cause confusion. I think "Support Bundle" is niche enough that replacing it is ok.

@acolomb

acolomb commented May 6, 2022 •

Copy link
Copy Markdown
Member Author

I like the idea of replacing the "Support Bundle" link. However, it took me some time to even find information about it, because it is hidden unless the Debugging flag is flipped on in advanced configuration. That's too much of a hurdle for accessing the paths.

@calmh

calmh commented May 6, 2022

Copy link
Copy Markdown
Member

The support bundle thing is specific functionality that is only available when debugging is enabled, yeah, not really related.

Frankly I think "About" is a good place. (I also think we should keep the list of all contributors there. Scrolling is alright.)

@imsodin

imsodin commented May 6, 2022

Copy link
Copy Markdown
Member

I like the idea of replacing the "Support Bundle" link. However, it took me some time to even find information about it, because it is hidden unless the Debugging flag is flipped on in advanced configuration. That's too much of a hurdle for accessing the paths.

Well we don't need to keep that: "Troubleshooting" could then have a conditionally visible tab/button for support bundle, but itself is always visible (including the paths). Anyway I don't particularly care where it goes in the end (about, standalone, troubleshooting, ...), only that it's discoverable. And as a tab in "Logs" I don't think it is.

@tomasz1986

tomasz1986 commented May 6, 2022 •

Copy link
Copy Markdown
Member

Well "Debugging" there is strictly about logging debug facilities, so that fits well in my opinion.

I don't think the action menu is very cluttered. If we want to keep the number of entries down, then a proposed "Troubleshooting" that replaces/incorporates the "Support Bundle" would make most sense to me. "Logs" is likely to be often used already, removing it might cause confusion. I think "Support Bundle" is niche enough that replacing it is ok.

The reason for suggesting the merge was that I think everything will become confusing with a new and separate "Troubleshooting" entry. We will have both "Logs" and "Troubleshooting" in the Actions menu, but then inside "Logs" there is "Debugging" whose purpose is also to troubleshoot (related to the logs, but still). On top of that, logging in itself is commonly considered a part of the troubleshooting process too.

@acolomb

acolomb commented Jun 16, 2022

Copy link
Copy Markdown
Member Author

I think this is done, please review. Do we want to keep the paths property in /rest/system/status as well or only on its own endpoint?

@imsodin

imsodin commented Jun 18, 2022

Copy link
Copy Markdown
Member

I think this is done, please review. Do we want to keep the paths property in /rest/system/status as well or only on its own endpoint?

What's the purpose of the separate endpoint?
Also what's the need to refresh paths when opening the modal view? The entire system infromation is refreshed every 10s, and this isn't information that changes often - if there's any controls in the web UI that can change them, I'd rather add a refresh call to them instead.

@acolomb

acolomb commented Jun 19, 2022

Copy link
Copy Markdown
Member Author

What's the purpose of the separate endpoint?

Exactly because the info never changes during runtime, we don't really need it as part of the 10 second refresh cycle. However, the tilde property for example is also contained there, so that was the first logical choice. Having a separate endpoint (instead of including it in /rest/system/status) allows to get the information only when needed, cutting down on the amount of cyclically refreshed data.

So you're suggesting to drop the separate endpoint and use only system status instead? I'd actually prefer the opposite, making endpoints more granular instead of stuffing everything together into one big "status".

@imsodin

imsodin commented Jun 20, 2022

Copy link
Copy Markdown
Member

I was questioning having it in both. Personally I'd probably go for simplicity over granularity/optimisation given the existing /rest/system endpoint (containing static info already), but I don't feel strongly either way. Just no duplication of paths please.

@acolomb

acolomb commented Jun 20, 2022

Copy link
Copy Markdown
Member Author

I removed it from /rest/system/status again. Having static information there seems unfortunate to me, so I avoid proliferating that.

@acolomb

acolomb commented Jul 21, 2022

Copy link
Copy Markdown
Member Author

Ping. Anything else to get this merge-ready?

@acolomb

acolomb commented Aug 2, 2022

Copy link
Copy Markdown
Member Author

Ping again. Another week, another conflict resolution. Kindly asking to get this reviewed / merged soonish.

@tomasz1986

Copy link
Copy Markdown
Member

Ping again. Another week, another conflict resolution. Kindly asking to get this reviewed / merged soonish.

I can only say that on the GUI side, everything seems to work perfectly fine. I'd just like to ask to maybe add a new screenshot, as the final version is quite different than what's being shown now.

Also, I'd like to ask a question regarding the "user home" terminology. Wouldn't it be better to make it more explicit, e.g. "user home directory" or "user home folder"? There's no "user home" on some operating systems, either because the terminology is different (i.e. Windows, which uses "user profile"), or because the concept itself doesn't exist (i.e. Android). I think at least adding the word "directory" or "folder" makes it easier to understand.

* release:
  lib/ur: Properly initialize map in failure data (fixes syncthing#8479)
calmh
calmh previously approved these changes Aug 10, 2022
* main:
  build: bump actions/setup-go from 2.2.0 to 3.2.1 (syncthing#8492)
  build: Let dependabot suggest updates to GitHub actions (syncthing#8490)
  update: Go version in update-docs-translations action (syncthing#8489)
  gui, man, authors: Update docs, translations, and contributors
  cmd/syncthing: Refactor CLI code to allow passing CLI arguments via function parameter (syncthing#8485)
  build: Update quic-go for Go 1.19 (syncthing#8483)
  lib/ur: Properly initialize map in failure data (fixes syncthing#8479) (syncthing#8480)
  lib/ur: Properly initialize map in failure data (fixes syncthing#8479)
@calmh
calmh merged commit 63de838 into syncthing:main Aug 10, 2022
calmh added a commit to acolomb/syncthing that referenced this pull request Aug 10, 2022
* main: (121 commits)
  gui, api: Show internal config and state paths (fixes syncthing#8323) (syncthing#8324)
  build(deps): bump github.com/go-ldap/ldap/v3 from 3.4.1 to 3.4.4 (syncthing#8475)
  build: bump actions/setup-go from 2.2.0 to 3.2.1 (syncthing#8492)
  build: Let dependabot suggest updates to GitHub actions (syncthing#8490)
  update: Go version in update-docs-translations action (syncthing#8489)
  gui, man, authors: Update docs, translations, and contributors
  cmd/syncthing: Refactor CLI code to allow passing CLI arguments via function parameter (syncthing#8485)
  build: Update quic-go for Go 1.19 (syncthing#8483)
  lib/ur: Properly initialize map in failure data (fixes syncthing#8479) (syncthing#8480)
  lib/ur: Properly initialize map in failure data (fixes syncthing#8479)
  gui, man, authors: Update docs, translations, and contributors
  docs: Clarify docker network mode limitations (syncthing#8472)
  lib/config: Use net.JoinHostPort instead of string manipulation (syncthing#8470)
  lib/api: Fix inverted logic in string comparison
  lib/model: Use bytes.Equal instead of converting to string (syncthing#8469)
  all: Add build constants for runtime.GOOS comparisons (syncthing#8442)
  cmd/strelaysrv: Fix superfluous else statements (syncthing#8468)
  all: Fix nested `if` with `else if` (syncthing#8467)
  all: Unused errors
  lib/fs: Consolidate append in test
  ...
calmh added a commit to calmh/syncthing that referenced this pull request Aug 10, 2022
* main:
  gui, api: Show internal config and state paths (fixes syncthing#8323) (syncthing#8324)
  build(deps): bump github.com/go-ldap/ldap/v3 from 3.4.1 to 3.4.4 (syncthing#8475)
  build: bump actions/setup-go from 2.2.0 to 3.2.1 (syncthing#8492)
  build: Let dependabot suggest updates to GitHub actions (syncthing#8490)
  update: Go version in update-docs-translations action (syncthing#8489)
  lib/ur: Properly initialize map in failure data (fixes syncthing#8479)
@calmh calmh added this to the v1.22.0 milestone Aug 10, 2022
@acolomb

acolomb commented Aug 10, 2022

Copy link
Copy Markdown
Member Author

I think at least adding the word "directory" or "folder" makes it easier to understand.

Well it's under a "paths" heading, so that should point in the right direction. Anyway thanks for merging @calmh.

@acolomb
acolomb deleted the show-gui-paths branch August 14, 2022 20:09
calmh added a commit to calmh/syncthing that referenced this pull request Aug 18, 2022
* main: (256 commits)
  cmd/syncthing: Use os.executable in monitor, only fallback to PATH (syncthing#8502)
  all: Modernize error wrapping (syncthing#8491)
  gui, man, authors: Update docs, translations, and contributors
  cmd/syncthing: Work around binary in current dir restriction (fixes syncthing#8499) (syncthing#8500)
  lib/fs: Cache user lookups (syncthing#8496)
  all: Make scanning ownership opt-in (syncthing#8497)
  lib/model: Skip paused folders in aggregated completion loop (fixes syncthing#8219) (syncthing#8220)
  gui: Remove unused strings from translations (syncthing#8288)
  gui, api: Show internal config and state paths (fixes syncthing#8323) (syncthing#8324)
  build(deps): bump github.com/go-ldap/ldap/v3 from 3.4.1 to 3.4.4 (syncthing#8475)
  build: bump actions/setup-go from 2.2.0 to 3.2.1 (syncthing#8492)
  build: Let dependabot suggest updates to GitHub actions (syncthing#8490)
  update: Go version in update-docs-translations action (syncthing#8489)
  gui, man, authors: Update docs, translations, and contributors
  cmd/syncthing: Refactor CLI code to allow passing CLI arguments via function parameter (syncthing#8485)
  build: Update quic-go for Go 1.19 (syncthing#8483)
  lib/ur: Properly initialize map in failure data (fixes syncthing#8479) (syncthing#8480)
  lib/ur: Properly initialize map in failure data (fixes syncthing#8479)
  gui, man, authors: Update docs, translations, and contributors
  docs: Clarify docker network mode limitations (syncthing#8472)
  ...
@calmh calmh modified the milestones: v1.22.0, v1.21.0 Aug 23, 2022
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Aug 10, 2023
@syncthing syncthing locked and limited conversation to collaborators Aug 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show internally used paths in the GUI for debugging

6 participants