From 1141207bd0c5c8ce850b6a019401409fb2e49220 Mon Sep 17 00:00:00 2001 From: Jesse Rodriguez <54310591+1pone@users.noreply.github.com> Date: Thu, 16 Nov 2023 17:00:11 +0800 Subject: [PATCH] Feat replay noise reduction (#532) * fix: init request url parse * fix: init request url parse * feat: exclusions noise reduce * feat: diff denoise check all * feat: excludeNoise * fix: controlled checkBox * fix: noiseItemList * feat: sort by entryPoint * fix: appId ReplayDiffScenes localStorage * feat: move denoise button to AppTitleBar * feat: hidden create app button for GUEST * fix: scale arex logo --------- Co-authored-by: onePone --- package.json | 2 +- packages/arex-core/src/layout/ArexHeader.tsx | 2 +- packages/arex/package.json | 2 +- .../arex/src/i18n/locales/cn/components.json | 12 +- .../arex/src/i18n/locales/en/components.json | 4 +- packages/arex/src/menus/Replay.tsx | 17 +- packages/arex/src/panes/Replay/AppTitle.tsx | 9 +- .../arex/src/panes/Replay/CompareNoise.tsx | 235 ++++++++++++------ .../Replay/CompareNoiseOperationItem.tsx | 107 +++++--- packages/arex/src/panes/Replay/PlanItem.tsx | 6 - .../ReplayDiffScenes/ReplayDiffScenes.tsx | 4 +- .../services/ScheduleService/excludeNoise.ts | 17 ++ .../src/services/ScheduleService/index.ts | 1 + .../services/ScheduleService/queryNoise.ts | 21 +- packages/arex/vite.config.ts | 6 +- 15 files changed, 298 insertions(+), 147 deletions(-) create mode 100644 packages/arex/src/services/ScheduleService/excludeNoise.ts diff --git a/package.json b/package.json index f4dfa01ce..474aab8c5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "arex", "private": true, - "version": "0.6.7", + "version": "0.6.8", "description": "", "homepage": "https://github.com/arextest/arex", "main": "index.js", diff --git a/packages/arex-core/src/layout/ArexHeader.tsx b/packages/arex-core/src/layout/ArexHeader.tsx index 48d353f3d..98e6f4461 100644 --- a/packages/arex-core/src/layout/ArexHeader.tsx +++ b/packages/arex-core/src/layout/ArexHeader.tsx @@ -61,7 +61,7 @@ const ArexHeader: FC = (props) => { AREX diff --git a/packages/arex/package.json b/packages/arex/package.json index 32820a6b2..441a6e302 100644 --- a/packages/arex/package.json +++ b/packages/arex/package.json @@ -1,7 +1,7 @@ { "name": "arex", "private": true, - "version": "0.6.7", + "version": "0.6.8", "author": "arextest", "main": "dist-electron/main.js", "files": [ diff --git a/packages/arex/src/i18n/locales/cn/components.json b/packages/arex/src/i18n/locales/cn/components.json index 9d5b4710b..05014a070 100644 --- a/packages/arex/src/i18n/locales/cn/components.json +++ b/packages/arex/src/i18n/locales/cn/components.json @@ -109,7 +109,8 @@ "timeConsumed": "耗时(秒)", "cases": "case 数", "action": "操作", - "denoise": "差异降噪", + "denoise": "对比配置推荐", + "noDenoiseRecommended": "暂无对比配置推荐", "logs": "执行日志", "retry": "重新计算", "rerun": "重新执行", @@ -202,13 +203,14 @@ "compareConfig": "对比配置", "configType": "类型", "configTarget": "目标", - "nodesIgnore": "忽略节点配置", - "nodesSort": "数组节点配置", - "nodesDesensitization": "加密节点配置", - "categoryIgnore": "类型忽略配置", + "nodesIgnore": "忽略节点", + "nodesSort": "数组节点", + "nodesDesensitization": "加密节点", + "categoryIgnore": "类型忽略", "global": "全局", "interface": "接口", "dependency": "依赖", + "entryPoint": "主入口", "agentVersion": "Agent 版本", "agentHost": "Agent 地址", "basic": "基础", diff --git a/packages/arex/src/i18n/locales/en/components.json b/packages/arex/src/i18n/locales/en/components.json index c7ce1b57b..00707c6a0 100644 --- a/packages/arex/src/i18n/locales/en/components.json +++ b/packages/arex/src/i18n/locales/en/components.json @@ -109,7 +109,8 @@ "timeConsumed": "Time consumed(s)", "cases": "Cases", "action": "Action", - "denoise": "Diff Denoise", + "denoise": "Comparative Config Recommendation", + "noDenoiseRecommended": "No comparison configuration is recommended", "logs": "Execution Logs", "retry": "Retry", "rerun": "Rerun", @@ -209,6 +210,7 @@ "global": "Global", "interface": "Interfaces", "dependency": "Dependency", + "entryPoint": "EntryPoint", "agentVersion": "Agent Version", "agentHost": "Agent Host", "basic": "Basic", diff --git a/packages/arex/src/menus/Replay.tsx b/packages/arex/src/menus/Replay.tsx index 969b061b1..d34469fa2 100644 --- a/packages/arex/src/menus/Replay.tsx +++ b/packages/arex/src/menus/Replay.tsx @@ -138,13 +138,16 @@ const ReplayMenu: ArexMenuFC = (props) => { selectedKeys={selectedKeys} prefix={ <> - } - onClick={() => setOpen(true)} - /> + {!email.startsWith('GUEST') && ( + } + onClick={() => setOpen(true)} + /> + )} + void; onRefresh?: () => void; onSetting?: () => void; @@ -129,6 +129,8 @@ const TitleWrapper = styled( + /> = (props) => { open={open} title={ - {t('replay.denoise')} + + {t('replay.denoise')} + + + = (props) => { } extra={ } + styles={{ + body: { + padding: '8px 16px', + }, + }} onClose={handleClose} > - {loading && } - - {noiseData.map((noise) => ( - handleChecked(value, noise)} - /> - ))} - + + {noiseData.map((noise) => ( + handleChecked(value, noise)} + /> + ))} + + ); diff --git a/packages/arex/src/panes/Replay/CompareNoiseOperationItem.tsx b/packages/arex/src/panes/Replay/CompareNoiseOperationItem.tsx index 7ac316ddc..73bf636ac 100644 --- a/packages/arex/src/panes/Replay/CompareNoiseOperationItem.tsx +++ b/packages/arex/src/panes/Replay/CompareNoiseOperationItem.tsx @@ -1,20 +1,38 @@ -import { SpaceBetweenWrapper } from '@arextest/arex-core'; -import { Card, Checkbox, List, Typography } from 'antd'; -import React, { FC } from 'react'; +import { CodeSandboxOutlined, StarOutlined } from '@ant-design/icons'; +import { SpaceBetweenWrapper, useTranslation } from '@arextest/arex-core'; +import { Card, Checkbox, List, Tooltip } from 'antd'; +import React, { FC, useMemo } from 'react'; import { Connector } from '@/constant'; -import { InterfaceNoiseItem } from '@/services/ScheduleService'; +import { InterfaceNoiseItem, RandomNoise } from '@/services/ScheduleService'; export interface CompareNoiseOperationItemProps { appId: string; + value?: RandomNoise[]; noise: InterfaceNoiseItem; onChange?: (value: string[]) => void; } const CompareNoiseOperationItem: FC = (props) => { + const { t } = useTranslation('components'); + const value = useMemo( + () => + props.value?.reduce((value, cur, index) => { + value.push( + ...cur.noiseItemList.map((item) => { + const entityPath = item.nodeEntity.map((entityItem) => entityItem.nodeName).join('/'); + return entityPath + Connector + index; + }), + ); + return value; + }, []), + [props.value], + ); + return ( props.onChange?.(value as string[])} style={{ width: '100%' }} > @@ -22,38 +40,55 @@ const CompareNoiseOperationItem: FC = (props) => size='small' style={{ width: '100%' }} dataSource={props.noise.randomNoise} - renderItem={(operation, randomNoiseIndex) => ( - - - - {operation.mockCategoryType.entryPoint && ( - [EntryPoint] - )}{' '} - {operation.operationName} - - - { - const entityPath = item.nodeEntity - .map((entityItem) => entityItem.nodeName) - .join('/'); - return ( - - - {entityPath} - - - - ); - }} - /> - - )} + renderItem={(operation, randomNoiseIndex) => { + return ( + + + + + + {operation.mockCategoryType.entryPoint ? ( + + ) : ( + + )} + + + {operation.operationName} + + + { + const entityPath = item.nodeEntity + .map((entityItem) => entityItem.nodeName) + .join('/'); + return ( + + + {entityPath} + + + + ); + }} + style={{ + marginLeft: '16px', + }} + /> + + ); + }} /> diff --git a/packages/arex/src/panes/Replay/PlanItem.tsx b/packages/arex/src/panes/Replay/PlanItem.tsx index 5d82a453d..b4bcb8654 100644 --- a/packages/arex/src/panes/Replay/PlanItem.tsx +++ b/packages/arex/src/panes/Replay/PlanItem.tsx @@ -525,12 +525,6 @@ const PlanItem: FC = (props) => { } extra={ - -