Skip to content

Commit 5eeb925

Browse files
committed
fix odata type issue and From format in mbx rule
1 parent 1985001 commit 5eeb925

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/components/CippTable/util-columnsFromAPI.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const utilColumnsFromAPI = (dataArray) => {
4343
id: accessorKey,
4444
accessorFn: (row) => {
4545
let value;
46-
if (accessorKey.startsWith("@odata")) {
46+
if (accessorKey.includes("@odata")) {
4747
value = row[accessorKey];
4848
} else {
4949
value = accessorKey.split(".").reduce((acc, part) => acc && acc[part], row);
@@ -53,7 +53,7 @@ export const utilColumnsFromAPI = (dataArray) => {
5353
...getCippFilterVariant(key),
5454
Cell: ({ row }) => {
5555
let value;
56-
if (accessorKey.startsWith("@odata")) {
56+
if (accessorKey.includes("@odata")) {
5757
value = row.original[accessorKey];
5858
} else {
5959
value = accessorKey.split(".").reduce((acc, part) => acc && acc[part], row.original);

src/utils/get-cipp-formatting.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,26 @@ export const getCippFormatting = (data, cellName, type, canReceive) => {
253253
);
254254
}
255255

256-
if (cellName === "@odata.type") {
256+
if (cellName.includes("@odata.type")) {
257257
if (data.startsWith("#microsoft.graph")) {
258258
data = data.replace("#microsoft.graph.", "");
259+
return getCippTranslation(data, "@odata.type");
259260
}
260-
return getCippTranslation(data, "@odata.type");
261+
return data
261262
}
262263

263264
// Handle From address
264265
if (cellName === "From") {
265-
// split on ; , and create chips per email
266-
const emails = data.split(/;|,/);
267-
return isText
268-
? emails.join(", ")
269-
: emails.map((email) => <CippCopyToClipBoard key={email} text={email} type="chip" />);
266+
// if data is array
267+
if (Array.isArray(data)) {
268+
return isText ? data.join(", ") : data.join(", ");
269+
} else {
270+
// split on ; , and create chips per email
271+
const emails = data.split(/;|,/);
272+
return isText
273+
? emails.join(", ")
274+
: emails.map((email) => <CippCopyToClipBoard key={email} text={email} type="chip" />);
275+
}
270276
}
271277

272278
// Handle proxyAddresses

0 commit comments

Comments
 (0)