Skip to content

Implemented auto refresh button for VM metrics #10900

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 1 commit into
base: main
Choose a base branch
from

Conversation

erikbocks
Copy link
Contributor

Description

This PR adds an option to the VM Metrics tab, that allow users to enable auto refresh for VM resource usage data after the selected amount of time. The interval options are: None (Disabled), 5s, 30s, 1min and 5min.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

image
image

How Has This Been Tested?

  1. Built the deb packages and applied to my local env.
  2. Then, deployed a new VM and ensured that the new option was available at the Metrics tab
  3. Tested all the available intervals and validated that the updated data was fetched (or not, if None was selected) after the selected amount of time.

@bernardodemarco
Copy link
Member

@blueorangutan ui

@blueorangutan
Copy link

@bernardodemarco a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan
Copy link

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/10900 (QA-JID-632)

Copy link

codecov bot commented Jun 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 16.53%. Comparing base (d5ba23c) to head (da6da8b).
Report is 49 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #10900      +/-   ##
============================================
+ Coverage     16.49%   16.53%   +0.03%     
- Complexity    13705    13801      +96     
============================================
  Files          5708     5717       +9     
  Lines        504083   506308    +2225     
  Branches      61101    61441     +340     
============================================
+ Hits          83139    83705     +566     
- Misses       411665   413228    +1563     
- Partials       9279     9375      +96     
Flag Coverage Δ
uitests 3.97% <ø> (-0.03%) ⬇️
unittests 17.40% <ø> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@sureshanaparti sureshanaparti changed the title Implemented auto refresh button for vm metrics Implemented auto refresh button for VM metrics Jun 5, 2025
@sureshanaparti sureshanaparti added this to the 4.21.0 milestone Jun 5, 2025
@sureshanaparti sureshanaparti requested review from shwstppr, bernardodemarco, Copilot and vishesh92 and removed request for bernardodemarco June 5, 2025 08:53
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds an auto-refresh control to the VM Metrics tab, letting users pick refresh intervals (None, 5s, 30s, 1min, 5min) and automatically re-fetch stats. It also externalizes hard-coded duration labels into i18n keys.

  • Switched the “1 hour” label to use label.duration.1hour (and added corresponding locale entries).
  • Added a select dropdown bound to refreshTime with options for different intervals.
  • Introduced refreshTime and refreshIntervalId data fields, a calculated reaction to interval changes, and an unmounted hook to clear timers.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
ui/src/components/view/StatsTab.vue Added auto-refresh select, data/computed fields, and lifecycle cleanup for intervals
ui/public/locales/pt_BR.json Added Portuguese translations for auto-refresh labels
ui/public/locales/en.json Added English translations for auto-refresh labels
Comments suppressed due to low confidence (2)

ui/src/components/view/StatsTab.vue:310

  • [nitpick] The data property 'refreshTime' is ambiguous (it represents milliseconds). Consider renaming to 'refreshIntervalMs' for better clarity.
refreshTime: '0',

ui/src/components/view/StatsTab.vue:67

  • There are no tests covering the auto-refresh dropdown behavior. Consider adding unit or integration tests to verify interval selection, fetch triggering, and interval cleanup.
v-model:value="refreshTime"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

4 participants