Feat version status sftpgo - #947
Conversation
…goApiKey to maintain naming consistency with the rest of the codebase
…ey) to match Homer conventions
export ADMIN_ACCESS_TOKEN=$(curl -s http://localhost:8888/api/v2/token -u "admin:password" | jq -r .access_token)
export ADMIN_API_KEY=$(curl -s -X POST http://localhost:8888/api/v2/apikeys \
-H "Authorization: Bearer $ADMIN_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "admin-key", "scope": 1, "description": "API key for Homer", "admin": "admin", "expires_at": 0}' \
| jq -r .key)4.Then test the API: curl -H "X-SFTPGO-API-KEY: $ADMIN_API_KEY" http://localhost:8888/api/v2/connections
curl -H "X-SFTPGO-API-KEY: $ADMIN_API_KEY" http://localhost:8888/api/v2/version📘 Full API documentation is available at: |
|
|
bastienwirtz
left a comment
There was a problem hiding this comment.
Thanks for your contribution @thibaut1304 !
I didn't know about SFTPGo, looks like a cool project.
A few minor thing and we should be good to go 👍
| } | ||
| try { | ||
| const response = await this.fetch("/api/v2/version", { headers }); | ||
| this.versionstring = response.version || "inconnue"; |
There was a problem hiding this comment.
| this.versionstring = response.version || "inconnue"; | |
| this.versionstring = response.version || "unknown"; |
There was a problem hiding this comment.
Yes, sorry, I will be careful in the future on the new PR to put everything in English.
Fix in this commit 440160f
| const response = await this.fetch("/api/v2/version", { headers }); | ||
| this.versionstring = response.version || "inconnue"; | ||
|
|
||
| const connResponse = await this.fetch("/api/v2/connections", { headers }); |
There was a problem hiding this comment.
could make both requests run in parallel? Using promise for exemple. This way the card would load faster, doing both request at the same time.
There was a problem hiding this comment.
Thanks for the suggestion!
Switched to Promise.all so /version and /connections are fetched in parallel; card now renders in one RTT.
fix here : 2d7b8e3
| this.versionstring = response.version || "inconnue"; | ||
|
|
||
| const connResponse = await this.fetch("/api/v2/connections", { headers }); | ||
| this.activeConnections = Array.isArray(connResponse) ? connResponse.length : null; |
There was a problem hiding this comment.
If the request is successful but connResponse is not an array, does it means there is 0 connections ? If that's the case, I would suggest to change for connResponse.length : 0
There was a problem hiding this comment.
The /api/v2/connections route always returns an array even if there are 0 connections! I simplified it in this commit 2d7b8e3
|
Also, could you add some sample API output here : https://github.com/bastienwirtz/homer/tree/main/dummy-data#dummy-data so I can test it and add it to the demo page ? Thanks ! |
I can't get the mock server to work. I figured out from the demo page that I needed to set an endpoint: "/dummy-data/sftpgo," but even then, I can't get it to work. I added the information anyway, but I couldn't test it. I'd like to know the procedure. Thank you. |
thibaut1304
left a comment
There was a problem hiding this comment.
This issue ('e' is defined but never used) has been fixed in commit 7db55c6.
bastienwirtz
left a comment
There was a problem hiding this comment.
Thx for your patience 🙏
One last question and we should be good to go !
| <span v-if="activeConnections !== null && !this.showUpdateAvailable"> | ||
| – Active connections: {{ activeConnections }} |
There was a problem hiding this comment.
The idea here is to not show the line on small screen right? why showUpdateAvailable is named like that ? It's not related to updates ? or I'm missing something ?
You may be able to reduce the message (for example, just {{ activeConnections }} connections or {{ activeConnections }} clients) to make it fit on most screen and avoid the need to have a matchMedia check.



Description
📌 Issue :
There was no native support to display the current version and display active connection for SFTPGo from Homer.
✅ Solution
🔥 Motivation
Allows you to see at a glance if there are active connections and the version of our instance
Type of change
Checklist:
config.ymlfile