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



##########
File path: web/src/pages/Route/components/Step1/ProxyRewrite.tsx
##########
@@ -0,0 +1,289 @@
+/*
+ * 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 from 'react';
+import Form from 'antd/es/form';
+import { Button, Input, Radio, Row, Col } from 'antd';
+import { PlusOutlined, MinusCircleOutlined } from '@ant-design/icons';
+import { useIntl } from 'umi';
+import { PanelSection } from '@api7-dashboard/ui';
+
+import {
+  FORM_ITEM_LAYOUT,
+  FORM_ITEM_WITHOUT_LABEL,
+  ShcemeRewrite,

Review comment:
       Uppercase is used in Class IMO, we'd better use something like `A_B_C` 
in the future.

##########
File path: 
web/cypress/integration/route/create-route-with-proxy-rewrite-plugin.spec.js
##########
@@ -0,0 +1,139 @@
+/*
+ * 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 */
+import menuLocaleUS from '../../../src/locales/en-US/menu';
+import componentLocaleUS from '../../../src/locales/en-US/component';
+import routeLocaleUS from '../../../src/pages/Route/locales/en-US';
+
+context('create route with proxy-rewrite plugin', () => {
+  const data = {
+    rewriteUri: '/get',
+    rewriteHeaderKey1: 'test1',
+    rewriteHeaderKey2: 'test2',
+    rewriteHeaderValue1: '1',
+    rewriteHeaderValue2: '2',
+  };
+
+  const domSelector = {
+    staticUri: '[data-cy=uri-static]',
+    staticHost: '[data-cy=host-static]',
+    keepHost: '[data-cy=host-keep]',
+    newUri: '#proxyRewrite_uri',
+    uriRewriteReg: '#proxyRewrite_regex_uri_0',
+    uriRewriteTemp: '#proxyRewrite_regex_uri_1',
+    newHost: '#proxyRewrite_host',
+    buttonCreateNewRewriteHeader: '[data-cy=create-new-rewrite-header]',
+    rewriteHeaderKey1: '#proxyRewrite_kvHeaders_0_key',
+    rewriteHeaderValue1: '#proxyRewrite_kvHeaders_0_value',
+    rewriteHeaderKey2: '#proxyRewrite_kvHeaders_1_key',
+    rewriteHeaderValue2: '#proxyRewrite_kvHeaders_1_value',
+  }
+
+  beforeEach(() => {
+    cy.login();
+
+    cy.fixture('selector.json').as('domSelector');
+    cy.fixture('data.json').as('data');
+  });
+
+  it('should create route with proxy-rewrite plugin', function () {
+    cy.visit('/');
+    cy.contains(menuLocaleUS['menu.routes']).click();
+
+    // show create page
+    cy.contains(componentLocaleUS['component.global.create']).click();
+    cy.get(this.domSelector.name).type(this.data.routeName);
+
+    // show requestOverride PanelSection
+    
cy.contains(routeLocaleUS['page.route.panelSection.title.requestOverride']).should('be.visible');
+    // should show newPath after the uriRewriteType static clicked
+    cy.get(domSelector.staticUri).click();
+    
cy.contains(routeLocaleUS['page.route.form.itemLabel.newPath']).should('be.visible');
+    cy.get(domSelector.newUri).should('be.visible').type(data.rewriteUri);
+    // should show regexp and template after uriRewriteType regexp clicked
+    cy.contains(routeLocaleUS['page.route.radio.regx']).click();

Review comment:
       ```suggestion
       cy.contains(routeLocaleUS['page.route.radio.regex']).click();
   ```

##########
File path: web/src/pages/Route/components/Step3/index.tsx
##########
@@ -32,16 +32,17 @@ type Props = {
   onChange: (data: { plugins: PluginComponent.Data; script: any, 
plugin_config_id?: string; }) => void;
   readonly?: boolean;
   isForceHttps: boolean;
+  isProxyEnable: boolean;

Review comment:
       could it be optional and default to false?




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to