2022-02-14 22:11:12 +00:00
|
|
|
import PropTypes from "prop-types";
|
2016-11-17 17:12:41 +00:00
|
|
|
|
|
|
|
|
export default PropTypes.shape({
|
2021-07-27 22:04:43 +00:00
|
|
|
created_at: PropTypes.string,
|
2021-08-16 14:30:19 +00:00
|
|
|
updated_at: PropTypes.string,
|
2022-10-10 18:07:47 +00:00
|
|
|
id: PropTypes.oneOfType([PropTypes.number]),
|
2021-07-27 22:04:43 +00:00
|
|
|
name: PropTypes.string,
|
2021-08-16 14:30:19 +00:00
|
|
|
query: PropTypes.string,
|
2021-07-27 22:04:43 +00:00
|
|
|
label_type: PropTypes.string,
|
2021-08-16 14:30:19 +00:00
|
|
|
label_membership_type: PropTypes.string,
|
|
|
|
|
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),
|
2016-11-17 17:12:41 +00:00
|
|
|
});
|
2021-03-03 16:51:39 +00:00
|
|
|
|
2023-06-06 20:44:21 +00:00
|
|
|
export type LabelType = "regular" | "builtin";
|
|
|
|
|
export type LabelMembershipType = "dynamic" | "manual";
|
|
|
|
|
|
2022-06-10 18:29:45 +00:00
|
|
|
export interface ILabelSummary {
|
2022-10-10 18:07:47 +00:00
|
|
|
id: number;
|
2021-07-27 22:04:43 +00:00
|
|
|
name: string;
|
2021-09-30 19:32:06 +00:00
|
|
|
description?: string;
|
2023-06-06 20:44:21 +00:00
|
|
|
label_type: LabelType;
|
2022-06-10 18:29:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ILabel extends ILabelSummary {
|
|
|
|
|
created_at: string;
|
|
|
|
|
updated_at: string;
|
|
|
|
|
uuid?: string;
|
|
|
|
|
query: string;
|
2023-06-06 20:44:21 +00:00
|
|
|
label_membership_type: LabelMembershipType;
|
2024-01-18 16:10:50 +00:00
|
|
|
host_count?: number; // returned for built-in labels but not custom labels
|
2021-08-16 14:30:19 +00:00
|
|
|
display_text: string;
|
|
|
|
|
count: number; // seems to be a repeat of hosts_count issue #1618
|
|
|
|
|
host_ids: number[] | null;
|
2022-02-14 22:11:12 +00:00
|
|
|
type?: "custom" | "platform" | "status" | "all";
|
2021-09-30 19:32:06 +00:00
|
|
|
slug?: string; // e.g., "labels/13" | "online"
|
|
|
|
|
target_type?: string; // e.g., "labels"
|
|
|
|
|
platform: string;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-06 20:44:21 +00:00
|
|
|
// 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[];
|
|
|
|
|
};
|
|
|
|
|
}
|