-
-
Notifications
You must be signed in to change notification settings - Fork 884
Feat version status sftpgo #947
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
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 π
src/components/services/Sftpgo.vue
Outdated
| } | ||
| try { | ||
| const response = await this.fetch("/api/v2/version", { headers }); | ||
| this.versionstring = response.version || "inconnue"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| this.versionstring = response.version || "inconnue"; | |
| this.versionstring = response.version || "unknown"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry, I will be careful in the future on the new PR to put everything in English.
Fix in this commit 440160f
src/components/services/Sftpgo.vue
Outdated
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
src/components/services/Sftpgo.vue
Outdated
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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