Skip to content

Commit 137003f

Browse files
authored
Merge pull request #64 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 56d9878 + d185ae1 commit 137003f

File tree

2 files changed

+32
-33
lines changed

2 files changed

+32
-33
lines changed

src/components/CippIntegrations/CippIntegrationTenantMapping.jsx

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -95,37 +95,37 @@ const CippIntegrationSettings = ({ children }) => {
9595
};
9696

9797
const handleAutoMap = () => {
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}`,
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,
126114
});
127115
}
128-
};
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}`,
126+
});
127+
}
128+
};
129129

130130
const actions = [
131131
{
@@ -140,7 +140,7 @@ const CippIntegrationSettings = ({ children }) => {
140140

141141
useEffect(() => {
142142
if (mappings.isSuccess) {
143-
setTableData(mappings.data.Mappings);
143+
setTableData(mappings.data.Mappings ?? []);
144144
}
145145
}, [mappings.isSuccess]);
146146

src/pages/cipp/integrations/configure.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,9 @@ const Page = () => {
174174
))}
175175
</>
176176
)}
177-
178-
<CippApiResults apiObject={actionTestResults} />
179-
<CippApiResults apiObject={actionSyncResults} />
180177
</Stack>
178+
<CippApiResults apiObject={actionTestResults} />
179+
<CippApiResults apiObject={actionSyncResults} />
181180
</CardContent>
182181

183182
<Box sx={{ width: "100%" }}>

0 commit comments

Comments
 (0)