Skip to content
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

UI: Fix projects metrics on dashboard #10651

Merged

Conversation

bernardodemarco
Copy link
Collaborator

Description

Currently, the dashboard for projects faces some inconsistencies for the amount of resources consumed by the project. They can be noticed when accessing the project's view, with an account that is not in the same domain as the project is.

Therefore, in scenarios in which a RootAdmin accesses the dashboard of a project that belongs to any subdomain of the ROOT domain (e.g. ROOT/d1), the dashboard will display the project's storage metrics as NaN and undefined and the compute metrics will be omitted:

image

The root cause of the bug is that, when the project's attributes are fetched from the listProjects API, the parameter listall is not specified:

listProject () {
this.loading = true
api('listProjects', { id: store.getters.project.id }).then(json => {
this.loading = false
if (json && json.listprojectsresponse && json.listprojectsresponse.project) {
this.project = json.listprojectsresponse.project[0]
}
})
},

As a consequence of that, the UI is not able to render the projects metrics. This PR fixes this bug.

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

  • Before:

image

  • After:

image

How Has This Been Tested?

  • Created a domain (d1), and an account (d1) and a project (project-d1) within it
  • Accessed the project-d1 view with a RootAdmin account
  • Before applying the PR's changes, verified that the project's metrics were not correctly fetched and rendered
  • After applying the PR's changes, verified that the metrics were correctly fetched and rendered

@bernardodemarco
Copy link
Collaborator Author

@blueorangutan ui

@bernardodemarco bernardodemarco added this to the 4.19.3 milestone Apr 2, 2025
@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/10651 (QA-JID-592)

Copy link

codecov bot commented Apr 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 15.89%. Comparing base (ee94ae5) to head (171ab70).
Report is 1 commits behind head on 4.19.

Additional details and impacted files
@@             Coverage Diff              @@
##               4.19   #10651      +/-   ##
============================================
+ Coverage     15.16%   15.89%   +0.72%     
- Complexity    11328    11329       +1     
============================================
  Files          5415     5046     -369     
  Lines        474824   445155   -29669     
  Branches      57912    52704    -5208     
============================================
- Hits          72014    70758    -1256     
+ Misses       394757   366490   -28267     
+ Partials       8053     7907     -146     
Flag Coverage Δ
uitests ?
unittests 15.89% <ø> (+<0.01%) ⬆️

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.

Copy link
Member

@rohityadavcloud rohityadavcloud left a comment

Choose a reason for hiding this comment

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

Didn't test but LGTM

@DaanHoogland
Copy link
Contributor

@bernardodemarco , I see no difference in qa.

Is there some reason why no difference would be shown there?

It is 4.20 , so does that mean the bug is non-existent above 4.19?

@bernardodemarco
Copy link
Collaborator Author

@DaanHoogland, to reproduce the bug, the project must not be in the same domain as the account accessing the dashboard is. I've recorded a video showcasing it:

2025-04-05.16-00-17.mp4

Copy link
Collaborator

@lucas-a-martins lucas-a-martins left a comment

Choose a reason for hiding this comment

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

LGTM

Tested in a 4.20 local environment.

Before proposed changes:

Screenshot from 2025-04-07 15-05-02

After proposed changes:

Screenshot from 2025-04-07 15-06-46

@DaanHoogland DaanHoogland merged commit d5ba393 into apache:4.19 Apr 8, 2025
25 checks passed
DaanHoogland pushed a commit that referenced this pull request Apr 9, 2025
* 4.20:
  xenserver: do not destroy halted hypervisor vm (#9175)
  define the limit of projects through the UI (#10652)
  fix projects metrics on dashboard (#10651)
  systemvm: Bump systemvm template version to debian 12.10 (#10628)
  Enhance VPC Network Tier form to auto-populate  Gateway, and Netmask (#10617)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants