-
Notifications
You must be signed in to change notification settings - Fork 544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add startup assistant to the UI #17731
Merged
ghernandez345
merged 50 commits into
feat-prefill-account-name
from
feat-ui-startup-assistant
Mar 26, 2024
Merged
Changes from 44 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
0b3134e
Ensure the DEP enrollment profiles get regenerated when enable releas…
mna 324b5bc
Fix some tests
mna 49f6bb1
Fix test that failed when running the suite, but not in isolation
mna e642835
Fix-ish for idp/macos setup settings
mna f946401
Add plan for release implementation
mna 17cf645
Fix worker tests
mna 7ae50b9
setup assistant UI
ghernandez345 463a947
Queue delayed job for post-dep release, adjust tests
mna 62e321b
Finish integration test, make it pass
mna cbd3377
Fix dep release test with fleetd config profile also sent
mna f289693
Add integration test for global manual release
mna a7e068b
Add team-enrolled release device test
mna 51aa4e3
Refactor integration tests
mna 938983d
Add database migration to re-generate all DEP profiles
mna b9095ea
Add DB migration, adjust tests
mna 6041f0e
Add schema changes
mna 3d55339
Use hard-coded timestamps so schema.sql is stable
mna a53a8c4
Add changes file
mna 8c8803e
Fix erroneous comments
mna c09f3e8
Remove obsolete todo
mna 96995e8
add advanced options section
ghernandez345 d98e434
fix up some styles
ghernandez345 bacff62
delete modal
ghernandez345 76a066f
Merge branch 'feat-prefill-account-name' into feat-ui-startup-assistant
ghernandez345 53b7f15
get correct config
ghernandez345 472f30d
change file names and change rendering for uploader section
ghernandez345 84453cb
update global config for release device
ghernandez345 1727fe5
update team config release device settings
ghernandez345 35813ee
pass default release device setting to advanced form
ghernandez345 8e706f1
get enrollment profile
ghernandez345 cba0383
show uploader correctly
ghernandez345 00df0d3
set up deleting mdm profile
ghernandez345 1d39566
finish up download
ghernandez345 b976ee9
Merge branch 'feat-prefill-account-name' into mna-17401-post-dep-enro…
ghernandez345 befd7be
Merge branch 'mna-17401-post-dep-enroll-device-release' into feat-ui-…
ghernandez345 60b25ea
fix build
ghernandez345 df85616
change endpoint to update relese device settings
ghernandez345 770c9d4
Add debugging information to release device job
mna 1c2c1d7
Merge branch 'mna-17401-post-dep-enroll-device-release' into feat-ui-…
ghernandez345 c4da092
Fix awaiting for empty command uuid
mna c77820c
Merge branch 'mna-17401-post-dep-enroll-device-release' into feat-ui-…
ghernandez345 f44ddb3
pass though error messages
ghernandez345 060532d
finish errors
ghernandez345 a936cd9
Merge branch 'feat-prefill-account-name' into feat-ui-startup-assistant
ghernandez345 8dfbf7a
fix build
ghernandez345 baeb07f
pr updates
ghernandez345 c84d2e0
change file uploader label
ghernandez345 1c5c264
use reveal button
ghernandez345 791f639
remove unuused styles file
ghernandez345 cb84f76
change apos character
ghernandez345 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 142 additions & 0 deletions
142
frontend/pages/ManageControlsPage/SetupExperience/cards/SetupAssistant/SetupAssistant.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
import React, { useState } from "react"; | ||
import { useQuery } from "react-query"; | ||
import { AxiosError } from "axios"; | ||
|
||
import { IConfig } from "interfaces/config"; | ||
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"; | ||
import CustomLink from "components/CustomLink"; | ||
|
||
import SetupAssistantPreview from "./components/SetupAssistantPreview"; | ||
import SetupAssistantProfileUploader from "./components/SetupAssistantProfileUploader"; | ||
import SetuAssistantProfileCard from "./components/SetupAssistantProfileCard/SetupAssistantProfileCard"; | ||
import DeleteAutoEnrollmentProfile from "./components/DeleteAutoEnrollmentProfile"; | ||
import AdvancedOptionsForm from "./components/AdvancedOptionsForm"; | ||
|
||
const baseClass = "setup-assistant"; | ||
|
||
interface ISetupAssistantProps { | ||
currentTeamId: number; | ||
} | ||
|
||
const StartupAssistant = ({ currentTeamId }: ISetupAssistantProps) => { | ||
ghernandez345 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const [showDeleteProfileModal, setShowDeleteProfileModal] = useState(false); | ||
|
||
const { data: globalConfig, isLoading: isLoadingGlobalConfig } = useQuery< | ||
IConfig, | ||
Error | ||
>(["config", currentTeamId], () => configAPI.loadAll(), { | ||
ghernandez345 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
enabled: currentTeamId === API_NO_TEAM_ID, | ||
refetchOnWindowFocus: false, | ||
retry: false, | ||
}); | ||
|
||
const { data: teamConfig, isLoading: isLoadingTeamConfig } = useQuery< | ||
ILoadTeamResponse, | ||
Error, | ||
ITeamConfig | ||
>(["team", currentTeamId], () => teamsAPI.load(currentTeamId), { | ||
refetchOnWindowFocus: false, | ||
retry: false, | ||
enabled: currentTeamId !== API_NO_TEAM_ID, | ||
select: (res) => res.team, | ||
}); | ||
|
||
const { | ||
data: enrollmentProfileData, | ||
isLoading: isLoadingEnrollmentProfile, | ||
isError: isErrorEnrollmentProfile, | ||
ghernandez345 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
error: enrollmentProfileError, | ||
refetch: refetchEnrollmentProfile, | ||
} = useQuery<IAppleSetupEnrollmentProfileResponse, AxiosError>( | ||
["enrollment_profile", currentTeamId], | ||
() => mdmAPI.getSetupEnrollmentProfile(currentTeamId), | ||
{ | ||
...DEFAULT_USE_QUERY_OPTIONS, | ||
ghernandez345 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
retry: false, | ||
} | ||
); | ||
|
||
const getReleaseDeviceSetting = () => { | ||
if (currentTeamId === API_NO_TEAM_ID) { | ||
return ( | ||
globalConfig?.mdm.macos_setup.enable_release_device_manually || false | ||
); | ||
} | ||
return teamConfig?.mdm?.macos_setup.enable_release_device_manually || false; | ||
}; | ||
|
||
const onUpload = () => { | ||
refetchEnrollmentProfile(); | ||
}; | ||
|
||
const onDelete = () => { | ||
setShowDeleteProfileModal(false); | ||
refetchEnrollmentProfile(); | ||
}; | ||
|
||
const defaultReleaseDeviceSetting = getReleaseDeviceSetting(); | ||
|
||
const isLoading = | ||
isLoadingGlobalConfig || isLoadingTeamConfig || isLoadingEnrollmentProfile; | ||
const enrollmentProfileNotFound = enrollmentProfileError?.status === 404; | ||
|
||
return ( | ||
<div className={baseClass}> | ||
<SectionHeader title="Setup assistant" /> | ||
{isLoading ? ( | ||
<Spinner /> | ||
) : ( | ||
<div className={`${baseClass}__content`}> | ||
<div className={`${baseClass}__upload-container`}> | ||
<p className={`${baseClass}__section-description`}> | ||
Add an automatic enrollment profile to customize the macOS Setup | ||
Assistant. | ||
<CustomLink | ||
url=" https://fleetdm.com/learn-more-about/setup-assistant" | ||
ghernandez345 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
text="Learn how" | ||
newTab | ||
/> | ||
</p> | ||
{enrollmentProfileNotFound || !enrollmentProfileData ? ( | ||
<SetupAssistantProfileUploader | ||
currentTeamId={currentTeamId} | ||
onUpload={onUpload} | ||
/> | ||
) : ( | ||
<SetuAssistantProfileCard | ||
profile={enrollmentProfileData} | ||
onDelete={() => setShowDeleteProfileModal(true)} | ||
/> | ||
)} | ||
<AdvancedOptionsForm | ||
key={String(defaultReleaseDeviceSetting)} | ||
currentTeamId={currentTeamId} | ||
defaultReleaseDevice={defaultReleaseDeviceSetting} | ||
/> | ||
</div> | ||
<div className={`${baseClass}__preview-container`}> | ||
<SetupAssistantPreview /> | ||
</div> | ||
</div> | ||
)} | ||
{showDeleteProfileModal && ( | ||
<DeleteAutoEnrollmentProfile | ||
currentTeamId={currentTeamId} | ||
onDelete={onDelete} | ||
onCancel={() => setShowDeleteProfileModal(false)} | ||
/> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default StartupAssistant; |
25 changes: 25 additions & 0 deletions
25
frontend/pages/ManageControlsPage/SetupExperience/cards/SetupAssistant/_styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.setup-assistant { | ||
&__content { | ||
max-width: $break-xxl; | ||
margin: 0 auto; | ||
display: flex; | ||
justify-content: space-between; | ||
gap: $pad-xxlarge; | ||
} | ||
|
||
&__upload-container { | ||
display: flex; | ||
flex-direction: column; | ||
gap: $pad-large; | ||
} | ||
|
||
&__section-description { | ||
margin: 0; | ||
} | ||
|
||
@media (max-width: $break-md) { | ||
&__content { | ||
flex-direction: column; | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more generic than "upload-profile"?