mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
UI - Fix a synchronicity issue in automations API patches (#13035)
## Addresses #13007 ## Fix a synchronicity issue in automations API patches <img width="825" alt="Screenshot 2023-07-28 at 12 49 21 PM" src="https://github.com/fleetdm/fleet/assets/61553566/9729dcd0-4813-452a-9911-6cf60f8352af"> - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
parent
37203dbad2
commit
1cf532dfbb
3 changed files with 7 additions and 9 deletions
|
|
@ -18,7 +18,6 @@ import {
|
|||
IHost,
|
||||
IDeviceMappingResponse,
|
||||
IMacadminsResponse,
|
||||
IPackStats,
|
||||
IHostResponse,
|
||||
IHostMdmData,
|
||||
IPackStats,
|
||||
|
|
@ -33,7 +32,6 @@ import {
|
|||
IQueryKeyQueriesLoadAll,
|
||||
ISchedulableQuery,
|
||||
} from "interfaces/schedulable_query";
|
||||
import { IQueryStats } from "interfaces/query_stats";
|
||||
|
||||
import Spinner from "components/Spinner";
|
||||
import TabsWrapper from "components/TabsWrapper";
|
||||
|
|
|
|||
|
|
@ -353,14 +353,14 @@ const ManageQueriesPage = ({
|
|||
);
|
||||
|
||||
// Update query automations using queries/{id} manage_automations parameter
|
||||
const updateAutomatedQueries = [];
|
||||
updateAutomatedQueries.push(
|
||||
turnOnAutomations.map((id: number) =>
|
||||
const updateAutomatedQueries: Promise<any>[] = [];
|
||||
turnOnAutomations.map((id: number) =>
|
||||
updateAutomatedQueries.push(
|
||||
queriesAPI.update(id, { automations_enabled: true })
|
||||
)
|
||||
);
|
||||
updateAutomatedQueries.push(
|
||||
turnOffAutomations.map((id: number) =>
|
||||
turnOffAutomations.map((id: number) =>
|
||||
updateAutomatedQueries.push(
|
||||
queriesAPI.update(id, { automations_enabled: false })
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ func (ds *Datastore) ListQueries(ctx context.Context, opt fleet.ListQueryOptions
|
|||
sql = appendListOptionsToSQL(sql, &opt.ListOptions)
|
||||
|
||||
results := []*fleet.Query{}
|
||||
if err := sqlx.SelectContext(ctx, ds.writer(ctx), &results, sql, args...); err != nil {
|
||||
if err := sqlx.SelectContext(ctx, ds.reader(ctx), &results, sql, args...); err != nil {
|
||||
return nil, ctxerr.Wrap(ctx, err, "listing queries")
|
||||
}
|
||||
|
||||
|
|
@ -434,7 +434,7 @@ func (ds *Datastore) loadPacksForQueries(ctx context.Context, queries []*fleet.Q
|
|||
fleet.Pack
|
||||
}{}
|
||||
|
||||
err = sqlx.SelectContext(ctx, ds.writer(ctx), &rows, query, args...)
|
||||
err = sqlx.SelectContext(ctx, ds.reader(ctx), &rows, query, args...)
|
||||
if err != nil {
|
||||
return ctxerr.Wrap(ctx, err, "selecting load packs for queries")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue