From e77009beea868465e402b2dc3a172474112996bd Mon Sep 17 00:00:00 2001
From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com>
Date: Thu, 20 Jul 2023 10:16:39 +0200
Subject: [PATCH] updates to new portal logic
---
src/data/portals.json | 128 +++++-----
src/views/tenant/administration/Tenants.js | 275 ++-------------------
2 files changed, 90 insertions(+), 313 deletions(-)
diff --git a/src/data/portals.json b/src/data/portals.json
index 264b8a4aaab0..0e49317032f2 100644
--- a/src/data/portals.json
+++ b/src/data/portals.json
@@ -1,66 +1,66 @@
[
- {
- "label" : "M365 Portal",
- "name" : "M365_Portal",
- "url" : "https://portal.office.com/Partner/BeginClientSession.aspx?CTID=${row.customerId}&CSDEST=o365admincenter",
- "variable" : "${row.customerId}",
- "target" : "_blank",
- "external" : true
- },
- {
- "label" : "Exchange Portal",
- "name" : "Exchange_Portal",
- "url" : "https://admin.exchange.microsoft.com/?landingpage=homepage&form=mac_sidebar&delegatedOrg=${row.defaultDomainName}#",
- "variable" : "${row.defaultDomainName}",
- "target" : "_blank",
- "external" : true
- },
- {
- "label" : "Entra Portal",
- "name" : "Entra_Portal",
- "url" : "https://entra.microsoft.com/${row.defaultDomainName}",
- "variable" : "${row.defaultDomainName}",
- "target" : "_blank",
- "external" : true
- },
- {
- "label" : "Teams Portal",
- "name" : "Teams_Portal",
- "url" : "https://admin.teams.microsoft.com/?delegatedOrg=${row.defaultDomainName}",
- "variable" : "${row.defaultDomainName}",
- "target" : "_blank",
- "external" : true
- },
- {
- "label" : "Azure Portal",
- "name" : "Azure_Portal",
- "url" : "https://portal.azure.com/${row.defaultDomainName}",
- "variable" : "${row.defaultDomainName}",
- "target" : "_blank",
- "external" : true
- },
- {
- "label" : "Intune Portal",
- "name" : "Intune_Portal",
- "url" : "https://intune.microsoft.com/${row.defaultDomainName}",
- "variable" : "${row.defaultDomainName}",
- "target" : "_blank",
- "external" : true
- },
- {
- "label" : "Security Portal",
- "name" : "Security_Portal",
- "url" : "https://security.microsoft.com/?tid=${row.customerId}",
- "variable" : "${row.customerId}",
- "target" : "_blank",
- "external" : true
- },
- {
- "label" : "Sharepoint Admin",
- "name" : "Sharepoint_Admin",
- "url" : "https://admin.microsoft.com/Partner/beginclientsession.aspx?CTID=${row.customerId}&CSDEST=SharePoint",
- "variable" : "${row.customerId}",
- "target" : "_blank",
- "external" : true
- }
+ {
+ "label": "M365 Portal",
+ "name": "M365_Portal",
+ "url": "https://portal.office.com/Partner/BeginClientSession.aspx?CTID=customerId&CSDEST=o365admincenter",
+ "variable": "customerId",
+ "target": "_blank",
+ "external": true
+ },
+ {
+ "label": "Exchange Portal",
+ "name": "Exchange_Portal",
+ "url": "https://admin.exchange.microsoft.com/?landingpage=homepage&form=mac_sidebar&delegatedOrg=defaultDomainName#",
+ "variable": "defaultDomainName",
+ "target": "_blank",
+ "external": true
+ },
+ {
+ "label": "Entra Portal",
+ "name": "Entra_Portal",
+ "url": "https://entra.microsoft.com/defaultDomainName",
+ "variable": "defaultDomainName",
+ "target": "_blank",
+ "external": true
+ },
+ {
+ "label": "Teams Portal",
+ "name": "Teams_Portal",
+ "url": "https://admin.teams.microsoft.com/?delegatedOrg=defaultDomainName",
+ "variable": "defaultDomainName",
+ "target": "_blank",
+ "external": true
+ },
+ {
+ "label": "Azure Portal",
+ "name": "Azure_Portal",
+ "url": "https://portal.azure.com/defaultDomainName",
+ "variable": "defaultDomainName",
+ "target": "_blank",
+ "external": true
+ },
+ {
+ "label": "Intune Portal",
+ "name": "Intune_Portal",
+ "url": "https://intune.microsoft.com/defaultDomainName",
+ "variable": "defaultDomainName",
+ "target": "_blank",
+ "external": true
+ },
+ {
+ "label": "Security Portal",
+ "name": "Security_Portal",
+ "url": "https://security.microsoft.com/?tid=customerId",
+ "variable": "customerId",
+ "target": "_blank",
+ "external": true
+ },
+ {
+ "label": "Sharepoint Admin",
+ "name": "Sharepoint_Admin",
+ "url": "https://admin.microsoft.com/Partner/beginclientsession.aspx?CTID=customerId&CSDEST=SharePoint",
+ "variable": "customerId",
+ "target": "_blank",
+ "external": true
+ }
]
diff --git a/src/views/tenant/administration/Tenants.js b/src/views/tenant/administration/Tenants.js
index 45f6d7769a5e..3347f1f84471 100644
--- a/src/views/tenant/administration/Tenants.js
+++ b/src/views/tenant/administration/Tenants.js
@@ -36,7 +36,13 @@ const Offcanvas = (row, rowIndex, formatExtraData) => {
>
)
}
-
+ const actions = Portals.map((portal) => ({
+ icon: ,
+ label: portal.label,
+ external: true,
+ color: 'info',
+ link: portal.url.replace(portal.variable, row[portal.variable]),
+ }))
return (
<>
loadOffCanvasDetails(row.defaultDomainName)}>
@@ -85,86 +91,7 @@ const Offcanvas = (row, rowIndex, formatExtraData) => {
link: `/tenant/administration/tenants/Edit?tenantFilter=${row.defaultDomainName}&customerId=${row.customerId}`,
color: 'warning',
},
- {
- icon: ,
- label: Portals.find((obj) => obj.name === 'M365_Portal').label,
- external: true,
- color: 'info',
- link: Portals.find((obj) => obj.name === 'M365_Portal').url.replace(
- '${row.customerId}',
- row.customerId,
- ),
- },
- {
- icon: ,
- label: Portals.find((obj) => obj.name === 'Exchange_Portal').label,
- external: true,
- color: 'info',
- link: Portals.find((obj) => obj.name === 'Exchange_Portal').url.replace(
- '${row.customerId}',
- row.customerId,
- ),
- },
- {
- icon: ,
- label: Portals.find((obj) => obj.name === 'Entra_Portal').label,
- external: true,
- color: 'info',
- link: Portals.find((obj) => obj.name === 'Entra_Portal').url.replace(
- '${row.customerId}',
- row.customerId,
- ),
- },
- {
- icon: ,
- label: Portals.find((obj) => obj.name === 'Teams_Portal').label,
- external: true,
- color: 'info',
- link: Portals.find((obj) => obj.name === 'Teams_Portal').url.replace(
- '${row.customerId}',
- row.customerId,
- ),
- },
- {
- icon: ,
- label: Portals.find((obj) => obj.name === 'Azure_Portal').label,
- external: true,
- color: 'info',
- link: Portals.find((obj) => obj.name === 'Azure_Portal').url.replace(
- '${row.customerId}',
- row.customerId,
- ),
- },
- {
- icon: ,
- label: Portals.find((obj) => obj.name === 'Intune_Portal').label,
- external: true,
- color: 'info',
- link: Portals.find((obj) => obj.name === 'Intune_Portal').url.replace(
- '${row.customerId}',
- row.customerId,
- ),
- },
- {
- icon: ,
- label: Portals.find((obj) => obj.name === 'Security_Portal').label,
- external: true,
- color: 'info',
- link: Portals.find((obj) => obj.name === 'Security_Portal').url.replace(
- '${row.customerId}',
- row.customerId,
- ),
- },
- {
- icon: ,
- label: Portals.find((obj) => obj.name === 'Sharepoint_Admin').label,
- external: true,
- color: 'info',
- link: Portals.find((obj) => obj.name === 'Sharepoint_Admin').url.replace(
- '${row.customerId}',
- row.customerId,
- ),
- },
+ ...actions,
]}
placement="end"
visible={ocVisible}
@@ -175,27 +102,28 @@ const Offcanvas = (row, rowIndex, formatExtraData) => {
)
}
-function StatusIcon(graphErrorCount) {
- if (graphErrorCount > 0) {
- return
- } else {
- return
- }
-}
-
-function StatusText(graphErrorCount, lastGraphError) {
- if (graphErrorCount > 0) {
- return 'Error Count: ' + graphErrorCount + ' - Last Error: ' + lastGraphError
- } else {
- return 'No errors detected with this tenant'
- }
-}
-
const TenantsList = () => {
const TenantListSelector = useSelector((state) => state.app.TenantListSelector)
const tenant = useSelector((state) => state.app.currentTenant)
const [columnOmits, setOmitVisible] = useState(TenantListSelector)
+ const generatePortalColumn = (portal) => ({
+ name: portal.label,
+ omit: columnOmits,
+ selector: (row) => row['defaultDomainName'],
+ center: true,
+ cell: (row) => (
+
+
+
+ ),
+ })
+
const columns = [
{
name: 'Name',
@@ -213,158 +141,7 @@ const TenantsList = () => {
exportSelector: 'defaultDomainName',
minWidth: '200px',
},
- {
- name: Portals.find((obj) => obj.name === 'M365_Portal').label,
- omit: columnOmits,
- selector: (row) => row['customerId'],
- center: true,
- cell: (row) => (
- obj.name === 'M365_Portal').url.replace(
- '${row.customerId}',
- row.customerId,
- )}
- target="_blank"
- className="dlink"
- rel="noreferrer"
- >
-
-
- ),
- },
- {
- name: Portals.find((obj) => obj.name === 'Exchange_Portal').label,
- omit: columnOmits,
- selector: (row) => row['defaultDomainName'],
- center: true,
- cell: (row) => (
- obj.name === 'Exchange_Portal').url.replace(
- '${row.defaultDomainName}',
- row.defaultDomainName,
- )}
- target="_blank"
- className="dlink"
- rel="noreferrer"
- >
-
-
- ),
- },
- {
- name: Portals.find((obj) => obj.name === 'Entra_Portal').label,
- omit: columnOmits,
- selector: (row) => row['defaultDomainName'],
- center: true,
- cell: (row) => (
- obj.name === 'Entra_Portal').url.replace(
- '${row.defaultDomainName}',
- row.defaultDomainName,
- )}
- target="_blank"
- className="dlink"
- rel="noreferrer"
- >
-
-
- ),
- },
- {
- name: Portals.find((obj) => obj.name === 'Teams_Portal').label,
- omit: columnOmits,
- selector: (row) => row['defaultDomainName'],
- center: true,
- cell: (row) => (
- obj.name === 'Teams_Portal').url.replace(
- '${row.defaultDomainName}',
- row.defaultDomainName,
- )}
- target="_blank"
- className="dlink"
- rel="noreferrer"
- >
-
-
- ),
- },
- {
- name: Portals.find((obj) => obj.name === 'Azure_Portal').label,
- omit: columnOmits,
- selector: (row) => row['defaultDomainName'],
- center: true,
- cell: (row) => (
- obj.name === 'Azure_Portal').url.replace(
- '${row.defaultDomainName}',
- row.defaultDomainName,
- )}
- target="_blank"
- className="dlink"
- rel="noreferrer"
- >
-
-
- ),
- },
- {
- name: Portals.find((obj) => obj.name === 'Intune_Portal').label,
- omit: columnOmits,
- selector: (row) => row['defaultDomainName'],
- center: true,
- cell: (row) => (
- obj.name === 'Intune_Portal').url.replace(
- '${row.defaultDomainName}',
- row.defaultDomainName,
- )}
- target="_blank"
- className="dlink"
- rel="noreferrer"
- >
-
-
- ),
- },
- {
- name: Portals.find((obj) => obj.name === 'Security_Portal').label,
- selector: (row) => row['defaultDomainName'],
- center: true,
- omit: columnOmits,
- cell: (row) => (
- obj.name === 'Security_Portal').url.replace(
- '${row.customerId}',
- row.customerId,
- )}
- target="_blank"
- className="dlink"
- rel="noreferrer"
- >
-
-
- ),
- },
- {
- name: Portals.find((obj) => obj.name === 'Sharepoint_Admin').label,
- selector: (row) => row['defaultDomainName'],
- center: true,
- omit: columnOmits,
- cell: (row) => (
- obj.name === 'Sharepoint_Admin').url.replace(
- '${row.customerId}',
- row.customerId,
- )}
- target="_blank"
- className="dlink"
- rel="noreferrer"
- >
-
-
- ),
- },
+ ...Portals.map(generatePortalColumn),
{
exportSelector: 'customerId',
},