Skip to content

Commit

Permalink
Merge pull request #64 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
[pull] dev from KelvinTegelaar:dev
  • Loading branch information
pull[bot] authored Feb 4, 2025
2 parents 56d9878 + d185ae1 commit 137003f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 33 deletions.
60 changes: 30 additions & 30 deletions src/components/CippIntegrations/CippIntegrationTenantMapping.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,37 +95,37 @@ const CippIntegrationSettings = ({ children }) => {
};

const handleAutoMap = () => {
const newTableData = [];
tenantList.data?.pages[0]?.forEach((tenant) => {
const matchingCompany = mappings.data.Companies.find(
(company) => company.name === tenant.displayName
);
if (
Array.isArray(tableData) &&
tableData?.find((item) => item.TenantId === tenant.customerId)
)
return;
if (matchingCompany) {
newTableData.push({
TenantId: tenant.customerId,
Tenant: tenant.displayName,
IntegrationName: matchingCompany.name,
IntegrationId: matchingCompany.value,
});
}
});
if (Array.isArray(tableData)) {
setTableData([...tableData, ...newTableData]);
} else {
setTableData(newTableData);
}
if (extension.autoMapSyncApi) {
automapPostCall.mutate({
url: `/api/ExecExtensionMapping?AutoMapping=${router.query.id}`,
queryKey: `IntegrationTenantMapping-${router.query.id}`,
const newTableData = [];
tenantList.data?.pages[0]?.forEach((tenant) => {
const matchingCompany = mappings.data.Companies.find(
(company) => company.name === tenant.displayName
);
if (
Array.isArray(tableData) &&
tableData?.find((item) => item.TenantId === tenant.customerId)
)
return;
if (matchingCompany) {
newTableData.push({
TenantId: tenant.customerId,
Tenant: tenant.displayName,
IntegrationName: matchingCompany.name,
IntegrationId: matchingCompany.value,
});
}
};
});
if (Array.isArray(tableData)) {
setTableData([...tableData, ...newTableData]);
} else {
setTableData(newTableData);
}
if (extension.autoMapSyncApi) {
automapPostCall.mutate({
url: `/api/ExecExtensionMapping?AutoMapping=${router.query.id}`,
queryKey: `IntegrationTenantMapping-${router.query.id}`,
});
}
};

const actions = [
{
Expand All @@ -140,7 +140,7 @@ const CippIntegrationSettings = ({ children }) => {

useEffect(() => {
if (mappings.isSuccess) {
setTableData(mappings.data.Mappings);
setTableData(mappings.data.Mappings ?? []);
}
}, [mappings.isSuccess]);

Expand Down
5 changes: 2 additions & 3 deletions src/pages/cipp/integrations/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,9 @@ const Page = () => {
))}
</>
)}

<CippApiResults apiObject={actionTestResults} />
<CippApiResults apiObject={actionSyncResults} />
</Stack>
<CippApiResults apiObject={actionTestResults} />
<CippApiResults apiObject={actionSyncResults} />
</CardContent>

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

0 comments on commit 137003f

Please sign in to comment.