Skip to content

Commit

Permalink
fix odata type issue and From format in mbx rule
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDuprey committed Jan 6, 2025
1 parent 1985001 commit 5eeb925
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/components/CippTable/util-columnsFromAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const utilColumnsFromAPI = (dataArray) => {
id: accessorKey,
accessorFn: (row) => {
let value;
if (accessorKey.startsWith("@odata")) {
if (accessorKey.includes("@odata")) {
value = row[accessorKey];
} else {
value = accessorKey.split(".").reduce((acc, part) => acc && acc[part], row);
Expand All @@ -53,7 +53,7 @@ export const utilColumnsFromAPI = (dataArray) => {
...getCippFilterVariant(key),
Cell: ({ row }) => {
let value;
if (accessorKey.startsWith("@odata")) {
if (accessorKey.includes("@odata")) {
value = row.original[accessorKey];
} else {
value = accessorKey.split(".").reduce((acc, part) => acc && acc[part], row.original);
Expand Down
20 changes: 13 additions & 7 deletions src/utils/get-cipp-formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,20 +253,26 @@ export const getCippFormatting = (data, cellName, type, canReceive) => {
);
}

if (cellName === "@odata.type") {
if (cellName.includes("@odata.type")) {
if (data.startsWith("#microsoft.graph")) {
data = data.replace("#microsoft.graph.", "");
return getCippTranslation(data, "@odata.type");
}
return getCippTranslation(data, "@odata.type");
return data
}

// Handle From address
if (cellName === "From") {
// split on ; , and create chips per email
const emails = data.split(/;|,/);
return isText
? emails.join(", ")
: emails.map((email) => <CippCopyToClipBoard key={email} text={email} type="chip" />);
// if data is array
if (Array.isArray(data)) {
return isText ? data.join(", ") : data.join(", ");
} else {
// split on ; , and create chips per email
const emails = data.split(/;|,/);
return isText
? emails.join(", ")
: emails.map((email) => <CippCopyToClipBoard key={email} text={email} type="chip" />);
}
}

// Handle proxyAddresses
Expand Down

0 comments on commit 5eeb925

Please sign in to comment.