mirror of
https://github.com/fleetdm/fleet
synced 2026-05-16 21:48:48 +00:00
## #30198 [Video demo](https://drive.google.com/file/d/1RBk5QNQdQvXTHJveCNkIeMXj5hWFA5Ft/view?usp=sharing) - Implement the following logic for `teamId` in the UI when in Primo mode: <img width="870" alt="Screenshot 2025-06-24 at 12 47 48 PM" src="https://github.com/user-attachments/assets/8ae81c3f-223f-4dda-954d-c42c7008de45" /> - Above logic is enforced - if trying to change/add/remove `team_id`, automatically pushed to appropriate team - Fixes originally reported issue - user in Primo mode can access installable software (on the hidden "No team" which is now enforced): - Software page on No team - Update header help text  - Handle UI edge cases the above surfaces: - Queries page on All teams (No team not supported): <img width="1624" alt="Screenshot 2025-06-24 at 1 10 40 PM" src="https://github.com/user-attachments/assets/84bb2ca0-b8e7-44e8-9bf5-9f8f243d5584" /> - Policies page on No team: <img width="1624" alt="Screenshot 2025-06-24 at 1 10 53 PM" src="https://github.com/user-attachments/assets/144d745f-e9b0-4933-be45-2db4fe428cfe" /> - update `useTeamIdParam` hook's strip query params on change team logic to optionally also consider the current team **Important notes** - Software page: Software automations are only accessible via All teams, while Add software is only accessible on a team, including No team. In lieu of specs around this, I decided to favor Add software functionality over Software automations functionality, aka, push to "No team" on this page. Enabling _both_ functionalities would be a very large ticket and need to go through a proper drafting process, since Fleet doesn't currently support both in any state. - Policies page: - "Other workflows" (tickets and webhooks) is available on All Teams and specific teams, but not on No Team, so "Other workflows" is currently unavailable in Primo mode - If any of the Primo customers have created policies on All Teams already, they won't be able to manage automations on them anymore. All Teams policies can only have ticket/webhook workflows - [x] Changes file added for user-visible changes in `changes/` - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
121 lines
3.3 KiB
TypeScript
121 lines
3.3 KiB
TypeScript
import React from "react";
|
|
|
|
import { ITeam } from "interfaces/team";
|
|
import { IEnrollSecret } from "interfaces/enroll_secret";
|
|
|
|
import GitOpsModeTooltipWrapper from "components/GitOpsModeTooltipWrapper";
|
|
import Modal from "components/Modal";
|
|
import Button from "components/buttons/Button";
|
|
import Icon from "components/Icon/Icon";
|
|
import EnrollSecretTable from "../EnrollSecretTable";
|
|
|
|
interface IEnrollSecretModal {
|
|
selectedTeamId: number;
|
|
primoMode: boolean;
|
|
onReturnToApp: () => void;
|
|
teams: ITeam[];
|
|
toggleSecretEditorModal: () => void;
|
|
toggleDeleteSecretModal: () => void;
|
|
setSelectedSecret: React.Dispatch<
|
|
React.SetStateAction<IEnrollSecret | undefined>
|
|
>;
|
|
globalSecrets?: IEnrollSecret[] | undefined;
|
|
}
|
|
|
|
const baseClass = "enroll-secret-modal";
|
|
|
|
const EnrollSecretModal = ({
|
|
onReturnToApp,
|
|
selectedTeamId,
|
|
primoMode,
|
|
teams,
|
|
toggleSecretEditorModal,
|
|
toggleDeleteSecretModal,
|
|
setSelectedSecret,
|
|
globalSecrets,
|
|
}: IEnrollSecretModal): JSX.Element => {
|
|
const teamInfo =
|
|
selectedTeamId <= 0
|
|
? { name: "No team", secrets: globalSecrets }
|
|
: teams.find((team) => team.id === selectedTeamId);
|
|
|
|
const addNewSecretClick = () => {
|
|
setSelectedSecret(undefined);
|
|
toggleSecretEditorModal();
|
|
};
|
|
return (
|
|
<Modal
|
|
onExit={onReturnToApp}
|
|
onEnter={onReturnToApp}
|
|
title="Manage enroll secrets"
|
|
className={baseClass}
|
|
>
|
|
<div className={`${baseClass} form`}>
|
|
{teamInfo?.secrets?.length ? (
|
|
<>
|
|
<div className={`${baseClass}__description`}>
|
|
Use these secret(s) to enroll hosts
|
|
{primoMode ? (
|
|
""
|
|
) : (
|
|
<>
|
|
{" "}
|
|
to <b>{teamInfo?.name}</b>
|
|
</>
|
|
)}
|
|
:
|
|
</div>
|
|
<EnrollSecretTable
|
|
secrets={teamInfo?.secrets}
|
|
toggleSecretEditorModal={toggleSecretEditorModal}
|
|
toggleDeleteSecretModal={toggleDeleteSecretModal}
|
|
setSelectedSecret={setSelectedSecret}
|
|
/>
|
|
</>
|
|
) : (
|
|
<>
|
|
<div className={`${baseClass}__description`}>
|
|
<p>
|
|
<b>You have no enroll secrets.</b>
|
|
</p>
|
|
<p>
|
|
Add secret(s) to enroll hosts
|
|
{primoMode ? (
|
|
""
|
|
) : (
|
|
<>
|
|
{" "}
|
|
to <b>{teamInfo?.name}</b>
|
|
</>
|
|
)}
|
|
.
|
|
</p>
|
|
</div>
|
|
</>
|
|
)}
|
|
<div className={`${baseClass}__add-secret`}>
|
|
<GitOpsModeTooltipWrapper
|
|
position="right"
|
|
tipOffset={8}
|
|
renderChildren={(disableChildren) => (
|
|
<Button
|
|
disabled={disableChildren}
|
|
onClick={addNewSecretClick}
|
|
className={`${baseClass}__add-secret-btn`}
|
|
variant="text-icon"
|
|
iconStroke
|
|
>
|
|
Add secret <Icon name="plus" />
|
|
</Button>
|
|
)}
|
|
/>
|
|
</div>
|
|
<div className="modal-cta-wrap">
|
|
<Button onClick={onReturnToApp}>Done</Button>
|
|
</div>
|
|
</div>
|
|
</Modal>
|
|
);
|
|
};
|
|
|
|
export default EnrollSecretModal;
|