Skip to content

API: Fix pagination issue with listing LDAP configuration - #11444

Draft
Pearl1594 wants to merge 7 commits into
4.20from
fix-ldapconf-list-pagination
Draft

API: Fix pagination issue with listing LDAP configuration#11444
Pearl1594 wants to merge 7 commits into
4.20from
fix-ldapconf-list-pagination

Conversation

@Pearl1594

Copy link
Copy Markdown
Contributor

Description

This PR fixes issue with pagination when listing ldap configuration. When there are more than 20 entries and we want to list the 2nd page of ldap configs when using page size 20 , it returns the 1st 20 entries always.

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?

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

@codecov

codecov Bot commented Aug 13, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.36%. Comparing base (9c8bdf3) to head (9f3f7f3).

Files with missing lines Patch % Lines
.../cloudstack/ldap/dao/LdapConfigurationDaoImpl.java 0.00% 9 Missing ⚠️
.../org/apache/cloudstack/ldap/LdapConfiguration.java 0.00% 1 Missing ⚠️
...va/org/apache/cloudstack/ldap/LdapManagerImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #11444   +/-   ##
=========================================
  Coverage     16.35%   16.36%           
- Complexity    13587    13593    +6     
=========================================
  Files          5669     5669           
  Lines        501474   501474           
  Branches      60913    60913           
=========================================
+ Hits          82030    82066   +36     
+ Misses       410251   410217   -34     
+ Partials       9193     9191    -2     
Flag Coverage Δ
uitests 4.14% <ø> (ø)
unittests 17.22% <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 Harness.
📢 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.

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clgtm

@DaanHoogland

Copy link
Copy Markdown
Contributor

@pearl, It does not seem to work, I think we must consider the option ro add a uuid to the API/records

@Pearl1594

Copy link
Copy Markdown
Contributor Author

Seemed to be a UI issue. It works via cmk. Thanks for testing @DaanHoogland

@sonarqubecloud

Copy link
Copy Markdown

Comment thread ui/src/components/view/ListView.vue Outdated
:columns="isOrderUpdatable() ? columns : columns.filter(x => x.dataIndex !== 'order')"
:dataSource="items"
:rowKey="(record, idx) => record.id || record.name || record.usageType || idx + '-' + Math.random()"
:rowKey="(record, idx) => hasNoUniqueKey() ? (idx + '-' + Math.random()) : (record.id || record.name || record.usageType || idx + '-' + Math.random())"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

how about making the key/id be the concatenation of hostnam+”-“+port+”-“+domainid?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good point @DaanHoogland

also, can we create a method for this ? @Pearl1594

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does ldap configuration returns any of id, name or usagetype? Won't it automatically fallback to idx + '-' + Math.random()
On qa server, I was getting,

(qaserver) 🐱 > list ldapconfigurations 
{
  "LdapConfiguration": [
    {
      "hostname": "ldap.forumsys.com",
      "port": 389
    }
  ],
  "count": 1
}

@DaanHoogland

Copy link
Copy Markdown
Contributor

@Pearl1594 , the pagination works but no it reveals new issues, sorting does not work beyond the page we are looking at. I do not consider this a big issues as most installations will not have enormous amounts of ldap configurations, but still it seems like a(nother) justifications for giving ldapconfigurations a proper uuid. That said, lgtm.

@weizhouapache weizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

java code lgtm

Comment thread ui/src/components/view/ListView.vue Outdated
:columns="isOrderUpdatable() ? columns : columns.filter(x => x.dataIndex !== 'order')"
:dataSource="items"
:rowKey="(record, idx) => record.id || record.name || record.usageType || idx + '-' + Math.random()"
:rowKey="(record, idx) => hasNoUniqueKey() ? (idx + '-' + Math.random()) : (record.id || record.name || record.usageType || idx + '-' + Math.random())"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good point @DaanHoogland

also, can we create a method for this ? @Pearl1594

@DaanHoogland
DaanHoogland force-pushed the fix-ldapconf-list-pagination branch from 41b92dd to 6f432d1 Compare December 12, 2025 09:37
@sonarqubecloud

Copy link
Copy Markdown

@shwstppr shwstppr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

code lgtm

@Pearl1594 can you please check the outstanding comment?

Comment thread ui/src/components/view/ListView.vue Outdated
:columns="isOrderUpdatable() ? columns : columns.filter(x => x.dataIndex !== 'order')"
:dataSource="items"
:rowKey="(record, idx) => record.id || record.name || record.usageType || idx + '-' + Math.random()"
:rowKey="(record, idx) => hasNoUniqueKey() ? (idx + '-' + Math.random()) : (record.id || record.name || record.usageType || idx + '-' + Math.random())"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does ldap configuration returns any of id, name or usagetype? Won't it automatically fallback to idx + '-' + Math.random()
On qa server, I was getting,

(qaserver) 🐱 > list ldapconfigurations 
{
  "LdapConfiguration": [
    {
      "hostname": "ldap.forumsys.com",
      "port": 389
    }
  ],
  "count": 1
}

@weizhouapache weizhouapache added this to the 4.20.4 milestone Jun 29, 2026
@DaanHoogland
DaanHoogland force-pushed the fix-ldapconf-list-pagination branch from 6f432d1 to 57f1529 Compare August 4, 2026 07:08
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from blueorangutan Aug 4, 2026
@apache apache deleted a comment from Pearl1594 Aug 4, 2026
@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland 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
Copy Markdown

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

@DaanHoogland

Copy link
Copy Markdown
Contributor

@Pearl1594 , do you need to do more work on this (draft) PR?

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-16697)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 55792 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11444-t16697-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@DaanHoogland

Copy link
Copy Markdown
Contributor

@Pearl1594 , this can be marked ready-for-merge right?

@DaanHoogland
DaanHoogland force-pushed the fix-ldapconf-list-pagination branch from 57f1529 to 3546263 Compare August 31, 2026 09:51
@DaanHoogland DaanHoogland moved this from Backlog to Ready in CloudStack Testing Aug 31, 2026

@kiranchavala kiranchavala left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM tested manually

Insertted the records in the database

mysql> INSERT INTO cloud.ldap_configuration (hostname, port, domain_id)
    -> SELECT CONCAT('ldap-host-', LPAD(n, 2, '0')), 389, NULL FROM (
    ->   SELECT 1 n UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5
    ->   UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9 UNION SELECT 10
    ->   UNION SELECT 11 UNION SELECT 12 UNION SELECT 13 UNION SELECT 14 UNION SELECT 15
    ->   UNION SELECT 16 UNION SELECT 17 UNION SELECT 18 UNION SELECT 19 UNION SELECT 20
    ->   UNION SELECT 21 UNION SELECT 22 UNION SELECT 23 UNION SELECT 24 UNION SELECT 25
    -> ) t;
Query OK, 25 rows affected (0.00 sec)
Records: 25  Duplicates: 0  Warnings: 0
[root@ref-trl-12348-k-Mol8-kiran-chavala-mgmt1 ~]# cmk list ldapconfigurations listall=true pagesize=20 page=1 filter=hostname,port
Loaded in-built API cache. Failed to read API cache, please run 'sync'.
{
  "LdapConfiguration": [
    {
      "hostname": "10.0.33.32",
      "port": 389
    },
    {
      "hostname": "ldap-host-01",
      "port": 389
    },
    {
      "hostname": "ldap-host-02",
      "port": 389
    },
    {
      "hostname": "ldap-host-03",
      "port": 389
    },
    {
      "hostname": "ldap-host-04",
      "port": 389
    },
    {
      "hostname": "ldap-host-05",
      "port": 389
    },
    {
      "hostname": "ldap-host-06",
      "port": 389
    },
    {
      "hostname": "ldap-host-07",
      "port": 389
    },
    {
      "hostname": "ldap-host-08",
      "port": 389
    },
    {
      "hostname": "ldap-host-09",
      "port": 389
    },
    {
      "hostname": "ldap-host-10",
      "port": 389
    },
    {
      "hostname": "ldap-host-11",
      "port": 389
    },
    {
      "hostname": "ldap-host-12",
      "port": 389
    },
    {
      "hostname": "ldap-host-13",
      "port": 389
    },
    {
      "hostname": "ldap-host-14",
      "port": 389
    },
    {
      "hostname": "ldap-host-15",
      "port": 389
    },
    {
      "hostname": "ldap-host-16",
      "port": 389
    },
    {
      "hostname": "ldap-host-17",
      "port": 389
    },
    {
      "hostname": "ldap-host-18",
      "port": 389
    },
    {
      "hostname": "ldap-host-19",
      "port": 389
    }
  ],
  "count": 26
}


[root@ref-trl-12348-k-Mol8-kiran-chavala-mgmt1 ~]# cmk list ldapconfigurations listall=true pagesize=20 page=2 filter=hostname,port
Loaded in-built API cache. Failed to read API cache, please run 'sync'.
{
  "LdapConfiguration": [
    {
      "hostname": "ldap-host-20",
      "port": 389
    },
    {
      "hostname": "ldap-host-21",
      "port": 389
    },
    {
      "hostname": "ldap-host-22",
      "port": 389
    },
    {
      "hostname": "ldap-host-23",
      "port": 389
    },
    {
      "hostname": "ldap-host-24",
      "port": 389
    },
    {
      "hostname": "ldap-host-25",
      "port": 389
    }
  ],
  "count": 26
}

UI

Image Image

@kiranchavala

Copy link
Copy Markdown
Member

@Pearl1594 could please merge this pr

@Pearl1594

Copy link
Copy Markdown
Contributor Author

@Pearl1594 could please merge this pr

@kiranchavala can I please request you for a quick check - I made a change to the UI, pertaining to rowkey to address the pending comment. Apologies.

@Pearl1594

Copy link
Copy Markdown
Contributor Author

@blueorangutan ui

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

@sonarqubecloud

sonarqubecloud Bot commented Sep 9, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

7 participants