mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
Fix unreleased issues in VPP feature branch (#20590)
This commit is contained in:
parent
87f9a9a3e7
commit
f5296ab400
7 changed files with 24 additions and 11 deletions
|
|
@ -1174,13 +1174,13 @@ This activity contains the following fields:
|
|||
}
|
||||
```
|
||||
|
||||
## vpp_enabled
|
||||
## enabled_vpp
|
||||
|
||||
Generated when the VPP feature is enabled in Fleet.
|
||||
|
||||
|
||||
|
||||
## vpp_disabled
|
||||
## disabled_vpp
|
||||
|
||||
Generated when the VPP feature is disabled in Fleet.
|
||||
|
||||
|
|
|
|||
|
|
@ -833,7 +833,7 @@ const TAGGED_TEMPLATES = {
|
|||
<>
|
||||
{" "}
|
||||
added <b>{activity.details?.software_title}</b> (
|
||||
{activity.details?.software_package}) software to{" "}
|
||||
{activity.details?.software_package}) to{" "}
|
||||
{activity.details?.team_name ? (
|
||||
<>
|
||||
{" "}
|
||||
|
|
@ -850,7 +850,7 @@ const TAGGED_TEMPLATES = {
|
|||
<>
|
||||
{" "}
|
||||
deleted <b>{activity.details?.software_title}</b> (
|
||||
{activity.details?.software_package}) software from{" "}
|
||||
{activity.details?.software_package}) from{" "}
|
||||
{activity.details?.team_name ? (
|
||||
<>
|
||||
{" "}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,13 @@ const AppStoreVpp = ({ teamId, router, onExit }: IAppStoreVppProps) => {
|
|||
});
|
||||
router.push(`${PATHS.SOFTWARE}?${queryParams}`);
|
||||
} catch (e) {
|
||||
renderFlash("error", getErrorReason(e));
|
||||
const reason = getErrorReason(e);
|
||||
// TODO: update with pre-defined error messages we want to pass through from the API
|
||||
if (reason.toLowerCase().includes("already")) {
|
||||
renderFlash("error", reason);
|
||||
} else {
|
||||
renderFlash("error", "Couldn’t add software. Please try again.");
|
||||
}
|
||||
}
|
||||
onExit();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -172,7 +172,10 @@ const VppSetupPage = ({ router }: IVppSetupPageProps) => {
|
|||
<>{renderContent()}</>
|
||||
</>
|
||||
{showDisableModal && (
|
||||
<DisableVppModal onExit={() => setShowDisableModal(false)} />
|
||||
<DisableVppModal
|
||||
router={router}
|
||||
onExit={() => setShowDisableModal(false)}
|
||||
/>
|
||||
)}
|
||||
{showRenewModal && (
|
||||
<RenewVppTokenModal
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import React, { useContext, useState } from "react";
|
||||
import { InjectedRouter } from "react-router";
|
||||
import paths from "router/paths";
|
||||
|
||||
import mdmAppleAPI from "services/entities/mdm_apple";
|
||||
import { NotificationContext } from "context/notification";
|
||||
|
|
@ -9,21 +11,23 @@ import Button from "components/buttons/Button";
|
|||
const baseClass = "diable-vpp-modal";
|
||||
|
||||
interface IDisableVppModalProps {
|
||||
router: InjectedRouter;
|
||||
onExit: () => void;
|
||||
}
|
||||
|
||||
const DisableVppModal = ({ onExit }: IDisableVppModalProps) => {
|
||||
const DisableVppModal = ({ router, onExit }: IDisableVppModalProps) => {
|
||||
const { renderFlash } = useContext(NotificationContext);
|
||||
const [isDisabling, setIsDisabling] = useState(false);
|
||||
|
||||
const onDisableVpp = async () => {
|
||||
// TODO: API integration
|
||||
setIsDisabling(true);
|
||||
try {
|
||||
await mdmAppleAPI.disableVpp();
|
||||
renderFlash(
|
||||
"success",
|
||||
"Volume Purchasing Program (VPP) disabled successfully."
|
||||
);
|
||||
router.push(paths.ADMIN_INTEGRATIONS_VPP);
|
||||
} catch {
|
||||
renderFlash(
|
||||
"error",
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ export default {
|
|||
SOFTWARE_PACKAGE_INSTALL: (id: number) =>
|
||||
`/${API_VERSION}/fleet/software/packages/${id}`,
|
||||
SOFTWARE_AVAILABLE_FOR_INSTALL: (id: number) =>
|
||||
`/${API_VERSION}/fleet/software/${id}/available_for_install`,
|
||||
`/${API_VERSION}/fleet/software/titles/${id}/available_for_install`,
|
||||
|
||||
// AI endpoints
|
||||
AUTOFILL_POLICY: `/${API_VERSION}/fleet/autofill/policy`,
|
||||
|
|
|
|||
|
|
@ -1607,7 +1607,7 @@ func LogRoleChangeActivities(
|
|||
type ActivityEnabledVPP struct{}
|
||||
|
||||
func (a ActivityEnabledVPP) ActivityName() string {
|
||||
return "vpp_enabled"
|
||||
return "enabled_vpp"
|
||||
}
|
||||
|
||||
func (a ActivityEnabledVPP) Documentation() (activity string, details string, detailsExample string) {
|
||||
|
|
@ -1617,7 +1617,7 @@ func (a ActivityEnabledVPP) Documentation() (activity string, details string, de
|
|||
type ActivityDisabledVPP struct{}
|
||||
|
||||
func (a ActivityDisabledVPP) ActivityName() string {
|
||||
return "vpp_disabled"
|
||||
return "disabled_vpp"
|
||||
}
|
||||
|
||||
func (a ActivityDisabledVPP) Documentation() (activity string, details string, detailsExample string) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue