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 2022/03/03 02:05:13 UTC

[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #2320: feat: support protobuf on Web

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



##########
File path: web/src/locales/zh-CN/menu.ts
##########
@@ -67,6 +67,7 @@ export default {
   'menu.consumer': '消费者',
   'menu.plugin': '插件',
   'menu.service': '服务',
+  'menu.proto': 'Proto',

Review comment:
       Proto or Protocol Buffers?

##########
File path: web/cypress/integration/proto/create_and_edit_and_delete_proto.spce.js
##########
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('Create and Delete Proto', () => {
+  const selector = {
+    id: '#id',
+    description: '#desc',
+    content: '.view-lines',
+    draw: '.ant-drawer-content',
+    notification: '.ant-notification-notice-message',
+  };
+
+  const data = {
+    id: 'test_id',
+    description: 'test_description',
+    content: `message Person {
+required string name = 1;
+required int32 id = 2;
+optional string email = 3;
+}`,

Review comment:
       Why not keep the 2 spaces? 🤔

##########
File path: web/src/pages/Proto/List.tsx
##########
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import React, { useRef, useEffect, useState } from 'react';
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
+import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table';
+import ProtoDrawer from './components/ProtoDrawer';
+import { Button, notification, Popconfirm, Space } from 'antd';
+import { history, useIntl } from 'umi';
+import { PlusOutlined } from '@ant-design/icons';
+import querystring from 'query-string';
+
+import { timestampToLocaleString } from '@/helpers';
+import { fetchList, remove } from './service';
+
+const Page: React.FC = () => {
+  const ref = useRef<ActionType>();
+  const { formatMessage } = useIntl();
+  const [drawerVisible, setDrawerVisible] = useState(false);
+  const emptyProtoData = {
+    id: null,
+    content: '',
+    desc: '',
+  };
+  const [protoData, setProtoData] = useState<ProtoModule.ProtoData>(emptyProtoData);
+  const [editMode, setEditMode] = useState<ProtoModule.EditMode>('create');
+  const [paginationConfig, setPaginationConfig] = useState({ pageSize: 10, current: 1 });
+
+  const refreshTable = () => {
+    ref.current?.reload();
+  };
+
+  const savePageList = (page = 1, pageSize = 10) => {
+    history.replace(`/proto/list?page=${page}&pageSize=${pageSize}`);
+  };
+
+  useEffect(() => {
+    const { page = 1, pageSize = 10 } = querystring.parse(window.location.search);
+    setPaginationConfig({ pageSize: Number(pageSize), current: Number(page) });

Review comment:
       How about using your usepagination? (we could merge that one first)




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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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