Skip to content

Conversation

@SimonFair
Copy link
Contributor

@SimonFair SimonFair commented Jan 14, 2026

Summary by CodeRabbit

  • New Features

    • Added nominal and current power metrics for UPS devices (nominal can be sourced from an optional field; current is derived from nominal and load), improving capacity and consumption visibility.
  • Tests

    • Updated UPS mock data to include nominal power for validation.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 14, 2026

Walkthrough

Added two new UPS power fields (nominalPower and currentPower) to the GraphQL model, extended parsed UPS data with NOMPOWER, and updated the resolver to parse nominal power and compute current power from nominalPower and loadPercentage.

Changes

Cohort / File(s) Summary
UPS Power Model
api/src/unraid-api/graph/resolvers/ups/ups.model.ts
Added nominalPower?: number (Int, nullable) and currentPower?: number (Float, nullable) fields to the UPSPower GraphQL model with comments.
UPS Power Calculation Logic
api/src/unraid-api/graph/resolvers/ups/ups.resolver.ts
In createUPSDevice, introduced loadPercentage (default 25), parsed nominalPower from NOMPOWER, and computed currentPower = nominalPower * loadPercentage / 100; included these values in the returned power object.
UPS Data Schema
api/src/unraid-api/graph/resolvers/ups/ups.service.ts
Added optional NOMPOWER?: string to UPSSchema / UPSData to surface nominal power from parsed UPS input.
Tests / Mocks
api/src/unraid-api/graph/resolvers/ups/ups.resolver.spec.ts
Added NOMPOWER: '600' to mock UPS data used in resolver tests.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I nudged a watt and hummed a tune,
Added numbers under the moon,
Nominal, current—now they play,
Load and math keep night at bay,
Hop, zap, and power on! ⚡️

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title 'feat: add UPS power' directly and concisely describes the main change: adding power-related fields and calculations to the UPS model, resolver, and service.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

❌ Patch coverage is 55.00000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.43%. Comparing base (38a6f0c) to head (27ab4f5).

Files with missing lines Patch % Lines
...pi/src/unraid-api/graph/resolvers/ups/ups.model.ts 20.00% 8 Missing ⚠️
...src/unraid-api/graph/resolvers/ups/ups.resolver.ts 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1874      +/-   ##
==========================================
+ Coverage   46.40%   46.43%   +0.02%     
==========================================
  Files         954      954              
  Lines       59791    59810      +19     
  Branches     5538     5547       +9     
==========================================
+ Hits        27749    27772      +23     
+ Misses      31923    31919       -4     
  Partials      119      119              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

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/PR1874/dynamix.unraid.net.plg

@elibosley elibosley changed the title Feature: Add UPS power feat: add UPS power Jan 15, 2026
@elibosley elibosley merged commit b531aed into main Jan 15, 2026
13 checks passed
@elibosley elibosley deleted the UPS-add-power branch January 15, 2026 15:13
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.

3 participants