diff --git a/.github/workflows/frontend-e2e-test.yml b/.github/workflows/frontend-e2e-test.yml index 98e76c6c50..644cf47822 100644 --- a/.github/workflows/frontend-e2e-test.yml +++ b/.github/workflows/frontend-e2e-test.yml @@ -46,7 +46,7 @@ jobs: nohup go run ./cmd/manager & - name: Cache node_modules - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 id: yarn-cache with: path: '*/node_modules' @@ -55,7 +55,7 @@ jobs: ${{ runner.os }}-yarn-cache0 - name: Cache Cypress binary - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 id: cypress-binary-cache with: path: '*/cypress/cache' diff --git a/.github/workflows/frontend-plugin-e2e-test.yml b/.github/workflows/frontend-plugin-e2e-test.yml index d9192997e9..4bad9c6d3b 100644 --- a/.github/workflows/frontend-plugin-e2e-test.yml +++ b/.github/workflows/frontend-plugin-e2e-test.yml @@ -44,7 +44,7 @@ jobs: nohup go run ./cmd/manager & - name: Cache node_modules - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 id: yarn-cache with: path: '*/node_modules' @@ -53,7 +53,7 @@ jobs: ${{ runner.os }}-yarn-cache0 - name: Cache Cypress binary - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 id: cypress-binary-cache with: path: '*/cypress/cache' diff --git a/web/cypress/fixtures/export-route-dataset.json b/web/cypress/fixtures/export-route-dataset.json index a60eee0b65..133971fa7e 100644 --- a/web/cypress/fixtures/export-route-dataset.json +++ b/web/cypress/fixtures/export-route-dataset.json @@ -38,6 +38,7 @@ "weight": 1 } ], + "retries": 1, "timeout": { "connect": 6, "read": 6, @@ -89,6 +90,7 @@ "weight": 1 } ], + "retries": 1, "timeout": { "connect": 6, "read": 6, @@ -139,6 +141,7 @@ "weight": 1 } ], + "retries": 1, "timeout": { "connect": 6, "read": 6, diff --git a/web/cypress/integration/rawDataEditor/test-rawDataEditor.spec.js b/web/cypress/integration/rawDataEditor/test-rawDataEditor.spec.js index 91856ee0a4..3c803974f3 100644 --- a/web/cypress/integration/rawDataEditor/test-rawDataEditor.spec.js +++ b/web/cypress/integration/rawDataEditor/test-rawDataEditor.spec.js @@ -35,10 +35,9 @@ context('Test RawDataEditor', () => { menuList.forEach(function (item) { cy.visit('/'); cy.contains(item).click(); - cy.contains('Create with Editor').click(); + cy.contains('Raw Data Editor').click(); const data = dateset[item]; - // create with editor cy.window().then(({ codemirror }) => { if (codemirror) { codemirror.setValue(JSON.stringify(data)); diff --git a/web/cypress/integration/upstream/create_and_delete_upstream.spec.js b/web/cypress/integration/upstream/create_and_delete_upstream.spec.js index 71831557dc..a8063ebd93 100644 --- a/web/cypress/integration/upstream/create_and_delete_upstream.spec.js +++ b/web/cypress/integration/upstream/create_and_delete_upstream.spec.js @@ -74,9 +74,9 @@ context('Create and Delete Upstream', () => { cy.get(this.domSelector.description).type(this.data.description); // change upstream type to chash, todo: optimize the search method - cy.get('[title=roundrobin]').click(); + cy.get('[title="Round Robin"]').click(); cy.get(this.domSelector.upstreamType).within(() => { - cy.contains('chash').click(); + cy.contains('CHash').click(); }); cy.get('#hash_on').click(); cy.get(this.domSelector.upstreamType).within(() => { diff --git a/web/src/components/Plugin/PluginDetail.tsx b/web/src/components/Plugin/PluginDetail.tsx index 6ad7d9c071..8c3eac7220 100644 --- a/web/src/components/Plugin/PluginDetail.tsx +++ b/web/src/components/Plugin/PluginDetail.tsx @@ -87,24 +87,24 @@ const PluginDetail: React.FC = ({ readonly = false, maskClosable = true, initialData = {}, - onClose = () => {}, - onChange = () => {}, + onClose = () => { }, + onChange = () => { }, }) => { const { formatMessage } = useIntl(); enum codeMirrorModeList { - Json = 'Json', - Yaml = 'Yaml', + JSON = 'JSON', + YAML = 'YAML', } const [form] = Form.useForm(); const ref = useRef(null); const data = initialData[name] || {}; const pluginType = pluginList.find((item) => item.name === name)?.type; const [codeMirrorMode, setCodeMirrorMode] = useState( - codeMirrorModeList.Json, + codeMirrorModeList.JSON, ); const modeOptions = [ - { label: codeMirrorModeList.Json, value: codeMirrorModeList.Json }, - { label: codeMirrorModeList.Yaml, value: codeMirrorModeList.Yaml }, + { label: codeMirrorModeList.JSON, value: codeMirrorModeList.JSON }, + { label: codeMirrorModeList.YAML, value: codeMirrorModeList.YAML }, ]; useEffect(() => { @@ -160,8 +160,8 @@ const PluginDetail: React.FC = ({ }; const handleModeChange = (value: PluginComponent.CodeMirrorMode) => { switch (value) { - case codeMirrorModeList.Json: { - const { data: yamlData , error } = yaml2json(ref.current.editor.getValue(), true); + case codeMirrorModeList.JSON: { + const { data: yamlData, error } = yaml2json(ref.current.editor.getValue(), true); if (error) { notification.error({ @@ -176,7 +176,7 @@ const PluginDetail: React.FC = ({ ); break; } - case codeMirrorModeList.Yaml: { + case codeMirrorModeList.YAML: { const { data: jsonData, error } = json2yaml(ref.current.editor.getValue()); if (error) { @@ -250,7 +250,7 @@ const PluginDetail: React.FC = ({ onClick={() => { try { const editorData = - codeMirrorMode === codeMirrorModeList.Json + codeMirrorMode === codeMirrorModeList.JSON ? JSON.parse(ref.current?.editor.getValue()) : yaml2json(ref.current?.editor.getValue(), false).data; validateData(name, editorData).then((value) => { @@ -320,7 +320,7 @@ const PluginDetail: React.FC = ({ {formatMessage({ id: 'component.global.document' })} , { @@ -192,6 +192,7 @@ const RawDataEditor: React.FC = ({ visible, readonly = true, type, data = ref.current = codemirror; if (codemirror) { // NOTE: for debug & test + // @ts-ignore window.codemirror = codemirror.editor; } }} diff --git a/web/src/components/RawDataEditor/locales/en-US.ts b/web/src/components/RawDataEditor/locales/en-US.ts index 773b53cdbe..c5c1643277 100644 --- a/web/src/components/RawDataEditor/locales/en-US.ts +++ b/web/src/components/RawDataEditor/locales/en-US.ts @@ -16,5 +16,4 @@ */ export default { 'component.rawDataEditor.tip': "Don't support edit mode currently", - 'component.rawDataEditor.title': 'Raw Data Editor', }; diff --git a/web/src/components/RawDataEditor/locales/zh-CN.ts b/web/src/components/RawDataEditor/locales/zh-CN.ts index 7a4a1ac55d..14e10c65e1 100644 --- a/web/src/components/RawDataEditor/locales/zh-CN.ts +++ b/web/src/components/RawDataEditor/locales/zh-CN.ts @@ -16,5 +16,4 @@ */ export default { 'component.rawDataEditor.tip': '目前暂不支持编辑', - 'component.rawDataEditor.title': '元数据编辑器', }; diff --git a/web/src/components/Upstream/UpstreamForm.tsx b/web/src/components/Upstream/UpstreamForm.tsx index dcb82e4deb..929e90350e 100644 --- a/web/src/components/Upstream/UpstreamForm.tsx +++ b/web/src/components/Upstream/UpstreamForm.tsx @@ -66,7 +66,7 @@ type Props = { }; const removeBtnStyle = { - marginLeft: -10, + marginLeft: 20, display: 'flex', alignItems: 'center', }; @@ -83,14 +83,17 @@ const UpstreamForm: React.FC = forwardRef( { label: formatMessage({ id: 'page.upstream.step.connect.timeout' }), name: ['timeout', 'connect'], + desc: formatMessage({ id: 'page.upstream.step.connect.timeout.desc' }) }, { label: formatMessage({ id: 'page.upstream.step.send.timeout' }), name: ['timeout', 'send'], + desc: formatMessage({ id: 'page.upstream.step.send.timeout.desc' }) }, { label: formatMessage({ id: 'page.upstream.step.read.timeout' }), name: ['timeout', 'read'], + desc: formatMessage({ id: 'page.upstream.step.read.timeout.desc' }) }, ]; @@ -155,22 +158,9 @@ const UpstreamForm: React.FC = forwardRef( {(fields, { add, remove }) => ( <> - {fields.map((field, index) => ( - - + + {fields.map((field, index) => ( + = forwardRef( /> - + = forwardRef( - + = forwardRef( /> - - {!readonly && fields.length > 1 && ( + + {!readonly && ( remove(field.name)} /> )} - - ))} + ))} + {!readonly && ( , ]} /> diff --git a/web/src/pages/Route/List.tsx b/web/src/pages/Route/List.tsx index a9c1ba5cc6..15984620eb 100644 --- a/web/src/pages/Route/List.tsx +++ b/web/src/pages/Route/List.tsx @@ -478,7 +478,7 @@ const Page: React.FC = () => { setRawData({}); }}> - {formatMessage({ id: 'component.global.createWithEditor' })} + {formatMessage({ id: 'component.global.data.editor' })} , , ]} /> diff --git a/web/src/pages/Upstream/Create.tsx b/web/src/pages/Upstream/Create.tsx index 0e6714e810..0e068c7bdb 100644 --- a/web/src/pages/Upstream/Create.tsx +++ b/web/src/pages/Upstream/Create.tsx @@ -16,8 +16,9 @@ */ import React, { useState, useEffect, useRef } from 'react'; import { PageContainer } from '@ant-design/pro-layout'; -import { Card, Steps, notification, Form } from 'antd'; +import { Card, Steps, notification, Form, Button } from 'antd'; import { history, useIntl } from 'umi'; +import { QuestionCircleOutlined } from '@ant-design/icons'; import ActionBar from '@/components/ActionBar'; @@ -78,8 +79,15 @@ const Page: React.FC = (props) => { <> + + {formatMessage({ id: 'component.document' })} + } > diff --git a/web/src/pages/Upstream/List.tsx b/web/src/pages/Upstream/List.tsx index 27474e5c18..486fbbeb28 100644 --- a/web/src/pages/Upstream/List.tsx +++ b/web/src/pages/Upstream/List.tsx @@ -116,7 +116,7 @@ const Page: React.FC = () => { ]; return ( - + actionRef={ref} columns={columns} @@ -136,13 +136,12 @@ const Page: React.FC = () => { {formatMessage({ id: 'component.global.create' })} , - , ]} /> diff --git a/web/src/pages/Upstream/components/Step1.tsx b/web/src/pages/Upstream/components/Step1.tsx index 494f3cb832..182ffbc458 100644 --- a/web/src/pages/Upstream/components/Step1.tsx +++ b/web/src/pages/Upstream/components/Step1.tsx @@ -42,8 +42,7 @@ const Step1: React.FC = ({ form, disabled, upstreamRef }) => {