Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from KelvinTegelaar:main #46

Merged
merged 3 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading