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/08/27 01:31:48 UTC

[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #415: Feat:added pluginChart

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



##########
File path: src/pages/Route/components/Step3/index.tsx
##########
@@ -0,0 +1,54 @@
+import React, { useState } from 'react';
+import { Radio, Tooltip } from 'antd';
+import { QuestionCircleOutlined } from '@ant-design/icons';
+import { isChrome } from 'react-device-detect';
+import { PluginPage, PluginPageType } from '@api7-dashboard/plugin';
+import PluginChart from '@api7-dashboard/pluginchart';
+
+type Props = {
+  data: PluginPageType.PluginData;
+  onChange(data: PluginPageType.PluginData): void;
+};
+
+type Mode = 'NORMAL' | 'DRAW';
+
+const Page: React.FC<Props> = ({ data, onChange }) => {
+  const { plugins = {}, script = {} } = data;
+
+  // NOTE: Currently only compatible with chrome
+  const type = Object.keys(script).length === 0 || !isChrome ? 'NORMAL' : 'DRAW';
+  const [mode, setMode] = useState<Mode>(type);
+
+  return (
+    <>
+      <div style={{ display: 'flex', alignItems: 'center' }}>
+        <Radio.Group
+          value={mode}
+          onChange={(e) => {
+            setMode(e.target.value);
+          }}
+        >
+          <Radio.Button value="NORMAL">普通模式</Radio.Button>
+          <Radio.Button value="DRAW" disabled={!isChrome}>
+            插件编排
+          </Radio.Button>
+        </Radio.Group>
+        {Boolean(!isChrome) && (
+          <div style={{ marginLeft: '10px' }}>
+            <Tooltip placement="right" title="插件编排仅支持 Chorme 浏览器">

Review comment:
       NOTE: i18n would be added in the later PR @moonming 




----------------------------------------------------------------
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