From c154f031d260f0656a4d7fc6776b25ce1b3672d4 Mon Sep 17 00:00:00 2001
From: Andres Martinez Gotor
Date: Wed, 8 Apr 2020 16:56:03 +0200
Subject: [PATCH] Include the Categories filter even if the result is empty
---
.../OperatorList/OperatorList.test.tsx | 1 +
.../components/OperatorList/OperatorList.tsx | 71 ++++++++++---------
2 files changed, 40 insertions(+), 32 deletions(-)
diff --git a/dashboard/src/components/OperatorList/OperatorList.test.tsx b/dashboard/src/components/OperatorList/OperatorList.test.tsx
index 69cae1b46af..4ff3f5b8148 100644
--- a/dashboard/src/components/OperatorList/OperatorList.test.tsx
+++ b/dashboard/src/components/OperatorList/OperatorList.test.tsx
@@ -234,6 +234,7 @@ describe("filter operators", () => {
.dive()
.text(),
).toMatch("No Operator found");
+ expect(wrapper.find(".horizontal-column")).toExist();
});
it("filters by category", () => {
diff --git a/dashboard/src/components/OperatorList/OperatorList.tsx b/dashboard/src/components/OperatorList/OperatorList.tsx
index 146c978d962..ee15b2abc5e 100644
--- a/dashboard/src/components/OperatorList/OperatorList.tsx
+++ b/dashboard/src/components/OperatorList/OperatorList.tsx
@@ -197,9 +197,6 @@ class OperatorList extends React.ComponentNo Operator found
;
- }
filteredOperators.forEach(operator => {
if (csvNames.some(csvName => csvName === getDefaultChannel(operator.status).currentCSV)) {
installedOperators.push(operator);
@@ -249,34 +246,28 @@ class OperatorList extends React.Component
- {installedOperators.length > 0 && (
- <>
-
Installed
-
- {installedOperators.map(operator => {
- return (
-
- );
- })}
-
- >
+ {filteredOperators.length === 0 ? (
+
No Operator found
+ ) : (
+ this.renderCardGrid(installedOperators, availableOperators)
)}
-
Available Operators
+
+
+
+ );
+ }
+
+ private renderCardGrid(
+ installedOperators: IPackageManifest[],
+ availableOperators: IPackageManifest[],
+ ) {
+ return (
+ <>
+ {installedOperators.length > 0 && (
+ <>
+ Installed
- {availableOperators.map(operator => {
+ {installedOperators.map(operator => {
return (
-
-
-
+ >
+ )}
+ Available Operators
+
+ {availableOperators.map(operator => {
+ return (
+
+ );
+ })}
+
+ >
);
}