mirror of
https://github.com/fleetdm/fleet
synced 2026-05-21 16:08:47 +00:00
For #27037 # Checklist for submitter - [ ] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files) for more information. ## Details This PR updates the UI to allow team admins and maintainers to create labels, and to edit or delete labels that they created. They will not be able to edit or delete labels created by other team admins or maintainers, or by global admins. Global admins will still be able to edit or delete any label. ## Testing 1. Log in a global user and create a new label 1. Create a team admin user 1. Verify that the team admin user can create a label 2. Verify that the team admin user can edit their own label 2. Verify that the team admin user can delete their own label 2. Verify that the team admin user cannot edit or delete the label created by the global user 3. Create a team maintainer user 1. Verify that the team maintainer user can create a label 2. Verify that the team maintainer user can edit their own label 2. Verify that the team maintainer user can delete their own label 2. Verify that the team maintainer user cannot edit or delete the label created by the global user 2. Verify that the team maintainer user cannot edit or delete the label created by the team admin user 3. Verify that the team admin user cannot edit or delete the label created by the team maintainer user
66 lines
1.8 KiB
TypeScript
66 lines
1.8 KiB
TypeScript
import PropTypes from "prop-types";
|
|
|
|
export default PropTypes.shape({
|
|
created_at: PropTypes.string,
|
|
updated_at: PropTypes.string,
|
|
id: PropTypes.oneOfType([PropTypes.number]),
|
|
name: PropTypes.string,
|
|
query: PropTypes.string,
|
|
label_type: PropTypes.oneOf(["regular", "builtin"]),
|
|
label_membership_type: PropTypes.oneOf(["dynamic", "manual"]),
|
|
hosts_count: PropTypes.number,
|
|
display_text: PropTypes.string,
|
|
count: PropTypes.number, // seems to be a repeat of hosts_count issue #1618
|
|
host_ids: PropTypes.arrayOf(PropTypes.number),
|
|
});
|
|
|
|
export type LabelType = "regular" | "builtin";
|
|
export type LabelMembershipType = "dynamic" | "manual";
|
|
|
|
export interface ILabelSummary {
|
|
id: number;
|
|
name: string;
|
|
description?: string;
|
|
label_type: LabelType;
|
|
}
|
|
|
|
export interface ILabelSoftwareTitle {
|
|
id: number;
|
|
name: string;
|
|
}
|
|
|
|
export interface ILabelQuery {
|
|
id: number;
|
|
name: string;
|
|
}
|
|
|
|
export interface ILabel extends ILabelSummary {
|
|
created_at: string;
|
|
updated_at: string;
|
|
uuid?: string;
|
|
query: string;
|
|
label_membership_type: LabelMembershipType;
|
|
host_count?: number; // returned for built-in labels but not custom labels
|
|
display_text: string;
|
|
count: number; // seems to be a repeat of hosts_count issue #1618
|
|
host_ids: number[] | null;
|
|
type?: "custom" | "platform" | "status" | "all";
|
|
slug?: string; // e.g., "labels/13" | "online"
|
|
target_type?: string; // e.g., "labels"
|
|
platform: string;
|
|
author_id?: number;
|
|
}
|
|
|
|
// corresponding to fleet>server>fleet>labels.go>LabelSpec
|
|
export interface ILabelSpecResponse {
|
|
specs: {
|
|
id: number;
|
|
name: string;
|
|
description: string;
|
|
query: string;
|
|
platform?: string; // improve to only allow possible platforms from API
|
|
label_type?: LabelType;
|
|
label_membership_type: LabelMembershipType;
|
|
hosts?: string[];
|
|
};
|
|
}
|