Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] dev from KelvinTegelaar:dev #86

Merged
merged 14 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/CippComponents/CippApiResults.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const extractAllResults = (data) => {

const getSeverity = (text) => {
if (typeof text !== "string") return "success";
return /error|failed|exception|not found/i.test(text) ? "error" : "success";
return /error|failed|exception|not found|invalid_grant/i.test(text) ? "error" : "success";
};

const processResultItem = (item) => {
Expand Down
31 changes: 17 additions & 14 deletions src/components/CippComponents/CippFormComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@ import {
} from "mui-tiptap";
import StarterKit from "@tiptap/starter-kit";
import { CippDataTable } from "../CippTable/CippDataTable";
import React from "react";

// Helper function to convert bracket notation to dot notation
const convertBracketsToDots = (name) => {
return name.replace(/\[(\d+)\]/g, ".$1"); // Replace [0] with .0
};

const MemoizedCippAutoComplete = React.memo((props) => {
return <CippAutoComplete {...props} />;
});

export const CippFormComponent = (props) => {
const {
validators,
Expand Down Expand Up @@ -233,19 +238,17 @@ export const CippFormComponent = (props) => {
name={convertedName}
control={formControl.control}
rules={validators}
render={({ field }) =>
React.memo(
<CippAutoComplete
{...other}
isFetching={other.isFetching}
variant="filled"
defaultValue={field.value}
label={label}
multiple={false}
onChange={(value) => field.onChange(value.value)}
/>
)
}
render={({ field }) => (
<MemoizedCippAutoComplete
{...other}
isFetching={other.isFetching}
variant="filled"
defaultValue={field.value}
label={label}
multiple={false}
onChange={(value) => field.onChange(value.value)}
/>
)}
/>
</div>
<Typography variant="subtitle3" color="error">
Expand All @@ -263,7 +266,7 @@ export const CippFormComponent = (props) => {
control={formControl.control}
rules={validators}
render={({ field }) => (
<CippAutoComplete
<MemoizedCippAutoComplete
{...other}
isFetching={other.isFetching}
variant="filled"
Expand Down
2 changes: 1 addition & 1 deletion src/components/CippComponents/CippUserActions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export const CippUserActions = () => {
},
{
label: "Clear Immutable ID",
type: "GET",
type: "POST",
icon: <Clear />,
url: "/api/ExecClrImmId",
data: {
Expand Down
9 changes: 8 additions & 1 deletion src/components/CippWizard/CippWizardCSVImport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ export const CippWizardCSVImport = (props) => {
const [newTableData, setTableData] = useState([]);
const [open, setOpen] = useState(false);

// Register form field with validation
formControl.register(name, {
validate: (value) => Array.isArray(value) && value.length > 0,
});

const handleRemoveItem = (row) => {
if (row === undefined) return false;
const index = tableData?.findIndex((item) => item === row);
Expand All @@ -49,7 +54,9 @@ export const CippWizardCSVImport = (props) => {
};

useEffect(() => {
formControl.setValue(name, newTableData);
formControl.setValue(name, newTableData, {
shouldValidate: true,
});
}, [newTableData]);

const actions = [
Expand Down
6 changes: 6 additions & 0 deletions src/components/CippWizard/CippWizardOffboarding.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ export const CippWizardOffboarding = (props) => {
type="switch"
formControl={formControl}
/>
<CippFormComponent
name="ClearImmutableId"
label="Clear Immutable ID"
type="switch"
formControl={formControl}
/>
<CippFormComponent
name="ResetPass"
label="Reset Password"
Expand Down
4 changes: 2 additions & 2 deletions src/data/Extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@
"logo": "/assets/integrations/github.png",
"logoDark": "/assets/integrations/github_dark.png",
"description": "Enable the GitHub integration to manage your repositories from CIPP.",
"helpText": "This integration allows you to manage your GitHub repositories from CIPP. Requires a GitHub Fine Grained Personal Access Token (PAT).",
"helpText": "This integration allows you to manage GitHub repositories from CIPP, including the Community Repositorities functionality. Requires a GitHub Personal Access Token (PAT) with a minimum of repo:public_repo permissions. You can create a PAT in your GitHub account settings, see the GitHub Token documentation for more info.",
"links": [
{
"name": "GitHub Token",
Expand All @@ -526,7 +526,7 @@
{
"type": "password",
"name": "GitHub.APIKey",
"label": "GitHub Fine Grained Personal Access Token",
"label": "GitHub Personal Access Token",
"placeholder": "Enter your GitHub PAT",
"required": true
},
Expand Down
9 changes: 9 additions & 0 deletions src/data/alerts.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@
"label": "Alert on overused licenses",
"recommendedRunInterval": "7d"
},
{
"name": "EntraLicenseUtilization",
"label": "Alert on Entra ID P1/P2 license over-utilization",
"recommendedRunInterval": "7d",
"requiresInput": true,
"inputType": "textField",
"inputLabel": "Alert when utilization exceeds % (default: 110)",
"inputName": "EntraLicenseUtilizationThreshold"
},
{
"name": "AppSecretExpiry",
"label": "Alert on expiring application secrets",
Expand Down
Loading