fleet/frontend/interfaces/label.ts
Jacob Shandling 58043c9d27
Remove lowercasing of display text match when generating label filter options (#16176)
## Addresses #15894 
![Screenshot 2024-01-17 at 12 14
38 PM](https://github.com/fleetdm/fleet/assets/61553566/92c520d4-d1d7-48df-80e8-9c40e2c261f3)

![Screenshot 2024-01-17 at 12 14
58 PM](https://github.com/fleetdm/fleet/assets/61553566/68607bec-48e6-4e4d-abe3-6f7afa0a4f94)
![Screenshot 2024-01-17 at 12 14
54 PM](https://github.com/fleetdm/fleet/assets/61553566/5ffd673b-2924-45c3-a4f0-8a3ee8c167f6)


## Checklist for submitter
- [x] Changes file added for user-visible changes in `changes/`
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2024-01-18 11:10:50 -05:00

62 lines
1.7 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.string,
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),
});
export type LabelType = "regular" | "builtin";
export type LabelMembershipType = "dynamic" | "manual";
export interface ILabelSummary {
id: number;
name: string;
description?: string;
label_type: LabelType;
}
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;
}
export interface ILabelFormData {
name: string;
query: string;
description: string;
platform: string;
}
// 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[];
};
}