You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/06/11 09:52:46 UTC

[GitHub] [incubator-apisix-dashboard] juzhiyuan commented on a change in pull request #255: add: metrics(Grafana)

juzhiyuan commented on a change in pull request #255:
URL: https://github.com/apache/incubator-apisix-dashboard/pull/255#discussion_r438666207



##########
File path: src/pages/Metrics/Metrics.tsx
##########
@@ -0,0 +1,53 @@
+import React, { useState } from 'react';
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
+import { Empty, Button, Card } from 'antd';
+import { history } from 'umi';
+import { stringify } from 'qs';
+
+const Metrics: React.FC<{}> = () => {

Review comment:
       ,

##########
File path: src/pages/Metrics/Metrics.tsx
##########
@@ -0,0 +1,53 @@
+import React, { useState } from 'react';
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
+import { Empty, Button, Card } from 'antd';
+import { history } from 'umi';
+import { stringify } from 'qs';
+
+const Metrics: React.FC<{}> = () => {
+  const GLOBAL_ADMIN_SETTING_GRAFANA_URL =
+    localStorage.getItem('GLOBAL_ADMIN_SETTING_GRAFANA_URL') || undefined;
+  const [showMetricsDashboard] = useState(GLOBAL_ADMIN_SETTING_GRAFANA_URL);

Review comment:
       or `const grafanaURL = xxx`

##########
File path: src/pages/Setting/service.ts
##########
@@ -1,8 +1,9 @@
-export const getAdminAPIConfig = (): Setting.AdminAPI => {
+export const getAdminAPIConfig = (): Setting.DashboardConfig => {

Review comment:
       A & B

##########
File path: src/pages/Metrics/Metrics.tsx
##########
@@ -0,0 +1,53 @@
+import React, { useState } from 'react';
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
+import { Empty, Button, Card } from 'antd';
+import { history } from 'umi';
+import { stringify } from 'qs';
+
+const Metrics: React.FC<{}> = () => {
+  const GLOBAL_ADMIN_SETTING_GRAFANA_URL =
+    localStorage.getItem('GLOBAL_ADMIN_SETTING_GRAFANA_URL') || undefined;

Review comment:
       undefined?

##########
File path: src/pages/Metrics/Metrics.tsx
##########
@@ -0,0 +1,53 @@
+import React, { useState } from 'react';
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
+import { Empty, Button, Card } from 'antd';
+import { history } from 'umi';
+import { stringify } from 'qs';
+
+const Metrics: React.FC<{}> = () => {
+  const GLOBAL_ADMIN_SETTING_GRAFANA_URL =
+    localStorage.getItem('GLOBAL_ADMIN_SETTING_GRAFANA_URL') || undefined;
+  const [showMetricsDashboard] = useState(GLOBAL_ADMIN_SETTING_GRAFANA_URL);

Review comment:
       1. showMetrics is fine;
   2. useState(Boolean(localStorage.getItem('GLOBAL_ADMIN_SETTING_GRAFANA_URL')))

##########
File path: src/pages/Setting/typingd.d.ts
##########
@@ -5,4 +5,8 @@ declare namespace Setting {
     path: string;
     key: string;
   }
+
+  interface DashboardConfig extends AdminAPI {

Review comment:
       ,

##########
File path: src/pages/Setting/service.ts
##########
@@ -1,8 +1,9 @@
-export const getAdminAPIConfig = (): Setting.AdminAPI => {
+export const getAdminAPIConfig = (): Setting.DashboardConfig => {
   return {
     schema: localStorage.getItem('GLOBAL_ADMIN_API_SCHEMA') || 'http',
     host: localStorage.getItem('GLOBAL_ADMIN_API_HOST') || '127.0.0.1:9080',
     path: localStorage.getItem('GLOBAL_ADMIN_API_PATH') || '/apisix/admin',
     key: localStorage.getItem('GLOBAL_ADMIN_API_KEY') || '',
+    grafanaUrl: localStorage.getItem('GLOBAL_ADMIN_SETTING_GRAFANA_URL') || '',

Review comment:
       grafanaURL

##########
File path: src/pages/Metrics/Metrics.tsx
##########
@@ -0,0 +1,53 @@
+import React, { useState } from 'react';
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
+import { Empty, Button, Card } from 'antd';
+import { history } from 'umi';
+import { stringify } from 'qs';
+
+const Metrics: React.FC<{}> = () => {
+  const GLOBAL_ADMIN_SETTING_GRAFANA_URL =
+    localStorage.getItem('GLOBAL_ADMIN_SETTING_GRAFANA_URL') || undefined;

Review comment:
       from service?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org