Skip to content

Handle project delete in details view #11197

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: 4.20
Choose a base branch
from

Conversation

abh1sar
Copy link
Collaborator

@abh1sar abh1sar commented Jul 15, 2025

Description

This PR fixes #10910

  1. The watch was causing the AccountsTab.vue and ProjectRoles.vue modules to call the list APIs with the deleted project id. The watch is not really required for updating accounts or project roles, so have removed it.
  2. Added null reousrce.id checks before calling list Apis.

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

  1. Tested Project delete after adding accounts and project roles.
  2. Tested Project delete after navigating from accounts tab to details tab.
  3. Tested account related operations : add accounts, assign admin.
  4. Tested project roles related operations : add project roles, assign permissions

How did you try to break this feature and the system with this change?

Copy link

codecov bot commented Jul 15, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 16.15%. Comparing base (80f46ad) to head (ba1cd23).
Report is 18 commits behind head on 4.20.

Files with missing lines Patch % Lines
...command/admin/acl/project/ListProjectRolesCmd.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #11197   +/-   ##
=========================================
  Coverage     16.15%   16.15%           
- Complexity    13269    13272    +3     
=========================================
  Files          5657     5656    -1     
  Lines        497772   497724   -48     
  Branches      60364    60361    -3     
=========================================
+ Hits          80414    80420    +6     
+ Misses       408408   408353   -55     
- Partials       8950     8951    +1     
Flag Coverage Δ
uitests 4.00% <ø> (+<0.01%) ⬆️
unittests 17.00% <0.00%> (+<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.

@abh1sar
Copy link
Collaborator Author

abh1sar commented Jul 16, 2025

@blueorangutan package

@blueorangutan
Copy link

@abh1sar a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 14204

@sureshanaparti sureshanaparti changed the title Handle project delete in detailsview Handle project delete in details view Jul 23, 2025
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 fixes issue #10910 by preventing API calls with deleted project IDs when viewing project details. The main problem was that watchers in the AccountsTab and ProjectRoleTab components were triggering API calls even after a project was deleted, causing errors.

Key changes:

  • Removed unnecessary watchers that were triggering API calls on resource changes
  • Added null checks before making API calls to prevent calls with invalid project IDs
  • Initialized projectRoles list to prevent potential null pointer issues

Reviewed Changes

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

File Description
ui/src/views/project/iam/ProjectRoleTab.vue Removed resource watcher and added null check before fetching project roles
ui/src/views/project/AccountsTab.vue Removed resource watcher and added null check before fetching project accounts
api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/ListProjectRolesCmd.java Initialized projectRoles list to empty ArrayList to prevent potential null pointer issues

@@ -192,6 +181,7 @@ export default {
},
fetchData () {
this.loading = true
if (!this.resource.id) return
Copy link
Preview

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

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

Consider setting loading to false before returning to maintain consistent loading state when resource.id is null.

Suggested change
if (!this.resource.id) return
if (!this.resource.id) {
this.loading = false
return
}

Copilot uses AI. Check for mistakes.

methods: {
fetchData () {
const params = {}
params.projectId = this.resource.id
params.page = this.page
params.pageSize = this.pageSize
this.updateProjectApi = this.$store.getters.apis.updateProject
if (!this.resource.id) return
Copy link
Preview

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

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

Consider setting loading to false before returning to maintain consistent loading state when resource.id is null, similar to how it should be handled in ProjectRoleTab.

Suggested change
if (!this.resource.id) return
if (!this.resource.id) {
this.loading.table = false
return
}

Copilot uses AI. Check for mistakes.

@sureshanaparti
Copy link
Contributor

@blueorangutan ui

@blueorangutan
Copy link

@sureshanaparti 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/11197 (QA-JID-682)

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.

3 participants