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

tokers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 904fbc2  feat: When Dashboard and APISIX version do not match, make 
the prompt information clearer (#1944) (#1968)
904fbc2 is described below

commit 904fbc248c8cace5b5544cf28b9108395b4fd323
Author: RedemptionC <[email protected]>
AuthorDate: Mon Jul 26 19:24:06 2021 +0800

    feat: When Dashboard and APISIX version do not match, make the prompt 
information clearer (#1944) (#1968)
    
    Co-authored-by: nic-chen <[email protected]>
---
 api/internal/handler/tool/tool.go       | 9 ++++++---
 api/internal/handler/tool/tool_test.go  | 2 +-
 api/test/e2enew/version/version_test.go | 5 +++--
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/api/internal/handler/tool/tool.go 
b/api/internal/handler/tool/tool.go
index a5a0537..e7bf4d6 100644
--- a/api/internal/handler/tool/tool.go
+++ b/api/internal/handler/tool/tool.go
@@ -17,6 +17,7 @@
 package tool
 
 import (
+       "fmt"
        "net/http"
 
        "github.com/gin-gonic/gin"
@@ -101,9 +102,11 @@ func (h *Handler) VersionMatch(c droplet.Context) 
(interface{}, error) {
        } else {
                // TODO: move this to utils
                return &data.SpecCodeResponse{StatusCode: http.StatusOK, 
Response: data.Response{
-                       Data:    &output,
-                       Code:    2000001,
-                       Message: "The manager-api and apache apisix are 
mismatched.",
+                       Data: &output,
+                       Code: 2000001,
+                       Message: fmt.Sprintf("The Manager API and Apache APISIX 
are mismatched. "+
+                               "The version of Manager API is %s, and should 
be used with Apache APISIX %s.",
+                               version, matchedVersion),
                }}, nil
        }
 
diff --git a/api/internal/handler/tool/tool_test.go 
b/api/internal/handler/tool/tool_test.go
index 2bc5150..e1ed54d 100644
--- a/api/internal/handler/tool/tool_test.go
+++ b/api/internal/handler/tool/tool_test.go
@@ -115,7 +115,7 @@ func TestTool_VersionMatch(t *testing.T) {
                                                },
                                        },
                                        Code:    2000001,
-                                       Message: "The manager-api and apache 
apisix are mismatched.",
+                                       Message: "The Manager API and Apache 
APISIX are mismatched. The version of Manager API is , and should be used with 
Apache APISIX .",
                                }},
                        },
                }
diff --git a/api/test/e2enew/version/version_test.go 
b/api/test/e2enew/version/version_test.go
index 7056e32..13794e6 100644
--- a/api/test/e2enew/version/version_test.go
+++ b/api/test/e2enew/version/version_test.go
@@ -44,8 +44,9 @@ var _ = ginkgo.Describe("Version", func() {
                        Headers:      map[string]string{"Authorization": 
base.GetToken()},
                        ExpectStatus: http.StatusOK,
                        ExpectBody: []string{"\"code\":2000001",
-                               "\"message\":\"The manager-api and apache 
apisix are mismatched.\"",
-                               "\"matched\":false", "apisix_server1", 
"apisix_server2"},
+                               `"message":"The Manager API and Apache APISIX 
are mismatched. ` +
+                                       `The version of Manager API is , and 
should be used with Apache APISIX ."`,
+                               `"matched":false`, "apisix_server1", 
"apisix_server2"},
                }),
        )
 })

Reply via email to