Skip to content

Commit 4df740f

Browse files
authored
Merge pull request #76 from KelvinTegelaar/main
[pull] main from KelvinTegelaar:main
2 parents 0c1872c + ac351b0 commit 4df740f

File tree

145 files changed

+8235
-1512
lines changed

Some content is hidden

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

145 files changed

+8235
-1512
lines changed

.vscode/tasks.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
"type": "shell",
1111
"command": "azurite --location ../",
1212
"isBackground": true,
13+
"options": {
14+
"env": {
15+
"LC_ALL": "en-US.UTF-8",
16+
"LANG": "en-US"
17+
}
18+
},
1319
"problemMatcher": {
1420
"pattern": [
1521
{

cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"Reshare",
3131
"Rewst",
3232
"Sherweb",
33+
"superadmin",
3334
"Syncro",
3435
"TERRL",
3536
"unconfigured",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cipp",
3-
"version": "8.4.2",
3+
"version": "8.5.0",
44
"author": "CIPP Contributors",
55
"homepage": "https://cipp.app/",
66
"bugs": {

public/permissionsList.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7969,5 +7969,25 @@
79697969
"userConsentDescription": "Allows the app to manage workforce integrations, to synchronize data from Microsoft Teams Shifts, on your behalf.",
79707970
"userConsentDisplayName": "Read and write workforce integrations",
79717971
"value": "WorkforceIntegration.ReadWrite.All"
7972+
},
7973+
{
7974+
"description": "Read and Modify Tenant-Acquired Telephone Number Details",
7975+
"displayName": "Read and Modify Tenant-Acquired Telephone Number Details",
7976+
"id": "424b07a8-1209-4d17-9fe4-9018a93a1024",
7977+
"isEnabled": true,
7978+
"Origin": "Delegated",
7979+
"userConsentDescription": "Allows the app to read and modify your tenant's acquired telephone number details on behalf of the signed-in admin user. Acquired telephone numbers may include attributes related to assigned object, emergency location, network site, etc.",
7980+
"userConsentDisplayName": "Allows the app to read and modify your tenant's acquired telephone number details on behalf of the signed-in admin user. Acquired telephone numbers may include attributes related to assigned object, emergency location, network site, etc.",
7981+
"value": "TeamsTelephoneNumber.ReadWrite.All"
7982+
},
7983+
{
7984+
"description": "Read and Modify Tenant-Acquired Telephone Number Details",
7985+
"displayName": "Read and Modify Tenant-Acquired Telephone Number Details",
7986+
"id": "0a42382f-155c-4eb1-9bdc-21548ccaa387",
7987+
"isEnabled": true,
7988+
"Origin": "Application",
7989+
"userConsentDescription": "Allows the app to read your tenant's acquired telephone number details, without a signed-in user. Acquired telephone numbers may include attributes related to assigned object, emergency location, network site, etc.",
7990+
"userConsentDisplayName": "Allows the app to read your tenant's acquired telephone number details, without a signed-in user. Acquired telephone numbers may include attributes related to assigned object, emergency location, network site, etc.",
7991+
"value": "TeamsTelephoneNumber.ReadWrite.All"
79727992
}
79737993
]

public/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "8.4.2"
2+
"version": "8.5.0"
33
}

src/api/ApiCall.jsx

Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,25 @@ export function ApiGetCall(props) {
7676
if (relatedQueryKeys) {
7777
const clearKeys = Array.isArray(relatedQueryKeys) ? relatedQueryKeys : [relatedQueryKeys];
7878
setTimeout(() => {
79-
clearKeys.forEach((key) => {
79+
// Separate wildcard patterns from exact keys
80+
const wildcardPatterns = clearKeys
81+
.filter((key) => key.endsWith("*"))
82+
.map((key) => key.slice(0, -1));
83+
const exactKeys = clearKeys.filter((key) => !key.endsWith("*"));
84+
85+
// Use single predicate call for all wildcard patterns
86+
if (wildcardPatterns.length > 0) {
87+
queryClient.invalidateQueries({
88+
predicate: (query) => {
89+
if (!query.queryKey || !query.queryKey[0]) return false;
90+
const queryKeyStr = String(query.queryKey[0]);
91+
return wildcardPatterns.some((pattern) => queryKeyStr.startsWith(pattern));
92+
},
93+
});
94+
}
95+
96+
// Handle exact keys
97+
exactKeys.forEach((key) => {
8098
queryClient.invalidateQueries({ queryKey: [key] });
8199
});
82100
}, 1000);
@@ -96,7 +114,25 @@ export function ApiGetCall(props) {
96114
if (relatedQueryKeys) {
97115
const clearKeys = Array.isArray(relatedQueryKeys) ? relatedQueryKeys : [relatedQueryKeys];
98116
setTimeout(() => {
99-
clearKeys.forEach((key) => {
117+
// Separate wildcard patterns from exact keys
118+
const wildcardPatterns = clearKeys
119+
.filter((key) => key.endsWith("*"))
120+
.map((key) => key.slice(0, -1));
121+
const exactKeys = clearKeys.filter((key) => !key.endsWith("*"));
122+
123+
// Use single predicate call for all wildcard patterns
124+
if (wildcardPatterns.length > 0) {
125+
queryClient.invalidateQueries({
126+
predicate: (query) => {
127+
if (!query.queryKey || !query.queryKey[0]) return false;
128+
const queryKeyStr = String(query.queryKey[0]);
129+
return wildcardPatterns.some((pattern) => queryKeyStr.startsWith(pattern));
130+
},
131+
});
132+
}
133+
134+
// Handle exact keys
135+
exactKeys.forEach((key) => {
100136
queryClient.invalidateQueries({ queryKey: [key] });
101137
});
102138
}, 1000);
@@ -117,6 +153,7 @@ export function ApiGetCall(props) {
117153

118154
export function ApiPostCall({ relatedQueryKeys, onResult }) {
119155
const queryClient = useQueryClient();
156+
120157
const mutation = useMutation({
121158
mutationFn: async (props) => {
122159
const { url, data, bulkRequest } = props;
@@ -144,9 +181,43 @@ export function ApiPostCall({ relatedQueryKeys, onResult }) {
144181
const clearKeys = Array.isArray(relatedQueryKeys) ? relatedQueryKeys : [relatedQueryKeys];
145182
setTimeout(() => {
146183
if (relatedQueryKeys === "*") {
184+
console.log("Invalidating all queries");
147185
queryClient.invalidateQueries();
148186
} else {
149-
clearKeys.forEach((key) => {
187+
// Separate wildcard patterns from exact keys
188+
const wildcardPatterns = clearKeys
189+
.filter((key) => key.endsWith("*"))
190+
.map((key) => key.slice(0, -1));
191+
const exactKeys = clearKeys.filter((key) => !key.endsWith("*"));
192+
193+
// Use single predicate call for all wildcard patterns
194+
if (wildcardPatterns.length > 0) {
195+
queryClient.invalidateQueries({
196+
predicate: (query) => {
197+
if (!query.queryKey || !query.queryKey[0]) return false;
198+
const queryKeyStr = String(query.queryKey[0]);
199+
const matches = wildcardPatterns.some((pattern) =>
200+
queryKeyStr.startsWith(pattern)
201+
);
202+
203+
// Debug logging for each query check
204+
if (matches) {
205+
console.log("Invalidating query:", {
206+
queryKey: query.queryKey,
207+
queryKeyStr,
208+
matchedPattern: wildcardPatterns.find((pattern) =>
209+
queryKeyStr.startsWith(pattern)
210+
),
211+
});
212+
}
213+
214+
return matches;
215+
},
216+
});
217+
}
218+
219+
// Handle exact keys
220+
exactKeys.forEach((key) => {
150221
queryClient.invalidateQueries({ queryKey: [key] });
151222
});
152223
}

src/components/CippCards/CippChartCard.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,15 @@ export const CippChartCard = ({
9393
title,
9494
actions,
9595
onClick,
96+
totalLabel = "Total",
97+
customTotal,
9698
}) => {
9799
const [range, setRange] = useState("Last 7 days");
98100
const [barSeries, setBarSeries] = useState([]);
99101
const chartOptions = useChartOptions(labels, chartType);
100102
chartSeries = chartSeries.filter((item) => item !== null);
101-
const total = chartSeries.reduce((acc, value) => acc + value, 0);
103+
const calculatedTotal = chartSeries.reduce((acc, value) => acc + value, 0);
104+
const total = customTotal !== undefined ? customTotal : calculatedTotal;
102105
useEffect(() => {
103106
if (chartType === "bar") {
104107
setBarSeries(
@@ -160,7 +163,7 @@ export const CippChartCard = ({
160163
>
161164
{labels.length > 0 && (
162165
<>
163-
<Typography variant="h5">Total</Typography>
166+
<Typography variant="h5">{totalLabel}</Typography>
164167
<Typography variant="h5">{isFetching ? "0" : total}</Typography>
165168
</>
166169
)}

0 commit comments

Comments
 (0)