Skip to content

Commit

Permalink
Merge pull request #89 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
[pull] dev from KelvinTegelaar:dev
  • Loading branch information
kris6673 authored Jan 27, 2025
2 parents 9938a37 + a3346a9 commit 1b8eaca
Show file tree
Hide file tree
Showing 30 changed files with 747 additions and 252 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/PR_Branch_Check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ permissions:

jobs:
check-branch:
if: github.event.repository.fork == false
runs-on: ubuntu-latest
steps:
- name: Check and Comment on PR
# Only process fork PRs with specific branch conditions
# Must be a fork AND (source is main/master OR target is main/master)
if: |
github.event.pull_request.head.repo.fork == true &&
github.event.pull_request.head.repo.fork == true &&
((github.event.pull_request.head.ref == 'main' || github.event.pull_request.head.ref == 'master') ||
(github.event.pull_request.base.ref == 'main' || github.event.pull_request.base.ref == 'master'))
uses: actions/github-script@v7
Expand All @@ -40,20 +41,20 @@ jobs:
}
// Check if PR is from a fork's main/master branch
if (context.payload.pull_request.head.repo.fork &&
if (context.payload.pull_request.head.repo.fork &&
(context.payload.pull_request.head.ref === 'main' || context.payload.pull_request.head.ref === 'master')) {
message += '⚠️ This PR cannot be merged because it originates from your fork\'s main/master branch. If you are attempting to contribute code please PR from your dev branch or another non-main/master branch.\n\n';
}
message += '🔒 This PR will now be automatically closed due to the above violation(s).';
// Post the comment
await github.rest.issues.createComment({
...context.repo,
issue_number: context.issue.number,
body: message
});
// Close the PR
await github.rest.pulls.update({
...context.repo,
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dev_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_RW }} # change this to your repository secret name
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AMBITIOUS_MOSS_0A047A40F }} # change this to your repository secret name
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: 'upload'
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
Expand All @@ -37,5 +37,5 @@ jobs:
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_RW }} # change this to your repository secret name
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AMBITIOUS_MOSS_0A047A40F }} # change this to your repository secret name
action: 'close'
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.0.5"
"version": "7.1.1"
}
26 changes: 17 additions & 9 deletions src/components/CippCards/CippBannerListCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { CippPropertyListCard } from "./CippPropertyListCard";
import { CippDataTable } from "../CippTable/CippDataTable";

export const CippBannerListCard = (props) => {
const { items = [], isCollapsible = false, isFetching = false, ...other } = props;
const { items = [], isCollapsible = false, isFetching = false, children, ...other } = props;
const [expanded, setExpanded] = useState(null);

const handleExpand = useCallback((itemId) => {
Expand Down Expand Up @@ -145,14 +145,18 @@ export const CippBannerListCard = (props) => {
{isCollapsible && (
<Collapse in={isExpanded}>
<Divider />
{item?.propertyItems?.length > 0 && (
<CippPropertyListCard
propertyItems={item.propertyItems || []}
layout="dual"
isFetching={item.isFetching || false}
/>
)}
{item?.table && <CippDataTable {...item.table} />}
<Stack spacing={1}>
{item?.propertyItems?.length > 0 && (
<CippPropertyListCard
propertyItems={item.propertyItems || []}
layout="dual"
isFetching={item.isFetching || false}
/>
)}
{item?.table && <CippDataTable {...item.table} />}
{item?.children && <Box sx={{ pl: 3 }}>{item.children}</Box>}
{item?.actionButton && <Box sx={{ pl: 3, pb: 2 }}>{item.actionButton}</Box>}
</Stack>
</Collapse>
)}
</li>
Expand Down Expand Up @@ -180,8 +184,12 @@ CippBannerListCard.propTypes = {
subtext: PropTypes.string,
statusColor: PropTypes.string,
statusText: PropTypes.string,
actionButton: PropTypes.element,
propertyItems: PropTypes.array,
table: PropTypes.object,
actionButton: PropTypes.element,
isFetching: PropTypes.bool,
children: PropTypes.node,
})
).isRequired,
isCollapsible: PropTypes.bool,
Expand Down
3 changes: 2 additions & 1 deletion src/components/CippComponents/CippAutocomplete.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const CippAutoComplete = (props) => {
onChange,
onCreateOption,
required = false,
isFetching = false,
sx,
...other
} = props;
Expand Down Expand Up @@ -132,7 +133,7 @@ export const CippAutoComplete = (props) => {
return (
<Autocomplete
key={`${defaultValue}-${rand}`}
disabled={disabled || actionGetRequest.isFetching}
disabled={disabled || actionGetRequest.isFetching || isFetching}
popupIcon={
actionGetRequest.isFetching ? (
<CircularProgress color="inherit" size={20} />
Expand Down
52 changes: 52 additions & 0 deletions src/components/CippComponents/CippLocationDialog.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { Button, Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
import { useState } from "react";
import dynamic from "next/dynamic"; // Import dynamic from next/dynamic
import { CippPropertyList } from "./CippPropertyList"; // Import CippPropertyList
import { LocationOn } from "@mui/icons-material";

const CippMap = dynamic(() => import("./CippMap"), { ssr: false }); // Dynamic import for CippMap

export const CippLocationDialog = ({ location }) => {
const [open, setOpen] = useState(false);

const handleOpen = () => {
setOpen(true);
};

const handleClose = () => {
setOpen(false);
};

const markers = [
{
position: [location.geoCoordinates.latitude, location.geoCoordinates.longitude],
popup: `${location.city}, ${location.state}, ${location.countryOrRegion}`,
},
];

const properties = [
{ label: "City", value: location.city },
{ label: "State", value: location.state },
{ label: "Country/Region", value: location.countryOrRegion },
];

return (
<>
<Button size="small" variant="outlined" onClick={handleOpen} startIcon={<LocationOn />}>
{location.city}, {location.state}, {location.countryOrRegion}
</Button>
<Dialog fullWidth maxWidth="sm" onClose={handleClose} open={open}>
<DialogTitle>Location Details</DialogTitle>
<DialogContent>
<CippPropertyList propertyItems={properties} showDivider={false} />
<CippMap markers={markers} zoom={10} mapSx={{ height: "300px", width: "100%" }} />
</DialogContent>
<DialogActions>
<Button color="inherit" onClick={handleClose}>
Close
</Button>
</DialogActions>
</Dialog>
</>
);
};
7 changes: 6 additions & 1 deletion src/components/CippFormPages/CippSchedulerForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,12 @@ const CippSchedulerForm = (props) => {
<Skeleton width={"100%"} />
)}
<Grid item xs={12} md={12}>
<CippFormTenantSelector label="Select a Tenant" formControl={formControl} type="single" />
<CippFormTenantSelector
label="Select a Tenant"
formControl={formControl}
type="single"
allTenants={true}
/>
</Grid>

<Grid item xs={12} md={12}>
Expand Down
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
4 changes: 2 additions & 2 deletions src/components/CippSettings/CippGDAPResults.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const CippGDAPResults = (props) => {
) : (
<>
<List>
{gdapTests.map((test) => {
{gdapTests.map((test, index) => {
var matchedResults = results?.Results?.[test.resultProperty]?.filter((item) =>
new RegExp(test.match)?.test(item?.[test.matchProperty])
);
Expand All @@ -128,7 +128,7 @@ export const CippGDAPResults = (props) => {
}

return (
<ListItem sx={{ py: 0 }}>
<ListItem sx={{ py: 0 }} key={index}>
<Typography variant="body2">
<SvgIcon fontSize="sm" style={{ marginRight: 4 }}>
{testResult ? <CheckCircle /> : <XMarkIcon />}
Expand Down
35 changes: 33 additions & 2 deletions src/components/CippSettings/CippPermissionCheck.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import { Box, Button, Chip, Stack, SvgIcon, Typography } from "@mui/material";
import {
Alert,
Box,
Button,
Chip,
Collapse,
IconButton,
Stack,
SvgIcon,
Typography,
} from "@mui/material";
import CippButtonCard from "/src/components/CippCards/CippButtonCard";
import { ApiGetCall } from "/src/api/ApiCall";
import { useEffect, useState } from "react";
import { CippPermissionResults } from "./CippPermissionResults";
import { CippGDAPResults } from "./CippGDAPResults";
import { Sync } from "@mui/icons-material";
import { Close, Sync } from "@mui/icons-material";
import { CippTenantResults } from "./CippTenantResults";
import { CippTimeAgo } from "../CippComponents/CippTimeAgo";
import { Description } from "@mui/icons-material";
Expand All @@ -14,6 +24,7 @@ const CippPermissionCheck = (props) => {
const [skipCache, setSkipCache] = useState(false);
const [cardIcon, setCardIcon] = useState(null);
const [offcanvasVisible, setOffcanvasVisible] = useState(false);
const [showAlertMessage, setShowAlertMessage] = useState(true);
var showDetails = true;

if (type === "Tenants") {
Expand Down Expand Up @@ -130,6 +141,26 @@ const CippPermissionCheck = (props) => {
>
{(executeCheck.isSuccess || executeCheck.isLoading) && (
<>
{executeCheck.data?.Metadata?.AlertMessage && (
<Collapse in={showAlertMessage}>
<Alert
severity={executeCheck?.data?.Metadata?.AlertSeverity ?? "info"}
sx={{ mb: 2 }}
action={
<IconButton
aria-label="close"
color="inherit"
size="small"
onClick={() => setShowAlertMessage(false)}
>
<Close fontSize="inherit" />
</IconButton>
}
>
{executeCheck.data.Metadata.AlertMessage}
</Alert>
</Collapse>
)}
{type === "Permissions" && (
<CippPermissionResults
executeCheck={executeCheck}
Expand Down
Loading

0 comments on commit 1b8eaca

Please sign in to comment.