-
-
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
Open
thibaut1304
wants to merge
10
commits into
bastienwirtz:main
Choose a base branch
from
thibaut1304:feat-version-status-sftpgo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+161
−0
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
343d190
add service sftpgo
thibaut1304 47bd7ec
update customerservices
thibaut1304 fe0e164
add number of active connections and i renamed sftpgo_api_key to sftp…
thibaut1304 6500ecb
i renamed sftpgo_api_key to sftpgoApiKey
thibaut1304 df9f4cb
fix: use snake_case (sftpgo_api_key) instead of camelCase (sftpgoApiK…
thibaut1304 440160f
fix english/french (api version) unknown
thibaut1304 2d7b8e3
fix dual call fetch with one RTT (Promise.all)
thibaut1304 000b076
fix version mobile hidden connection on mobile
thibaut1304 278ce56
add dummy data service sftpgo
thibaut1304 7db55c6
fix catch ('e' is defined but never used)
thibaut1304 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| [ | ||
| { | ||
| "username": "test", | ||
| "connection_id": "SFTP_94f5b2b9f379173fa9cd0b8a836a7f40d860e4299e167793722d1e957a94e4d2_1", | ||
| "client_version": "SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.13", | ||
| "remote_address": "192.168.1.15:37616", | ||
| "connection_time": 1751462552179, | ||
| "last_activity": 1751462552179, | ||
| "current_time": 1751462680531, | ||
| "protocol": "SFTP" | ||
| }, | ||
| { | ||
| "username": "test", | ||
| "connection_id": "SFTP_f50a640bded5f2dda3f9861b0f73c1d9220fe65da1de1bbb5c549618221a6455_1", | ||
| "client_version": "SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.13", | ||
| "remote_address": "192.168.1.15:37680", | ||
| "connection_time": 1751462590652, | ||
| "last_activity": 1751462590652, | ||
| "current_time": 1751462680531, | ||
| "protocol": "SFTP" | ||
| } | ||
| ] |
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,17 @@ | ||
| { | ||
| "version": "2.6.6", | ||
| "build_date": "2025-02-24T18:47:26Z", | ||
| "commit_hash": "6825db76", | ||
| "features": [ | ||
| "+metrics", | ||
| "+azblob", | ||
| "+gcs", | ||
| "+s3", | ||
| "+bolt", | ||
| "+mysql", | ||
| "+pgsql", | ||
| "+sqlite", | ||
| "+unixcrypt", | ||
| "+portable" | ||
| ] | ||
| } |
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,107 @@ | ||
| <template> | ||
| <Generic :item="item"> | ||
| <template #content> | ||
| <p class="title is-4">{{ item.name }}</p> | ||
| <p class="subtitle is-6"> | ||
| <template v-if="item.subtitle"> | ||
| {{ item.subtitle }} | ||
| </template> | ||
| <template v-else> | ||
| <span v-if="versionstring">Version {{ versionstring }}</span> | ||
| <span v-if="activeConnections !== null && !this.showUpdateAvailable"> | ||
| – Active connections: {{ activeConnections }} | ||
| </span> | ||
| </template> | ||
| </p> | ||
| </template> | ||
| <template #indicator> | ||
| <div v-if="status" class="status" :class="status"> | ||
| {{ status }} | ||
| </div> | ||
| </template> | ||
| </Generic> | ||
| </template> | ||
|
|
||
| <script> | ||
| import service from "@/mixins/service.js"; | ||
|
|
||
| export default { | ||
| name: "SFTPGo", | ||
| mixins: [service], | ||
| props: { | ||
| item: Object, | ||
| }, | ||
| data: () => ({ | ||
| fetchOk: null, | ||
| versionstring: null, | ||
| activeConnections: null, | ||
| }), | ||
| computed: { | ||
| status: function () { | ||
| return this.fetchOk ? "online" : "offline"; | ||
| }, | ||
| showUpdateAvailable: function () { | ||
| return this.isSmallScreenMethod(); | ||
| }, | ||
| }, | ||
| created() { | ||
| this.fetchStatus(); | ||
| }, | ||
| methods: { | ||
| isSmallScreenMethod: function () { | ||
| return window.matchMedia("screen and (max-width: 1023px)").matches; | ||
| }, | ||
| fetchStatus: async function () { | ||
| let headers = {}; | ||
| if (this.item.sftpgo_api_key) { | ||
| headers["X-SFTPGO-API-KEY"] = `${this.item.sftpgo_api_key}`; | ||
| } | ||
| try { | ||
| const [versionRes, connRes] = await Promise.all([ | ||
| this.fetch("/api/v2/version", { headers }), | ||
| this.fetch("/api/v2/connections", { headers }), | ||
| ]); | ||
|
|
||
| this.versionstring = versionRes.version || "unknown"; | ||
| this.activeConnections = connRes.length; | ||
|
|
||
| this.fetchOk = true; | ||
| } catch (e) { | ||
| console.error(e); | ||
| this.fetchOk = false; | ||
| } | ||
| }, | ||
| }, | ||
| }; | ||
| </script> | ||
|
|
||
| <style scoped lang="scss"> | ||
| .status { | ||
| font-size: 0.8rem; | ||
| color: var(--text-title); | ||
| white-space: nowrap; | ||
| margin-left: 0.25rem; | ||
|
|
||
| &.online:before { | ||
| background-color: #94e185; | ||
| border-color: #78d965; | ||
| box-shadow: 0 0 5px 1px #94e185; | ||
| } | ||
|
|
||
| &.offline:before { | ||
| background-color: #c9404d; | ||
| border-color: #c42c3b; | ||
| box-shadow: 0 0 5px 1px #c9404d; | ||
| } | ||
|
|
||
| &:before { | ||
| content: " "; | ||
| display: inline-block; | ||
| width: 7px; | ||
| height: 7px; | ||
| margin-right: 10px; | ||
| border: 1px solid #000; | ||
| border-radius: 7px; | ||
| } | ||
| } | ||
| </style> | ||
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.
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
showUpdateAvailableis 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 }} connectionsor{{ activeConnections }} clients) to make it fit on most screen and avoid the need to have a matchMedia check.