Skip to content

feat: docker widget #2288

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
wants to merge 44 commits into
base: dev
Choose a base branch
from
Open

feat: docker widget #2288

wants to merge 44 commits into from

Conversation

hillaliy
Copy link
Contributor

@hillaliy hillaliy commented Feb 9, 2025


Homarr

Thank you for your contribution. Please ensure that your pull request meets the following pull request:

  • Builds without warnings or errors (pnpm buid, autofix with pnpm format:fix)
  • Pull request targets dev branch
  • Commits follow the conventional commits guideline
  • No shorthand variable names are used (eg. x, y, i or any abbrevation)

Screenshots

image
image

@hillaliy hillaliy self-assigned this Feb 9, 2025
@hillaliy hillaliy added the enhancement New feature or request label Feb 9, 2025
@hillaliy hillaliy linked an issue Feb 9, 2025 that may be closed by this pull request
Copy link

deepsource-io bot commented Feb 9, 2025

Here's the code health analysis summary for commits d401086..1db257d. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

Copy link

github-actions bot commented Feb 9, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 21.99% 10811 / 49161
🔵 Statements 21.99% 10811 / 49161
🔵 Functions 30.55% 483 / 1581
🔵 Branches 63.83% 1345 / 2107
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/nextjs/src/app/[locale]/manage/tools/docker/docker-table.tsx 0% 0% 0% 0% 1-256
packages/api/src/router/docker/docker-router.ts 88.59% 70.83% 100% 88.59% 32-37, 55, 70, 85, 100, 117-118, 135-136
packages/cron-job-runner/src/index.ts 83.87% 100% 0% 83.87% 36-40
packages/cron-jobs/src/index.ts 0% 0% 0% 0% 1-41
packages/cron-jobs/src/jobs/docker.ts 0% 0% 0% 0% 1-28
packages/definitions/src/widget.ts 100% 100% 100% 100%
packages/docker/src/shared.ts 0% 100% 100% 0% 5-13
packages/request-handler/src/docker.ts 15.51% 100% 0% 15.51% 15-18, 26-80
packages/widgets/src/index.tsx 53.33% 100% 0% 53.33% 78-94, 109-122
packages/widgets/src/docker/component.tsx 0% 0% 0% 0% 1-256
packages/widgets/src/docker/index.ts 100% 100% 50% 100%
packages/widgets/src/errors/base-component.tsx 0% 0% 0% 0% 1-36
packages/widgets/src/errors/component.tsx 0% 0% 0% 0% 1-81
Generated in workflow #6379 for commit 1db257d by the Vitest Coverage Report Action

@hillaliy hillaliy marked this pull request as ready for review February 10, 2025 19:05
@hillaliy hillaliy requested a review from a team as a code owner February 10, 2025 19:05
@hillaliy
Copy link
Contributor Author

I will remove unused variables

@hillaliy
Copy link
Contributor Author

Screenshot 2025-02-10 at 21 03 07 Screenshot 2025-02-10 at 21 03 15

@manuel-rw
Copy link
Member

Hi @hillaliy , thanks for the contribution. Please see the lint and DeepSource first. After that, we'll happily review your PR. Thanks!

@hillaliy
Copy link
Contributor Author

Lint and deepSource errors is because unused variables. I'm still thinking if need to add options so if you can review my PR and if you have an idea for widget options. Thanks

hillaliy and others added 6 commits February 12, 2025 19:07
Co-authored-by: Crowdin Homarr <190541745+homarr-crowdin[bot]@users.noreply.github.com>
Co-authored-by: homarr-renovate[bot] <158783068+homarr-renovate[bot]@users.noreply.github.com>
@hillaliy
Copy link
Contributor Author

@Meierschlumpf I need your help with this widget. Refresh rate is not good enough.

@Meierschlumpf
Copy link
Member

  1. What do you mean with refresh rate?
  2. How can I help you?

@hillaliy
Copy link
Contributor Author

I mean with data refresh. Can you pull it and try it?

@Meierschlumpf
Copy link
Member

Okay yeah currently it is cached for 5 minutes:

const dockerCache = createCacheChannel<{
  containers: (ContainerInfo & { instance: string; iconUrl: string | null; cpuUsage: number; memoryUsage: number })[];
}>("docker-containers", 5 * 60 * 1000);

I would suggest that we replace this with the request-handlers we use for other integrations as well. Then we can also add a subscription functionallity

@ajnart
Copy link
Contributor

ajnart commented Feb 19, 2025

@hillaliy i think for this use case we'd want the data to be refreshed after the page loads as well as after every action (start/stop/restart)
Refreshing it in the background is not needed since the data is not shown on dashboards

@Meierschlumpf
Copy link
Member

It's the widget and not a modal or something, so we want to refresh the data every few seconds

@Meierschlumpf
Copy link
Member

Sadly we had to revert my restriction logic because of an infinite dependency import loop which also caused the dev server to crash / not run properly. I'll need to find another way to implement this. Sorry for it taking so long

@hillaliy
Copy link
Contributor Author

hillaliy commented Apr 7, 2025

Sadly we had to revert my restriction logic because of an infinite dependency import loop which also caused the dev server to crash / not run properly. I'll need to find another way to implement this. Sorry for it taking so long

It's OK if I can help with something just tell.

@manuel-rw
Copy link
Member

What's the status on this PR? Can we continue?

@Meierschlumpf
Copy link
Member

Okay @manuel-rw had a good idea that we just use the trpc response and if it is a tRPC-Error with Forbidden we could always just show the restricted widget text (so using suspense that will throw the error where we also have the NoIntegrationSelectedError)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

feat: widget for docker containers stats
4 participants