@@ -22,6 +22,7 @@ import { CippFormTenantSelector } from "../CippComponents/CippFormTenantSelector
22
22
import { Sync , SyncAlt } from "@mui/icons-material" ;
23
23
import { CippFormComponent } from "../CippComponents/CippFormComponent" ;
24
24
import { CippApiResults } from "../CippComponents/CippApiResults" ;
25
+ import { ApiGetCallWithPagination } from "../../api/ApiCall" ;
25
26
26
27
const CippIntegrationSettings = ( { children } ) => {
27
28
const router = useRouter ( ) ;
@@ -35,7 +36,7 @@ const CippIntegrationSettings = ({ children }) => {
35
36
queryKey : `IntegrationTenantMapping-${ router . query . id } ` ,
36
37
} ) ;
37
38
38
- const tenantList = ApiGetCall ( {
39
+ const tenantList = ApiGetCallWithPagination ( {
39
40
url : "/api/ListTenants" ,
40
41
data : { AllTenantSelector : false } ,
41
42
queryKey : "ListTenants-notAllTenants" ,
@@ -94,37 +95,37 @@ const CippIntegrationSettings = ({ children }) => {
94
95
} ;
95
96
96
97
const handleAutoMap = ( ) => {
97
- const newTableData = [ ] ;
98
- tenantList . data . forEach ( ( tenant ) => {
99
- const matchingCompany = mappings . data . Companies . find (
100
- ( company ) => company . name === tenant . displayName
101
- ) ;
102
- if (
103
- Array . isArray ( tableData ) &&
104
- tableData ?. find ( ( item ) => item . TenantId === tenant . customerId )
105
- )
106
- return ;
107
- if ( matchingCompany ) {
108
- newTableData . push ( {
109
- TenantId : tenant . customerId ,
110
- Tenant : tenant . displayName ,
111
- IntegrationName : matchingCompany . name ,
112
- IntegrationId : matchingCompany . value ,
98
+ const newTableData = [ ] ;
99
+ tenantList . data ?. pages [ 0 ] ?. forEach ( ( tenant ) => {
100
+ const matchingCompany = mappings . data . Companies . find (
101
+ ( company ) => company . name === tenant . displayName
102
+ ) ;
103
+ if (
104
+ Array . isArray ( tableData ) &&
105
+ tableData ?. find ( ( item ) => item . TenantId === tenant . customerId )
106
+ )
107
+ return ;
108
+ if ( matchingCompany ) {
109
+ newTableData . push ( {
110
+ TenantId : tenant . customerId ,
111
+ Tenant : tenant . displayName ,
112
+ IntegrationName : matchingCompany . name ,
113
+ IntegrationId : matchingCompany . value ,
114
+ } ) ;
115
+ }
116
+ } ) ;
117
+ if ( Array . isArray ( tableData ) ) {
118
+ setTableData ( [ ...tableData , ...newTableData ] ) ;
119
+ } else {
120
+ setTableData ( newTableData ) ;
121
+ }
122
+ if ( extension . autoMapSyncApi ) {
123
+ automapPostCall . mutate ( {
124
+ url : `/api/ExecExtensionMapping?AutoMapping=${ router . query . id } ` ,
125
+ queryKey : `IntegrationTenantMapping-${ router . query . id } ` ,
113
126
} ) ;
114
127
}
115
- } ) ;
116
- if ( Array . isArray ( tableData ) ) {
117
- setTableData ( [ ...tableData , ...newTableData ] ) ;
118
- } else {
119
- setTableData ( newTableData ) ;
120
- }
121
- if ( extension . autoMapSyncApi ) {
122
- automapPostCall . mutate ( {
123
- url : `/api/ExecExtensionMapping?AutoMapping=${ router . query . id } ` ,
124
- queryKey : `IntegrationTenantMapping-${ router . query . id } ` ,
125
- } ) ;
126
- }
127
- } ;
128
+ } ;
128
129
129
130
const actions = [
130
131
{
0 commit comments