Bugfix: fix many small bugs in activity actor and activity formatting (#26779)

This commit is contained in:
Martin Angers 2025-03-03 16:33:42 -05:00 committed by GitHub
parent 452650c03a
commit 96fc994558
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 4 deletions

View file

@ -1352,7 +1352,9 @@ const GlobalActivityItem = ({
const hasDetails = ACTIVITIES_WITH_DETAILS.has(activity.type);
const renderActivityPrefix = () => {
const DEFAULT_ACTOR_DISPLAY = <b>{activity.actor_full_name ?? "Fleet"} </b>;
const DEFAULT_ACTOR_DISPLAY = (
<b>{activity.fleet_initiated ? "Fleet" : activity.actor_full_name} </b>
);
switch (activity.type) {
case ActivityType.UserLoggedIn:

View file

@ -9,6 +9,7 @@ import { IHostActivityItemComponentPropsWithShowDetails } from "../../ActivityCo
const baseClass = "installed-software-activity-item";
const InstalledSoftwareActivityItem = ({
tab,
activity,
onShowDetails,
hideCancel,
@ -24,6 +25,12 @@ const InstalledSoftwareActivityItem = ({
<b>{actorName ?? "Fleet"}</b>
);
let installedSoftwarePrefix = getInstallStatusPredicate(status);
if (tab !== "past" && activity.fleet_initiated) {
installedSoftwarePrefix =
status === "pending_uninstall" ? "will uninstall" : "will install";
}
return (
<ActivityItem
className={baseClass}
@ -31,8 +38,8 @@ const InstalledSoftwareActivityItem = ({
hideCancel={hideCancel}
onShowDetails={onShowDetails}
>
<>{actorDisplayName}</> {getInstallStatusPredicate(status)} <b>{title}</b>{" "}
on this host {self_service && "(self-service)"}.{" "}
<>{actorDisplayName}</> {installedSoftwarePrefix} <b>{title}</b> on this
host{self_service && " (self-service)"}.{" "}
</ActivityItem>
);
};

View file

@ -15,7 +15,10 @@ const RanScriptActivityItem = ({
isSoloActivity,
hideCancel,
}: IHostActivityItemComponentPropsWithShowDetails) => {
const ranScriptPrefix = tab === "past" ? "ran" : "told Fleet to run";
let ranScriptPrefix = tab === "past" ? "ran" : "told Fleet to run";
if (tab !== "past" && activity.fleet_initiated) {
ranScriptPrefix = "will run";
}
return (
<ActivityItem