Skip to content

Commit 2900c3a

Browse files
authored
Merge pull request #139 from KelvinTegelaar/main
[pull] main from KelvinTegelaar:main
2 parents ebf4f8f + c92dedf commit 2900c3a

File tree

77 files changed

+2422
-712
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2422
-712
lines changed

.github/workflows/cipp_dev_build.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,17 @@ jobs:
1818
uses: actions/[email protected]
1919

2020
# Set up Node.js
21+
- name: Get Node version
22+
id: get_node_version
23+
run: |
24+
node_raw_version=$(node -p "require('./package.json').engines.node")
25+
node_sanitized_version=$(echo $node_raw_version | sed -E 's/[^0-9.]+//g')
26+
echo "node_version=$node_sanitized_version" >> $GITHUB_OUTPUT
27+
2128
- name: Set up Node.js
2229
uses: actions/[email protected]
2330
with:
24-
node-version: '20.18.1'
31+
node-version: ${{ steps.get_node_version.outputs.node_version }}
2532

2633
# Install dependencies
2734
- name: Install Dependencies

.github/workflows/cipp_frontend_build.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,17 @@ jobs:
1818
uses: actions/[email protected]
1919

2020
# Set up Node.js
21+
- name: Get Node version
22+
id: get_node_version
23+
run: |
24+
node_raw_version=$(node -p "require('./package.json').engines.node")
25+
node_sanitized_version=$(echo $node_raw_version | sed -E 's/[^0-9.]+//g')
26+
echo "node_version=$node_sanitized_version" >> $GITHUB_OUTPUT
27+
2128
- name: Set up Node.js
2229
uses: actions/[email protected]
2330
with:
24-
node-version: '20.18.1'
31+
node-version: ${{ steps.get_node_version.outputs.node_version }}
2532

2633
# Install dependencies
2734
- name: Install Dependencies

.github/workflows/dev_deploy.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CIPP Development Frontend CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
8+
jobs:
9+
build_and_deploy_job:
10+
if: github.event.repository.fork == false && github.event_name == 'push'
11+
runs-on: ubuntu-latest
12+
name: Build and Deploy Job
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
submodules: true
17+
- name: Build And Deploy
18+
id: builddeploy
19+
uses: Azure/static-web-apps-deploy@v1
20+
with:
21+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AMBITIOUS_MOSS_0A047A40F }} # change this to your repository secret name
22+
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
23+
action: 'upload'
24+
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
25+
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
26+
app_location: '/' # App source code path
27+
api_location: '' # Api source code path - optional
28+
output_location: 'out' # Built app content directory - optional
29+
###### End of Repository/Build Configurations ######
30+
31+
close_pull_request_job:
32+
if: github.event.repository.fork == false && github.event_name == 'pull_request' && github.event.action == 'closed'
33+
runs-on: ubuntu-latest
34+
name: Close Pull Request Job
35+
steps:
36+
- name: Close Pull Request
37+
id: closepullrequest
38+
uses: Azure/static-web-apps-deploy@v1
39+
with:
40+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AMBITIOUS_MOSS_0A047A40F }} # change this to your repository secret name
41+
action: 'close'

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"license": "AGPL-3.0",
1010
"engines": {
11-
"node": "^20.18.1"
11+
"node": "^22.13.0"
1212
},
1313
"repository": {
1414
"type": "git",

public/version.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "7.2.3"
2+
"version": "7.3.0"
33
}

src/api/ApiCall.jsx

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import axios, { isAxiosError } from "axios";
33
import { useDispatch } from "react-redux";
44
import { showToast } from "../store/toasts";
55
import { getCippError } from "../utils/get-cipp-error";
6-
import { useRouter } from "next/router";
76

87
export function ApiGetCall(props) {
98
const {
@@ -16,6 +15,8 @@ export function ApiGetCall(props) {
1615
bulkRequest = false,
1716
toast = false,
1817
onResult,
18+
staleTime = 600000, // 10 minutes
19+
refetchOnWindowFocus = false,
1920
} = props;
2021
const queryClient = useQueryClient();
2122
const dispatch = useDispatch();
@@ -27,6 +28,12 @@ export function ApiGetCall(props) {
2728
returnRetry = false;
2829
}
2930
if (isAxiosError(error) && HTTP_STATUS_TO_NOT_RETRY.includes(error.response?.status ?? 0)) {
31+
if (
32+
error.response?.status === 302 &&
33+
error.response?.headers.get("location").includes("/.auth/login/aad")
34+
) {
35+
queryClient.invalidateQueries({ queryKey: ["authmecipp"] });
36+
}
3037
returnRetry = false;
3138
}
3239
if (returnRetry === false && toast) {
@@ -93,8 +100,8 @@ export function ApiGetCall(props) {
93100
return response.data;
94101
}
95102
},
96-
staleTime: 600000, // 10 minutes
97-
refetchOnWindowFocus: false,
103+
staleTime: staleTime,
104+
refetchOnWindowFocus: refetchOnWindowFocus,
98105
retry: retryFn,
99106
});
100107
return queryInfo;

src/components/CippCards/CippPageCard.jsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useRouter } from "next/router";
22
import { Box, Container, Stack, Button, SvgIcon, Typography, Card } from "@mui/material";
33
import ArrowLeftIcon from "@mui/icons-material/ArrowLeft";
44
import Head from "next/head";
5+
import { CippHead } from "../CippComponents/CippHead";
56
const CippPageCard = (props) => {
67
const {
78
title,
@@ -20,9 +21,7 @@ const CippPageCard = (props) => {
2021

2122
return (
2223
<>
23-
<Head>
24-
<title>{title}</title>
25-
</Head>
24+
<CippHead title={title} />
2625
<Box
2726
sx={{
2827
flexGrow: 1,

src/components/CippCards/CippUserInfoCard.jsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,14 @@ export const CippUserInfoCard = (props) => {
112112
value={isFetching ? <Skeleton variant="text" width={100} /> : user?.jobTitle || "N/A"}
113113
/>
114114
<PropertyListItem
115-
divider
116115
label="Department"
117116
value={isFetching ? <Skeleton variant="text" width={100} /> : user?.department || "N/A"}
118117
/>
118+
<PropertyListItem
119+
divider
120+
label="Manager"
121+
value={isFetching ? <Skeleton variant="text" width={100} /> : user?.manager?.displayName || "N/A"}
122+
/>
119123
<PropertyListItem
120124
label="Address"
121125
value={

src/components/CippComponents/CippApiDialog.jsx

+20-6
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ export const CippApiDialog = (props) => {
9797
} else {
9898
newData[key] = value;
9999
}
100+
} else if (typeof value === 'boolean') {
101+
newData[key] = value;
100102
} else if (typeof value === "object" && value !== null) {
101103
const processedValue = processActionData(value, row, replacementBehaviour);
102104
if (replacementBehaviour !== "removeNulls" || Object.keys(processedValue).length > 0) {
@@ -273,20 +275,32 @@ export const CippApiDialog = (props) => {
273275
.reduce((acc, key) => (acc && acc[key] !== undefined ? acc[key] : undefined), obj);
274276
};
275277

276-
// Handling link navigation
277-
if (api.link) {
278+
// Handling external link navigation
279+
useEffect(() => {
280+
if (api.link && createDialog.open) {
281+
const linkWithRowData = api.link.replace(/\[([^\]]+)\]/g, (_, key) => {
282+
return getNestedValue(row, key) || `[${key}]`;
283+
});
284+
285+
if (!linkWithRowData.startsWith("/")) {
286+
window.open(linkWithRowData, api.target || "_blank");
287+
createDialog.handleClose();
288+
}
289+
}
290+
}, [api.link, createDialog.open]);
291+
292+
// Handling internal link navigation
293+
if (api.link && createDialog.open) {
278294
const linkWithRowData = api.link.replace(/\[([^\]]+)\]/g, (_, key) => {
279295
return getNestedValue(row, key) || `[${key}]`;
280296
});
281297

282298
if (linkWithRowData.startsWith("/")) {
283299
router.push(linkWithRowData, undefined, { shallow: true });
284-
} else {
285-
window.open(linkWithRowData, api.target || "_blank");
300+
createDialog.handleClose();
286301
}
287-
288-
return null;
289302
}
303+
290304
useEffect(() => {
291305
if (api.noConfirm) {
292306
formHook.handleSubmit(onSubmit)(); // Submits the form on mount

src/components/CippComponents/CippCentralSearch.jsx

+13-8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
Grid,
1010
Card,
1111
CardContent,
12+
CardActionArea,
1213
Typography,
1314
Box,
1415
} from "@mui/material";
@@ -107,15 +108,19 @@ export const CippCentralSearch = ({ handleClose, open }) => {
107108
<Grid item xs={12} sm={12} md={12} key={index}>
108109
<Card
109110
variant="outlined"
110-
sx={{ height: "100%", cursor: "pointer" }}
111-
onClick={() => handleCardClick(item.path)}
111+
sx={{ height: "100%" }}
112112
>
113-
<CardContent>
114-
<Typography variant="h6">{highlightMatch(item.title)}</Typography>
115-
<Typography variant="body2" color="textSecondary">
116-
Path: {highlightMatch(item.path)}
117-
</Typography>
118-
</CardContent>
113+
<CardActionArea
114+
onClick={() => handleCardClick(item.path)}
115+
aria-label={`Navigate to ${item.title}`}
116+
>
117+
<CardContent>
118+
<Typography variant="h6">{highlightMatch(item.title)}</Typography>
119+
<Typography variant="body2" color="textSecondary">
120+
Path: {highlightMatch(item.path)}
121+
</Typography>
122+
</CardContent>
123+
</CardActionArea>
119124
</Card>
120125
</Grid>
121126
))}

src/components/CippComponents/CippFormComponent.jsx

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const CippFormComponent = (props) => {
4343
name, // The name that may have bracket notation
4444
label,
4545
labelLocation = "behind", // Default location for switches
46+
defaultValue,
4647
...other
4748
} = props;
4849
const { errors } = useFormState({ control: formControl.control });
@@ -121,6 +122,7 @@ export const CippFormComponent = (props) => {
121122
{...other}
122123
{...formControl.register(convertedName, { ...validators })}
123124
label={label}
125+
defaultValue={defaultValue}
124126
/>
125127
</div>
126128
<Typography variant="subtitle3" color="error">
@@ -156,6 +158,7 @@ export const CippFormComponent = (props) => {
156158
{...other}
157159
{...formControl.register(convertedName, { ...validators })}
158160
label={label}
161+
defaultValue={defaultValue}
159162
/>
160163
</div>
161164
<Typography variant="subtitle3" color="error">
@@ -171,6 +174,7 @@ export const CippFormComponent = (props) => {
171174
<Controller
172175
name={convertedName}
173176
control={formControl.control}
177+
defaultValue={defaultValue}
174178
render={({ field }) =>
175179
renderSwitchWithLabel(
176180
<Switch

0 commit comments

Comments
 (0)