diff --git a/package.json b/package.json index d4d4aad1955a..13dac459bf3f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cipp", - "version": "7.0.0", + "version": "7.1.3", "author": "CIPP Contributors", "homepage": "https://cipp.app/", "bugs": { diff --git a/public/version.json b/public/version.json index ef511cf84994..795806e4fd04 100644 --- a/public/version.json +++ b/public/version.json @@ -1,3 +1,3 @@ { - "version": "7.1.2" + "version": "7.1.3" } diff --git a/src/components/CippFormPages/CippSchedulerForm.jsx b/src/components/CippFormPages/CippSchedulerForm.jsx index e18e9c57421a..5bc71dd02211 100644 --- a/src/components/CippFormPages/CippSchedulerForm.jsx +++ b/src/components/CippFormPages/CippSchedulerForm.jsx @@ -206,7 +206,8 @@ const CippSchedulerForm = (props) => { formControl={formControl} > - {param.Type === "System.Boolean" ? ( + {param.Type === "System.Boolean" || + param.Type === "System.Management.Automation.SwitchParameter" ? ( { + const endpoint = watchedValues.endpoint; + if (endpoint && endpoint !== currentEndpoint) { + setCurrentEndpoint(endpoint); + } + }, [watchedValues.endpoint]); // API call for available properties const propertyList = ApiGetCall({ url: "/api/ListGraphRequest", - queryKey: `graph-properties-${endpoint}`, + queryKey: `graph-properties-${currentEndpoint}`, data: { - Endpoint: endpoint, + Endpoint: currentEndpoint, ListProperties: true, TenantFilter: tenant, IgnoreErrors: true, @@ -141,16 +149,16 @@ const CippGraphExplorerFilter = ({ }); } setPresetOptions(presetOptionList); - }, [defaultPresets, presetList.isSuccess]); + }, [defaultPresets, presetList.isSuccess, presetList.data]); // Debounced refetch when endpoint, put in in a useEffect dependand on endpoint const debouncedRefetch = useCallback( debounce(() => { - if (endpoint) { + if (currentEndpoint) { propertyList.refetch(); } }, 1000), - [endpoint] // Dependencies that the debounce function depends on + [currentEndpoint] // Dependencies that the debounce function depends on ); useEffect(() => { @@ -159,10 +167,10 @@ const CippGraphExplorerFilter = ({ return () => { debouncedRefetch.cancel(); }; - }, [endpoint, debouncedRefetch]); + }, [currentEndpoint, debouncedRefetch]); const savePresetApi = ApiPostCall({ - relatedQueryKeys: "ListGraphExplorerPresets", + relatedQueryKeys: ["ListGraphExplorerPresets", "ListGraphRequest"], }); // Save preset function @@ -278,13 +286,13 @@ const CippGraphExplorerFilter = ({ }; // Schedule report function const handleScheduleReport = () => { - const formParameters = formControl.getValues(); + const formParameters = watchedValues; const selectString = formParameters.$select ? formParameters.$select?.map((item) => item.value).join(",") : null; //compose the parameters for the form based on what is available - const Parameters = [ + var Parameters = [ { Key: "$select", Value: selectString, @@ -309,32 +317,17 @@ const CippGraphExplorerFilter = ({ Key: "$expand", Value: formParameters.$expand, }, - { - Key: "ReverseTenantLookup", - Value: formParameters.ReverseTenantLookup, - }, - { - Key: "ReverseTenantLookupProperty", - Value: formParameters.ReverseTenantLookupProperty, - }, - { - Key: "NoPagination", - Value: formParameters.NoPagination, - }, - { - Key: "AsApp", - Value: formParameters.AsApp, - }, { Key: "$format", Value: formParameters.$format, }, ]; - Parameters.forEach((param) => { - if (param.Value == null || param.Value === "") { - //delete the index - Parameters.splice(Parameters.indexOf(param), 1); - } + Parameters = Parameters.filter((param) => { + return ( + param.Value != null && + param.Value !== "" && + !(typeof param.Value === "boolean" && param.Value === false) + ); }); const resetParams = { tenantFilter: tenant, @@ -350,6 +343,9 @@ const CippGraphExplorerFilter = ({ Endpoint: formParameters.endpoint, skipCache: true, NoPagination: formParameters.NoPagination, + AsApp: formParameters.AsApp, + ReverseTenantLookup: formParameters.ReverseTenantLookup, + ReverseTenantLookupProperty: formParameters.ReverseTenantLookupProperty, Parameters: Parameters, }, advancedParameters: false, @@ -375,12 +371,14 @@ const CippGraphExplorerFilter = ({ function getPresetProps(values) { var newvals = Object.assign({}, values); + console.log(values); if (newvals?.$select !== undefined && Array.isArray(newvals?.$select)) { newvals.$select = newvals?.$select.map((p) => p.value).join(","); } delete newvals["reportTemplate"]; delete newvals["tenantFilter"]; delete newvals["IsShared"]; + delete newvals["id"]; if (newvals.ReverseTenantLookup === false) { delete newvals.ReverseTenantLookup; } @@ -390,6 +388,9 @@ const CippGraphExplorerFilter = ({ if (newvals.$count === false) { delete newvals.$count; } + if (newvals.AsApp === false) { + delete newvals.AsApp; + } Object.keys(newvals).forEach((key) => { if (values[key] === "" || values[key] === null) { delete newvals[key]; @@ -399,7 +400,7 @@ const CippGraphExplorerFilter = ({ } useEffect(() => { - var values = getPresetProps(formControl.getValues()); + var values = getPresetProps(watchedValues); setOffCanvasContent(() => ( <> @@ -425,7 +426,7 @@ const CippGraphExplorerFilter = ({ )); - }, [editorValues, savePresetApi.isPending, formControl, selectedPresets]); + }, [editorValues, savePresetApi.isPending, formControl, selectedPresets, watchedValues]); const handleImport = () => { setOffCanvasOpen(true); // Open the offCanvas, the content will be updated by useEffect @@ -555,6 +556,7 @@ const CippGraphExplorerFilter = ({ multiple={false} formControl={formControl} options={presetOptions} + isFetching={presetList.isFetching} groupBy={(option) => option.type} renderGroup={(params) => (
  • @@ -594,7 +596,7 @@ const CippGraphExplorerFilter = ({ name="$select" label="Select" formControl={formControl} - isFetching={propertyList.isLoading} + isFetching={propertyList.isFetching} options={ (propertyList.isSuccess && propertyList?.data?.Results?.length > 0 &&