Skip to content

Commit 8484523

Browse files
authored
fix: allow deleting updatemany queries COMPASS-9121 (#6817)
pipelines work one way, other query types another
1 parent aa9fd52 commit 8484523

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

packages/compass-saved-aggregations-queries/src/stores/delete-item.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ export const confirmDeleteItem = (
5555
undefined // this event is connection scoped when triggered from the aggregation or query screen
5656
);
5757

58-
if (item.type === 'query') {
59-
await queryStorage?.delete(item.id);
60-
} else {
58+
if (item.type === 'aggregation') {
6159
await pipelineStorage?.delete(item.id);
60+
} else {
61+
// query or updatemany
62+
await queryStorage?.delete(item.id);
6263
}
6364

6465
dispatch({ type: ActionTypes.DeleteItemConfirm, id: item.id });

packages/compass-saved-aggregations-queries/src/stores/edit-item.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,14 @@ export const updateItem =
8787
return;
8888
}
8989

90-
if (item.type === 'query') {
90+
if (item.type === 'aggregation') {
91+
await pipelineStorage?.updateAttributes(id, attributes);
92+
} else {
93+
// query or updatemany
9194
await queryStorage?.updateAttributes(id, {
9295
_name: attributes.name,
9396
_dateModified: new Date(),
9497
});
95-
} else {
96-
await pipelineStorage?.updateAttributes(id, attributes);
9798
}
9899

99100
dispatch({

packages/compass-saved-aggregations-queries/src/stores/open-item.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,8 @@ export const openSelectedItem =
572572
await pipelineStorage?.updateAttributes(id, {
573573
namespace: newNamespace,
574574
});
575-
} else if (selectedItem.type === 'query') {
575+
} else {
576+
// query or updatemany
576577
await queryStorage?.updateAttributes(id, { _ns: newNamespace });
577578
}
578579
}

0 commit comments

Comments
 (0)