fleet/frontend/interfaces/query.ts
Jacob Shandling 2adf3ce477
UI – Componentize "Discard data" option and add it to Edit Query page (#14343)
## Addresses #13470 

- [x] Save query
  - [x] Add checkbox
    - [x] default unchecked
- [x] If global setting is disabled (that is, "Disable query reports" is
_enabled_)
      - [x] this box is disabled
      - [x] copy below is changed
- [x] If enabled locally but globally disabled, box is checked and
disabled
- [x] If user clicks "Edit anyway", the normal checkbox state is
restored, allowing them to edit it anyway., e.g. to prepare for enabling
globally before doing so
- [x] banner under [certain
conditions](https://www.figma.com/file/ss8dSfoueq3REJxoGaxkNw/%237766-See-latest-query-results?type=design&node-id=470%3A9996&mode=design&t=XDBlQetD7kqdEdh9-1)
  - [x] 2 x update help text
- [x] Edit query
  - [x] checkbox
  - [x] back button
  - [x] 2 x help text updates
- [x] save changes modals when
[conditions](https://www.figma.com/file/ss8dSfoueq3REJxoGaxkNw/%237766-See-latest-query-results?type=design&node-id=470%3A8745&mode=design&t=XDBlQetD7kqdEdh9-1)
are met:
    - [x] changed SQL
    - [x] other 
- [x] Mange queries - update[
tooltip](https://www.figma.com/file/ss8dSfoueq3REJxoGaxkNw/%237766-See-latest-query-results?type=design&node-id=470%3A10035&mode=design&t=ACwsj3wVdqzCXulq-1)
- [x] Significant cleanup and improvement of styles and structure around
the Edit Queries page


<img width="854" alt="Screenshot 2023-10-05 at 3 44 05 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/9831570f-3c83-4e59-b040-649d52faa257">
<img width="854" alt="Screenshot 2023-10-05 at 3 44 15 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/dec76eba-46d1-4e43-87e9-e7fc44e84691">
<img width="854" alt="Screenshot 2023-10-05 at 3 45 09 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/a7879b21-49b0-476a-81ab-6b465967510f">
<img width="854" alt="Screenshot 2023-10-05 at 3 45 29 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/14a90d0a-2a52-4e59-8ee8-fb76fce55417">
<img width="1105" alt="Screenshot 2023-10-05 at 3 46 58 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/6c488fbe-4e5a-442b-8b62-2ddd15bda1fe">
<img width="1105" alt="Screenshot 2023-10-05 at 3 47 10 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/649534c5-d859-41f9-8c8a-6882b1dc2219">
<img width="1105" alt="Screenshot 2023-10-05 at 3 47 24 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/eaa0469c-a57a-474d-87bc-21cf2133dd3c">


## Checklist for submitter

- [x] Added/updated tests
- [ ] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2023-10-09 11:31:31 -07:00

44 lines
1.1 KiB
TypeScript

import { IFormField } from "./form_field";
import { IPack } from "./pack";
import { ISchedulableQuery } from "./schedulable_query";
import { IScheduledQueryStats } from "./scheduled_query_stats";
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 IFleetQueriesResponse {
queries: 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?: IScheduledQueryStats;
}
export interface IEditQueryFormFields {
description: IFormField;
name: IFormField;
query: IFormField;
observer_can_run: IFormField;
}