[PR #386] [MERGED] Adding a read API endpoint to get container states similar to GetDeploymentsSummary but for all containers that Komodo can see. #730

Closed
opened 2025-10-31 15:20:12 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/moghtech/komodo/pull/386
Author: @alexshore
Created: 3/28/2025
Status: Merged
Merged: 3/29/2025
Merged by: @mbecker20

Base: 1.17.1Head: main


📝 Commits (7)

  • 1b6f2f8 added GetDockerContainersSummary endpoint in rust api
  • c7b9b78 typescript stuff
  • 0bca0a5 more autogenned typescript stuff
  • f9c75cf fixed comments to be in line with actual behaviour
  • c47863f fixed ReadResponse for GetDockerContainersSummary
  • 73f7e89 I64 -> u32 for response types
  • 9db8273 more accurate error context

📊 Changes

7 files changed (+118 additions, -1 deletions)

View changed files

📝 bin/core/src/api/read/mod.rs (+1 -0)
📝 bin/core/src/api/read/server.rs (+42 -1)
📝 client/core/rs/src/api/read/server.rs (+29 -0)
📝 client/core/ts/src/responses.ts (+1 -0)
📝 client/core/ts/src/types.ts (+22 -0)
📝 frontend/public/client/responses.d.ts (+1 -0)
📝 frontend/public/client/types.d.ts (+22 -0)

📄 Description

I wanted to create a custom homepage widget for Komodo so I could just see what was running/stopped and a total count but an endpoint like GetDeploymentsSummary and GetStacksSummary didn't exist for all containers.

At first, I just made a separate python API (https://github.com/alexshore/komodo-containers-api) but thought this could be a good way to up my contributions to open source software so heres my attempt at contributing a GetDockerContainersSummary endpoint :)

I'm not too fussed as what counts as what category. For my use-case it's helpful for there really to just be 2 final "states" that the docker containers are categorised into (i.e. just Stopped and Running) but thats a bit more specific to my use-case than to Komodo so right now they're split into Stopped, Running, Unknown and Unhealthy but that can be changed.

I also wasn't sure where in the file to put the new code so I just put it all next to ListAllDockerContainers as it performs a similar function.

Hope this is all good and doesn't need too many more changes! Thanks for your help in discord too :)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/moghtech/komodo/pull/386 **Author:** [@alexshore](https://github.com/alexshore) **Created:** 3/28/2025 **Status:** ✅ Merged **Merged:** 3/29/2025 **Merged by:** [@mbecker20](https://github.com/mbecker20) **Base:** `1.17.1` ← **Head:** `main` --- ### 📝 Commits (7) - [`1b6f2f8`](https://github.com/moghtech/komodo/commit/1b6f2f89b0ab5640e0eb6334e89a10c7640b1c8a) added GetDockerContainersSummary endpoint in rust api - [`c7b9b78`](https://github.com/moghtech/komodo/commit/c7b9b78578234cd2324ddaa3a1b58c16a2d879cb) typescript stuff - [`0bca0a5`](https://github.com/moghtech/komodo/commit/0bca0a572546ad14d2faa16e5b541c1c4e4cb7f6) more autogenned typescript stuff - [`f9c75cf`](https://github.com/moghtech/komodo/commit/f9c75cfe8247cbcc70ad01823c9a315e276e2d9b) fixed comments to be in line with actual behaviour - [`c47863f`](https://github.com/moghtech/komodo/commit/c47863fe8e161c9ed71c164844a1977473a74ff2) fixed ReadResponse for GetDockerContainersSummary - [`73f7e89`](https://github.com/moghtech/komodo/commit/73f7e89c4cdd76dbd26dfe434ab721182b42afb8) I64 -> u32 for response types - [`9db8273`](https://github.com/moghtech/komodo/commit/9db8273ed985f5ccff3893288f825a1bd8909e7f) more accurate error context ### 📊 Changes **7 files changed** (+118 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `bin/core/src/api/read/mod.rs` (+1 -0) 📝 `bin/core/src/api/read/server.rs` (+42 -1) 📝 `client/core/rs/src/api/read/server.rs` (+29 -0) 📝 `client/core/ts/src/responses.ts` (+1 -0) 📝 `client/core/ts/src/types.ts` (+22 -0) 📝 `frontend/public/client/responses.d.ts` (+1 -0) 📝 `frontend/public/client/types.d.ts` (+22 -0) </details> ### 📄 Description I wanted to create a custom homepage widget for Komodo so I could just see what was running/stopped and a total count but an endpoint like `GetDeploymentsSummary` and `GetStacksSummary` didn't exist for all containers. At first, I just made a separate python API (https://github.com/alexshore/komodo-containers-api) but thought this could be a good way to up my contributions to open source software so heres my attempt at contributing a `GetDockerContainersSummary` endpoint :) I'm not too fussed as what counts as what category. For my use-case it's helpful for there really to just be 2 final "states" that the docker containers are categorised into (i.e. just Stopped and Running) but thats a bit more specific to my use-case than to Komodo so right now they're split into Stopped, Running, Unknown and Unhealthy but that can be changed. I also wasn't sure where in the file to put the new code so I just put it all next to `ListAllDockerContainers` as it performs a similar function. Hope this is all good and doesn't need too many more changes! Thanks for your help in discord too :) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-10-31 15:20:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/komodo#730