From e02c7ad6c856feec18e3a25f14aa34f8a89a59f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Kj=C3=A6rg=C3=A5rd?= Date: Tue, 11 Feb 2025 18:53:47 +0100 Subject: [PATCH 1/7] Update authentication methods to use negated state values --- .../tenant/administration/authentication-methods/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/tenant/administration/authentication-methods/index.js b/src/pages/tenant/administration/authentication-methods/index.js index cd8fc26259c3..d86eccb0c3e6 100644 --- a/src/pages/tenant/administration/authentication-methods/index.js +++ b/src/pages/tenant/administration/authentication-methods/index.js @@ -15,7 +15,7 @@ const Page = () => { type: "POST", icon: , url: "/api/SetAuthMethod", - data: { state: "enabled", id: "id" }, + data: { state: "!enabled", id: "id" }, confirmText: "Are you sure you want to enable this policy?", multiPost: false, }, @@ -24,7 +24,7 @@ const Page = () => { type: "POST", icon: , url: "/api/SetAuthMethod", - data: { state: "disabled", id: "id" }, + data: { state: "!disabled", id: "id" }, confirmText: "Are you sure you want to disable this policy?", multiPost: false, }, From adf719a90f27bcdb30dda8ef36556af8ae55e9a2 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Wed, 12 Feb 2025 10:31:05 -0500 Subject: [PATCH 2/7] bugfixes --- src/components/CippComponents/CippApiResults.jsx | 2 +- src/components/CippComponents/CippAutocomplete.jsx | 2 +- src/components/CippTable/CippGraphExplorerFilter.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/CippComponents/CippApiResults.jsx b/src/components/CippComponents/CippApiResults.jsx index 04f3f3062f28..4d0180f485df 100644 --- a/src/components/CippComponents/CippApiResults.jsx +++ b/src/components/CippComponents/CippApiResults.jsx @@ -294,7 +294,7 @@ export const CippApiResults = (props) => { ))} )} - {(apiObject.isSuccess || apiObject.isError) && finalResults.length > 0 ? ( + {(apiObject.isSuccess || apiObject.isError) && finalResults?.length > 0 ? ( tableDialog.handleOpen()}> diff --git a/src/components/CippComponents/CippAutocomplete.jsx b/src/components/CippComponents/CippAutocomplete.jsx index 8fee074a5cdb..b87f571b4d38 100644 --- a/src/components/CippComponents/CippAutocomplete.jsx +++ b/src/components/CippComponents/CippAutocomplete.jsx @@ -275,7 +275,7 @@ export const CippAutoComplete = (props) => { sx={sx} renderInput={(params) => ( - + {api?.url && api?.showRefresh && ( Date: Wed, 12 Feb 2025 17:57:30 +0100 Subject: [PATCH 3/7] New DisableQRCodePin standard --- src/data/standards.json | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/data/standards.json b/src/data/standards.json index f7a88174afc0..616a60642fe4 100644 --- a/src/data/standards.json +++ b/src/data/standards.json @@ -800,7 +800,7 @@ "impact": "High Impact", "impactColour": "danger", "powershellEquivalent": "Update-MgBetaPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration", - "recommendedBy": [] + "recommendedBy": ["CIPP"] }, { "name": "standards.DisableVoice", @@ -813,7 +813,7 @@ "impact": "High Impact", "impactColour": "danger", "powershellEquivalent": "Update-MgBetaPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration", - "recommendedBy": [] + "recommendedBy": ["CIPP"] }, { "name": "standards.DisableEmail", @@ -840,6 +840,19 @@ "powershellEquivalent": "Update-MgBetaPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration", "recommendedBy": [] }, + { + "name": "standards.DisableQRCodePin", + "cat": "Entra (AAD) Standards", + "tag": ["highimpact"], + "helpText": "This blocks users from using QR Code Pin as an MFA method. If a user only has QR Code Pin as a MFA method, they will be unable to log in.", + "docsDescription": "Disables QR Code Pin as an MFA method for the tenant. If a user only has QR Code Pin as a MFA method, they will be unable to sign in.", + "addedComponent": [], + "label": "Disables QR Code Pin as an MFA method", + "impact": "High Impact", + "impactColour": "danger", + "powershellEquivalent": "Update-MgBetaPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration", + "recommendedBy": [] + }, { "name": "standards.PerUserMFA", "cat": "Entra (AAD) Standards", From 22e0dbc45f0f67c36823ba76edc0499b651ab101 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Wed, 12 Feb 2025 12:53:54 -0500 Subject: [PATCH 4/7] add save to github for all template pages --- .../list-connectionfilter-templates/index.js | 46 +++++++++++++++++- .../spamfilter/list-connectionfilter/index.js | 4 +- .../email/spamfilter/list-templates/index.js | 46 +++++++++++++++++- .../list-connector-templates/index.js | 46 +++++++++++++++++- .../email/transport/list-templates/index.js | 47 ++++++++++++++++++- .../endpoint/MEM/list-templates/index.js | 46 +++++++++++++++++- .../administration/group-templates/index.js | 45 +++++++++++++++++- .../tenant/conditional/list-template/index.js | 45 +++++++++++++++++- .../tenant/standards/bpa-report/index.js | 47 ++++++++++++++++++- .../tenant/standards/list-standards/index.js | 2 +- 10 files changed, 361 insertions(+), 13 deletions(-) diff --git a/src/pages/email/spamfilter/list-connectionfilter-templates/index.js b/src/pages/email/spamfilter/list-connectionfilter-templates/index.js index 4a104db53a18..71b2a900ef3e 100644 --- a/src/pages/email/spamfilter/list-connectionfilter-templates/index.js +++ b/src/pages/email/spamfilter/list-connectionfilter-templates/index.js @@ -1,11 +1,55 @@ import { Layout as DashboardLayout } from "/src/layouts/index.js"; import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx"; -import { EyeIcon, TrashIcon } from "@heroicons/react/24/outline"; +import { TrashIcon } from "@heroicons/react/24/outline"; +import { GitHub } from "@mui/icons-material"; const Page = () => { const pageTitle = "Connection filter Templates"; const actions = [ + { + label: "Save to GitHub", + type: "POST", + url: "/api/ExecCommunityRepo", + icon: , + data: { + Action: "UploadTemplate", + GUID: "GUID", + }, + fields: [ + { + label: "Repository", + name: "FullName", + type: "select", + api: { + url: "/api/ListCommunityRepos", + data: { + WriteAccess: true, + }, + queryKey: "CommunityRepos-Write", + dataKey: "Results", + valueField: "FullName", + labelField: "FullName", + }, + multiple: false, + creatable: false, + required: true, + validators: { + required: { value: true, message: "This field is required" }, + }, + }, + { + label: "Commit Message", + placeholder: "Enter a commit message for adding this file to GitHub", + name: "Message", + type: "textField", + multiline: true, + required: true, + rows: 4, + }, + ], + confirmText: "Are you sure you want to save this template to the selected repository?", + }, { label: "Delete Template", type: "POST", diff --git a/src/pages/email/spamfilter/list-connectionfilter/index.js b/src/pages/email/spamfilter/list-connectionfilter/index.js index 02481161dc18..0ebf8fc05c5b 100644 --- a/src/pages/email/spamfilter/list-connectionfilter/index.js +++ b/src/pages/email/spamfilter/list-connectionfilter/index.js @@ -9,14 +9,14 @@ const Page = () => { const actions = [ { - label: "Create template based on rule", + label: "Create template based on filter", type: "POST", url: "/api/AddConnectionfilterTemplate", dataFunction: (data) => { return { ...data }; }, icon: , - confirmText: "Are you sure you want to create a template based on this rule?", + confirmText: "Are you sure you want to create a template based on this filter?", }, ]; diff --git a/src/pages/email/spamfilter/list-templates/index.js b/src/pages/email/spamfilter/list-templates/index.js index faa7f9a905a0..5f8784ebfc30 100644 --- a/src/pages/email/spamfilter/list-templates/index.js +++ b/src/pages/email/spamfilter/list-templates/index.js @@ -1,11 +1,55 @@ import { Layout as DashboardLayout } from "/src/layouts/index.js"; import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx"; -import { EyeIcon, TrashIcon } from "@heroicons/react/24/outline"; +import { TrashIcon } from "@heroicons/react/24/outline"; +import { GitHub } from "@mui/icons-material"; const Page = () => { const pageTitle = "Spamfilter Templates"; const actions = [ + { + label: "Save to GitHub", + type: "POST", + url: "/api/ExecCommunityRepo", + icon: , + data: { + Action: "UploadTemplate", + GUID: "GUID", + }, + fields: [ + { + label: "Repository", + name: "FullName", + type: "select", + api: { + url: "/api/ListCommunityRepos", + data: { + WriteAccess: true, + }, + queryKey: "CommunityRepos-Write", + dataKey: "Results", + valueField: "FullName", + labelField: "FullName", + }, + multiple: false, + creatable: false, + required: true, + validators: { + required: { value: true, message: "This field is required" }, + }, + }, + { + label: "Commit Message", + placeholder: "Enter a commit message for adding this file to GitHub", + name: "Message", + type: "textField", + multiline: true, + required: true, + rows: 4, + }, + ], + confirmText: "Are you sure you want to save this template to the selected repository?", + }, { label: "Delete Template", type: "POST", diff --git a/src/pages/email/transport/list-connector-templates/index.js b/src/pages/email/transport/list-connector-templates/index.js index 188e87254ab6..88dbb5277a9b 100644 --- a/src/pages/email/transport/list-connector-templates/index.js +++ b/src/pages/email/transport/list-connector-templates/index.js @@ -3,13 +3,57 @@ import { Button } from "@mui/material"; import Link from "next/link"; import { RocketLaunch } from "@mui/icons-material"; import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx"; -import { EyeIcon, TrashIcon } from "@heroicons/react/24/outline"; +import { TrashIcon } from "@heroicons/react/24/outline"; +import { GitHub } from "@mui/icons-material"; import ConnectorTemplateDetails from "../../../../components/CippComponents/ConnectorTemplateDetails"; const Page = () => { const pageTitle = "Exchange Connector Templates"; const actions = [ + { + label: "Save to GitHub", + type: "POST", + url: "/api/ExecCommunityRepo", + icon: , + data: { + Action: "UploadTemplate", + GUID: "GUID", + }, + fields: [ + { + label: "Repository", + name: "FullName", + type: "select", + api: { + url: "/api/ListCommunityRepos", + data: { + WriteAccess: true, + }, + queryKey: "CommunityRepos-Write", + dataKey: "Results", + valueField: "FullName", + labelField: "FullName", + }, + multiple: false, + creatable: false, + required: true, + validators: { + required: { value: true, message: "This field is required" }, + }, + }, + { + label: "Commit Message", + placeholder: "Enter a commit message for adding this file to GitHub", + name: "Message", + type: "textField", + multiline: true, + required: true, + rows: 4, + }, + ], + confirmText: "Are you sure you want to save this template to the selected repository?", + }, { label: "Delete Template", type: "POST", diff --git a/src/pages/email/transport/list-templates/index.js b/src/pages/email/transport/list-templates/index.js index fb40f8da0e9b..ecbe161d4015 100644 --- a/src/pages/email/transport/list-templates/index.js +++ b/src/pages/email/transport/list-templates/index.js @@ -1,14 +1,57 @@ import { Layout as DashboardLayout } from "/src/layouts/index.js"; import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx"; -import { EyeIcon, TrashIcon } from "@heroicons/react/24/outline"; +import { TrashIcon } from "@heroicons/react/24/outline"; import { Button } from "@mui/material"; -import { RocketLaunch } from "@mui/icons-material"; +import { RocketLaunch, GitHub } from "@mui/icons-material"; import Link from "next/link"; const Page = () => { const pageTitle = "Transport Rule Templates"; const actions = [ + { + label: "Save to GitHub", + type: "POST", + url: "/api/ExecCommunityRepo", + icon: , + data: { + Action: "UploadTemplate", + GUID: "GUID", + }, + fields: [ + { + label: "Repository", + name: "FullName", + type: "select", + api: { + url: "/api/ListCommunityRepos", + data: { + WriteAccess: true, + }, + queryKey: "CommunityRepos-Write", + dataKey: "Results", + valueField: "FullName", + labelField: "FullName", + }, + multiple: false, + creatable: false, + required: true, + validators: { + required: { value: true, message: "This field is required" }, + }, + }, + { + label: "Commit Message", + placeholder: "Enter a commit message for adding this file to GitHub", + name: "Message", + type: "textField", + multiline: true, + required: true, + rows: 4, + }, + ], + confirmText: "Are you sure you want to save this template to the selected repository?", + }, { label: "Delete Template", type: "POST", diff --git a/src/pages/endpoint/MEM/list-templates/index.js b/src/pages/endpoint/MEM/list-templates/index.js index e61d3930aedc..3c98cef08836 100644 --- a/src/pages/endpoint/MEM/list-templates/index.js +++ b/src/pages/endpoint/MEM/list-templates/index.js @@ -1,6 +1,7 @@ import { Layout as DashboardLayout } from "/src/layouts/index.js"; import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx"; -import { EyeIcon, PencilIcon, TrashIcon } from "@heroicons/react/24/outline"; +import { PencilIcon, TrashIcon } from "@heroicons/react/24/outline"; +import { GitHub } from "@mui/icons-material"; import CippJsonView from "../../../../components/CippFormPages/CippJSONView"; const Page = () => { @@ -30,6 +31,49 @@ const Page = () => { icon: , color: "info", }, + { + label: "Save to GitHub", + type: "POST", + url: "/api/ExecCommunityRepo", + icon: , + data: { + Action: "UploadTemplate", + GUID: "GUID", + }, + fields: [ + { + label: "Repository", + name: "FullName", + type: "select", + api: { + url: "/api/ListCommunityRepos", + data: { + WriteAccess: true, + }, + queryKey: "CommunityRepos-Write", + dataKey: "Results", + valueField: "FullName", + labelField: "FullName", + }, + multiple: false, + creatable: false, + required: true, + validators: { + required: { value: true, message: "This field is required" }, + }, + }, + { + label: "Commit Message", + placeholder: "Enter a commit message for adding this file to GitHub", + name: "Message", + type: "textField", + multiline: true, + required: true, + rows: 4, + }, + ], + confirmText: "Are you sure you want to save this template to the selected repository?", + }, { label: "Delete Template", type: "GET", diff --git a/src/pages/identity/administration/group-templates/index.js b/src/pages/identity/administration/group-templates/index.js index 69a3a55d6911..dc93aec61dd7 100644 --- a/src/pages/identity/administration/group-templates/index.js +++ b/src/pages/identity/administration/group-templates/index.js @@ -1,7 +1,7 @@ import { Button } from "@mui/material"; import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx"; import { Layout as DashboardLayout } from "/src/layouts/index.js"; -import { AddBox, RocketLaunch, Delete } from "@mui/icons-material"; +import { AddBox, RocketLaunch, Delete, GitHub } from "@mui/icons-material"; import Link from "next/link"; import { CippCodeBlock } from "../../../../components/CippComponents/CippCodeBlock"; @@ -9,6 +9,49 @@ const Page = () => { const pageTitle = "Group Templates"; const actions = [ + { + label: "Save to GitHub", + type: "POST", + url: "/api/ExecCommunityRepo", + icon: , + data: { + Action: "UploadTemplate", + GUID: "GUID", + }, + fields: [ + { + label: "Repository", + name: "FullName", + type: "select", + api: { + url: "/api/ListCommunityRepos", + data: { + WriteAccess: true, + }, + queryKey: "CommunityRepos-Write", + dataKey: "Results", + valueField: "FullName", + labelField: "FullName", + }, + multiple: false, + creatable: false, + required: true, + validators: { + required: { value: true, message: "This field is required" }, + }, + }, + { + label: "Commit Message", + placeholder: "Enter a commit message for adding this file to GitHub", + name: "Message", + type: "textField", + multiline: true, + required: true, + rows: 4, + }, + ], + confirmText: "Are you sure you want to save this template to the selected repository?", + }, { label: "Delete Template", type: "GET", diff --git a/src/pages/tenant/conditional/list-template/index.js b/src/pages/tenant/conditional/list-template/index.js index b45950ba60dc..f8cbb6eb1b2a 100644 --- a/src/pages/tenant/conditional/list-template/index.js +++ b/src/pages/tenant/conditional/list-template/index.js @@ -2,12 +2,55 @@ import { Layout as DashboardLayout } from "/src/layouts/index.js"; import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx"; import { Button } from "@mui/material"; import CippJsonView from "../../../../components/CippFormPages/CippJSONView"; -import { Delete } from "@mui/icons-material"; +import { Delete, GitHub } from "@mui/icons-material"; const Page = () => { const pageTitle = "Available Conditional Access Templates"; const actions = [ + { + label: "Save to GitHub", + type: "POST", + url: "/api/ExecCommunityRepo", + icon: , + data: { + Action: "UploadTemplate", + GUID: "GUID", + }, + fields: [ + { + label: "Repository", + name: "FullName", + type: "select", + api: { + url: "/api/ListCommunityRepos", + data: { + WriteAccess: true, + }, + queryKey: "CommunityRepos-Write", + dataKey: "Results", + valueField: "FullName", + labelField: "FullName", + }, + multiple: false, + creatable: false, + required: true, + validators: { + required: { value: true, message: "This field is required" }, + }, + }, + { + label: "Commit Message", + placeholder: "Enter a commit message for adding this file to GitHub", + name: "Message", + type: "textField", + multiline: true, + required: true, + rows: 4, + }, + ], + confirmText: "Are you sure you want to save this template to the selected repository?", + }, { label: "Delete Template", type: "GET", diff --git a/src/pages/tenant/standards/bpa-report/index.js b/src/pages/tenant/standards/bpa-report/index.js index 50cf80d53b99..e59b5c7ea5bf 100644 --- a/src/pages/tenant/standards/bpa-report/index.js +++ b/src/pages/tenant/standards/bpa-report/index.js @@ -3,7 +3,7 @@ import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx" import { Layout as DashboardLayout } from "/src/layouts/index.js"; // had to add an extra path here because I added an extra folder structure. We should switch to absolute pathing so we dont have to deal with relative. import Link from "next/link"; import { EyeIcon } from "@heroicons/react/24/outline"; -import { CopyAll, Delete, Edit, AddBox } from "@mui/icons-material"; +import { CopyAll, Delete, Edit, AddBox, GitHub } from "@mui/icons-material"; const Page = () => { const pageTitle = "Best Practice Reports"; @@ -30,6 +30,49 @@ const Page = () => { color: "success", target: "_self", }, + { + label: "Save to GitHub", + type: "POST", + url: "/api/ExecCommunityRepo", + icon: , + data: { + Action: "UploadTemplate", + GUID: "GUID", + }, + fields: [ + { + label: "Repository", + name: "FullName", + type: "select", + api: { + url: "/api/ListCommunityRepos", + data: { + WriteAccess: true, + }, + queryKey: "CommunityRepos-Write", + dataKey: "Results", + valueField: "FullName", + labelField: "FullName", + }, + multiple: false, + creatable: false, + required: true, + validators: { + required: { value: true, message: "This field is required" }, + }, + }, + { + label: "Commit Message", + placeholder: "Enter a commit message for adding this file to GitHub", + name: "Message", + type: "textField", + multiline: true, + required: true, + rows: 4, + }, + ], + confirmText: "Are you sure you want to save this template to the selected repository?", + }, { label: "Delete Template", type: "GET", @@ -54,7 +97,7 @@ const Page = () => { } actions={actions} simpleColumns={["Name", "Style"]} - queryKey="ListPATemplates" + queryKey="ListBPATemplates" /> ); }; diff --git a/src/pages/tenant/standards/list-standards/index.js b/src/pages/tenant/standards/list-standards/index.js index f1725d1402a4..3bd38b3b816c 100644 --- a/src/pages/tenant/standards/list-standards/index.js +++ b/src/pages/tenant/standards/list-standards/index.js @@ -75,7 +75,7 @@ const Page = () => { labelField: "FullName", }, multiple: false, - createable: false, + creatable: false, required: true, validators: { required: { value: true, message: "This field is required" }, From af17615c5d3df07310ba27b2befee1d91f545175 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Wed, 12 Feb 2025 13:27:10 -0500 Subject: [PATCH 5/7] add conditionals to GitHub action requiring a token --- .../list-connectionfilter-templates/index.js | 7 ++++++- .../email/spamfilter/list-templates/index.js | 7 ++++++- .../transport/list-connector-templates/index.js | 7 ++++++- src/pages/email/transport/list-templates/index.js | 7 ++++++- src/pages/endpoint/MEM/list-templates/index.js | 7 ++++++- .../administration/group-templates/index.js | 7 ++++++- .../tenant/conditional/list-template/index.js | 7 ++++++- src/pages/tenant/standards/bpa-report/index.js | 6 ++++++ .../tenant/standards/list-standards/index.js | 6 +++++- src/pages/tools/community-repos/index.js | 15 +++++++++++---- 10 files changed, 64 insertions(+), 12 deletions(-) diff --git a/src/pages/email/spamfilter/list-connectionfilter-templates/index.js b/src/pages/email/spamfilter/list-connectionfilter-templates/index.js index 71b2a900ef3e..9eeb2638a408 100644 --- a/src/pages/email/spamfilter/list-connectionfilter-templates/index.js +++ b/src/pages/email/spamfilter/list-connectionfilter-templates/index.js @@ -2,10 +2,14 @@ import { Layout as DashboardLayout } from "/src/layouts/index.js"; import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx"; import { TrashIcon } from "@heroicons/react/24/outline"; import { GitHub } from "@mui/icons-material"; +import { ApiGetCall } from "/src/api/ApiCall"; const Page = () => { const pageTitle = "Connection filter Templates"; - + const integrations = ApiGetCall({ + url: "/api/ListExtensionsConfig", + queryKey: "Integrations", + }); const actions = [ { label: "Save to GitHub", @@ -49,6 +53,7 @@ const Page = () => { }, ], confirmText: "Are you sure you want to save this template to the selected repository?", + condition: () => integrations.isSuccess && integrations?.data?.GitHub.Enabled, }, { label: "Delete Template", diff --git a/src/pages/email/spamfilter/list-templates/index.js b/src/pages/email/spamfilter/list-templates/index.js index 5f8784ebfc30..ce86b031198c 100644 --- a/src/pages/email/spamfilter/list-templates/index.js +++ b/src/pages/email/spamfilter/list-templates/index.js @@ -2,10 +2,14 @@ import { Layout as DashboardLayout } from "/src/layouts/index.js"; import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx"; import { TrashIcon } from "@heroicons/react/24/outline"; import { GitHub } from "@mui/icons-material"; +import { ApiGetCall } from "/src/api/ApiCall"; const Page = () => { const pageTitle = "Spamfilter Templates"; - + const integrations = ApiGetCall({ + url: "/api/ListExtensionsConfig", + queryKey: "Integrations", + }); const actions = [ { label: "Save to GitHub", @@ -49,6 +53,7 @@ const Page = () => { }, ], confirmText: "Are you sure you want to save this template to the selected repository?", + condition: () => integrations.isSuccess && integrations?.data?.GitHub.Enabled, }, { label: "Delete Template", diff --git a/src/pages/email/transport/list-connector-templates/index.js b/src/pages/email/transport/list-connector-templates/index.js index 88dbb5277a9b..567eac960f94 100644 --- a/src/pages/email/transport/list-connector-templates/index.js +++ b/src/pages/email/transport/list-connector-templates/index.js @@ -6,10 +6,14 @@ import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx" import { TrashIcon } from "@heroicons/react/24/outline"; import { GitHub } from "@mui/icons-material"; import ConnectorTemplateDetails from "../../../../components/CippComponents/ConnectorTemplateDetails"; +import { ApiGetCall } from "/src/api/ApiCall"; const Page = () => { const pageTitle = "Exchange Connector Templates"; - + const integrations = ApiGetCall({ + url: "/api/ListExtensionsConfig", + queryKey: "Integrations", + }); const actions = [ { label: "Save to GitHub", @@ -53,6 +57,7 @@ const Page = () => { }, ], confirmText: "Are you sure you want to save this template to the selected repository?", + condition: () => integrations.isSuccess && integrations?.data?.GitHub.Enabled, }, { label: "Delete Template", diff --git a/src/pages/email/transport/list-templates/index.js b/src/pages/email/transport/list-templates/index.js index ecbe161d4015..5e9e8d12e90e 100644 --- a/src/pages/email/transport/list-templates/index.js +++ b/src/pages/email/transport/list-templates/index.js @@ -4,10 +4,14 @@ import { TrashIcon } from "@heroicons/react/24/outline"; import { Button } from "@mui/material"; import { RocketLaunch, GitHub } from "@mui/icons-material"; import Link from "next/link"; +import { ApiGetCall } from "/src/api/ApiCall"; const Page = () => { const pageTitle = "Transport Rule Templates"; - + const integrations = ApiGetCall({ + url: "/api/ListExtensionsConfig", + queryKey: "Integrations", + }); const actions = [ { label: "Save to GitHub", @@ -51,6 +55,7 @@ const Page = () => { }, ], confirmText: "Are you sure you want to save this template to the selected repository?", + condition: () => integrations.isSuccess && integrations?.data?.GitHub.Enabled, }, { label: "Delete Template", diff --git a/src/pages/endpoint/MEM/list-templates/index.js b/src/pages/endpoint/MEM/list-templates/index.js index 3c98cef08836..9a1dfc6e3264 100644 --- a/src/pages/endpoint/MEM/list-templates/index.js +++ b/src/pages/endpoint/MEM/list-templates/index.js @@ -3,10 +3,14 @@ import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx" import { PencilIcon, TrashIcon } from "@heroicons/react/24/outline"; import { GitHub } from "@mui/icons-material"; import CippJsonView from "../../../../components/CippFormPages/CippJSONView"; +import { ApiGetCall } from "/src/api/ApiCall"; const Page = () => { const pageTitle = "Available Endpoint Manager Templates"; - + const integrations = ApiGetCall({ + url: "/api/ListExtensionsConfig", + queryKey: "Integrations", + }); const actions = [ { label: "Edit Template Name and Description", @@ -73,6 +77,7 @@ const Page = () => { }, ], confirmText: "Are you sure you want to save this template to the selected repository?", + condition: () => integrations.isSuccess && integrations?.data?.GitHub.Enabled, }, { label: "Delete Template", diff --git a/src/pages/identity/administration/group-templates/index.js b/src/pages/identity/administration/group-templates/index.js index dc93aec61dd7..d1d047594a89 100644 --- a/src/pages/identity/administration/group-templates/index.js +++ b/src/pages/identity/administration/group-templates/index.js @@ -4,10 +4,14 @@ import { Layout as DashboardLayout } from "/src/layouts/index.js"; import { AddBox, RocketLaunch, Delete, GitHub } from "@mui/icons-material"; import Link from "next/link"; import { CippCodeBlock } from "../../../../components/CippComponents/CippCodeBlock"; +import { ApiGetCall } from "/src/api/ApiCall"; const Page = () => { const pageTitle = "Group Templates"; - + const integrations = ApiGetCall({ + url: "/api/ListExtensionsConfig", + queryKey: "Integrations", + }); const actions = [ { label: "Save to GitHub", @@ -51,6 +55,7 @@ const Page = () => { }, ], confirmText: "Are you sure you want to save this template to the selected repository?", + condition: () => integrations.isSuccess && integrations?.data?.GitHub.Enabled, }, { label: "Delete Template", diff --git a/src/pages/tenant/conditional/list-template/index.js b/src/pages/tenant/conditional/list-template/index.js index f8cbb6eb1b2a..fbfb20795f40 100644 --- a/src/pages/tenant/conditional/list-template/index.js +++ b/src/pages/tenant/conditional/list-template/index.js @@ -3,10 +3,14 @@ import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx" import { Button } from "@mui/material"; import CippJsonView from "../../../../components/CippFormPages/CippJSONView"; import { Delete, GitHub } from "@mui/icons-material"; +import { ApiGetCall } from "/src/api/ApiCall"; const Page = () => { const pageTitle = "Available Conditional Access Templates"; - + const integrations = ApiGetCall({ + url: "/api/ListExtensionsConfig", + queryKey: "Integrations", + }); const actions = [ { label: "Save to GitHub", @@ -50,6 +54,7 @@ const Page = () => { }, ], confirmText: "Are you sure you want to save this template to the selected repository?", + condition: () => integrations.isSuccess && integrations?.data?.GitHub.Enabled, }, { label: "Delete Template", diff --git a/src/pages/tenant/standards/bpa-report/index.js b/src/pages/tenant/standards/bpa-report/index.js index e59b5c7ea5bf..1bb4a6cca89b 100644 --- a/src/pages/tenant/standards/bpa-report/index.js +++ b/src/pages/tenant/standards/bpa-report/index.js @@ -4,9 +4,14 @@ import { Layout as DashboardLayout } from "/src/layouts/index.js"; // had to add import Link from "next/link"; import { EyeIcon } from "@heroicons/react/24/outline"; import { CopyAll, Delete, Edit, AddBox, GitHub } from "@mui/icons-material"; +import { ApiGetCall } from "/src/api/ApiCall"; const Page = () => { const pageTitle = "Best Practice Reports"; + const integrations = ApiGetCall({ + url: "/api/ListExtensionsConfig", + queryKey: "Integrations", + }); const actions = [ { label: "View Report", @@ -72,6 +77,7 @@ const Page = () => { }, ], confirmText: "Are you sure you want to save this template to the selected repository?", + condition: () => integrations.isSuccess && integrations?.data?.GitHub.Enabled, }, { label: "Delete Template", diff --git a/src/pages/tenant/standards/list-standards/index.js b/src/pages/tenant/standards/list-standards/index.js index 3bd38b3b816c..023e58df5071 100644 --- a/src/pages/tenant/standards/list-standards/index.js +++ b/src/pages/tenant/standards/list-standards/index.js @@ -9,7 +9,10 @@ import { CippApiResults } from "../../../../components/CippComponents/CippApiRes const Page = () => { const oldStandards = ApiGetCall({ url: "/api/ListStandards", queryKey: "ListStandards-legacy" }); - + const integrations = ApiGetCall({ + url: "/api/ListExtensionsConfig", + queryKey: "Integrations", + }); const pageTitle = "Standard Templates"; const actions = [ { @@ -92,6 +95,7 @@ const Page = () => { }, ], confirmText: "Are you sure you want to save this template to the selected repository?", + condition: () => integrations.isSuccess && integrations?.data?.GitHub.Enabled, }, { label: "Delete Template", diff --git a/src/pages/tools/community-repos/index.js b/src/pages/tools/community-repos/index.js index 56cfd7a62e30..34a5bd9b8510 100644 --- a/src/pages/tools/community-repos/index.js +++ b/src/pages/tools/community-repos/index.js @@ -17,7 +17,6 @@ import { Tooltip, Typography, Alert, - Link, Chip, } from "@mui/material"; import { TrashIcon } from "@heroicons/react/24/outline"; @@ -29,9 +28,8 @@ import AddIcon from "@mui/icons-material/Add"; import { Box } from "@mui/system"; import { Add, ForkLeft, OpenInNew } from "@mui/icons-material"; import { CippApiResults } from "/src/components/CippComponents/CippApiResults"; -import { ApiGetCall } from "../../../api/ApiCall"; -import NextLink from "next/link"; import CippFormComponent from "../../../components/CippComponents/CippFormComponent"; +import { ApiGetCall } from "../../../api/ApiCall"; const Page = () => { const [openSearch, setOpenSearch] = useState(false); @@ -42,6 +40,11 @@ const Page = () => { const [openCreate, setOpenCreate] = useState(false); const createForm = useForm({ mode: "onChange", defaultValues: { Type: "user" } }); + const integrations = ApiGetCall({ + url: "/api/ListExtensionsConfig", + queryKey: "Integrations", + }); + const createMutation = ApiPostCall({ urlFromData: true, relatedQueryKeys: ["CommunityRepos"], @@ -176,7 +179,11 @@ const Page = () => { - From be8595eafdfcf6cbfdf01054df0eee09db6f45c5 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Wed, 12 Feb 2025 14:49:34 -0500 Subject: [PATCH 6/7] UI tweaks --- src/pages/tools/community-repos/index.js | 315 +++++++++++++---------- 1 file changed, 173 insertions(+), 142 deletions(-) diff --git a/src/pages/tools/community-repos/index.js b/src/pages/tools/community-repos/index.js index 34a5bd9b8510..433f1559cdd6 100644 --- a/src/pages/tools/community-repos/index.js +++ b/src/pages/tools/community-repos/index.js @@ -18,15 +18,16 @@ import { Typography, Alert, Chip, + SvgIcon, } from "@mui/material"; -import { TrashIcon } from "@heroicons/react/24/outline"; +import { MagnifyingGlassIcon, TrashIcon } from "@heroicons/react/24/outline"; import { ApiPostCall } from "/src/api/ApiCall"; import { useForm, FormProvider } from "react-hook-form"; import { Radio, RadioGroup, FormControlLabel } from "@mui/material"; import { CippFormCondition } from "/src/components/CippComponents/CippFormCondition"; import AddIcon from "@mui/icons-material/Add"; import { Box } from "@mui/system"; -import { Add, ForkLeft, OpenInNew } from "@mui/icons-material"; +import { Add, AddBox, ForkLeft, OpenInNew } from "@mui/icons-material"; import { CippApiResults } from "/src/components/CippComponents/CippApiResults"; import CippFormComponent from "../../../components/CippComponents/CippFormComponent"; import { ApiGetCall } from "../../../api/ApiCall"; @@ -176,15 +177,22 @@ const Page = () => { simpleColumns={["Name", "Owner", "URL", "Visibility", "WriteAccess", "UploadBranch"]} cardButton={ <> - } @@ -226,6 +234,10 @@ const Page = () => { valueField: "login", }} multiple={false} + required={true} + validators={{ + required: { value: true, message: "Organization is required" }, + }} /> { name="repoName" label="Repository Name" formControl={createForm} + required={true} /> { setOpenSearch(false)}> Add Community Repositories from GitHub - - - searchForm.setValue("searchType", e.target.value)} + + searchForm.setValue("searchType", e.target.value)} + > + } label="User" /> + } label="Org" /> + } label="Repository" /> + + + - } label="User" /> - } label="Org" /> - } label="Repository" /> - - - setRepo(e.target.value)} + required={true} + /> + + + setUser(e.target.value)} + required={true} + /> + + - setRepo(e.target.value)} - /> - - + + + setOrg(e.target.value)} + required={true} + /> + - setUser(e.target.value)} - /> + freeSolo + fullWidth + options={[]} + label="Search Terms" + /> + + + - - - - setOrg(e.target.value)} - /> - - + {searchMutation.isPending || + (searchMutation.isSuccess && ( + + + Search Results - - - - {searchMutation.isPending || - (searchMutation.isSuccess && Search Results)} - {searchMutation.isPending ? ( - - - - ) : ( - <> - {searchMutation.isSuccess && results.length === 0 && ( + ))} + {searchMutation.isPending ? ( + <> + + + Searching... + + + + + + + + + + + + ) : ( + <> + {(searchMutation.isSuccess && results.length === 0) || + (searchMutation.isError && ( No search results found. Refine your query and try again. - )} - - {results.map((r) => ( - - - - - handleAdd(r.id)}> - - - - - window.open(r.html_url, "_blank")} - > - - - - - - - {r.full_name} - - - - - {r.html_url} + ))} + + {results.map((r) => ( + + + + + handleAdd(r.id)}> + + + + + window.open(r.html_url, "_blank")} + > + + + + + + + {r.full_name} + - - - - ))} - - - )} - - - - + + {r.html_url} + + + + + + ))} + + + )} + + + @@ -445,10 +446,18 @@ const Page = () => { - -