mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 21:47:20 +00:00
## PR 2/2 for #32037 - Implements update for the Linux setup experience from the end-user's point of view (the "My device" page). - Works in concert with the new endpoints implemented in https://github.com/fleetdm/fleet/pull/32493 - My device page calls a new endpoint to get in-progress setup experience software installations. If there are any, the page is replaced with a "Setting up your device" page - The UI polls this endpoint until all such installations are either successful or failed (including canceled) - Setting up your device page includes a table displaying the name and status of each software installation - Once all installations are finished (succeed/fail), renders the regular My device page - Add a handler for the new API call for relevant tests  ## Testing Can use [this branch with fake data](https://github.com/fleetdm/fleet/tree/32037-end-user-fake-data) to help test this PR - [x] Changes file added for user-visible changes in `changes/` - [x] Added/updated automated tests - additional tests coming in follow-up - [x] QA'd all new/changed functionality manually --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import React from "react";
|
|
|
|
import { SetupSoftwareStatus } from "interfaces/software";
|
|
|
|
import Icon from "components/Icon";
|
|
import { IconNames } from "components/icons";
|
|
import Spinner from "components/Spinner";
|
|
|
|
const baseClass = "setup-software-status-cell";
|
|
|
|
interface ISetupSoftwareStatusCell {
|
|
status: SetupSoftwareStatus;
|
|
}
|
|
|
|
const serverToUiStatus = (
|
|
status: SetupSoftwareStatus
|
|
): { label: string; icon: IconNames | "spinner" } => {
|
|
switch (status) {
|
|
case "pending":
|
|
return { label: "Pending", icon: "pending-outline" };
|
|
case "running":
|
|
return { label: "Installing", icon: "spinner" };
|
|
case "success":
|
|
return { label: "Installed", icon: "success" };
|
|
case "failure":
|
|
case "cancelled":
|
|
return { label: "Failed", icon: "error" };
|
|
default:
|
|
return { label: "Pending", icon: "pending-outline" };
|
|
}
|
|
};
|
|
|
|
const SetupSoftwareStatusCell = ({ status }: ISetupSoftwareStatusCell) => {
|
|
const { label, icon } = serverToUiStatus(status);
|
|
return (
|
|
<div className={baseClass}>
|
|
{icon === "spinner" ? <Spinner size="x-small" /> : <Icon name={icon} />}
|
|
{label}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default SetupSoftwareStatusCell;
|