diff --git a/src/components/CippComponents/CippApiResults.jsx b/src/components/CippComponents/CippApiResults.jsx index b1fee51f09de..3ef597b2ddb1 100644 --- a/src/components/CippComponents/CippApiResults.jsx +++ b/src/components/CippComponents/CippApiResults.jsx @@ -52,40 +52,47 @@ const extractAllResults = (data) => { return; } - const ignoreKeys = ["metadata", "Metadata"]; - - if (typeof obj === "object") { - Object.keys(obj).forEach((key) => { - const value = obj[key]; - if (ignoreKeys.includes(key)) return; - if (["Results", "Result", "results", "result"].includes(key)) { - if (Array.isArray(value)) { - value.forEach((valItem) => { - const processed = processResultItem(valItem); + if (obj?.resultText) { + const processed = processResultItem(obj); + if (processed) { + results.push(processed); + } + } else { + const ignoreKeys = ["metadata", "Metadata"]; + + if (typeof obj === "object") { + Object.keys(obj).forEach((key) => { + const value = obj[key]; + if (ignoreKeys.includes(key)) return; + if (["Results", "Result", "results", "result"].includes(key)) { + if (Array.isArray(value)) { + value.forEach((valItem) => { + const processed = processResultItem(valItem); + if (processed) { + results.push(processed); + } else { + extractFrom(valItem); + } + }); + } else if (typeof value === "object") { + const processed = processResultItem(value); if (processed) { results.push(processed); } else { - extractFrom(valItem); + extractFrom(value); } - }); - } else if (typeof value === "object") { - const processed = processResultItem(value); - if (processed) { - results.push(processed); - } else { - extractFrom(value); + } else if (typeof value === "string") { + results.push({ + text: value, + copyField: value, + severity: getSeverity(value), + }); } - } else if (typeof value === "string") { - results.push({ - text: value, - copyField: value, - severity: getSeverity(value), - }); + } else { + extractFrom(value); } - } else { - extractFrom(value); - } - }); + }); + } } }; diff --git a/src/components/CippComponents/CippAutocomplete.jsx b/src/components/CippComponents/CippAutocomplete.jsx index 0cb207b835dc..1742ab9c17f2 100644 --- a/src/components/CippComponents/CippAutocomplete.jsx +++ b/src/components/CippComponents/CippAutocomplete.jsx @@ -1,5 +1,11 @@ import { ArrowDropDown } from "@mui/icons-material"; -import { Autocomplete, CircularProgress, createFilterOptions, TextField, IconButton } from "@mui/material"; +import { + Autocomplete, + CircularProgress, + createFilterOptions, + TextField, + IconButton, +} from "@mui/material"; import { useEffect, useState } from "react"; import { useSettings } from "../../hooks/use-settings"; import { getCippError } from "../../utils/get-cipp-error"; @@ -189,7 +195,9 @@ export const CippAutoComplete = (props) => { } return item; }); - newValue = newValue.filter((item) => item.value && item.value.trim() !== "" && item.value !== "error"); + newValue = newValue.filter( + (item) => item.value && item.value !== "" && item.value !== "error" && item.value !== -1 + ); } else { if (newValue?.manual || !newValue?.label) { newValue = { @@ -200,7 +208,7 @@ export const CippAutoComplete = (props) => { onCreateOption(newValue, newValue?.addedFields); } } - if (!newValue?.value || !newValue.value.trim() || newValue.value === "error") { + if (!newValue?.value || newValue.value === "error") { newValue = null; } } diff --git a/src/data/Extensions.json b/src/data/Extensions.json index e81d25cf3468..9fe08b00eb57 100644 --- a/src/data/Extensions.json +++ b/src/data/Extensions.json @@ -156,15 +156,25 @@ "type": "textField", "name": "HaloPSA.Tenant", "label": "HaloPSA Tenant", - "placeholder": "Enter your HaloPSA Tenant (Leave blank if self-hosted", + "placeholder": "Enter your HaloPSA Tenant (Leave blank if self-hosted)", "required": true }, { - "type": "textField", + "type": "autoComplete", "name": "HaloPSA.TicketType", - "label": "HaloPSA Ticket Type ID", - "placeholder": "Enter your HaloPSA ticket type to use for CIPP Tickets. Leave blank for default.", - "required": true + "label": "Select your HaloPSA Ticket Type, leave blank for default.", + "multiple": false, + "api": { + "url": "/api/ExecExtensionMapping", + "data": { + "List": "HaloPSAFields" + }, + "queryKey": "HaloTicketTypes", + "dataKey": "TicketTypes", + "labelField": "name", + "valueField": "id", + "showRefresh": true + } }, { "type": "textField", @@ -344,6 +354,11 @@ "name": "PWPush.Enabled", "label": "Enable Integration - Replace passwords with PWPush links" }, + { + "type": "switch", + "name": "PWPush.PWPushPro", + "label": "PWPush Pro/Premium account" + }, { "type": "textField", "name": "PWPush.BaseUrl", @@ -354,7 +369,7 @@ "type": "textField", "name": "PWPush.EmailAddress", "label": "PWPush email address", - "placeholder": "Enter your email address for PWPush. (optional)" + "placeholder": "Enter your email address for PWPush. (Free/Self-Hosted only)" }, { "type": "password", @@ -363,10 +378,25 @@ "placeholder": "Enter your PWPush API Key. (optional)" }, { - "type": "switch", - "name": "PWPush.RetrievalStep", - "label": "Click to retrieve password (recommended)" + "type": "autoComplete", + "name": "PWPush.AccountId", + "label": "Select your PWPush Account for branding (Pro/Premium only)", + "multiple": false, + "api": { + "url": "/api/ExecExtensionMapping?List=PWPushFields", + "queryKey": "PWPushAccounts", + "dataKey": "Accounts", + "labelField": "name", + "valueField": "id", + "showRefresh": true + }, + "condition": { + "field": "PWPush.PWPushPro", + "compareType": "is", + "compareValue": true + } }, + { "type": "number", "name": "PWPush.ExpireAfterDays", @@ -379,6 +409,11 @@ "label": "Expiration after views", "placeholder": "Expiration after views. (optional)" }, + { + "type": "switch", + "name": "PWPush.RetrievalStep", + "label": "Click to retrieve password (recommended)" + }, { "type": "switch", "name": "PWPush.DeletableByViewer",