This is an automated email from the ASF dual-hosted git repository.

hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks-controller.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 475976a  Fix npm build error and build web ui in CI (#296)
475976a is described below

commit 475976a843bca2ec7e96625134f4ad245eea62fa
Author: hulk <[email protected]>
AuthorDate: Wed Mar 26 08:13:40 2025 +0800

    Fix npm build error and build web ui in CI (#296)
    
    Before this PR, run `npm run build` will return the following error:
    
    ```shell
    ./src/app/namespaces/[namespace]/clusters/[cluster]/page.tsx:114:41
    Type error: Type '({ label: string; color: string; } | undefined)[]' is not 
assignable to type '{ label: string; color?: string | undefined; }[]'.
      Type '{ label: string; color: string; } | undefined' is not assignable to 
type '{ label: string; color?: string | undefined; }'.
        Type 'undefined' is not assignable to type '{ label: string; color?: 
string | undefined; }'.
    
      112 |                                     <ResourceCard
      113 |                                         title={`Shard ${index + 1}`}
    > 114 |                                         tags={[
          |                                         ^
      115 |                                             {
      116 |                                                 label: 
`${shard.nodes.length} nodes`,
      117 |                                                 color: "secondary",
    
    ```
    
    It's due to using the array filter on undefined values.
---
 .github/workflows/ci.yaml                                        | 3 +++
 webui/src/app/namespaces/[namespace]/clusters/[cluster]/page.tsx | 8 ++++----
 webui/src/app/not-found.tsx                                      | 4 ++--
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index cc8d0b1..5372d25 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -97,6 +97,9 @@ jobs:
       - name: Build
         run: make
 
+      - name: Build Web UI
+        run: cd webui && npm install && npm run build
+
       - name: Make Test
         run: make test
 
diff --git a/webui/src/app/namespaces/[namespace]/clusters/[cluster]/page.tsx 
b/webui/src/app/namespaces/[namespace]/clusters/[cluster]/page.tsx
index 64481a4..a970e64 100644
--- a/webui/src/app/namespaces/[namespace]/clusters/[cluster]/page.tsx
+++ b/webui/src/app/namespaces/[namespace]/clusters/[cluster]/page.tsx
@@ -116,10 +116,10 @@ export default function Cluster({ params }: { params: { 
namespace: string; clust
                                                 label: `${shard.nodes.length} 
nodes`,
                                                 color: "secondary",
                                             },
-                                            shard.migrating_slot >= 0
-                                                ? { label: "Migrating", color: 
"warning" }
-                                                : undefined,
-                                        ].filter(Boolean)}
+                                            ...(shard.migrating_slot >= 0
+                                                ? [{ label: "Migrating", 
color: "warning" }]
+                                                : []),
+                                        ]}
                                     >
                                         <div className="space-y-2 text-sm">
                                             <div className="flex 
justify-between">
diff --git a/webui/src/app/not-found.tsx b/webui/src/app/not-found.tsx
index 3c3c6df..851b6e8 100644
--- a/webui/src/app/not-found.tsx
+++ b/webui/src/app/not-found.tsx
@@ -42,8 +42,8 @@ export default function NotFound() {
                 </Typography>
 
                 <Typography variant="body1" className="mb-8 text-gray-600 
dark:text-gray-300">
-                    We couldn't find the page you're looking for. It might 
have been moved, deleted,
-                    or never existed.
+                    We couldn&apos;t find the page you&apos;re looking for. It 
might have been
+                    moved, deleted, or never existed.
                 </Typography>
 
                 <div className="flex flex-wrap justify-center gap-4">

Reply via email to