You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/06/15 08:58:02 UTC

[incubator-apisix-dashboard] branch next updated: add: Verify grafanaURL (#258)

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

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


The following commit(s) were added to refs/heads/next by this push:
     new 864b44e  add: Verify grafanaURL (#258)
864b44e is described below

commit 864b44e3711210028992b381bcc68b5cb61a91ea
Author: litesun <31...@users.noreply.github.com>
AuthorDate: Mon Jun 15 16:57:55 2020 +0800

    add: Verify grafanaURL (#258)
    
    * add: grafanaURL startsWith
    
    * feat: drop startsWith
---
 src/pages/Setting/Setting.tsx | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/pages/Setting/Setting.tsx b/src/pages/Setting/Setting.tsx
index ee09f87..9c12565 100644
--- a/src/pages/Setting/Setting.tsx
+++ b/src/pages/Setting/Setting.tsx
@@ -17,6 +17,15 @@ const Settings: React.FC<{}> = () => {
   }, []);
 
   const onFinish = ({ grafanaURL, baseURL }: Setting.AdminAPI & Setting.GrafanaConfig) => {
+    if (grafanaURL.length) {
+      if (!/^https?:\/\//.test(grafanaURL)) {
+        notification.error({
+          duration: 3,
+          message: 'Grafana 地址需以 http 或 https 开头',
+        });
+        return;
+      }
+    }
     localStorage.setItem('GLOBAL_SETTING_API_BASE_URL', baseURL);
     localStorage.setItem('GLOBAL_SETTING_GRAFANA_URL', grafanaURL);