mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
Fleet UI: Editing team(s) using fleetctl added to activities (#8538)
This commit is contained in:
parent
3b668131a1
commit
6b1589fe8a
3 changed files with 17 additions and 5 deletions
1
changes/issue-7825-edit-team-config-file-fleetctl
Normal file
1
changes/issue-7825-edit-team-config-file-fleetctl
Normal file
|
|
@ -0,0 +1 @@
|
|||
* Activity feed includes editing team config file using fleetctl
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import { IPolicy } from "./policy";
|
||||
import { IQuery } from "./query";
|
||||
import { ITeamSummary } from "./team";
|
||||
|
||||
export enum ActivityType {
|
||||
CreatedPack = "created_pack",
|
||||
|
|
@ -40,6 +41,7 @@ export interface IActivityDetails {
|
|||
query_name?: string;
|
||||
team_id?: number;
|
||||
team_name?: string;
|
||||
teams?: ITeamSummary[];
|
||||
targets_count?: number;
|
||||
specs?: IQuery[] | IPolicy[];
|
||||
global?: boolean;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,16 @@ const TAGGED_TEMPLATES = {
|
|||
? "edited a query using fleetctl"
|
||||
: `edited ${count === 1 ? "a query" : "queries"} using fleetctl`;
|
||||
},
|
||||
editTeamCtlActivityTemplate: (activity: IActivity) => {
|
||||
const count = activity.details?.teams?.length;
|
||||
return count === 1 && activity.details?.teams ? (
|
||||
<>
|
||||
edited <b>{activity.details?.teams[0].name}</b> team using fleetctl
|
||||
</>
|
||||
) : (
|
||||
"edited multiple teams using fleetctl"
|
||||
);
|
||||
},
|
||||
userAddedBySSOTempalte: () => {
|
||||
return `was added to Fleet by SSO`;
|
||||
},
|
||||
|
|
@ -109,11 +119,7 @@ const ActivityFeed = ({
|
|||
keepPreviousData: true,
|
||||
staleTime: 5000,
|
||||
select: (data) => {
|
||||
// We purposly removed the "applied_spec_team" activity as we are currently
|
||||
// thinking how we want to display this in the UI.
|
||||
return data.activities.filter(
|
||||
(activity) => activity.type !== ActivityType.AppliedSpecTeam
|
||||
);
|
||||
return data.activities;
|
||||
},
|
||||
onSuccess: (results) => {
|
||||
setShowActivityFeedTitle(true);
|
||||
|
|
@ -150,6 +156,9 @@ const ActivityFeed = ({
|
|||
case ActivityType.AppliedSpecSavedQuery: {
|
||||
return TAGGED_TEMPLATES.editQueryCtlActivityTemplate(activity);
|
||||
}
|
||||
case ActivityType.AppliedSpecTeam: {
|
||||
return TAGGED_TEMPLATES.editTeamCtlActivityTemplate(activity);
|
||||
}
|
||||
case ActivityType.UserAddedBySSO: {
|
||||
return TAGGED_TEMPLATES.userAddedBySSOTempalte();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue