fleet/frontend/interfaces/query.ts
jacobshandling 2118616f64
21855 – Paginate and filter Queries on the server, update platform filtering from compatible to targeted platforms (#24446)
## Addresses #21855 and all of its subtasks

**Frontend:**
- Update list queries API call to include pagination and filter-related
query params, including new `platform` param for filtering queries by
platforms they've been set to target
- Convert all filtering, sorting, and pagination functionality of the
Manage queries page from client-side to server-side
- Remove unneeded variable declarations / logic
- Various typing and naming improvements

**Server:**
- Add new `platform` `ListQueryOption`
- Update service and datastore level list queries logic to handle
filtering queries by targeted platform
- Update service and datastore level list queries logic to include
`meta` and `count` fields in addition to filtered/paginated queries


- [x] Changes file added for user-visible changes in `changes/`, `
- [x] Added/updated tests
  - [x] update DB, integration
  - [x] add integration (pagination)
  - [x] add integration (platform filter)
  - [x] add DB (pagination)
  - [x] add DB (platform filter)
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2024-12-11 10:50:28 -08:00

38 lines
966 B
TypeScript

import { IFormField } from "./form_field";
import { IPack } from "./pack";
import { ISchedulableQuery, ISchedulableQueryStats } from "./schedulable_query";
export interface IEditQueryFormData {
description?: string | number | boolean | undefined;
name?: string | number | boolean | undefined;
query?: string | number | boolean | undefined;
observer_can_run?: string | number | boolean | undefined;
automations_enabled?: boolean;
}
export interface IStoredQueryResponse {
query: ISchedulableQuery;
}
export interface IQuery {
created_at: string;
updated_at: string;
id: number;
name: string;
description: string;
query: string;
saved: boolean;
author_id: number;
author_name: string;
author_email: string;
observer_can_run: boolean;
packs: IPack[];
stats?: ISchedulableQueryStats;
}
export interface IEditQueryFormFields {
description: IFormField;
name: IFormField;
query: IFormField;
observer_can_run: IFormField;
}