ソースを参照

Fix search in Replicas and Migrations pages

Fixes an issue where search functionality was not working when replicas
or migrations had a notes field with a null value. Previously, it was
assumed that the notes field could only contain a string.
Sergiu Miclea 2 年 前
コミット
224545a49a

+ 1 - 1
src/@types/MainItem.ts

@@ -71,7 +71,7 @@ type BaseItem = {
   id: string;
   name: string;
   description?: string;
-  notes: string;
+  notes: string | null;
   created_at: string;
   updated_at: string;
   origin_endpoint_id: string;

+ 1 - 1
src/components/smart/MigrationsPage/MigrationsPage.tsx

@@ -179,7 +179,7 @@ class MigrationsPage extends React.Component<{ history: any }, State> {
     if (item.instances[0].toLowerCase().indexOf(text) > -1) {
       return true;
     }
-    if (item.notes.toLowerCase().indexOf(text) > -1) {
+    if (item.notes && item.notes.toLowerCase().indexOf(text) > -1) {
       return true;
     }
     if (item.destination_environment) {

+ 1 - 1
src/components/smart/ReplicasPage/ReplicasPage.tsx

@@ -307,7 +307,7 @@ class ReplicasPage extends React.Component<{ history: any }, State> {
     if (item.instances[0].toLowerCase().indexOf(text) > -1) {
       return true;
     }
-    if (item.notes.toLowerCase().indexOf(text) > -1) {
+    if (item.notes && item.notes.toLowerCase().indexOf(text) > -1) {
       return true;
     }
     if (item.destination_environment) {