fleet/frontend/__mocks__/queryMock.ts
Jacob Shandling df2ada1809
UI - Add 'Discard data' option to Save Query modal (#14284)
## Addresses pt.1 of #13470

4 states + InfoBanner:

<img width="746" alt="Screenshot 2023-10-03 at 2 51 36 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/0cffd9a1-8a96-4723-a080-10d68d7c7c70">
<img width="746" alt="Screenshot 2023-10-03 at 2 51 55 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/12237208-f29a-4c90-86c8-8fb71d64fbf4">
<img width="746" alt="Screenshot 2023-10-03 at 2 52 20 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/6bdeb8c6-250f-4edb-a630-aa978a98e428">
<img width="746" alt="Screenshot 2023-10-03 at 2 52 26 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/bae0e656-56f4-4f6a-9972-5ff0fa2f24bf">

<img width="735" alt="Screenshot 2023-10-03 at 5 15 44 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/b26ce3ed-7949-4823-a6a4-fa04e152a480">

## Checklist for submitter
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2023-10-04 15:19:26 -07:00

39 lines
889 B
TypeScript

import { ISchedulableQuery } from "interfaces/schedulable_query";
const DEFAULT_QUERY_MOCK: ISchedulableQuery = {
created_at: "2022-11-03T17:22:14Z",
updated_at: "2022-11-03T17:22:14Z",
id: 1,
name: "Test Query",
description: "A test query",
query: "SELECT * FROM users",
saved: true,
author_id: 1,
author_name: "Test User",
author_email: "test@example.com",
observer_can_run: false,
discard_data: false,
interval: 300,
packs: [],
team_id: null,
platform: "",
min_osquery_version: "",
automations_enabled: false,
logging: "snapshot",
stats: {
user_time_p50: 0,
user_time_p95: 2,
system_time_p50: 0,
system_time_p95: 1,
total_executions: 6,
},
};
const createMockQuery = (
overrides?: Partial<ISchedulableQuery>
): ISchedulableQuery => {
return { ...DEFAULT_QUERY_MOCK, ...overrides };
};
export default createMockQuery;