mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
UI: Update setup experience software IT admin endpoints (#32670)
## For #32037 Align setup experience software endpoints with https://github.com/fleetdm/fleet/pull/32317/files - only merge with associated server and agent PRs --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
parent
ec2163768f
commit
32d43a1a73
5 changed files with 19 additions and 30 deletions
|
|
@ -66,7 +66,8 @@ const BootstrapPackage = ({ currentTeamId }: IBootstrapPackageProps) => {
|
|||
>(
|
||||
["install-software", currentTeamId],
|
||||
() =>
|
||||
mdmAPI.getSetupExperienceSoftware("macos", {
|
||||
mdmAPI.getSetupExperienceSoftware({
|
||||
platform: "macos",
|
||||
team_id: currentTeamId,
|
||||
per_page: PER_PAGE_SIZE,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ const InstallSoftware = ({ currentTeamId }: IInstallSoftwareProps) => {
|
|||
>(
|
||||
["install-software", currentTeamId, selectedPlatform],
|
||||
() =>
|
||||
mdmAPI.getSetupExperienceSoftware(selectedPlatform, {
|
||||
mdmAPI.getSetupExperienceSoftware({
|
||||
platform: selectedPlatform,
|
||||
team_id: currentTeamId,
|
||||
per_page: PER_PAGE_SIZE,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import endpoints from "utilities/endpoints";
|
|||
import { buildQueryStringFromParams } from "utilities/url";
|
||||
|
||||
import { ISoftwareTitlesResponse } from "./software";
|
||||
import { PaginationParams } from "./common";
|
||||
|
||||
export interface IEulaMetadataResponse {
|
||||
name: string;
|
||||
|
|
@ -89,9 +90,9 @@ export interface IGetSetupExperienceScriptResponse {
|
|||
updated_at: string;
|
||||
}
|
||||
|
||||
interface IGetSetupExperienceSoftwareParams {
|
||||
interface IGetSetupExperienceSoftwareParams extends Partial<PaginationParams> {
|
||||
team_id: number;
|
||||
per_page: number;
|
||||
platform: SetupExperiencePlatform;
|
||||
}
|
||||
|
||||
export type IGetSetupExperienceSoftwareResponse = ISoftwareTitlesResponse & {
|
||||
|
|
@ -360,16 +361,15 @@ const mdmService = {
|
|||
},
|
||||
|
||||
getSetupExperienceSoftware: (
|
||||
platform: SetupExperiencePlatform,
|
||||
params: IGetSetupExperienceSoftwareParams
|
||||
): Promise<IGetSetupExperienceSoftwareResponse> => {
|
||||
const { MDM_SETUP_EXPERIENCE_SOFTWARE } = endpoints;
|
||||
|
||||
const path = `${MDM_SETUP_EXPERIENCE_SOFTWARE(
|
||||
platform
|
||||
)}?${buildQueryStringFromParams({
|
||||
...params,
|
||||
})}`;
|
||||
const path = `${MDM_SETUP_EXPERIENCE_SOFTWARE}?${buildQueryStringFromParams(
|
||||
{
|
||||
...params,
|
||||
}
|
||||
)}`;
|
||||
|
||||
return sendRequest("GET", path);
|
||||
},
|
||||
|
|
@ -379,17 +379,10 @@ const mdmService = {
|
|||
teamId: number,
|
||||
softwareTitlesIds: number[]
|
||||
) => {
|
||||
const { MDM_SETUP_EXPERIENCE_SOFTWARE } = endpoints;
|
||||
|
||||
const path = `${MDM_SETUP_EXPERIENCE_SOFTWARE(
|
||||
platform
|
||||
)}?${buildQueryStringFromParams({
|
||||
team_id: teamId,
|
||||
})}`;
|
||||
|
||||
return sendRequest("PUT", path, {
|
||||
team_id: teamId,
|
||||
return sendRequest("PUT", endpoints.MDM_SETUP_EXPERIENCE_SOFTWARE, {
|
||||
software_title_ids: softwareTitlesIds,
|
||||
team_id: teamId,
|
||||
platform,
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,9 @@ import {
|
|||
IGetSetupExperienceScriptResponse,
|
||||
IGetSetupExperienceSoftwareResponse,
|
||||
} from "services/entities/mdm";
|
||||
import { SetupExperiencePlatform } from "interfaces/platform";
|
||||
|
||||
const setupExperienceScriptUrl = baseUrl("/setup_experience/script");
|
||||
const setupExperienceInstallSoftwareUrl = (platform: SetupExperiencePlatform) =>
|
||||
baseUrl(`/setup_experience/${platform}/software`);
|
||||
const setupExperienceInstallSoftwareUrl = baseUrl(`/setup_experience/software`);
|
||||
const setupExperienceBootstrapMetadataUrl = baseUrl(
|
||||
"/mdm/bootstrap/:teamId/metadata"
|
||||
);
|
||||
|
|
@ -47,10 +45,9 @@ export const errorNoSetupExperienceScriptHandler = http.get(
|
|||
);
|
||||
|
||||
export const createSetupExperienceSoftwareHandler = (
|
||||
overrides?: Partial<IGetSetupExperienceSoftwareResponse>,
|
||||
platform: SetupExperiencePlatform = "macos"
|
||||
overrides?: Partial<IGetSetupExperienceSoftwareResponse>
|
||||
) =>
|
||||
http.get(setupExperienceInstallSoftwareUrl(platform), () => {
|
||||
http.get(setupExperienceInstallSoftwareUrl, () => {
|
||||
return HttpResponse.json(
|
||||
createMockSetupExperienceSoftwareResponse({ ...overrides })
|
||||
);
|
||||
|
|
|
|||
|
|
@ -182,10 +182,7 @@ export default {
|
|||
|
||||
// Setup experiece endpoints
|
||||
MDM_SETUP_EXPERIENCE: `/${API_VERSION}/fleet/setup_experience`,
|
||||
// maintained for backwards compatibility, use MDM_SETUP_EXPERIENCE_SOFTWARE endpoint
|
||||
MDM_MACOS_SETUP_EXPERIENCE_SOFTWARE: `/${API_VERSION}/fleet/setup_experience/software`,
|
||||
MDM_SETUP_EXPERIENCE_SOFTWARE: (platform: SetupExperiencePlatform) =>
|
||||
`/${API_VERSION}/fleet/setup_experience/${platform}/software`,
|
||||
MDM_SETUP_EXPERIENCE_SOFTWARE: `/${API_VERSION}/fleet/setup_experience/software`,
|
||||
MDM_SETUP_EXPERIENCE_SCRIPT: `/${API_VERSION}/fleet/setup_experience/script`,
|
||||
|
||||
// OS Version endpoints
|
||||
|
|
|
|||
Loading…
Reference in a new issue