Skip to content

Commit

Permalink
pass default release device setting to advanced form
Browse files Browse the repository at this point in the history
  • Loading branch information
ghernandez345 committed Mar 21, 2024
1 parent 1727fe5 commit 35813ee
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from "react";
import { useQuery } from "react-query";

import { IConfig } from "interfaces/config";
import { API_NO_TEAM_ID, ITeamConfig } from "interfaces/team";
import team, { API_NO_TEAM_ID, ITeam, ITeamConfig } from "interfaces/team";
import configAPI from "services/entities/config";
import teamsAPI, { ILoadTeamResponse } from "services/entities/teams";

Expand Down Expand Up @@ -45,6 +45,15 @@ const StartupAssistant = ({ currentTeamId }: ISetupAssistantProps) => {
select: (res) => res.team,
});

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 isLoading = false;

const noPackageUploaded = true;
Expand All @@ -53,6 +62,8 @@ const StartupAssistant = ({ currentTeamId }: ISetupAssistantProps) => {

const onDelete = () => {};

Check failure on line 63 in frontend/pages/ManageControlsPage/SetupExperience/cards/SetupAssistant/SetupAssistant.tsx

View workflow job for this annotation

GitHub Actions / lint-js (ubuntu-latest)

Unexpected empty arrow function

const defaultReleaseDeviceSetting = getReleaseDeviceSetting();

return (
<div className={baseClass}>
<SectionHeader title="Setup assistant" />
Expand Down Expand Up @@ -82,7 +93,11 @@ const StartupAssistant = ({ currentTeamId }: ISetupAssistantProps) => {
onDelete={() => setShowDeleteProfileModal(true)}
/>
)}
<AdvancedOptionsForm currentTeamId={currentTeamId} />
<AdvancedOptionsForm
key={String(defaultReleaseDeviceSetting)}
currentTeamId={currentTeamId}
defaultReleaseDevice={defaultReleaseDeviceSetting}
/>
</div>
<div className={`${baseClass}__preview-container`}>
<SetupAssistantPreview />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ const baseClass = "advanced-options-form";

interface IAdvancedOptionsFormProps {
currentTeamId: number;
defaultReleaseDevice: boolean;
}

const AdvancedOptionsForm = ({ currentTeamId }: IAdvancedOptionsFormProps) => {
const AdvancedOptionsForm = ({
currentTeamId,
defaultReleaseDevice,
}: IAdvancedOptionsFormProps) => {
const [showAdvancedOptions, setShowAdvancedOptions] = useState(false);
const [releaseDevice, setReleaseDevice] = useState(false);
const [releaseDevice, setReleaseDevice] = useState(defaultReleaseDevice);
const { renderFlash } = useContext(NotificationContext);

const accordionText = showAdvancedOptions ? "Hide" : "Show";
Expand Down

0 comments on commit 35813ee

Please sign in to comment.