diff --git a/app/packages/mongodb/src/components/Collections.tsx b/app/packages/mongodb/src/components/Collections.tsx
index 482de054..1cf40305 100644
--- a/app/packages/mongodb/src/components/Collections.tsx
+++ b/app/packages/mongodb/src/components/Collections.tsx
@@ -254,9 +254,11 @@ const CollectionList: FunctionComponent<{ collections: string[]; instance: IPlug
const handleClear = () => {
setFilter('');
- setOptions({ filter: filter, page: 1, perPage: options.perPage });
+ setOptions({ filter: '', page: 1, perPage: options.perPage });
};
+ console.log(options);
+
return (
<>
@@ -285,12 +287,15 @@ const CollectionList: FunctionComponent<{ collections: string[]; instance: IPlug
- {collections.map((collection, index) => (
-
-
- {index + 1 !== collections.length && }
-
- ))}
+ {collections
+ .filter((collection) => collection.includes(options.filter))
+ .slice((options.page - 1) * options.perPage, options.page * options.perPage)
+ .map((collection, index) => (
+
+
+ {index + 1 !== collections.length && }
+
+ ))}
(
['mongodb/collections', instance],
async () => {
- return apiContext.client.get(`/api/plugins/mongodb/collections`, {
+ const collections = await apiContext.client.get(`/api/plugins/mongodb/collections`, {
headers: {
'x-kobs-cluster': instance.cluster,
'x-kobs-plugin': instance.name,
},
});
+ return collections.sort();
},
);