Skip to content

Commit

Permalink
Merge branch 'KelvinTegelaar:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorykcts authored Jan 26, 2025
2 parents 908e86d + 33af7ae commit dd43bd0
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 35 deletions.
2 changes: 1 addition & 1 deletion public/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "7.1.0"
"version": "7.1.1"
}
61 changes: 31 additions & 30 deletions src/components/CippIntegrations/CippIntegrationTenantMapping.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { CippFormTenantSelector } from "../CippComponents/CippFormTenantSelector
import { Sync, SyncAlt } from "@mui/icons-material";
import { CippFormComponent } from "../CippComponents/CippFormComponent";
import { CippApiResults } from "../CippComponents/CippApiResults";
import { ApiGetCallWithPagination } from "../../api/ApiCall";

const CippIntegrationSettings = ({ children }) => {
const router = useRouter();
Expand All @@ -35,7 +36,7 @@ const CippIntegrationSettings = ({ children }) => {
queryKey: `IntegrationTenantMapping-${router.query.id}`,
});

const tenantList = ApiGetCall({
const tenantList = ApiGetCallWithPagination({
url: "/api/ListTenants",
data: { AllTenantSelector: false },
queryKey: "ListTenants-notAllTenants",
Expand Down Expand Up @@ -94,37 +95,37 @@ const CippIntegrationSettings = ({ children }) => {
};

const handleAutoMap = () => {
const newTableData = [];
tenantList.data.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,
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}`,
});
}
});
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 Down
8 changes: 6 additions & 2 deletions src/components/CippSettings/CippCustomRoles.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from "@mui/material";

import Grid from "@mui/material/Grid2";
import { ApiGetCall, ApiPostCall } from "../../api/ApiCall";
import { ApiGetCall, ApiGetCallWithPagination, ApiPostCall } from "../../api/ApiCall";
import { CippOffCanvas } from "/src/components/CippComponents/CippOffCanvas";
import { CippFormTenantSelector } from "/src/components/CippComponents/CippFormTenantSelector";
import { Save } from "@mui/icons-material";
Expand Down Expand Up @@ -67,10 +67,14 @@ export const CippCustomRoles = () => {
queryKey: "customRoleList",
});

const { data: tenants = [], isSuccess: tenantsSuccess } = ApiGetCall({
const {
data: { pages = [] } = {},
isSuccess: tenantsSuccess,
} = ApiGetCallWithPagination({
url: "/api/ListTenants?AllTenantSelector=true",
queryKey: "ListTenants-AllTenantSelector",
});
const tenants = pages[0] || [];

useEffect(() => {
if (customRoleListSuccess && tenantsSuccess && selectedRole !== currentRole?.value) {
Expand Down
5 changes: 3 additions & 2 deletions src/pages/cipp/super-admin/sam-app-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import CippFormPage from "/src/components/CippFormPages/CippFormPage";
import { Alert, CardContent, Stack, Typography } from "@mui/material";
import { WarningAmberOutlined } from "@mui/icons-material";
import { useForm } from "react-hook-form";
import { ApiGetCall } from "../../../api/ApiCall";
import { ApiGetCall, ApiGetCallWithPagination } from "../../../api/ApiCall";
import { useEffect } from "react";
import CippFormComponent from "../../../components/CippComponents/CippFormComponent";
import GDAPRoles from "/src/data/GDAPRoles";
Expand All @@ -23,10 +23,11 @@ const Page = () => {
queryKey: "ExecSAMRoles",
});

const { data: tenants = [], isSuccess: tenantsSuccess } = ApiGetCall({
const { data: tenantsData = { pages: [] }, isSuccess: tenantsSuccess } = ApiGetCallWithPagination({
url: "/api/ListTenants?AllTenantSelector=true",
queryKey: "ListTenants-AllTenantSelector",
});
const tenants = tenantsData?.pages?.[0] || [];

useEffect(() => {
if (execSAMRoles.isSuccess && tenantsSuccess) {
Expand Down

0 comments on commit dd43bd0

Please sign in to comment.