Skip to content

Conversation

@elibosley
Copy link
Member

@elibosley elibosley commented Apr 4, 2025

Summary by CodeRabbit

  • New Features
    • Enhanced container data now includes an additional field displaying container names for improved detail and clarity in container information.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 4, 2025

Walkthrough

The change updates the DockerService in the Unraid API by introducing a new property, names, to the object returned by the transformContainer method. This property is populated from container.Names, providing an array of names associated with each Docker container. Additionally, the mock data in the test suite has been enhanced to reflect this new structure.

Changes

File Path Change Summary
api/src/.../docker/docker.service.ts Added names property to the object returned by transformContainer method in DockerService class
api/src/.../docker/docker.service.spec.ts Updated mock container data in tests to include sizeRootFs (undefined) and names (array of container names)

Possibly related PRs

  • feat: basic docker controls #1292: The changes in the main PR, which involve adding a names property to the transformContainer method in the DockerService class, are related to the modifications in the retrieved PR that enhance the test suite for the DockerService, as both involve the DockerService and its functionality.

Suggested reviewers

  • pujitm
  • mdatelle

Poem

A small tweak in our code’s embrace,
Docker containers now reveal more face,
Their names no longer lost in flight,
A touch of clarity, shining bright,
CodeRabbit’s magic makes data feel just right!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 7176b6d and 018496c.

📒 Files selected for processing (2)
  • api/src/unraid-api/graph/resolvers/docker/docker.service.spec.ts (10 hunks)
  • api/src/unraid-api/graph/resolvers/docker/docker.service.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • api/src/unraid-api/graph/resolvers/docker/docker.service.ts
  • api/src/unraid-api/graph/resolvers/docker/docker.service.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Build Web App
  • GitHub Check: Build API
  • GitHub Check: Test API
  • GitHub Check: Cloudflare Pages

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc3ca92 and 3baec74.

📒 Files selected for processing (1)
  • api/src/unraid-api/graph/resolvers/docker/docker.service.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Build Web App
  • GitHub Check: Build API
  • GitHub Check: Test API
  • GitHub Check: Cloudflare Pages

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
api/src/unraid-api/graph/resolvers/docker/docker.service.spec.ts (1)

493-526: Missing new properties in appUpdateEvent test

The mock containers in the appUpdateEvent test are missing the sizeRootFs and names properties that were added to all other container objects. While this might not affect the test outcome since the test only checks for installed and running counts, it creates inconsistency with the other tests.

Consider updating these mock containers to include the new properties:

                    id: 'abc123def456',
                    autoStart: false,
                    command: 'test',
                    created: 1234567890,
                    image: 'test-image',
                    imageId: 'test-image-id',
                    ports: [],
+                   sizeRootFs: undefined,
+                   names: ['/test-container'],
                    state: ContainerState.RUNNING,
                    status: 'Up 2 hours',
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 3baec74 and 5cd8081.

📒 Files selected for processing (1)
  • api/src/unraid-api/graph/resolvers/docker/docker.service.spec.ts (10 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Build Web App
  • GitHub Check: Build API
  • GitHub Check: Test API
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (5)
api/src/unraid-api/graph/resolvers/docker/docker.service.spec.ts (5)

145-155: LGTM: Added properties match the updated DockerContainer structure

The test expectations have been updated to include the new sizeRootFs and names properties, which aligns with the changes made to the DockerService implementation.


198-208: LGTM: Updated test expectations for startContainer

The expected result now correctly includes the container names property, fixing the issue mentioned in the PR.


251-261: LGTM: Updated test expectations for stopContainer

The expected result has been updated to include the new container properties, maintaining consistency across tests.


403-423: LGTM: Updated mock containers in getter tests

Both mock containers in the "installed count" test properly include the new properties.


452-472: LGTM: Updated mock containers in running count test

The mock container objects used for the running count test now include the necessary properties to match the implementation.

Copy link
Member

@pujitm pujitm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one liner, pog

@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 2025

This plugin has been deployed to Cloudflare R2 and is available for testing.
Download it at this URL:

https://preview.dl.unraid.net/unraid-api/tag/1335/dynamix.unraid.net.plg

@elibosley elibosley merged commit 8a5b238 into main Apr 8, 2025
9 checks passed
@elibosley elibosley deleted the fix/names-null branch April 8, 2025 12:56
elibosley pushed a commit that referenced this pull request Apr 24, 2025
🤖 I have created a release *beep* *boop*
---


## [4.7.0](v4.6.6...v4.7.0)
(2025-04-24)


### Features

* add basic docker network listing
([#1317](#1317))
([c4fdff8](c4fdff8))
* add permission documentation by using a custom decorator
([#1355](#1355))
([45ecab6](45ecab6))
* basic vm controls ([#1293](#1293))
([bc3ca92](bc3ca92))
* code first graphql
([#1347](#1347))
([f5724ab](f5724ab))


### Bug Fixes

* container names always null
([#1335](#1335))
([8a5b238](8a5b238))
* **deps:** update all non-major dependencies
([#1337](#1337))
([2345732](2345732))
* hide reboot notice for patch releases
([#1341](#1341))
([4b57439](4b57439))
* move docker mutations to the mutations resolver
([#1333](#1333))
([1bbe7d2](1bbe7d2))
* PR build issue
([457d338](457d338))
* remove some unused fields from the report object
([#1342](#1342))
([cd323ac](cd323ac))
* sso unreliable if API outputs more than raw json
([#1353](#1353))
([e65775f](e65775f))
* vms now can detect starting of libvirt and start local hypervisor
([#1356](#1356))
([ad0f4c8](ad0f4c8))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query: docker names always null API - Expose the user-set docker container name

2 participants