From cba0383c6b1566d9282bc281c695caaf40b42d1a Mon Sep 17 00:00:00 2001 From: Gabriel Hernandez Date: Fri, 22 Mar 2024 13:31:06 +0000 Subject: [PATCH] show uploader correctly --- .../cards/SetupAssistant/SetupAssistant.tsx | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/frontend/pages/ManageControlsPage/SetupExperience/cards/SetupAssistant/SetupAssistant.tsx b/frontend/pages/ManageControlsPage/SetupExperience/cards/SetupAssistant/SetupAssistant.tsx index 7aa3d2fb6967..9e8ba073089c 100644 --- a/frontend/pages/ManageControlsPage/SetupExperience/cards/SetupAssistant/SetupAssistant.tsx +++ b/frontend/pages/ManageControlsPage/SetupExperience/cards/SetupAssistant/SetupAssistant.tsx @@ -1,13 +1,15 @@ import React, { useState } from "react"; import { useQuery } from "react-query"; +import { AxiosError } from "axios"; import { IConfig } from "interfaces/config"; -import { API_NO_TEAM_ID, ITeam, ITeamConfig } from "interfaces/team"; +import { API_NO_TEAM_ID, ITeamConfig } from "interfaces/team"; import configAPI from "services/entities/config"; import teamsAPI, { ILoadTeamResponse } from "services/entities/teams"; import mdmAPI, { IAppleSetupEnrollmentProfileResponse, } from "services/entities/mdm"; +import { DEFAULT_USE_QUERY_OPTIONS } from "utilities/constants"; import SectionHeader from "components/SectionHeader"; import Spinner from "components/Spinner"; @@ -18,8 +20,6 @@ import SetupAssistantProfileUploader from "./components/SetupAssistantProfileUpl import SetuAssistantProfileCard from "./components/SetupAssistantProfileCard/SetupAssistantProfileCard"; import DeleteAutoEnrollmentProfile from "./components/DeleteAutoEnrollmentProfile"; import AdvancedOptionsForm from "./components/AdvancedOptionsForm"; -import { DEFAULT_USE_QUERY_OPTIONS } from "utilities/constants"; -import { Axios, AxiosError } from "axios"; const baseClass = "setup-assistant"; @@ -54,10 +54,14 @@ const StartupAssistant = ({ currentTeamId }: ISetupAssistantProps) => { data: enrollmentProfileData, isLoading: isLoadingEnrollmentProfile, isError: isErrorEnrollmentProfile, + error: enrollmentProfileError, } = useQuery( ["enrollment_profile", currentTeamId], () => mdmAPI.getSetupEnrollmentProfile(currentTeamId), - DEFAULT_USE_QUERY_OPTIONS + { + ...DEFAULT_USE_QUERY_OPTIONS, + retry: false, + } ); const getReleaseDeviceSetting = () => { @@ -75,10 +79,14 @@ const StartupAssistant = ({ currentTeamId }: ISetupAssistantProps) => { const defaultReleaseDeviceSetting = getReleaseDeviceSetting(); + const isLoading = + isLoadingGlobalConfig || isLoadingTeamConfig || isLoadingEnrollmentProfile; + const enrollmentProfileNotFound = enrollmentProfileError?.status === 404; + return (
- {isLoadingEnrollmentProfile ? ( + {isLoading ? ( ) : (
@@ -92,7 +100,7 @@ const StartupAssistant = ({ currentTeamId }: ISetupAssistantProps) => { newTab />

- {!enrollmentProfileData ? ( + {enrollmentProfileNotFound ? ( 1}