From f41dfb0845da3722dd3d476b7ff0f1b357142e17 Mon Sep 17 00:00:00 2001 From: maomin Date: Thu, 19 Jan 2023 14:52:48 +0800 Subject: [PATCH 1/2] feat(package): package.json --- ui/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/package.json b/ui/package.json index e251be5..ec94675 100644 --- a/ui/package.json +++ b/ui/package.json @@ -80,7 +80,6 @@ "@ant-design/pro-components": "2.3.52", "@monaco-editor/react": "^4.4.6", "@types/js-yaml": "^4.0.5", - "@types/styled-components": "^5.1.26", "@umijs/route-utils": "^4.0.1", "ahooks": "^3.7.2", "antd": "^5.1.5", @@ -107,6 +106,7 @@ "devDependencies": { "@ant-design/pro-cli": "^3.0.1", "@playwright/test": "^1.17.0", + "@types/styled-components": "^5.1.26", "@types/classnames": "^2.3.1", "@types/express": "^4.17.0", "@types/history": "^4.7.0", From 04c306f444028b6b62347891307ae568cfa3f963 Mon Sep 17 00:00:00 2001 From: maomin Date: Tue, 31 Jan 2023 11:21:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(tcpdump=20&=20profile):=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=8E=AF=E5=A2=83=E6=A3=80=E6=9F=A5=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=B8=8B=E8=BD=BD=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/package.json | 4 +- ui/src/app.tsx | 8 +- ui/src/components/BackToTopButton/index.tsx | 2 +- .../components/ClusterSettingButton/index.tsx | 2 +- .../styles/index.styled.ts | 2 +- .../components/ContainerSelectCard/index.tsx | 2 +- ui/src/components/ContentCard/index.tsx | 4 +- ui/src/components/CustomPageWrapper/index.tsx | 2 +- ui/src/components/Loading/index.tsx | 2 +- ui/src/components/PageHeader/index.tsx | 6 +- .../PageHeader/styles/index.styled.ts | 2 +- ui/src/components/PodSelectCard/index.tsx | 6 +- ui/src/components/ToolCardEmpty/index.tsx | 6 +- ui/src/components/ToolsMenuButton/index.tsx | 10 +- .../ToolsMenuButton/styles/index.styled.ts | 2 +- ui/src/hooks/useContainer.ts | 2 +- ui/src/hooks/usePodSelect.ts | 16 +- ui/src/hooks/useTerminal.ts | 8 +- ui/src/layouts/index.tsx | 8 +- ui/src/main/createProtocol.ts | 2 +- ui/src/main/index.ts | 11 +- ui/src/main/server.ts | 6 +- ui/src/main/utils/downloadFileUtil.ts | 23 +- ui/src/main/utils/fixPathUtil.ts | 4 +- ui/src/models/pod.ts | 2 +- ui/src/pages/AppInit/index.tsx | 2 +- .../pages/ClustersManage/ClusterOptions.tsx | 2 +- .../components/ClusterForm/index.tsx | 6 +- .../components/CreateClusterModal/index.tsx | 7 +- .../components/UpdateClusterModal/index.tsx | 7 +- .../pages/ClustersManage/hooks/useClusters.ts | 2 +- ui/src/pages/ClustersManage/index.tsx | 14 +- .../components/ConfigMapEditor/index.tsx | 12 +- .../ConfigmapFiles/ConfigMapFileItem.tsx | 7 +- .../components/ConfigmapFiles/index.tsx | 10 +- .../components/CreateFileModal/index.tsx | 6 +- .../components/DiffContextModal/index.tsx | 6 +- .../Tools/ConfigMap/hooks/useConfigMap.ts | 8 +- ui/src/pages/Tools/ConfigMap/index.tsx | 12 +- .../Tools/ConfigMap/styles/editor.styled.ts | 2 +- .../Tools/ConfigMap/styles/files.styled.ts | 2 +- .../Debug/components/ConfigForm/index.tsx | 25 +- ui/src/pages/Tools/Debug/hooks/useDebug.ts | 10 +- ui/src/pages/Tools/Debug/index.tsx | 12 +- .../Tools/Files/components/FileList/index.tsx | 14 +- .../Files/components/FilesContent/index.tsx | 8 +- .../components/FilesHeader/FilesPathItem.tsx | 3 +- .../Files/components/FilesHeader/index.tsx | 14 +- ui/src/pages/Tools/Files/hooks/useFiles.ts | 8 +- ui/src/pages/Tools/Files/index.tsx | 6 +- .../Nodes/components/FilterForm/index.tsx | 10 +- ui/src/pages/Tools/Nodes/index.tsx | 6 +- .../pages/Tools/Nodes/styles/form.styled.ts | 2 +- .../components/ProxyRequest/index.tsx | 10 +- .../ProxyRequestInfo/RequestBody.tsx | 4 +- .../ProxyRequestInfo/RequestHeaders.tsx | 4 +- .../components/ProxyRequestInfo/index.tsx | 4 +- .../components/ProxyResponse/index.tsx | 12 +- .../PodProxy/components/RequestType/index.tsx | 2 +- .../components/ResponseInfo/ResponseBody.tsx | 8 +- .../ResponseInfo/ResponseBodyOptions.tsx | 10 +- .../ResponseInfo/ResponseCookiesProps.tsx | 4 +- .../ResponseInfo/ResponseHeaders.tsx | 4 +- .../components/ResponseInfo/index.tsx | 7 +- .../components/ResponseType/index.tsx | 2 +- .../Tools/PodProxy/hooks/useFormOptions.ts | 72 +++++ .../PodProxy/hooks/useResponseBodyOptions.ts | 10 +- .../Tools/PodProxy/hooks/useResponseType.ts | 2 +- ui/src/pages/Tools/PodProxy/index.tsx | 76 +---- .../Tools/PodProxy/styles/request.styled.ts | 2 +- .../components/CreateProfile/index.tsx | 6 +- .../ProfileHistoryList/DiffProfileModal.tsx | 4 +- .../ProfileHistoryOption.tsx | 10 +- .../components/ProfileHistoryList/index.tsx | 10 +- .../components/ProfileViewSvg/index.tsx | 30 +- .../hooks/useCheckProfilingDependencies.ts | 52 +++ .../Tools/Profiling/hooks/useDiffProfile.ts | 14 +- .../pages/Tools/Profiling/hooks/useProfile.ts | 11 +- ui/src/pages/Tools/Profiling/index.tsx | 122 ++++--- .../Tools/Profiling/styles/index.styled.ts | 18 ++ .../Profiling/utils/dependencyErrorsUtil.tsx | 22 ++ ...ProfileUtile.ts => downloadProfileUtil.ts} | 0 .../Tcpdump/components/TcpdumpCard/index.tsx | 10 +- .../components/TcpdumpConfigCard/index.tsx | 16 +- .../Tcpdump/components/TcpdumpForm/index.tsx | 57 ++-- .../Tools/Tcpdump/hooks/useCheckWireshark.tsx | 89 ++++++ .../Tools/Tcpdump/hooks/useSocketTcpdump.ts | 4 +- .../pages/Tools/Tcpdump/hooks/useTcpdump.ts | 12 +- ui/src/pages/Tools/Tcpdump/index.tsx | 14 +- .../Tools/Tcpdump/styles/index.styled.ts | 2 +- .../Tools/Terminal/components/Term/index.tsx | 8 +- ui/src/pages/Tools/Terminal/index.tsx | 12 +- .../Tools/Terminal/styles/term.styled.ts | 2 +- ui/src/pages/Tools/index.tsx | 22 +- .../ToolsMap/components/ToolItem/ToolItem.tsx | 6 +- ui/src/pages/ToolsMap/configs/configs.ts | 10 +- ui/src/pages/ToolsMap/index.tsx | 8 +- ui/src/pages/ToolsMap/styles/index.styled.ts | 2 +- ui/src/preload/index.ts | 5 + ui/src/services/dependency.ts | 9 + ui/src/services/pods.ts | 2 +- ui/src/services/profiling.ts | 11 +- ui/src/services/tcpdump.ts | 8 + ui/src/services/workload.ts | 2 +- ui/src/types/index.d.ts | 1 + ui/yarn.lock | 302 +++++++++++------- 106 files changed, 925 insertions(+), 586 deletions(-) create mode 100644 ui/src/pages/Tools/PodProxy/hooks/useFormOptions.ts create mode 100644 ui/src/pages/Tools/Profiling/hooks/useCheckProfilingDependencies.ts create mode 100644 ui/src/pages/Tools/Profiling/utils/dependencyErrorsUtil.tsx rename ui/src/pages/Tools/Profiling/utils/{downloadProfileUtile.ts => downloadProfileUtil.ts} (100%) create mode 100644 ui/src/pages/Tools/Tcpdump/hooks/useCheckWireshark.tsx create mode 100644 ui/src/services/dependency.ts diff --git a/ui/package.json b/ui/package.json index ec94675..cc1e014 100644 --- a/ui/package.json +++ b/ui/package.json @@ -82,7 +82,7 @@ "@types/js-yaml": "^4.0.5", "@umijs/route-utils": "^4.0.1", "ahooks": "^3.7.2", - "antd": "^5.1.5", + "antd": "^5.1.6", "classnames": "^2.3.0", "copy-to-clipboard": "^3.3.2", "dayjs": "^1.11.7", @@ -117,7 +117,7 @@ "@types/react-dom": "^18.0.10", "@types/react-helmet": "^6.1.6", "@umijs/fabric": "^3.0.0", - "@umijs/max": "^4.0.46", + "@umijs/max": "^4.0.47", "@umijs/openapi": "^1.8.1", "cross-env": "^7.0.0", "cross-port-killer": "^1.3.0", diff --git a/ui/src/app.tsx b/ui/src/app.tsx index b8ff093..4a5326a 100644 --- a/ui/src/app.tsx +++ b/ui/src/app.tsx @@ -1,12 +1,12 @@ import Footer from '@/components/Footer'; +import { handleElectronMessage, RequestBaseUrl } from '@/utils/electronRenderUtil'; import type { Settings as LayoutSettings } from '@ant-design/pro-components'; +import { loader } from '@monaco-editor/react'; import type { RunTimeLayoutConfig } from '@umijs/max'; import { history } from '@umijs/max'; -import defaultSettings from '../config/defaultSettings'; -import type { RequestConfig } from 'umi'; -import { handleElectronMessage, RequestBaseUrl } from '@/utils/electronRenderUtil'; import { notification } from 'antd'; -import { loader } from '@monaco-editor/react'; +import type { RequestConfig } from 'umi'; +import defaultSettings from '../config/defaultSettings'; // 初始化 monaco loader diff --git a/ui/src/components/BackToTopButton/index.tsx b/ui/src/components/BackToTopButton/index.tsx index 8498e53..83e03b3 100644 --- a/ui/src/components/BackToTopButton/index.tsx +++ b/ui/src/components/BackToTopButton/index.tsx @@ -1,5 +1,5 @@ -import React, { useCallback } from 'react'; import { FloatButton } from 'antd'; +import React, { useCallback } from 'react'; const BackToTopButton: React.FC = () => { const handleScrollTarget = useCallback(() => document.getElementById('main') || window, []); diff --git a/ui/src/components/ClusterSettingButton/index.tsx b/ui/src/components/ClusterSettingButton/index.tsx index f31540c..6ec924a 100644 --- a/ui/src/components/ClusterSettingButton/index.tsx +++ b/ui/src/components/ClusterSettingButton/index.tsx @@ -1,6 +1,6 @@ -import React from 'react'; import { StyledClusterSettingButton } from '@/components/ClusterSettingButton/styles/index.styled'; import { SettingOutlined } from '@ant-design/icons'; +import React from 'react'; const CLUSTER_SETTING_HASH = '#/manage/cluster'; const ClusterSettingButton: React.FC = () => { diff --git a/ui/src/components/ClusterSettingButton/styles/index.styled.ts b/ui/src/components/ClusterSettingButton/styles/index.styled.ts index c2e06db..1ab42a0 100644 --- a/ui/src/components/ClusterSettingButton/styles/index.styled.ts +++ b/ui/src/components/ClusterSettingButton/styles/index.styled.ts @@ -1,5 +1,5 @@ -import styled from 'styled-components'; import { FloatButton } from 'antd'; +import styled from 'styled-components'; export const StyledClusterSettingButton = styled(FloatButton)` top: 30px; diff --git a/ui/src/components/ContainerSelectCard/index.tsx b/ui/src/components/ContainerSelectCard/index.tsx index 4d499e5..52df76e 100644 --- a/ui/src/components/ContainerSelectCard/index.tsx +++ b/ui/src/components/ContainerSelectCard/index.tsx @@ -1,7 +1,7 @@ import ContentCard from '@/components/ContentCard'; import { Select } from 'antd'; -import React from 'react'; import type { DefaultOptionType } from 'rc-select/lib/Select'; +import React from 'react'; interface ContainerSelectCardProps { value?: string; diff --git a/ui/src/components/ContentCard/index.tsx b/ui/src/components/ContentCard/index.tsx index 708a9c1..6febc64 100644 --- a/ui/src/components/ContentCard/index.tsx +++ b/ui/src/components/ContentCard/index.tsx @@ -1,11 +1,11 @@ -import type { ReactNode } from 'react'; -import React from 'react'; import { StyledContentCard, StyledContentCardBody, StyledContentCardTitle, StyledContentCardTitleContext, } from '@/components/ContentCard/styles/index.styled'; +import type { ReactNode } from 'react'; +import React from 'react'; interface ContentCardProps { id?: string; diff --git a/ui/src/components/CustomPageWrapper/index.tsx b/ui/src/components/CustomPageWrapper/index.tsx index 4a2580d..4a20516 100644 --- a/ui/src/components/CustomPageWrapper/index.tsx +++ b/ui/src/components/CustomPageWrapper/index.tsx @@ -1,6 +1,6 @@ -import type { ReactNode } from 'react'; import { Card } from 'antd'; import type { CardProps } from 'antd/lib/card/Card'; +import type { ReactNode } from 'react'; interface CustomPageWrapperProps extends CardProps { children?: ReactNode; diff --git a/ui/src/components/Loading/index.tsx b/ui/src/components/Loading/index.tsx index 13a28f8..5ed88a0 100644 --- a/ui/src/components/Loading/index.tsx +++ b/ui/src/components/Loading/index.tsx @@ -1,6 +1,6 @@ -import React from 'react'; import { StyledLoading } from '@/components/Loading/styles/index.styled'; import { Spin } from 'antd'; +import React from 'react'; interface LoadingProps { loading?: boolean; diff --git a/ui/src/components/PageHeader/index.tsx b/ui/src/components/PageHeader/index.tsx index 5aa14d2..df079e5 100644 --- a/ui/src/components/PageHeader/index.tsx +++ b/ui/src/components/PageHeader/index.tsx @@ -5,12 +5,12 @@ import { StyledPageHeaderTitle, StyledPageHeaderTitleContext, } from '@/components/PageHeader/styles/index.styled'; -import React, { useCallback, useMemo } from 'react'; -import { RollbackOutlined } from '@ant-design/icons'; import { useTools } from '@/hooks/useTools'; +import { ToolsMapArr } from '@/pages/ToolsMap/configs/configs'; import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; import { useLocation } from '@@/exports'; -import { ToolsMapArr } from '@/pages/ToolsMap/configs/configs'; +import { RollbackOutlined } from '@ant-design/icons'; +import React, { useCallback, useMemo } from 'react'; export interface PageHeaderProps { showBackHome?: boolean; diff --git a/ui/src/components/PageHeader/styles/index.styled.ts b/ui/src/components/PageHeader/styles/index.styled.ts index 158a5cb..3934fb4 100644 --- a/ui/src/components/PageHeader/styles/index.styled.ts +++ b/ui/src/components/PageHeader/styles/index.styled.ts @@ -1,5 +1,5 @@ -import styled from 'styled-components'; import { Button } from 'antd'; +import styled from 'styled-components'; export const StyledPageHeader = styled.div` position: relative; diff --git a/ui/src/components/PodSelectCard/index.tsx b/ui/src/components/PodSelectCard/index.tsx index ab49552..7f22db5 100644 --- a/ui/src/components/PodSelectCard/index.tsx +++ b/ui/src/components/PodSelectCard/index.tsx @@ -1,11 +1,11 @@ +import ContentCard from '@/components/ContentCard'; import { StyledPodSelectCardPods, StyledPodSelectCardSelect, } from '@/components/PodSelectCard/styles/index.styled'; -import { Select, Tag } from 'antd'; -import { useModel } from '@umijs/max'; -import ContentCard from '@/components/ContentCard'; import { usePodSelect } from '@/hooks/usePodSelect'; +import { useModel } from '@umijs/max'; +import { Select, Tag } from 'antd'; import { useMemo } from 'react'; import { useLocation } from 'umi'; diff --git a/ui/src/components/ToolCardEmpty/index.tsx b/ui/src/components/ToolCardEmpty/index.tsx index 3c26a08..34e2f84 100644 --- a/ui/src/components/ToolCardEmpty/index.tsx +++ b/ui/src/components/ToolCardEmpty/index.tsx @@ -1,8 +1,8 @@ -import React from 'react'; -import { Empty } from 'antd'; +import ContentCard from '@/components/ContentCard'; import { StyledCardPodEmpty } from '@/components/ToolCardEmpty/styles/index.styled'; import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; -import ContentCard from '@/components/ContentCard'; +import { Empty } from 'antd'; +import React from 'react'; interface ToolCardEmptyProps { tip: string; diff --git a/ui/src/components/ToolsMenuButton/index.tsx b/ui/src/components/ToolsMenuButton/index.tsx index cf15d50..96b4627 100644 --- a/ui/src/components/ToolsMenuButton/index.tsx +++ b/ui/src/components/ToolsMenuButton/index.tsx @@ -1,10 +1,10 @@ -import React, { useMemo } from 'react'; -import { FloatButton } from 'antd'; -import { ToolsMapArr } from '@/pages/ToolsMap/configs/configs'; -import { StyledToolsMenuButton } from '@/components/ToolsMenuButton/styles/index.styled'; -import { useLocation } from 'umi'; import IconFont from '@/components/IconFont'; +import { StyledToolsMenuButton } from '@/components/ToolsMenuButton/styles/index.styled'; import { useTools } from '@/hooks/useTools'; +import { ToolsMapArr } from '@/pages/ToolsMap/configs/configs'; +import { FloatButton } from 'antd'; +import React, { useMemo } from 'react'; +import { useLocation } from 'umi'; const ToolsMenuButton: React.FC = () => { const locationPathname = useLocation().pathname; diff --git a/ui/src/components/ToolsMenuButton/styles/index.styled.ts b/ui/src/components/ToolsMenuButton/styles/index.styled.ts index 6c4cc65..ec368eb 100644 --- a/ui/src/components/ToolsMenuButton/styles/index.styled.ts +++ b/ui/src/components/ToolsMenuButton/styles/index.styled.ts @@ -1,5 +1,5 @@ -import styled from 'styled-components'; import { FloatButton } from 'antd'; +import styled from 'styled-components'; export const StyledToolsMenuButton = styled(FloatButton.Group)` left: 38px; diff --git a/ui/src/hooks/useContainer.ts b/ui/src/hooks/useContainer.ts index 3bee405..af6d6e6 100644 --- a/ui/src/hooks/useContainer.ts +++ b/ui/src/hooks/useContainer.ts @@ -1,6 +1,6 @@ import type { Pod } from '@/services/pods'; -import { useState, useMemo, useEffect } from 'react'; import lodash from 'lodash'; +import { useEffect, useMemo, useState } from 'react'; export const MIN_CONTAINERS_LEN = 1; export const FIST_CONTAINER_INDEX = 0; diff --git a/ui/src/hooks/usePodSelect.ts b/ui/src/hooks/usePodSelect.ts index 820f6ff..467686b 100644 --- a/ui/src/hooks/usePodSelect.ts +++ b/ui/src/hooks/usePodSelect.ts @@ -1,17 +1,17 @@ -import { useCallback, useEffect, useMemo, useState } from 'react'; +import { SHOW_ALL_POD_PATHNAME_ARR, SHOW_CONFIGMAP_PATHNAME_ARR } from '@/components/PodSelectCard'; import type { Clusters } from '@/services/cluster'; import { getClusterList } from '@/services/cluster'; -import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; -import { message } from 'antd'; -import type { Namespace } from '@/services/namespace'; -import { getNamespaceList } from '@/services/namespace'; -import { SHOW_ALL_POD_PATHNAME_ARR, SHOW_CONFIGMAP_PATHNAME_ARR } from '@/components/PodSelectCard'; import type { ConfigMapInfo } from '@/services/configmap'; import { getConfigmaps } from '@/services/configmap'; +import type { Namespace } from '@/services/namespace'; +import { getNamespaceList } from '@/services/namespace'; import type { Pod } from '@/services/pods'; import { getPodListInNamespace } from '@/services/pods'; import { checkJsonStrUtils } from '@/utils/checkJsonUtils'; +import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; +import { message } from 'antd'; import { omit } from 'lodash'; +import { useCallback, useEffect, useMemo, useState } from 'react'; import { useLocation } from 'umi'; interface PodSelectProps { @@ -98,7 +98,7 @@ export const usePodSelect = ({ .finally(() => setLoadingCluster(false)); }, []); - const getNamespaces = useCallback((cluster, isFocus?: boolean) => { + const getNamespaces = useCallback((cluster: string, isFocus?: boolean) => { setLoadingNamespace(true); getNamespaceList({ cluster }) .then((res) => { @@ -119,7 +119,7 @@ export const usePodSelect = ({ }, []); const getPodsOrConfigmap = useCallback( - (cluster, namespace, isFocus?: boolean) => { + (cluster: string, namespace: string, isFocus?: boolean) => { const allowNotReady = SHOW_ALL_POD_PATHNAME_ARR.includes(currentLocation?.pathname); const getList = isConfigMap ? getConfigmaps : getPodListInNamespace; const params = isConfigMap diff --git a/ui/src/hooks/useTerminal.ts b/ui/src/hooks/useTerminal.ts index 329a4e6..b0d58fa 100644 --- a/ui/src/hooks/useTerminal.ts +++ b/ui/src/hooks/useTerminal.ts @@ -1,13 +1,13 @@ -import { useCallback, useRef } from 'react'; -import lodash from 'lodash'; import type { OptionsPodInfo } from '@/services/pods'; +import lodash from 'lodash'; +import { useCallback, useRef } from 'react'; import { Terminal } from 'xterm'; import { FitAddon } from 'xterm-addon-fit'; // @ts-ignore // AdventureTime,Dracula -import { OneHalfLight } from 'xterm-theme'; -import { getWSHost } from '@/utils/common'; import { DEFAULT_WAIT } from '@/configs/default'; +import { getWSHost } from '@/utils/common'; +import { OneHalfLight } from 'xterm-theme'; interface TerminalProps { api: string; diff --git a/ui/src/layouts/index.tsx b/ui/src/layouts/index.tsx index 078d3a3..7a50a70 100644 --- a/ui/src/layouts/index.tsx +++ b/ui/src/layouts/index.tsx @@ -1,11 +1,11 @@ -import React from 'react'; -import { StyledBody, StyledMain } from '@/layouts/styles/index.styled'; -import PageHeader from '@/components/PageHeader'; import BackToTopButton from '@/components/BackToTopButton'; import ClusterSettingButton from '@/components/ClusterSettingButton'; -import { ConfigProvider } from 'antd'; +import PageHeader from '@/components/PageHeader'; import ToolsMenuButton from '@/components/ToolsMenuButton'; +import { StyledBody, StyledMain } from '@/layouts/styles/index.styled'; import { ToolsMapArr } from '@/pages/ToolsMap/configs/configs'; +import { ConfigProvider } from 'antd'; +import React from 'react'; import { Outlet, useLocation } from 'umi'; const BasicLayout: React.FC = () => { diff --git a/ui/src/main/createProtocol.ts b/ui/src/main/createProtocol.ts index 45a4e3c..ac07943 100644 --- a/ui/src/main/createProtocol.ts +++ b/ui/src/main/createProtocol.ts @@ -1,6 +1,6 @@ import { protocol } from 'electron'; -import { URL } from 'url'; import * as path from 'path'; +import { URL } from 'url'; export default (scheme: string) => { protocol.registerFileProtocol(scheme, (request, respond) => { diff --git a/ui/src/main/index.ts b/ui/src/main/index.ts index 40630d5..fb0c750 100644 --- a/ui/src/main/index.ts +++ b/ui/src/main/index.ts @@ -1,13 +1,13 @@ -import { app, BrowserWindow, protocol } from 'electron'; +import { app, BrowserWindow, ipcMain, protocol, shell } from 'electron'; import * as path from 'path'; import createProtocol from './createProtocol'; +import { Platforms } from './enums'; +import { initWindow } from './init/init'; import { serverProcess } from './server'; +import { downloadFile } from './utils/downloadFileUtil'; import { fixPathUtil } from './utils/fixPathUtil'; import { initLog } from './utils/loggerUtil'; import { initWindowMenu } from './utils/menuUtil'; -import { downloadFile } from './utils/downloadFileUtil'; -import { initWindow } from './init/init'; -import { Platforms } from './enums'; initLog(); fixPathUtil(); @@ -43,6 +43,9 @@ function createWindow() { createProtocol('k8z'); mainWindow.loadURL('k8z://./index.html/').catch(console.error); } + ipcMain.on('openBrowser', async (evt, { url }) => { + shell.openExternal(url).catch(console.error); + }); downloadFile(mainWindow).catch(console.error); } diff --git a/ui/src/main/server.ts b/ui/src/main/server.ts index 4c0a305..893b182 100644 --- a/ui/src/main/server.ts +++ b/ui/src/main/server.ts @@ -1,12 +1,12 @@ import type { ChildProcess } from 'child_process'; import { exec } from 'child_process'; -import portfinder from 'portfinder'; import { app, dialog } from 'electron'; +import fs from 'fs-extra'; import * as net from 'net'; import path from 'path'; -import { getLogPath } from './utils/loggerUtil'; -import fs from 'fs-extra'; +import portfinder from 'portfinder'; import { Platforms } from './enums'; +import { getLogPath } from './utils/loggerUtil'; import { toNumber } from 'lodash'; export let serverProcess: ChildProcess; diff --git a/ui/src/main/utils/downloadFileUtil.ts b/ui/src/main/utils/downloadFileUtil.ts index aa3e5cd..c8e782f 100644 --- a/ui/src/main/utils/downloadFileUtil.ts +++ b/ui/src/main/utils/downloadFileUtil.ts @@ -1,7 +1,7 @@ import type { BrowserWindow } from 'electron'; import { app, dialog, ipcMain } from 'electron'; -import path from 'path'; import { pathExistsSync } from 'fs-extra'; +import path from 'path'; export const openFileDialog = async (mainWindow: BrowserWindow) => { const defaultPath = app.getPath('downloads'); @@ -17,14 +17,14 @@ export const openFileDialog = async (mainWindow: BrowserWindow) => { }; export async function downloadFile(mainWindow: BrowserWindow) { - let selectPath = ''; - ipcMain.on('download', async (evt, args) => { + let selectPath = app.getPath('downloads'); + ipcMain.on('download', async (evt, { downloadUrl }) => { // 打开系统弹窗 选择文件下载位置] openFileDialog(mainWindow) .then((res) => { if (res) { selectPath = res; - mainWindow.webContents.downloadURL(args.downloadUrl); + mainWindow.webContents.downloadURL(downloadUrl); } }) .catch(console.error); @@ -43,11 +43,13 @@ export async function downloadFile(mainWindow: BrowserWindow) { ext, name: `${name}(${fileNum})`, }); - savePath = `${selectPath}/${newFileName}`; + savePath = path.join(selectPath, newFileName); } + console.log('savePath: ', savePath); + item.setSavePath(savePath); - app.badgeCount = 1; + app.badgeCount = app.badgeCount + 1; item.on('updated', (event, state) => { if (state === 'interrupted') { console.log('Download is interrupted but can be resumed'); @@ -55,12 +57,17 @@ export async function downloadFile(mainWindow: BrowserWindow) { if (item.isPaused()) { console.log('Download is paused'); } else { - console.log(`Received bytes: ${item.getReceivedBytes()}`); + const progress = item.getReceivedBytes() / item.getTotalBytes(); + mainWindow.setProgressBar(progress); + console.log( + `Received bytes: ${item.getReceivedBytes()},Total Bytes: ${item.getTotalBytes()}`, + ); } } }); item.once('done', (event, state) => { - app.badgeCount = 0; + app.badgeCount = app.badgeCount - 1; + mainWindow.setProgressBar(-1); if (state === 'completed') { console.log('Download successfully'); dialog.showMessageBox(mainWindow, { diff --git a/ui/src/main/utils/fixPathUtil.ts b/ui/src/main/utils/fixPathUtil.ts index 748bfe7..b7b47bb 100644 --- a/ui/src/main/utils/fixPathUtil.ts +++ b/ui/src/main/utils/fixPathUtil.ts @@ -1,7 +1,7 @@ -import { userInfo } from 'os'; import { execSync } from 'child_process'; -import stripAnsi from 'strip-ansi'; import lodash from 'lodash'; +import { userInfo } from 'os'; +import stripAnsi from 'strip-ansi'; import { Platforms } from '../enums'; export const ENV_PATH_KEY = 'PATH'; diff --git a/ui/src/models/pod.ts b/ui/src/models/pod.ts index ebc9744..8fd0d84 100644 --- a/ui/src/models/pod.ts +++ b/ui/src/models/pod.ts @@ -1,7 +1,7 @@ +import type { ConfigMapInfo } from '@/services/configmap'; import type { Pod } from '@/services/pods'; import { k8zStorageKeys, localStorageManage, removeLocalStorageManage } from '@/utils/storageUtil'; import { useCallback, useState } from 'react'; -import type { ConfigMapInfo } from '@/services/configmap'; export default () => { const [cluster, setCluster] = useState(); diff --git a/ui/src/pages/AppInit/index.tsx b/ui/src/pages/AppInit/index.tsx index 3b5d3f0..c8c0041 100644 --- a/ui/src/pages/AppInit/index.tsx +++ b/ui/src/pages/AppInit/index.tsx @@ -1,5 +1,5 @@ -import { Result } from 'antd'; import { SmileOutlined } from '@ant-design/icons'; +import { Result } from 'antd'; import React from 'react'; import './styles/index.less'; diff --git a/ui/src/pages/ClustersManage/ClusterOptions.tsx b/ui/src/pages/ClustersManage/ClusterOptions.tsx index a444832..111d491 100644 --- a/ui/src/pages/ClustersManage/ClusterOptions.tsx +++ b/ui/src/pages/ClustersManage/ClusterOptions.tsx @@ -1,5 +1,5 @@ -import { Button, Divider, Modal, Space, Tooltip } from 'antd'; import { DeleteOutlined, EditOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; +import { Button, Divider, Modal, Space, Tooltip } from 'antd'; import React, { useCallback } from 'react'; interface ClusterOptionsProps { name: string; diff --git a/ui/src/pages/ClustersManage/components/ClusterForm/index.tsx b/ui/src/pages/ClustersManage/components/ClusterForm/index.tsx index c0fbfa0..f6eaf3d 100644 --- a/ui/src/pages/ClustersManage/components/ClusterForm/index.tsx +++ b/ui/src/pages/ClustersManage/components/ClusterForm/index.tsx @@ -1,10 +1,10 @@ +import type { ClusterInfo } from '@/services/cluster'; +import { checkJsonStrUtils } from '@/utils/checkJsonUtils'; +import MonacoEditor from '@monaco-editor/react'; import type { FormInstance } from 'antd'; import { Form, Input } from 'antd'; -import type { ClusterInfo } from '@/services/cluster'; import type { RefObject } from 'react'; import React, { useEffect, useRef } from 'react'; -import MonacoEditor from '@monaco-editor/react'; -import { checkJsonStrUtils } from '@/utils/checkJsonUtils'; import '../../styles/form.less'; export interface ClusterFormProps { diff --git a/ui/src/pages/ClustersManage/components/CreateClusterModal/index.tsx b/ui/src/pages/ClustersManage/components/CreateClusterModal/index.tsx index 8c8eb01..d63b4da 100644 --- a/ui/src/pages/ClustersManage/components/CreateClusterModal/index.tsx +++ b/ui/src/pages/ClustersManage/components/CreateClusterModal/index.tsx @@ -1,9 +1,8 @@ -import React, { useCallback, useEffect, useRef } from 'react'; +import ClusterForm from '@/pages/ClustersManage/components/ClusterForm'; +import type { ClusterInfo, ClusterMethod } from '@/services/cluster'; import type { FormInstance } from 'antd'; import { message, Modal, Spin } from 'antd'; -import type { ClusterInfo } from '@/services/cluster'; -import ClusterForm from '@/pages/ClustersManage/components/ClusterForm'; -import type { ClusterMethod } from '@/services/cluster'; +import React, { useCallback, useEffect, useRef } from 'react'; export interface CreateClusterModalProps { open: boolean; diff --git a/ui/src/pages/ClustersManage/components/UpdateClusterModal/index.tsx b/ui/src/pages/ClustersManage/components/UpdateClusterModal/index.tsx index 2c05189..1adb3ed 100644 --- a/ui/src/pages/ClustersManage/components/UpdateClusterModal/index.tsx +++ b/ui/src/pages/ClustersManage/components/UpdateClusterModal/index.tsx @@ -1,9 +1,8 @@ -import React, { useCallback, useEffect, useRef } from 'react'; +import ClusterForm from '@/pages/ClustersManage/components/ClusterForm'; +import type { ClusterInfo, ClusterMethod } from '@/services/cluster'; import type { FormInstance } from 'antd'; import { message, Modal, Spin } from 'antd'; -import type { ClusterInfo } from '@/services/cluster'; -import ClusterForm from '@/pages/ClustersManage/components/ClusterForm'; -import type { ClusterMethod } from '@/services/cluster'; +import React, { useCallback, useEffect, useRef } from 'react'; export interface UpdateClusterModalProps { open: boolean; diff --git a/ui/src/pages/ClustersManage/hooks/useClusters.ts b/ui/src/pages/ClustersManage/hooks/useClusters.ts index bef1a5f..d3b369c 100644 --- a/ui/src/pages/ClustersManage/hooks/useClusters.ts +++ b/ui/src/pages/ClustersManage/hooks/useClusters.ts @@ -1,7 +1,7 @@ -import { useCallback, useEffect, useState } from 'react'; import type { ClusterInfo, ClusterMethod, Clusters } from '@/services/cluster'; import { createOrUpdateCluster, getClusterList, getOrDeleteCluster } from '@/services/cluster'; import { message } from 'antd'; +import { useCallback, useEffect, useState } from 'react'; export const useClusters = () => { const [clusters, setClusters] = useState([]); diff --git a/ui/src/pages/ClustersManage/index.tsx b/ui/src/pages/ClustersManage/index.tsx index ccbb56f..156d38e 100644 --- a/ui/src/pages/ClustersManage/index.tsx +++ b/ui/src/pages/ClustersManage/index.tsx @@ -1,15 +1,15 @@ -import { Button, Table, Tooltip } from 'antd'; +import ContentCard from '@/components/ContentCard'; +import ClusterOptions from '@/pages/ClustersManage/ClusterOptions'; +import CreateClusterModal from '@/pages/ClustersManage/components/CreateClusterModal'; +import UpdateClusterModal from '@/pages/ClustersManage/components/UpdateClusterModal'; import { useClusters } from '@/pages/ClustersManage/hooks/useClusters'; import type { Clusters } from '@/services/cluster'; +import { PlusOutlined } from '@ant-design/icons'; +import { Button, Table, Tooltip } from 'antd'; import type { ColumnsType } from 'antd/es/table'; -import { useSearchParams } from 'umi'; import { useEffect, useMemo } from 'react'; +import { useSearchParams } from 'umi'; import styles from './styles/index.less'; -import { PlusOutlined } from '@ant-design/icons'; -import CreateClusterModal from '@/pages/ClustersManage/components/CreateClusterModal'; -import ClusterOptions from '@/pages/ClustersManage/ClusterOptions'; -import UpdateClusterModal from '@/pages/ClustersManage/components/UpdateClusterModal'; -import ContentCard from '@/components/ContentCard'; const ClustersManage = () => { const [searchParams] = useSearchParams(); diff --git a/ui/src/pages/Tools/ConfigMap/components/ConfigMapEditor/index.tsx b/ui/src/pages/Tools/ConfigMap/components/ConfigMapEditor/index.tsx index f97bb24..0c82d56 100644 --- a/ui/src/pages/Tools/ConfigMap/components/ConfigMapEditor/index.tsx +++ b/ui/src/pages/Tools/ConfigMap/components/ConfigMapEditor/index.tsx @@ -1,17 +1,17 @@ -import type { MutableRefObject } from 'react'; -import React, { useRef } from 'react'; +import Loading from '@/components/Loading'; +import { DEFAULT_CONFIGMAP_TYPE, PrettyConfigmapTypes } from '@/enums/pretty'; import { StyledConfigMapContent, StyledConfigMapEditor, StyledConfigMapEditorEmpty, StyledConfigMapEditorOptions, } from '@/pages/Tools/ConfigMap/styles/editor.styled'; -import { Button, Empty, Select, Space } from 'antd'; -import { DEFAULT_CONFIGMAP_TYPE, PrettyConfigmapTypes } from '@/enums/pretty'; -import Loading from '@/components/Loading'; -import lodash from 'lodash'; import { FullscreenExitOutlined, FullscreenOutlined, SaveOutlined } from '@ant-design/icons'; import { useFullscreen } from 'ahooks'; +import { Button, Empty, Select, Space } from 'antd'; +import lodash from 'lodash'; +import type { MutableRefObject } from 'react'; +import React, { useRef } from 'react'; interface ConfigMapEditorProps { loading: boolean; diff --git a/ui/src/pages/Tools/ConfigMap/components/ConfigmapFiles/ConfigMapFileItem.tsx b/ui/src/pages/Tools/ConfigMap/components/ConfigmapFiles/ConfigMapFileItem.tsx index 9d80420..b674501 100644 --- a/ui/src/pages/Tools/ConfigMap/components/ConfigmapFiles/ConfigMapFileItem.tsx +++ b/ui/src/pages/Tools/ConfigMap/components/ConfigmapFiles/ConfigMapFileItem.tsx @@ -1,14 +1,11 @@ -import React, { useCallback, useRef, useState } from 'react'; import { StyledConfigMapFileButton, StyledConfigMapFileNameButton, - // StyledConfigMapFileDeleteIcon, - // StyledConfigMapFileItem, - // StyledConfigMapFileName, } from '@/pages/Tools/ConfigMap/styles/files.styled'; import type { ConfigMapFileInfo } from '@/services/configmap'; -import { Button, message, Modal, Tooltip } from 'antd'; import { DeleteOutlined, ExclamationCircleFilled } from '@ant-design/icons'; +import { Button, message, Modal, Tooltip } from 'antd'; +import React, { useCallback, useRef, useState } from 'react'; interface ConfigMapFileItemProps { file: ConfigMapFileInfo; diff --git a/ui/src/pages/Tools/ConfigMap/components/ConfigmapFiles/index.tsx b/ui/src/pages/Tools/ConfigMap/components/ConfigmapFiles/index.tsx index dd1e753..50d0eca 100644 --- a/ui/src/pages/Tools/ConfigMap/components/ConfigmapFiles/index.tsx +++ b/ui/src/pages/Tools/ConfigMap/components/ConfigmapFiles/index.tsx @@ -1,16 +1,16 @@ -import React from 'react'; -import type { ConfigMapFileInfo } from '@/services/configmap'; +import ContentCard from '@/components/ContentCard'; +import ConfigMapFileItem from '@/pages/Tools/ConfigMap/components/ConfigmapFiles/ConfigMapFileItem'; import { StyledConfigMapFileAddButton, StyledConfigMapFiles, StyledConfigMapFilesList, StyledConfigMapFilesScroll, } from '@/pages/Tools/ConfigMap/styles/files.styled'; +import type { ConfigMapFileInfo } from '@/services/configmap'; +import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; import { FileAddOutlined } from '@ant-design/icons'; import lodash from 'lodash'; -import ConfigMapFileItem from '@/pages/Tools/ConfigMap/components/ConfigmapFiles/ConfigMapFileItem'; -import ContentCard from '@/components/ContentCard'; -import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; +import React from 'react'; interface ConfigmapFilesProps { files: ConfigMapFileInfo[]; diff --git a/ui/src/pages/Tools/ConfigMap/components/CreateFileModal/index.tsx b/ui/src/pages/Tools/ConfigMap/components/CreateFileModal/index.tsx index 2756974..3635d2a 100644 --- a/ui/src/pages/Tools/ConfigMap/components/CreateFileModal/index.tsx +++ b/ui/src/pages/Tools/ConfigMap/components/CreateFileModal/index.tsx @@ -1,8 +1,8 @@ -import type { MutableRefObject } from 'react'; -import React from 'react'; +import { DEFAULT_CONFIGMAP_TYPE, PrettyConfigmapTypes } from '@/enums/pretty'; import type { FormInstance } from 'antd'; import { Form, Input, Modal, Select } from 'antd'; -import { DEFAULT_CONFIGMAP_TYPE, PrettyConfigmapTypes } from '@/enums/pretty'; +import type { MutableRefObject } from 'react'; +import React from 'react'; interface CreateFileModalProps { open: boolean; diff --git a/ui/src/pages/Tools/ConfigMap/components/DiffContextModal/index.tsx b/ui/src/pages/Tools/ConfigMap/components/DiffContextModal/index.tsx index 59f6014..0f7b24d 100644 --- a/ui/src/pages/Tools/ConfigMap/components/DiffContextModal/index.tsx +++ b/ui/src/pages/Tools/ConfigMap/components/DiffContextModal/index.tsx @@ -1,7 +1,7 @@ -import React from 'react'; -import { Modal } from 'antd'; -import { DiffEditor } from '@monaco-editor/react'; import { DEFAULT_CONFIGMAP_TYPE } from '@/enums/pretty'; +import { DiffEditor } from '@monaco-editor/react'; +import { Modal } from 'antd'; +import React from 'react'; interface DiffContextModalProps { open: boolean; diff --git a/ui/src/pages/Tools/ConfigMap/hooks/useConfigMap.ts b/ui/src/pages/Tools/ConfigMap/hooks/useConfigMap.ts index 1eb9aef..1884226 100644 --- a/ui/src/pages/Tools/ConfigMap/hooks/useConfigMap.ts +++ b/ui/src/pages/Tools/ConfigMap/hooks/useConfigMap.ts @@ -1,4 +1,5 @@ -import { useCallback, useRef, useState } from 'react'; +import { INIT_MONACO_WAIT } from '@/configs/default'; +import { ALL_SUFFIX_ARR, DEFAULT_CONFIGMAP_TYPE, PrettyConfigmapTypes } from '@/enums/pretty'; import type { ConfigMapFileInfo, ConfigMapInfo } from '@/services/configmap'; import { deleteFile, @@ -6,11 +7,10 @@ import { getFileContext, saveFileContext, } from '@/services/configmap'; +import { AnchorScrollKey, documentScrollUtil } from '@/utils/documentScrollUtil'; import { message } from 'antd'; import lodash from 'lodash'; -import { ALL_SUFFIX_ARR, DEFAULT_CONFIGMAP_TYPE, PrettyConfigmapTypes } from '@/enums/pretty'; -import { INIT_MONACO_WAIT } from '@/configs/default'; -import { AnchorScrollKey, documentScrollUtil } from '@/utils/documentScrollUtil'; +import { useCallback, useRef, useState } from 'react'; interface ConfigMapProps { configmap: ConfigMapInfo; diff --git a/ui/src/pages/Tools/ConfigMap/index.tsx b/ui/src/pages/Tools/ConfigMap/index.tsx index 5909b07..bf7baed 100644 --- a/ui/src/pages/Tools/ConfigMap/index.tsx +++ b/ui/src/pages/Tools/ConfigMap/index.tsx @@ -1,15 +1,15 @@ -import React, { useEffect, useRef } from 'react'; import ContentCard from '@/components/ContentCard'; -import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; import ConfigMapEditor from '@/pages/Tools/ConfigMap/components/ConfigMapEditor'; -import { useConfigMap } from '@/pages/Tools/ConfigMap/hooks/useConfigMap'; -import type { ConfigMapInfo } from '@/services/configmap'; import ConfigmapFiles from '@/pages/Tools/ConfigMap/components/ConfigmapFiles'; +import CreateFileModal from '@/pages/Tools/ConfigMap/components/CreateFileModal'; import DiffContextModal from '@/pages/Tools/ConfigMap/components/DiffContextModal'; +import { useConfigMap } from '@/pages/Tools/ConfigMap/hooks/useConfigMap'; import { StyledConfigMap } from '@/pages/Tools/ConfigMap/styles/index.styled'; -import CreateFileModal from '@/pages/Tools/ConfigMap/components/CreateFileModal'; -import type { FormInstance } from 'antd'; +import type { ConfigMapInfo } from '@/services/configmap'; import { AnchorScrollKey } from '@/utils/documentScrollUtil'; +import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; +import type { FormInstance } from 'antd'; +import React, { useEffect, useRef } from 'react'; interface FilesProps { configmap: ConfigMapInfo; diff --git a/ui/src/pages/Tools/ConfigMap/styles/editor.styled.ts b/ui/src/pages/Tools/ConfigMap/styles/editor.styled.ts index 106d229..ddbec60 100644 --- a/ui/src/pages/Tools/ConfigMap/styles/editor.styled.ts +++ b/ui/src/pages/Tools/ConfigMap/styles/editor.styled.ts @@ -1,5 +1,5 @@ -import styled from 'styled-components'; import MonacoEditor from '@monaco-editor/react'; +import styled from 'styled-components'; export const StyledConfigMapContent = styled.div` flex: 1; display: flex; diff --git a/ui/src/pages/Tools/ConfigMap/styles/files.styled.ts b/ui/src/pages/Tools/ConfigMap/styles/files.styled.ts index e4ee90d..429f043 100644 --- a/ui/src/pages/Tools/ConfigMap/styles/files.styled.ts +++ b/ui/src/pages/Tools/ConfigMap/styles/files.styled.ts @@ -1,5 +1,5 @@ -import styled, { css } from 'styled-components'; import { Button } from 'antd'; +import styled, { css } from 'styled-components'; export const StyledConfigMapFiles = styled.div` width: 100%; diff --git a/ui/src/pages/Tools/Debug/components/ConfigForm/index.tsx b/ui/src/pages/Tools/Debug/components/ConfigForm/index.tsx index 4a237f7..48f30a6 100644 --- a/ui/src/pages/Tools/Debug/components/ConfigForm/index.tsx +++ b/ui/src/pages/Tools/Debug/components/ConfigForm/index.tsx @@ -1,13 +1,13 @@ -import React, { useEffect } from 'react'; -import { Button, Form, Select } from 'antd'; -import type { FormInstance } from 'antd'; +import { FIST_CONTAINER_INDEX, MIN_CONTAINERS_LEN } from '@/hooks/useContainer'; import { StyledConfigForm, StyledConfigFormButtonSpace, } from '@/pages/Tools/Debug/styles/config.styled'; -import { FIST_CONTAINER_INDEX, MIN_CONTAINERS_LEN } from '@/hooks/useContainer'; -import { StopOutlined, PlayCircleOutlined } from '@ant-design/icons'; +import { PlayCircleOutlined, StopOutlined } from '@ant-design/icons'; +import type { FormInstance } from 'antd'; +import { Button, Form, Select } from 'antd'; import type { DefaultOptionType } from 'rc-select/lib/Select'; +import React, { useCallback, useEffect } from 'react'; export interface FormParams { container: string; @@ -28,6 +28,11 @@ const ConfigForm: React.FC = ({ handleFinish, handleStopClient, }) => { + const handleGetPopupContainer = useCallback( + () => document.getElementById('ContainerForm') || document.body, + [], + ); + useEffect(() => { // 默认设置第一个 container if (form && containers.length >= MIN_CONTAINERS_LEN) { @@ -37,13 +42,19 @@ const ConfigForm: React.FC = ({ return ( -
+ - diff --git a/ui/src/pages/Tools/Debug/hooks/useDebug.ts b/ui/src/pages/Tools/Debug/hooks/useDebug.ts index 7f27692..d27d9e5 100644 --- a/ui/src/pages/Tools/Debug/hooks/useDebug.ts +++ b/ui/src/pages/Tools/Debug/hooks/useDebug.ts @@ -1,10 +1,10 @@ -import type { OptionsPodInfo } from '@/services/pods'; -import type { FormParams } from '@/pages/Tools/Debug/components/ConfigForm'; -import { useCallback, useEffect, useState } from 'react'; -import { AnchorScrollKey, documentScrollUtil } from '@/utils/documentScrollUtil'; +import { INIT_MONACO_WAIT } from '@/configs/default'; import { useTerminal } from '@/hooks/useTerminal'; +import type { FormParams } from '@/pages/Tools/Debug/components/ConfigForm'; +import type { OptionsPodInfo } from '@/services/pods'; import { DEBUG_API } from '@/services/pods'; -import { INIT_MONACO_WAIT } from '@/configs/default'; +import { AnchorScrollKey, documentScrollUtil } from '@/utils/documentScrollUtil'; +import { useCallback, useEffect, useState } from 'react'; interface DebugProps { podInfo?: OptionsPodInfo; diff --git a/ui/src/pages/Tools/Debug/index.tsx b/ui/src/pages/Tools/Debug/index.tsx index 539a0a0..ac0e635 100644 --- a/ui/src/pages/Tools/Debug/index.tsx +++ b/ui/src/pages/Tools/Debug/index.tsx @@ -1,18 +1,18 @@ -import React from 'react'; import ContentCard from '@/components/ContentCard'; -import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; +import Loading from '@/components/Loading'; +import { useContainer } from '@/hooks/useContainer'; import type { FormParams } from '@/pages/Tools/Debug/components/ConfigForm'; import ConfigForm from '@/pages/Tools/Debug/components/ConfigForm'; -import { Empty, Form } from 'antd'; -import type { Pod } from '@/services/pods'; -import { useContainer } from '@/hooks/useContainer'; import { useDebug } from '@/pages/Tools/Debug/hooks/useDebug'; -import Loading from '@/components/Loading'; import { StyledDebug, StyledDebugTerm, StyledDebugTermEmpty, } from '@/pages/Tools/Debug/styles/index.styled'; +import type { Pod } from '@/services/pods'; +import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; +import { Empty, Form } from 'antd'; +import React from 'react'; interface DebugProps { currentPod: Pod; diff --git a/ui/src/pages/Tools/Files/components/FileList/index.tsx b/ui/src/pages/Tools/Files/components/FileList/index.tsx index e07805d..8d7f769 100644 --- a/ui/src/pages/Tools/Files/components/FileList/index.tsx +++ b/ui/src/pages/Tools/Files/components/FileList/index.tsx @@ -1,14 +1,14 @@ -import React, { useCallback, useMemo } from 'react'; -import { Button, Empty, Table } from 'antd'; +import type { FilesContentProps } from '@/pages/Tools/Files/components/FilesContent'; +import styles from '@/pages/Tools/Files/styles/list.less'; +import { StyledFiles } from '@/pages/Tools/Files/styles/list.styled'; import type { FileInfo } from '@/services/podContainers'; -import type { ColumnsType } from 'antd/es/table'; import { stringTimeFormat } from '@/utils/timeUtils'; +import { Button, Empty, Table } from 'antd'; +import type { ColumnsType } from 'antd/es/table'; +import type { TableRowSelection } from 'antd/lib/table/interface'; import classNames from 'classnames'; import numeral from 'numeral'; -import type { TableRowSelection } from 'antd/lib/table/interface'; -import styles from '@/pages/Tools/Files/styles/list.less'; -import { StyledFiles } from '@/pages/Tools/Files/styles/list.styled'; -import type { FilesContentProps } from '@/pages/Tools/Files/components/FilesContent'; +import React, { useCallback, useMemo } from 'react'; export interface FileListProps extends FilesContentProps { fileList: FileInfo[]; diff --git a/ui/src/pages/Tools/Files/components/FilesContent/index.tsx b/ui/src/pages/Tools/Files/components/FilesContent/index.tsx index afa2c54..b421086 100644 --- a/ui/src/pages/Tools/Files/components/FilesContent/index.tsx +++ b/ui/src/pages/Tools/Files/components/FilesContent/index.tsx @@ -1,10 +1,10 @@ -import React from 'react'; -import type { OptionsPodInfo } from '@/services/pods'; -import { useFiles } from '@/pages/Tools/Files/hooks/useFiles'; -import FilesHeader from '@/pages/Tools/Files/components/FilesHeader'; import FileList from '@/pages/Tools/Files/components/FileList'; +import FilesHeader from '@/pages/Tools/Files/components/FilesHeader'; +import { useFiles } from '@/pages/Tools/Files/hooks/useFiles'; import { StyledFileCard } from '@/pages/Tools/Files/styles/index.styled'; +import type { OptionsPodInfo } from '@/services/pods'; import { useModel } from '@umijs/max'; +import React from 'react'; export interface FilesContentProps { pod: Required; diff --git a/ui/src/pages/Tools/Files/components/FilesHeader/FilesPathItem.tsx b/ui/src/pages/Tools/Files/components/FilesHeader/FilesPathItem.tsx index 2d83448..9af6104 100644 --- a/ui/src/pages/Tools/Files/components/FilesHeader/FilesPathItem.tsx +++ b/ui/src/pages/Tools/Files/components/FilesHeader/FilesPathItem.tsx @@ -1,7 +1,6 @@ -import React from 'react'; import styles from '@/pages/Tools/Files/styles/header.less'; -import { useCallback } from 'react'; import { message } from 'antd'; +import React, { useCallback } from 'react'; interface FilesPathItemProps { folder: string; diff --git a/ui/src/pages/Tools/Files/components/FilesHeader/index.tsx b/ui/src/pages/Tools/Files/components/FilesHeader/index.tsx index 346b70a..48f8043 100644 --- a/ui/src/pages/Tools/Files/components/FilesHeader/index.tsx +++ b/ui/src/pages/Tools/Files/components/FilesHeader/index.tsx @@ -1,17 +1,17 @@ -import React, { useCallback, useMemo, useState } from 'react'; -import { Button, message, Space, Spin, Upload } from 'antd'; +import type { FilesContentProps } from '@/pages/Tools/Files/components/FilesContent'; +import FilesPathItem from '@/pages/Tools/Files/components/FilesHeader/FilesPathItem'; import styles from '@/pages/Tools/Files/styles/header.less'; +import type { FileInfo } from '@/services/podContainers'; import { CloudDownloadOutlined, - LoginOutlined, + ForwardOutlined, LoadingOutlined, + LoginOutlined, RollbackOutlined, - ForwardOutlined, UploadOutlined, } from '@ant-design/icons'; -import type { FileInfo } from '@/services/podContainers'; -import FilesPathItem from '@/pages/Tools/Files/components/FilesHeader/FilesPathItem'; -import type { FilesContentProps } from '@/pages/Tools/Files/components/FilesContent'; +import { Button, message, Space, Spin, Upload } from 'antd'; +import React, { useCallback, useMemo, useState } from 'react'; export interface FilesHeaderProps extends FilesContentProps { selectFiles: FileInfo[]; diff --git a/ui/src/pages/Tools/Files/hooks/useFiles.ts b/ui/src/pages/Tools/Files/hooks/useFiles.ts index 79c1b78..1c87522 100644 --- a/ui/src/pages/Tools/Files/hooks/useFiles.ts +++ b/ui/src/pages/Tools/Files/hooks/useFiles.ts @@ -1,11 +1,11 @@ import type { ContainersFilesParams, FileInfo } from '@/services/podContainers'; import { DOWNLOAD_FILE_OR_FOLDER_PATH, getContainerList } from '@/services/podContainers'; -import type React from 'react'; -import { useCallback, useEffect, useRef, useState } from 'react'; -import { message } from 'antd'; import type { OptionsPodInfo } from '@/services/pods'; -import lodash from 'lodash'; import { RequestBaseUrl } from '@/utils/electronRenderUtil'; +import { message } from 'antd'; +import lodash from 'lodash'; +import type React from 'react'; +import { useCallback, useEffect, useRef, useState } from 'react'; export const useFiles = ({ currentPod, diff --git a/ui/src/pages/Tools/Files/index.tsx b/ui/src/pages/Tools/Files/index.tsx index 191df84..7a029be 100644 --- a/ui/src/pages/Tools/Files/index.tsx +++ b/ui/src/pages/Tools/Files/index.tsx @@ -1,10 +1,10 @@ +import ContainerSelectCard from '@/components/ContainerSelectCard'; import ContentCard from '@/components/ContentCard'; -import React from 'react'; import { useContainer } from '@/hooks/useContainer'; -import ContainerSelectCard from '@/components/ContainerSelectCard'; -import type { Pod } from '@/services/pods'; import FilesContent from '@/pages/Tools/Files/components/FilesContent'; import { StyledFileCardEmpty } from '@/pages/Tools/Files/styles/index.styled'; +import type { Pod } from '@/services/pods'; +import React from 'react'; interface FilesProps { currentPod: Pod; diff --git a/ui/src/pages/Tools/Nodes/components/FilterForm/index.tsx b/ui/src/pages/Tools/Nodes/components/FilterForm/index.tsx index 2deb718..ef004f1 100644 --- a/ui/src/pages/Tools/Nodes/components/FilterForm/index.tsx +++ b/ui/src/pages/Tools/Nodes/components/FilterForm/index.tsx @@ -1,11 +1,11 @@ -import React, { useCallback } from 'react'; +import ContentCard from '@/components/ContentCard'; +import type { FormParams } from '@/pages/Tools/Nodes'; +import { StyledForm } from '@/pages/Tools/Nodes/styles/form.styled'; import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; +import { SearchOutlined } from '@ant-design/icons'; import type { FormInstance } from 'antd'; import { Button, Col, Form, Input, Row, Select } from 'antd'; -import ContentCard from '@/components/ContentCard'; -import { SearchOutlined } from '@ant-design/icons'; -import { StyledForm } from '@/pages/Tools/Nodes/styles/form.styled'; -import type { FormParams } from '@/pages/Tools/Nodes'; +import React, { useCallback } from 'react'; export enum QueryMethods { Node = 'Node', diff --git a/ui/src/pages/Tools/Nodes/index.tsx b/ui/src/pages/Tools/Nodes/index.tsx index 9dd5a30..7cc2886 100644 --- a/ui/src/pages/Tools/Nodes/index.tsx +++ b/ui/src/pages/Tools/Nodes/index.tsx @@ -1,9 +1,9 @@ -import React from 'react'; import ContentCard from '@/components/ContentCard'; -import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; +import FilterForm from '@/pages/Tools/Nodes/components/FilterForm'; import { AnchorScrollKey } from '@/utils/documentScrollUtil'; +import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; import { useForm } from 'antd/es/form/Form'; -import FilterForm from '@/pages/Tools/Nodes/components/FilterForm'; +import React from 'react'; export interface FormParams { method: string; diff --git a/ui/src/pages/Tools/Nodes/styles/form.styled.ts b/ui/src/pages/Tools/Nodes/styles/form.styled.ts index 3119053..e63b1df 100644 --- a/ui/src/pages/Tools/Nodes/styles/form.styled.ts +++ b/ui/src/pages/Tools/Nodes/styles/form.styled.ts @@ -1,5 +1,5 @@ -import styled from 'styled-components'; import { Form } from 'antd'; +import styled from 'styled-components'; export const StyledForm = styled(Form)` margin-top: 8px; diff --git a/ui/src/pages/Tools/PodProxy/components/ProxyRequest/index.tsx b/ui/src/pages/Tools/PodProxy/components/ProxyRequest/index.tsx index 5b9c400..3589ec0 100644 --- a/ui/src/pages/Tools/PodProxy/components/ProxyRequest/index.tsx +++ b/ui/src/pages/Tools/PodProxy/components/ProxyRequest/index.tsx @@ -1,13 +1,13 @@ -import React, { useMemo } from 'react'; -import type { FormInstance } from 'antd'; -import { Button, Form, Input, Select } from 'antd'; -import RequestType, { RequestTypes } from '@/pages/Tools/PodProxy/components/RequestType'; +import { RequestProtocols } from '@/pages/Tools/PodProxy'; import ProxyRequestInfo from '@/pages/Tools/PodProxy/components/ProxyRequestInfo'; +import RequestType, { RequestTypes } from '@/pages/Tools/PodProxy/components/RequestType'; import { StyledPodProxyFormInput, StyledRequestPathInput, } from '@/pages/Tools/PodProxy/styles/request.styled'; -import { RequestProtocols } from '@/pages/Tools/PodProxy'; +import type { FormInstance } from 'antd'; +import { Button, Form, Input, Select } from 'antd'; +import React, { useMemo } from 'react'; interface ProxyRequestProps { podName: string; diff --git a/ui/src/pages/Tools/PodProxy/components/ProxyRequestInfo/RequestBody.tsx b/ui/src/pages/Tools/PodProxy/components/ProxyRequestInfo/RequestBody.tsx index 437ef21..b0a021b 100644 --- a/ui/src/pages/Tools/PodProxy/components/ProxyRequestInfo/RequestBody.tsx +++ b/ui/src/pages/Tools/PodProxy/components/ProxyRequestInfo/RequestBody.tsx @@ -1,6 +1,6 @@ -import React from 'react'; -import MonacoEditor from '@monaco-editor/react'; import type { DefaultInfoProps } from '@/pages/Tools/PodProxy/components/ProxyRequestInfo/index'; +import MonacoEditor from '@monaco-editor/react'; +import React from 'react'; const RequestBody: React.FC = ({ value, onChange }) => { return ( diff --git a/ui/src/pages/Tools/PodProxy/components/ProxyRequestInfo/RequestHeaders.tsx b/ui/src/pages/Tools/PodProxy/components/ProxyRequestInfo/RequestHeaders.tsx index 3c3e62a..66dda9b 100644 --- a/ui/src/pages/Tools/PodProxy/components/ProxyRequestInfo/RequestHeaders.tsx +++ b/ui/src/pages/Tools/PodProxy/components/ProxyRequestInfo/RequestHeaders.tsx @@ -1,7 +1,7 @@ -import React, { useCallback, useState } from 'react'; +import { RequestTypes } from '@/pages/Tools/PodProxy/components/RequestType'; import { Form, Input } from 'antd'; +import React, { useCallback, useState } from 'react'; import styled from 'styled-components'; -import { RequestTypes } from '@/pages/Tools/PodProxy/components/RequestType'; const StyledFormFields = styled.div` display: flex; diff --git a/ui/src/pages/Tools/PodProxy/components/ProxyRequestInfo/index.tsx b/ui/src/pages/Tools/PodProxy/components/ProxyRequestInfo/index.tsx index d769811..8d2dbac 100644 --- a/ui/src/pages/Tools/PodProxy/components/ProxyRequestInfo/index.tsx +++ b/ui/src/pages/Tools/PodProxy/components/ProxyRequestInfo/index.tsx @@ -1,8 +1,8 @@ -import React, { useMemo } from 'react'; -import { StyledPodProxyRequestInfo } from '@/pages/Tools/PodProxy/styles/request.styled'; import RequestBody from '@/pages/Tools/PodProxy/components/ProxyRequestInfo/RequestBody'; import RequestHeaders from '@/pages/Tools/PodProxy/components/ProxyRequestInfo/RequestHeaders'; import { RequestTypes } from '@/pages/Tools/PodProxy/components/RequestType'; +import { StyledPodProxyRequestInfo } from '@/pages/Tools/PodProxy/styles/request.styled'; +import React, { useMemo } from 'react'; export interface DefaultInfoProps { value?: any; diff --git a/ui/src/pages/Tools/PodProxy/components/ProxyResponse/index.tsx b/ui/src/pages/Tools/PodProxy/components/ProxyResponse/index.tsx index 222644d..216b7f7 100644 --- a/ui/src/pages/Tools/PodProxy/components/ProxyResponse/index.tsx +++ b/ui/src/pages/Tools/PodProxy/components/ProxyResponse/index.tsx @@ -1,14 +1,14 @@ -import React from 'react'; -import type { ProxyResultParams } from '@/services/podProxy'; -import ResponseType from '@/pages/Tools/PodProxy/components/ResponseType'; import ResponseInfo from '@/pages/Tools/PodProxy/components/ResponseInfo'; -import { Empty } from 'antd'; -import lodash from 'lodash'; +import ResponseType from '@/pages/Tools/PodProxy/components/ResponseType'; +import { useResponseType } from '@/pages/Tools/PodProxy/hooks/useResponseType'; import { StyledPodProxyEmptyResponse, StyledPodProxyResponse, } from '@/pages/Tools/PodProxy/styles/request.styled'; -import { useResponseType } from '@/pages/Tools/PodProxy/hooks/useResponseType'; +import type { ProxyResultParams } from '@/services/podProxy'; +import { Empty } from 'antd'; +import lodash from 'lodash'; +import React from 'react'; interface ProxyResponseProps { result?: ProxyResultParams; diff --git a/ui/src/pages/Tools/PodProxy/components/RequestType/index.tsx b/ui/src/pages/Tools/PodProxy/components/RequestType/index.tsx index 32f7498..66dddbb 100644 --- a/ui/src/pages/Tools/PodProxy/components/RequestType/index.tsx +++ b/ui/src/pages/Tools/PodProxy/components/RequestType/index.tsx @@ -1,6 +1,6 @@ -import React from 'react'; import styles from '@/pages/Tools/PodProxy/styles/response.less'; import classNames from 'classnames'; +import React from 'react'; export enum RequestTypes { // Params = 'Params', diff --git a/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseBody.tsx b/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseBody.tsx index 6130f7e..f874616 100644 --- a/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseBody.tsx +++ b/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseBody.tsx @@ -1,11 +1,11 @@ -import React, { useCallback, useMemo, useRef } from 'react'; -import styles from '@/pages/Tools/PodProxy/styles/response.less'; -import MonacoEditor from '@monaco-editor/react'; +import type { DefaultResponseInfoProps } from '@/pages/Tools/PodProxy/components/ResponseInfo/index'; import ResponseBodyOptions, { BodyRadios, } from '@/pages/Tools/PodProxy/components/ResponseInfo/ResponseBodyOptions'; import { useResponseBodyOptions } from '@/pages/Tools/PodProxy/hooks/useResponseBodyOptions'; -import type { DefaultResponseInfoProps } from '@/pages/Tools/PodProxy/components/ResponseInfo/index'; +import styles from '@/pages/Tools/PodProxy/styles/response.less'; +import MonacoEditor from '@monaco-editor/react'; +import React, { useCallback, useMemo, useRef } from 'react'; export type ResponseBodyProps = DefaultResponseInfoProps; diff --git a/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseBodyOptions.tsx b/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseBodyOptions.tsx index c17a723..f1a8692 100644 --- a/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseBodyOptions.tsx +++ b/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseBodyOptions.tsx @@ -1,11 +1,11 @@ +import { ReactComponent as TextNotWrapSVG } from '@/assets/icon/text-not-wrap.svg'; +import { ReactComponent as TextWrapSVG } from '@/assets/icon/text-wrap.svg'; +import { PrettyTypes, PrettyTypesMapping } from '@/enums/pretty'; +import styles from '@/pages/Tools/PodProxy/styles/response.less'; +import { CopyOutlined, FormatPainterOutlined, SearchOutlined } from '@ant-design/icons'; import type { RadioChangeEvent } from 'antd'; import { Button, Radio, Select } from 'antd'; import React, { useMemo } from 'react'; -import { CopyOutlined, FormatPainterOutlined, SearchOutlined } from '@ant-design/icons'; -import { ReactComponent as TextWrapSVG } from '@/assets/icon/text-wrap.svg'; -import { ReactComponent as TextNotWrapSVG } from '@/assets/icon/text-not-wrap.svg'; -import styles from '@/pages/Tools/PodProxy/styles/response.less'; -import { PrettyTypes, PrettyTypesMapping } from '@/enums/pretty'; export enum BodyRadios { pretty = 'pretty', diff --git a/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseCookiesProps.tsx b/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseCookiesProps.tsx index 0413529..c6c6354 100644 --- a/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseCookiesProps.tsx +++ b/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseCookiesProps.tsx @@ -1,7 +1,7 @@ +import type { DefaultResponseInfoProps } from '@/pages/Tools/PodProxy/components/ResponseInfo/index'; import { Table } from 'antd'; -import React from 'react'; import type { ColumnsType } from 'antd/es/table'; -import type { DefaultResponseInfoProps } from '@/pages/Tools/PodProxy/components/ResponseInfo/index'; +import React from 'react'; export type ResponseCookiesProps = DefaultResponseInfoProps; diff --git a/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseHeaders.tsx b/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseHeaders.tsx index b1c8c97..1c3d95a 100644 --- a/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseHeaders.tsx +++ b/ui/src/pages/Tools/PodProxy/components/ResponseInfo/ResponseHeaders.tsx @@ -1,7 +1,7 @@ +import type { DefaultResponseInfoProps } from '@/pages/Tools/PodProxy/components/ResponseInfo/index'; import { Table } from 'antd'; -import React, { useMemo } from 'react'; import type { ColumnsType } from 'antd/es/table'; -import type { DefaultResponseInfoProps } from '@/pages/Tools/PodProxy/components/ResponseInfo/index'; +import React, { useMemo } from 'react'; export type ResponseHeadersProps = DefaultResponseInfoProps; diff --git a/ui/src/pages/Tools/PodProxy/components/ResponseInfo/index.tsx b/ui/src/pages/Tools/PodProxy/components/ResponseInfo/index.tsx index 3ef4dc6..a17e80e 100644 --- a/ui/src/pages/Tools/PodProxy/components/ResponseInfo/index.tsx +++ b/ui/src/pages/Tools/PodProxy/components/ResponseInfo/index.tsx @@ -1,10 +1,9 @@ -import React from 'react'; -import { useMemo } from 'react'; -import type { ProxyResultParams } from '@/services/podProxy'; -import { ResponseTypes } from '@/pages/Tools/PodProxy/components/ResponseType'; import ResponseBody from '@/pages/Tools/PodProxy/components/ResponseInfo/ResponseBody'; import ResponseHeaders from '@/pages/Tools/PodProxy/components/ResponseInfo/ResponseHeaders'; +import { ResponseTypes } from '@/pages/Tools/PodProxy/components/ResponseType'; import { StyledResponseInfo } from '@/pages/Tools/PodProxy/styles/response.styled'; +import type { ProxyResultParams } from '@/services/podProxy'; +import React, { useMemo } from 'react'; export interface DefaultResponseInfoProps { value?: Pick; diff --git a/ui/src/pages/Tools/PodProxy/components/ResponseType/index.tsx b/ui/src/pages/Tools/PodProxy/components/ResponseType/index.tsx index 99f65fe..7f6721f 100644 --- a/ui/src/pages/Tools/PodProxy/components/ResponseType/index.tsx +++ b/ui/src/pages/Tools/PodProxy/components/ResponseType/index.tsx @@ -1,6 +1,6 @@ -import React, { useMemo } from 'react'; import styles from '@/pages/Tools/PodProxy/styles/response.less'; import classNames from 'classnames'; +import React, { useMemo } from 'react'; // import { Divider } from 'antd'; import type { ProxyResultParams } from '@/services/podProxy'; diff --git a/ui/src/pages/Tools/PodProxy/hooks/useFormOptions.ts b/ui/src/pages/Tools/PodProxy/hooks/useFormOptions.ts new file mode 100644 index 0000000..9cdacdb --- /dev/null +++ b/ui/src/pages/Tools/PodProxy/hooks/useFormOptions.ts @@ -0,0 +1,72 @@ +import { INIT_MONACO_WAIT } from '@/configs/default'; +import type { ProxyResultParams } from '@/services/podProxy'; +import { sendPodProxy } from '@/services/podProxy'; +import type { Pod } from '@/services/pods'; +import { AnchorScrollKey, documentScrollUtil } from '@/utils/documentScrollUtil'; +import { Form, message } from 'antd'; +import lodash from 'lodash'; +import { useCallback, useState } from 'react'; + +export const useFormOptions = ({ currentPod }: { currentPod: Pod }) => { + const [sendResult, setSendResult] = useState(); + const [loading, setLoading] = useState(false); + const [form] = Form.useForm(); + + const handleResetTab = useCallback(() => { + setSendResult(undefined); + form.resetFields(); + if (currentPod) { + form.setFieldsValue({ + clusterName: currentPod.cluster, + namespace: currentPod.namespace, + podName: currentPod.name, + }); + } + }, [currentPod, form]); + + const handleFinishForm = useCallback((fields: any) => { + const requestBody = lodash.pick(fields, ['info']).info; + const requestInfo = { + ...lodash.pick(fields, ['clusterName', 'namespace', 'podName', 'method']), + url: `${fields.urlBefore}${fields.url ?? ''}`, + }; + const headers = JSON.stringify( + requestBody?.headers + ?.filter((item: any) => item.key) + .reduce((pre: any, cur: any) => { + pre[cur.key] = cur?.value ?? ''; + return pre; + }, {}) ?? [], + ); + const payload = requestBody?.body ?? ''; + if (!requestInfo.url) { + message.warning({ content: '请填写相关的请求信息', key: 'request-warn' }); + return; + } + setLoading(true); + sendPodProxy({ ...requestInfo, headers, payload }) + .then((res) => { + if (res?.code !== 0) { + message.error({ + content: res?.msg ?? '接口出现未知错误,请重新尝试', + key: 'testApi-error', + }); + return; + } + setSendResult(res.data); + documentScrollUtil(AnchorScrollKey.Response); + }) + .catch((e) => { + message.error({ + content: `【未知错误】: ${JSON.stringify(e)}`, + key: 'testApi-request-error', + }); + console.error(e); + }) + .finally(() => { + setTimeout(() => setLoading(false), INIT_MONACO_WAIT); + }); + }, []); + + return { form, loading, sendResult, handleResetTab, handleFinishForm }; +}; diff --git a/ui/src/pages/Tools/PodProxy/hooks/useResponseBodyOptions.ts b/ui/src/pages/Tools/PodProxy/hooks/useResponseBodyOptions.ts index d05c157..0afbde9 100644 --- a/ui/src/pages/Tools/PodProxy/hooks/useResponseBodyOptions.ts +++ b/ui/src/pages/Tools/PodProxy/hooks/useResponseBodyOptions.ts @@ -1,13 +1,13 @@ -import type { RadioChangeEvent } from 'antd'; -import { message } from 'antd'; -import copy from 'copy-to-clipboard'; -import { useCallback, useState } from 'react'; +import { PrettyTypes } from '@/enums/pretty'; import type { WrapTypes } from '@/pages/Tools/PodProxy/components/ResponseInfo/ResponseBodyOptions'; import { BodyRadios, ContentTypes, } from '@/pages/Tools/PodProxy/components/ResponseInfo/ResponseBodyOptions'; -import { PrettyTypes } from '@/enums/pretty'; +import type { RadioChangeEvent } from 'antd'; +import { message } from 'antd'; +import copy from 'copy-to-clipboard'; +import { useCallback, useState } from 'react'; export interface ResponseBodyOptionProps { editor: any; diff --git a/ui/src/pages/Tools/PodProxy/hooks/useResponseType.ts b/ui/src/pages/Tools/PodProxy/hooks/useResponseType.ts index 7aecd42..13162cd 100644 --- a/ui/src/pages/Tools/PodProxy/hooks/useResponseType.ts +++ b/ui/src/pages/Tools/PodProxy/hooks/useResponseType.ts @@ -1,5 +1,5 @@ -import { useCallback, useState } from 'react'; import { ResponseTypes } from '@/pages/Tools/PodProxy/components/ResponseType'; +import { useCallback, useState } from 'react'; export const useResponseType = () => { const [selectResponseType, setSelectResponseType] = useState(ResponseTypes.Body); diff --git a/ui/src/pages/Tools/PodProxy/index.tsx b/ui/src/pages/Tools/PodProxy/index.tsx index 2fd84ad..c9883c2 100644 --- a/ui/src/pages/Tools/PodProxy/index.tsx +++ b/ui/src/pages/Tools/PodProxy/index.tsx @@ -1,15 +1,10 @@ -import type { Pod } from '@/services/pods'; -import React, { useCallback, useEffect, useState } from 'react'; -import type { ProxyResultParams } from '@/services/podProxy'; -import { sendPodProxy } from '@/services/podProxy'; -import { Form, message } from 'antd'; -import lodash from 'lodash'; import ContentCard from '@/components/ContentCard'; +import Loading from '@/components/Loading'; import ProxyRequest from '@/pages/Tools/PodProxy/components/ProxyRequest'; import ProxyResponse from '@/pages/Tools/PodProxy/components/ProxyResponse'; -import Loading from '@/components/Loading'; -import { INIT_MONACO_WAIT } from '@/configs/default'; -import { AnchorScrollKey, documentScrollUtil } from '@/utils/documentScrollUtil'; +import { useFormOptions } from '@/pages/Tools/PodProxy/hooks/useFormOptions'; +import type { Pod } from '@/services/pods'; +import React, { useEffect } from 'react'; export enum RequestProtocols { http = 'http://', @@ -19,66 +14,9 @@ interface PodProxyProps { currentPod: Pod; } const PodProxy: React.FC = ({ currentPod }) => { - const [sendResult, setSendResult] = useState(); - const [loading, setLoading] = useState(false); - const [form] = Form.useForm(); - - const handleResetTab = useCallback(() => { - setSendResult(undefined); - form.resetFields(); - if (currentPod) { - form.setFieldsValue({ - clusterName: currentPod.cluster, - namespace: currentPod.namespace, - podName: currentPod.name, - }); - } - }, [currentPod, form]); - - const handleFinishForm = useCallback((fields: any) => { - const requestBody = lodash.pick(fields, ['info']).info; - const requestInfo = { - ...lodash.pick(fields, ['clusterName', 'namespace', 'podName', 'method']), - url: `${fields.urlBefore}${fields.url ?? ''}`, - }; - const headers = JSON.stringify( - requestBody?.headers - ?.filter((item: any) => item.key) - .reduce((pre: any, cur: any) => { - pre[cur.key] = cur?.value ?? ''; - return pre; - }, {}) ?? [], - ); - const payload = requestBody?.body ?? ''; - if (!requestInfo.url) { - message.warning({ content: '请填写相关的请求信息', key: 'request-warn' }); - return; - } - - setLoading(true); - sendPodProxy({ ...requestInfo, headers, payload }) - .then((res) => { - if (res?.code !== 0) { - message.error({ - content: res?.msg ?? '接口出现未知错误,请重新尝试', - key: 'testApi-error', - }); - return; - } - setSendResult(res.data); - documentScrollUtil(AnchorScrollKey.Response); - }) - .catch((e) => { - message.error({ - content: `【未知错误】: ${JSON.stringify(e)}`, - key: 'testApi-request-error', - }); - console.error(e); - }) - .finally(() => { - setTimeout(() => setLoading(false), INIT_MONACO_WAIT); - }); - }, []); + const { form, loading, sendResult, handleResetTab, handleFinishForm } = useFormOptions({ + currentPod, + }); useEffect(() => { handleResetTab(); diff --git a/ui/src/pages/Tools/PodProxy/styles/request.styled.ts b/ui/src/pages/Tools/PodProxy/styles/request.styled.ts index 63586ad..569c65d 100644 --- a/ui/src/pages/Tools/PodProxy/styles/request.styled.ts +++ b/ui/src/pages/Tools/PodProxy/styles/request.styled.ts @@ -1,5 +1,5 @@ -import styled from 'styled-components'; import { Input } from 'antd'; +import styled from 'styled-components'; export const StyledPodProxyFormInput = styled.div` display: flex; diff --git a/ui/src/pages/Tools/Profiling/components/CreateProfile/index.tsx b/ui/src/pages/Tools/Profiling/components/CreateProfile/index.tsx index 9baa972..26b8f05 100644 --- a/ui/src/pages/Tools/Profiling/components/CreateProfile/index.tsx +++ b/ui/src/pages/Tools/Profiling/components/CreateProfile/index.tsx @@ -1,9 +1,9 @@ -import React, { useMemo } from 'react'; -import { Button, Col, Form, Input, InputNumber, Radio, Row, Space } from 'antd'; +import { StyledProfileCreatedMode } from '@/pages/Tools/Profiling/styles/index.styled'; import type { CreateProfileParams } from '@/services/profiling'; import { ModeMapping, Modes } from '@/services/profiling'; import { PlusOutlined } from '@ant-design/icons'; -import { StyledProfileCreatedMode } from '@/pages/Tools/Profiling/styles/index.styled'; +import { Button, Col, Form, Input, InputNumber, Radio, Row, Space } from 'antd'; +import React, { useMemo } from 'react'; interface CreateProfileProps { spinning: boolean; diff --git a/ui/src/pages/Tools/Profiling/components/ProfileHistoryList/DiffProfileModal.tsx b/ui/src/pages/Tools/Profiling/components/ProfileHistoryList/DiffProfileModal.tsx index d8b08fc..4707805 100644 --- a/ui/src/pages/Tools/Profiling/components/ProfileHistoryList/DiffProfileModal.tsx +++ b/ui/src/pages/Tools/Profiling/components/ProfileHistoryList/DiffProfileModal.tsx @@ -1,8 +1,8 @@ -import React, { useCallback, useEffect, useRef } from 'react'; +import type { Profile } from '@/services/profiling'; import { Form, Input, Modal, Select } from 'antd'; import type { FormInstance } from 'antd/es/form/Form'; -import type { Profile } from '@/services/profiling'; import type { DefaultOptionType } from 'rc-select/lib/Select'; +import React, { useCallback, useEffect, useRef } from 'react'; interface DiffProfileModalProps { open: boolean; diff --git a/ui/src/pages/Tools/Profiling/components/ProfileHistoryList/ProfileHistoryOption.tsx b/ui/src/pages/Tools/Profiling/components/ProfileHistoryList/ProfileHistoryOption.tsx index 9f47e6b..e94b479 100644 --- a/ui/src/pages/Tools/Profiling/components/ProfileHistoryList/ProfileHistoryOption.tsx +++ b/ui/src/pages/Tools/Profiling/components/ProfileHistoryList/ProfileHistoryOption.tsx @@ -1,11 +1,11 @@ -import React, { useCallback } from 'react'; -import { Button, Divider, Space, Tooltip } from 'antd'; -import { CloudDownloadOutlined, DiffOutlined, FileSearchOutlined } from '@ant-design/icons'; +import { getDownloadProfilePath } from '@/pages/Tools/Profiling/utils/downloadProfileUtil'; import type { Profile } from '@/services/profiling'; -import lodash from 'lodash'; import { AnchorScrollKey, documentScrollUtil } from '@/utils/documentScrollUtil'; -import { getDownloadProfilePath } from '@/pages/Tools/Profiling/utils/downloadProfileUtile'; +import { CloudDownloadOutlined, DiffOutlined, FileSearchOutlined } from '@ant-design/icons'; import { useModel } from '@umijs/max'; +import { Button, Divider, Space, Tooltip } from 'antd'; +import lodash from 'lodash'; +import React, { useCallback } from 'react'; interface ProfileHistoryOptionProps { profile: Profile; diff --git a/ui/src/pages/Tools/Profiling/components/ProfileHistoryList/index.tsx b/ui/src/pages/Tools/Profiling/components/ProfileHistoryList/index.tsx index 9433105..ef9a6a8 100644 --- a/ui/src/pages/Tools/Profiling/components/ProfileHistoryList/index.tsx +++ b/ui/src/pages/Tools/Profiling/components/ProfileHistoryList/index.tsx @@ -1,11 +1,11 @@ +import ProfileHistoryOption from '@/pages/Tools/Profiling/components/ProfileHistoryList/ProfileHistoryOption'; +import { StyledOptions } from '@/pages/Tools/Profiling/styles/history.styled'; import type { Profile } from '@/services/profiling'; -import React, { useMemo } from 'react'; -import { Button, Table } from 'antd'; +import { unixTimeFormat } from '@/utils/timeUtils'; import { PlusOutlined } from '@ant-design/icons'; +import { Button, Table } from 'antd'; import type { ColumnsType } from 'antd/es/table'; -import { unixTimeFormat } from '@/utils/timeUtils'; -import { StyledOptions } from '@/pages/Tools/Profiling/styles/history.styled'; -import ProfileHistoryOption from '@/pages/Tools/Profiling/components/ProfileHistoryList/ProfileHistoryOption'; +import React, { useMemo } from 'react'; interface ProfileHistoryListProps { dataList: Profile[]; diff --git a/ui/src/pages/Tools/Profiling/components/ProfileViewSvg/index.tsx b/ui/src/pages/Tools/Profiling/components/ProfileViewSvg/index.tsx index baa566f..47010f3 100644 --- a/ui/src/pages/Tools/Profiling/components/ProfileViewSvg/index.tsx +++ b/ui/src/pages/Tools/Profiling/components/ProfileViewSvg/index.tsx @@ -1,4 +1,11 @@ -import { Button, message, Radio, Space, Tabs } from 'antd'; +import Loading from '@/components/Loading'; +import { DEFAULT_WAIT } from '@/configs/default'; +import { + StyledIframe, + StyledProfileViewSvg, + StyledTools, +} from '@/pages/Tools/Profiling/styles/profileView.styled'; +import { getDownloadProfilePath } from '@/pages/Tools/Profiling/utils/downloadProfileUtil'; import { GET_PROFILE_DIFF_SVG_URL, GET_PROFILE_SVG_URL, @@ -8,19 +15,12 @@ import { SvgTypeMapping, SvgTypes, } from '@/services/profiling'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import { RequestBaseUrl } from '@/utils/electronRenderUtil'; import { FullscreenExitOutlined, FullscreenOutlined, LinkOutlined } from '@ant-design/icons'; -import { - StyledIframe, - StyledProfileViewSvg, - StyledTools, -} from '@/pages/Tools/Profiling/styles/profileView.styled'; -import { getDownloadProfilePath } from '@/pages/Tools/Profiling/utils/downloadProfileUtile'; -import { useThrottleFn } from 'ahooks'; -import { DEFAULT_WAIT } from '@/configs/default'; -import Loading from '@/components/Loading'; import { useModel } from '@umijs/max'; -import { RequestBaseUrl } from '@/utils/electronRenderUtil'; +import { useThrottleFn } from 'ahooks'; +import { Button, message, Radio, Space, Tabs } from 'antd'; +import React, { useCallback, useEffect, useMemo, useState } from 'react'; export interface ProfileViewProps { url?: string; @@ -43,11 +43,11 @@ const ProfileViewSvg: React.FC = ({ const { initialState } = useModel('@@initialState') || {}; const isElectron = initialState?.isElectron ?? false; - const handleChangeSvgType = useCallback((e) => { + const handleChangeSvgType = useCallback((e: any) => { setSvgType(e.target.value); }, []); - const handleChangeGoType = useCallback((type) => { + const handleChangeGoType = useCallback((type: any) => { setGoType(type); }, []); @@ -107,7 +107,7 @@ const ProfileViewSvg: React.FC = ({ }, [baseUrl, targetUrl]); const handleKeyDown = useCallback( - (e) => { + (e: any) => { // esc 键 if (isFull && e.keyCode === 27) { setIsFull(false); diff --git a/ui/src/pages/Tools/Profiling/hooks/useCheckProfilingDependencies.ts b/ui/src/pages/Tools/Profiling/hooks/useCheckProfilingDependencies.ts new file mode 100644 index 0000000..2a5219d --- /dev/null +++ b/ui/src/pages/Tools/Profiling/hooks/useCheckProfilingDependencies.ts @@ -0,0 +1,52 @@ +import { getErrorMsg } from '@/pages/Tools/Profiling/utils/dependencyErrorsUtil'; +import { checkProfilingDependencies } from '@/services/profiling'; +import { useModel } from '@@/plugin-model'; +import type { ReactNode } from 'react'; +import { useCallback, useEffect, useState } from 'react'; + +export const useCheckProfilingDependencies = () => { + const { initialState } = useModel('@@initialState') || {}; + const isElectron = initialState?.isElectron ?? false; + const [isShowDependencyErrors, setIsShowDependencyErrors] = useState(false); + const [isCheckLoading, setIsCheckLoading] = useState(false); + const [errorMessage, setErrorMessage] = useState(); + + const handleCheckProfilingDependencies = useCallback(() => { + if (!isElectron) { + setIsShowDependencyErrors(false); + return; + } + setIsCheckLoading(true); + checkProfilingDependencies() + .then((res) => { + if (!isElectron) return; + if (res?.code === 0 && !!res?.data?.success) { + setIsShowDependencyErrors(false); + return; + } + if (res?.code !== 0) { + setErrorMessage(`[Error]: ${res.msg}`); + } else { + setErrorMessage(getErrorMsg(res?.data?.dependencyErrors || [])); + } + setIsShowDependencyErrors(true); + }) + .catch((e) => { + console.error(e); + setIsShowDependencyErrors(true); + setErrorMessage(`[Error]: ${e.toString()}`); + }) + .finally(() => setIsCheckLoading(false)); + }, [isElectron]); + + useEffect(() => { + handleCheckProfilingDependencies(); + return () => { + setErrorMessage(undefined); + setIsCheckLoading(false); + setIsShowDependencyErrors(false); + }; + }, [handleCheckProfilingDependencies]); + + return { errorMessage, isCheckLoading, isShowDependencyErrors, handleCheckProfilingDependencies }; +}; diff --git a/ui/src/pages/Tools/Profiling/hooks/useDiffProfile.ts b/ui/src/pages/Tools/Profiling/hooks/useDiffProfile.ts index e68c5ea..2093431 100644 --- a/ui/src/pages/Tools/Profiling/hooks/useDiffProfile.ts +++ b/ui/src/pages/Tools/Profiling/hooks/useDiffProfile.ts @@ -1,7 +1,7 @@ -import { useCallback, useEffect, useMemo, useState } from 'react'; import type { Profile } from '@/services/profiling'; -import { unixTimeFormat } from '@/utils/timeUtils'; import { AnchorScrollKey, documentScrollUtil } from '@/utils/documentScrollUtil'; +import { unixTimeFormat } from '@/utils/timeUtils'; +import { useCallback, useEffect, useMemo, useState } from 'react'; export const useDiffProfile = ({ showHistory, @@ -54,10 +54,12 @@ export const useDiffProfile = ({ }, [currentBaseUrl?.ctime, profileHistoryList]); useEffect(() => { - setOpenDiffModal(false); - setBaseUrl(undefined); - setTargetUrl(undefined); - setCurrentBaseUrl(undefined); + return () => { + setOpenDiffModal(false); + setBaseUrl(undefined); + setTargetUrl(undefined); + setCurrentBaseUrl(undefined); + }; }, [showHistory]); return { diff --git a/ui/src/pages/Tools/Profiling/hooks/useProfile.ts b/ui/src/pages/Tools/Profiling/hooks/useProfile.ts index ca0f410..9691d90 100644 --- a/ui/src/pages/Tools/Profiling/hooks/useProfile.ts +++ b/ui/src/pages/Tools/Profiling/hooks/useProfile.ts @@ -1,15 +1,10 @@ -import { useCallback, useState } from 'react'; +import type { Pod } from '@/services/pods'; import type { CreateProfileParams, Profile } from '@/services/profiling'; import { createdProfile, getProfiles, Modes } from '@/services/profiling'; +import { AnchorScrollKey, documentScrollUtil } from '@/utils/documentScrollUtil'; import { message } from 'antd'; -import type { Pod } from '@/services/pods'; import lodash from 'lodash'; -import { AnchorScrollKey, documentScrollUtil } from '@/utils/documentScrollUtil'; - -export enum ProfileOptions { - create = 'create', - history = 'history', -} +import { useCallback, useState } from 'react'; export const useProfile = ({ currentPod }: { currentPod: Pod }) => { const [profile, setProfile] = useState<{ url: string } | undefined>(); diff --git a/ui/src/pages/Tools/Profiling/index.tsx b/ui/src/pages/Tools/Profiling/index.tsx index 8fe105e..0224667 100644 --- a/ui/src/pages/Tools/Profiling/index.tsx +++ b/ui/src/pages/Tools/Profiling/index.tsx @@ -1,19 +1,24 @@ -import type { Pod } from '@/services/pods'; -import React, { useMemo } from 'react'; -import CreateProfile from '@/pages/Tools/Profiling/components/CreateProfile'; import ContentCard from '@/components/ContentCard'; -import { useProfile } from '@/pages/Tools/Profiling/hooks/useProfile'; -import { Empty, Spin } from 'antd'; -import ProfileViewSvg from '@/pages/Tools/Profiling/components/ProfileViewSvg'; -import { StyledEmptyOrSpin } from '@/pages/Tools/Profiling/styles/index.styled'; +import CreateProfile from '@/pages/Tools/Profiling/components/CreateProfile'; import ProfileHistoryList from '@/pages/Tools/Profiling/components/ProfileHistoryList'; import DiffProfileModal from '@/pages/Tools/Profiling/components/ProfileHistoryList/DiffProfileModal'; +import ProfileViewSvg from '@/pages/Tools/Profiling/components/ProfileViewSvg'; +import { useCheckProfilingDependencies } from '@/pages/Tools/Profiling/hooks/useCheckProfilingDependencies'; import { useDiffProfile } from '@/pages/Tools/Profiling/hooks/useDiffProfile'; +import { useProfile } from '@/pages/Tools/Profiling/hooks/useProfile'; +import { + StyledEmptyOrSpin, + StyledErrorDependency, +} from '@/pages/Tools/Profiling/styles/index.styled'; +import type { Pod } from '@/services/pods'; +import { Empty, Spin } from 'antd'; +import React, { useMemo } from 'react'; interface ProfilingProps { currentPod: Pod; } const Profiling: React.FC = ({ currentPod }) => { + const { errorMessage, isCheckLoading, isShowDependencyErrors } = useCheckProfilingDependencies(); const { profile, spinningProfile, @@ -52,44 +57,77 @@ const Profiling: React.FC = ({ currentPod }) => { return ; }, [baseUrl, showDiff, profile, targetUrl]); - return ( - <> - {showHistory ? ( - - - - - ) : ( - - + const pageContent = useMemo(() => { + if (isShowDependencyErrors) { + return ( + + {errorMessage} - )} - - {spinningProfile ? ( - - - + ); + } + return ( + <> + {showHistory ? ( + + + + ) : ( - ProfileViewContent + + + )} - - + + {spinningProfile ? ( + + + + ) : ( + ProfileViewContent + )} + + + ); + }, [ + ProfileViewContent, + currentBaseUrl, + errorMessage, + handleClickChangeProfile, + handleClickDiffProfile, + handleClickJumpCreate, + handleClickJumpHistory, + handleCloseDiffModal, + handleHiddenDiff, + handleShowDiff, + handleSubmitForm, + isShowDependencyErrors, + openDiffModal, + otherProfileOptions, + profileHistoryList, + showHistory, + spinningProfile, + ]); + + return ( + + {pageContent} + ); }; export default Profiling; diff --git a/ui/src/pages/Tools/Profiling/styles/index.styled.ts b/ui/src/pages/Tools/Profiling/styles/index.styled.ts index 1cf2472..ddc8b18 100644 --- a/ui/src/pages/Tools/Profiling/styles/index.styled.ts +++ b/ui/src/pages/Tools/Profiling/styles/index.styled.ts @@ -12,3 +12,21 @@ export const StyledEmptyOrSpin = styled.div` align-items: center; justify-content: center; `; + +export const StyledErrorDependency = styled.div` + width: 100%; + height: 100%; + padding-top: 10px; + overflow-y: auto; + overflow-x: hidden; + word-wrap: break-word; + ul, + ol { + margin: 0; + padding-left: 20px; + list-style: decimal; + strong { + color: crimson; + } + } +`; diff --git a/ui/src/pages/Tools/Profiling/utils/dependencyErrorsUtil.tsx b/ui/src/pages/Tools/Profiling/utils/dependencyErrorsUtil.tsx new file mode 100644 index 0000000..a49d9dd --- /dev/null +++ b/ui/src/pages/Tools/Profiling/utils/dependencyErrorsUtil.tsx @@ -0,0 +1,22 @@ +import type { DependencyError } from '@/services/dependency'; + +export function getErrorMsg(errors: DependencyError[]) { + return ( + + [Error]: 依赖检测未通过,详情如下 +
    + {errors.map((error) => { + return ( +
  1. + 依赖缺失:{error.dependency},请参考 + window.electron?.openInBrowser?.(error?.refer)}> +  {error.refer}  + + 解决 +
  2. + ); + })} +
+
+ ); +} diff --git a/ui/src/pages/Tools/Profiling/utils/downloadProfileUtile.ts b/ui/src/pages/Tools/Profiling/utils/downloadProfileUtil.ts similarity index 100% rename from ui/src/pages/Tools/Profiling/utils/downloadProfileUtile.ts rename to ui/src/pages/Tools/Profiling/utils/downloadProfileUtil.ts diff --git a/ui/src/pages/Tools/Tcpdump/components/TcpdumpCard/index.tsx b/ui/src/pages/Tools/Tcpdump/components/TcpdumpCard/index.tsx index 451e1c5..b94115e 100644 --- a/ui/src/pages/Tools/Tcpdump/components/TcpdumpCard/index.tsx +++ b/ui/src/pages/Tools/Tcpdump/components/TcpdumpCard/index.tsx @@ -1,12 +1,12 @@ -import React, { useMemo } from 'react'; -import { TcpdumpMode } from '@/services/tcpdump'; -import { Empty } from 'antd'; -import MonacoEditor from '@monaco-editor/react'; +import Loading from '@/components/Loading'; import { StyledTcpdumpContentEmpty, StyledTcpdumpTerminal, } from '@/pages/Tools/Tcpdump/styles/index.styled'; -import Loading from '@/components/Loading'; +import { TcpdumpMode } from '@/services/tcpdump'; +import MonacoEditor from '@monaco-editor/react'; +import { Empty } from 'antd'; +import React, { useMemo } from 'react'; interface TcpdumpCardProps { tcpdumpMode?: TcpdumpMode; diff --git a/ui/src/pages/Tools/Tcpdump/components/TcpdumpConfigCard/index.tsx b/ui/src/pages/Tools/Tcpdump/components/TcpdumpConfigCard/index.tsx index 2874b51..260c447 100644 --- a/ui/src/pages/Tools/Tcpdump/components/TcpdumpConfigCard/index.tsx +++ b/ui/src/pages/Tools/Tcpdump/components/TcpdumpConfigCard/index.tsx @@ -1,16 +1,18 @@ -import type { RefObject } from 'react'; -import React from 'react'; -import { StyledConfigBody } from '@/pages/Tools/Tcpdump/styles/config.styled'; import TcpdumpForm from '@/pages/Tools/Tcpdump/components/TcpdumpForm'; +import { StyledConfigBody } from '@/pages/Tools/Tcpdump/styles/config.styled'; import type { StartTcpdumpWsUrlParams, TcpdumpMode } from '@/services/tcpdump'; import type { FormInstance } from 'antd'; import type { DefaultOptionType } from 'rc-select/lib/Select'; +import type { ReactNode, RefObject } from 'react'; +import React from 'react'; interface TcpdumpConfigCardProps { tcpdumpMode?: TcpdumpMode; containers: DefaultOptionType[]; isStartTcpdump: boolean; tcpdumpDownloadKey: string; + isElectron: boolean; + caughtModes: ReactNode[]; form: RefObject< FormInstance< Pick @@ -25,18 +27,22 @@ const TcpdumpConfigCard: React.FC = ({ tcpdumpMode, isStartTcpdump, form, + isElectron, tcpdumpDownloadKey, handleStartTcpdump, handleStopTcpdump, containers, + caughtModes, }) => { return ( @@ -35,15 +36,13 @@ const TcpdumpForm: React.FC = ({ form, isStartTcpdump, tcpdumpMode, + isElectron, tcpdumpDownloadKey, handleStopTcpdump, handleStartTcpdump, + caughtModes, containers, }) => { - const { initialState } = useModel('@@initialState'); - - const isElectron = initialState?.isElectron; - const handleClickDownload = useCallback(() => { const downloadPath = `${RequestBaseUrl}${DOWNLOAD_CAUGHT_PATH}${tcpdumpDownloadKey}`; if (isElectron) { @@ -53,6 +52,11 @@ const TcpdumpForm: React.FC = ({ window.open(downloadPath, '_blank'); }, [isElectron, tcpdumpDownloadKey]); + const handleGetPopupContainer = useCallback( + () => document.getElementById('tcpdumpForm') || document.body, + [], + ); + useEffect(() => { // 默认设置第一个 container if (form.current && containers.length >= MIN_CONTAINERS_LEN) { @@ -62,13 +66,19 @@ const TcpdumpForm: React.FC = ({ return (
- + - = ({ label="抓包模式" rules={[{ required: true, message: '请选择需要的抓包模式' }]} > - - {Object.keys(TcpdumpMode) - .filter((key) => { - if (TcpdumpMode.wireshark !== TcpdumpMode[key]) { - return TcpdumpMode[key]; - } - if (isElectron && TcpdumpMode.wireshark === TcpdumpMode[key]) { - return TcpdumpMode.wireshark; - } - }) - .map((mode) => ( - - {CaughtModeMapping[mode]} - - ))} - + {caughtModes} diff --git a/ui/src/pages/Tools/Tcpdump/hooks/useCheckWireshark.tsx b/ui/src/pages/Tools/Tcpdump/hooks/useCheckWireshark.tsx new file mode 100644 index 0000000..0e95311 --- /dev/null +++ b/ui/src/pages/Tools/Tcpdump/hooks/useCheckWireshark.tsx @@ -0,0 +1,89 @@ +import type { DependencyError } from '@/services/dependency'; +import { CaughtModeMapping, checkTcpdumpWireshark, TcpdumpMode } from '@/services/tcpdump'; +import { useModel } from '@@/plugin-model'; +import { ExclamationCircleOutlined, LoadingOutlined } from '@ant-design/icons'; +import { Radio, Tooltip } from 'antd'; +import { useCallback, useEffect, useMemo, useState } from 'react'; + +const DEFAULT_ICON_STYLES = { + marginLeft: '4px', +}; + +export const useCheckWireshark = () => { + const { initialState } = useModel('@@initialState'); + const isElectron = initialState?.isElectron || false; + const [isDisableWireshark, setIsDisableWireshark] = useState(true); + const [isCheckWiresharkLoading, setIsCheckWiresharkLoading] = useState(true); + const [wiresharkError, setWiresharkError] = useState(); + + const wiresharkIcon = useMemo(() => { + if (isElectron && isCheckWiresharkLoading && isDisableWireshark) { + return ; + } + if (isElectron && !isCheckWiresharkLoading && isDisableWireshark && wiresharkError) { + return ( + + 依赖缺失:{wiresharkError?.dependency},请参考 + window.electron?.openInBrowser?.(wiresharkError?.refer)}> +  {wiresharkError?.refer}  + + 解决 + + } + > + + + ); + } + return null; + }, [isCheckWiresharkLoading, isDisableWireshark, isElectron, wiresharkError]); + + const caughtModes = useMemo(() => { + return Object.keys(TcpdumpMode) + .filter((key) => { + if (TcpdumpMode.wireshark !== TcpdumpMode[key]) { + return TcpdumpMode[key]; + } + if (isElectron && TcpdumpMode.wireshark === TcpdumpMode[key]) { + return TcpdumpMode.wireshark; + } + }) + .map((mode) => ( + + {CaughtModeMapping[mode]} + {TcpdumpMode.wireshark === mode && wiresharkIcon} + + )); + }, [isDisableWireshark, isElectron, wiresharkIcon]); + + const handleCheckTcpdumpWireshark = useCallback(() => { + checkTcpdumpWireshark() + .then((res) => { + if (res?.code === 0 && !res?.data.success) { + setWiresharkError(res.data.dependencyErrors?.[0]); + } + if (res?.code === 0 && !!res?.data.success) { + setIsDisableWireshark(false); + } + }) + .catch(console.error) + .finally(() => setIsCheckWiresharkLoading(false)); + }, []); + + useEffect(() => { + handleCheckTcpdumpWireshark(); + return () => { + setIsDisableWireshark(true); + setIsCheckWiresharkLoading(false); + setWiresharkError(undefined); + }; + }, [handleCheckTcpdumpWireshark]); + + return { isElectron, caughtModes }; +}; diff --git a/ui/src/pages/Tools/Tcpdump/hooks/useSocketTcpdump.ts b/ui/src/pages/Tools/Tcpdump/hooks/useSocketTcpdump.ts index 15f2d22..c93b462 100644 --- a/ui/src/pages/Tools/Tcpdump/hooks/useSocketTcpdump.ts +++ b/ui/src/pages/Tools/Tcpdump/hooks/useSocketTcpdump.ts @@ -1,7 +1,7 @@ -import { message } from 'antd'; -import { useCallback, useRef } from 'react'; import type { StartTcpdumpWsUrlParams } from '@/services/tcpdump'; import { getStartTcpdumpWsUrl } from '@/services/tcpdump'; +import { message } from 'antd'; +import { useCallback, useRef } from 'react'; export enum socketMessages { done = 'done', diff --git a/ui/src/pages/Tools/Tcpdump/hooks/useTcpdump.ts b/ui/src/pages/Tools/Tcpdump/hooks/useTcpdump.ts index 8a5f23e..ff2b3b8 100644 --- a/ui/src/pages/Tools/Tcpdump/hooks/useTcpdump.ts +++ b/ui/src/pages/Tools/Tcpdump/hooks/useTcpdump.ts @@ -1,12 +1,12 @@ -import { TcpdumpMode } from '@/services/tcpdump'; -import type { StartTcpdumpWsUrlParams } from '@/services/tcpdump'; -import { useCallback, useEffect, useRef, useState } from 'react'; +import { INIT_MONACO_WAIT } from '@/configs/default'; +import { useSocketTcpdump } from '@/pages/Tools/Tcpdump/hooks/useSocketTcpdump'; import type { OptionsPodInfo } from '@/services/pods'; +import type { StartTcpdumpWsUrlParams } from '@/services/tcpdump'; +import { TcpdumpMode } from '@/services/tcpdump'; +import { AnchorScrollKey, documentScrollUtil } from '@/utils/documentScrollUtil'; import type { FormInstance } from 'antd'; import { message } from 'antd'; -import { useSocketTcpdump } from '@/pages/Tools/Tcpdump/hooks/useSocketTcpdump'; -import { INIT_MONACO_WAIT } from '@/configs/default'; -import { AnchorScrollKey, documentScrollUtil } from '@/utils/documentScrollUtil'; +import { useCallback, useEffect, useRef, useState } from 'react'; export const useTcpdump = ({ currentPod, diff --git a/ui/src/pages/Tools/Tcpdump/index.tsx b/ui/src/pages/Tools/Tcpdump/index.tsx index 7dc2a97..04a4870 100644 --- a/ui/src/pages/Tools/Tcpdump/index.tsx +++ b/ui/src/pages/Tools/Tcpdump/index.tsx @@ -1,11 +1,12 @@ -import React from 'react'; -import type { Pod } from '@/services/pods'; +import ContentCard from '@/components/ContentCard'; +import { useContainer } from '@/hooks/useContainer'; import TcpdumpCard from '@/pages/Tools/Tcpdump/components/TcpdumpCard'; import TcpdumpConfigCard from '@/pages/Tools/Tcpdump/components/TcpdumpConfigCard'; +import { useCheckWireshark } from '@/pages/Tools/Tcpdump/hooks/useCheckWireshark'; import { useTcpdump } from '@/pages/Tools/Tcpdump/hooks/useTcpdump'; -import { useContainer } from '@/hooks/useContainer'; -import ContentCard from '@/components/ContentCard'; +import type { Pod } from '@/services/pods'; import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; +import React from 'react'; interface TcpdumpProps { currentPod: Pod; @@ -24,6 +25,9 @@ const Tcpdump: React.FC = ({ currentPod }) => { handleStartTcpdump, handleStopTcpdump, } = useTcpdump({ currentPod: podInfo }); + + const { isElectron, caughtModes } = useCheckWireshark(); + return ( <> @@ -32,6 +36,8 @@ const Tcpdump: React.FC = ({ currentPod }) => { isStartTcpdump={isStartTcpdump} tcpdumpMode={tcpdumpMode} form={tcpdumpFormRef} + isElectron={isElectron} + caughtModes={caughtModes} tcpdumpDownloadKey={tcpdumpDownloadKey} handleStartTcpdump={handleStartTcpdump} handleStopTcpdump={handleStopTcpdump} diff --git a/ui/src/pages/Tools/Tcpdump/styles/index.styled.ts b/ui/src/pages/Tools/Tcpdump/styles/index.styled.ts index 45d447b..9659d92 100644 --- a/ui/src/pages/Tools/Tcpdump/styles/index.styled.ts +++ b/ui/src/pages/Tools/Tcpdump/styles/index.styled.ts @@ -1,5 +1,5 @@ -import styled from 'styled-components'; import { Empty } from 'antd'; +import styled from 'styled-components'; export const StyledTcpdumpContentEmpty = styled(Empty)` width: 100%; diff --git a/ui/src/pages/Tools/Terminal/components/Term/index.tsx b/ui/src/pages/Tools/Terminal/components/Term/index.tsx index 21169f6..6e2182c 100644 --- a/ui/src/pages/Tools/Terminal/components/Term/index.tsx +++ b/ui/src/pages/Tools/Terminal/components/Term/index.tsx @@ -1,15 +1,15 @@ -import React, { useEffect, useRef } from 'react'; +import { useTerminal } from '@/hooks/useTerminal'; import { StyledFullscreenButton, StyledTerm, StyledTerminal, } from '@/pages/Tools/Terminal/styles/term.styled'; -import 'xterm/css/xterm.css'; import type { OptionsPodInfo } from '@/services/pods'; import { TERMINAL_API } from '@/services/pods'; -import { useTerminal } from '@/hooks/useTerminal'; -import { useFullscreen } from 'ahooks'; import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons'; +import { useFullscreen } from 'ahooks'; +import React, { useEffect, useRef } from 'react'; +import 'xterm/css/xterm.css'; export interface TermProps { pod: Required; diff --git a/ui/src/pages/Tools/Terminal/index.tsx b/ui/src/pages/Tools/Terminal/index.tsx index 8682287..699b16c 100644 --- a/ui/src/pages/Tools/Terminal/index.tsx +++ b/ui/src/pages/Tools/Terminal/index.tsx @@ -1,15 +1,15 @@ -import React from 'react'; -import type { Pod } from '@/services/pods'; +import ContainerSelectCard from '@/components/ContainerSelectCard'; +import ContentCard from '@/components/ContentCard'; import { useContainer } from '@/hooks/useContainer'; +import Term from '@/pages/Tools/Terminal/components/Term'; import { StyledTerminalCardBody, StyledTerminalCardBodyEmpty, } from '@/pages/Tools/Terminal/styles/body.styled'; -import { Empty } from 'antd'; -import Term from '@/pages/Tools/Terminal/components/Term'; -import ContentCard from '@/components/ContentCard'; +import type { Pod } from '@/services/pods'; import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; -import ContainerSelectCard from '@/components/ContainerSelectCard'; +import { Empty } from 'antd'; +import React from 'react'; interface TerminalToolProps { currentPod: Pod; diff --git a/ui/src/pages/Tools/Terminal/styles/term.styled.ts b/ui/src/pages/Tools/Terminal/styles/term.styled.ts index 902917b..d709546 100644 --- a/ui/src/pages/Tools/Terminal/styles/term.styled.ts +++ b/ui/src/pages/Tools/Terminal/styles/term.styled.ts @@ -1,5 +1,5 @@ -import styled from 'styled-components'; import { Button } from 'antd'; +import styled from 'styled-components'; export const StyledTerm = styled.div<{ isFullscreen: boolean }>` box-sizing: border-box; diff --git a/ui/src/pages/Tools/index.tsx b/ui/src/pages/Tools/index.tsx index e8d3990..e0c8f2f 100644 --- a/ui/src/pages/Tools/index.tsx +++ b/ui/src/pages/Tools/index.tsx @@ -1,22 +1,22 @@ -import { useModel } from '@umijs/max'; import PodSelectCard, { HIDE_POD_OR_CONFIGMAP_SELECT_ARR, SHOW_CONFIGMAP_PATHNAME_ARR, } from '@/components/PodSelectCard'; -import React, { useEffect, useMemo } from 'react'; -import { ToolPathNames, ToolsMapArr } from '@/pages/ToolsMap/configs/configs'; -import TerminalTool from '@/pages/Tools/Terminal'; -import Tcpdump from '@/pages/Tools/Tcpdump'; -import { k8zStorageKeys, localStorageManage, removeLocalStorageManage } from '@/utils/storageUtil'; -import { useTools } from '@/hooks/useTools'; import ToolCardEmpty from '@/components/ToolCardEmpty'; +import { useTools } from '@/hooks/useTools'; +import ConfigMap from '@/pages/Tools/ConfigMap'; +import Debug from '@/pages/Tools/Debug'; +import Files from '@/pages/Tools/Files'; +import Nodes from '@/pages/Tools/Nodes'; import PodProxy from '@/pages/Tools/PodProxy'; import Profiling from '@/pages/Tools/Profiling'; -import Files from '@/pages/Tools/Files'; -import Debug from '@/pages/Tools/Debug'; -import ConfigMap from '@/pages/Tools/ConfigMap'; +import Tcpdump from '@/pages/Tools/Tcpdump'; +import TerminalTool from '@/pages/Tools/Terminal'; +import { ToolPathNames, ToolsMapArr } from '@/pages/ToolsMap/configs/configs'; +import { k8zStorageKeys, localStorageManage, removeLocalStorageManage } from '@/utils/storageUtil'; +import { useModel } from '@umijs/max'; +import React, { useEffect, useMemo } from 'react'; import { useLocation } from 'umi'; -import Nodes from '@/pages/Tools/Nodes'; const Tools: React.FC = () => { const currentLocation = useLocation(); diff --git a/ui/src/pages/ToolsMap/components/ToolItem/ToolItem.tsx b/ui/src/pages/ToolsMap/components/ToolItem/ToolItem.tsx index 50a0691..787711e 100644 --- a/ui/src/pages/ToolsMap/components/ToolItem/ToolItem.tsx +++ b/ui/src/pages/ToolsMap/components/ToolItem/ToolItem.tsx @@ -1,13 +1,11 @@ -import React from 'react'; -import type { Tool } from '@/pages/ToolsMap/configs/configs'; +import type { Tool, ToolNames } from '@/pages/ToolsMap/configs/configs'; import { StyledToolItem, StyledToolItemImg, StyledToolItemTitle, StyledToolItemTitleContext, } from '@/pages/ToolsMap/styles/item.styled'; -import { useCallback } from 'react'; -import type { ToolNames } from '@/pages/ToolsMap/configs/configs'; +import React, { useCallback } from 'react'; export interface ToolItemProps { tool: Tool; diff --git a/ui/src/pages/ToolsMap/configs/configs.ts b/ui/src/pages/ToolsMap/configs/configs.ts index b5b06b5..e83031f 100644 --- a/ui/src/pages/ToolsMap/configs/configs.ts +++ b/ui/src/pages/ToolsMap/configs/configs.ts @@ -1,10 +1,10 @@ -import TerminalImg from '@/assets/toolsIcon/terminal.png'; -import TcpdumpImg from '@/assets/toolsIcon/tcpdump.png'; +import ConfigMapImg from '@/assets/toolsIcon/config.png'; +import DebugImg from '@/assets/toolsIcon/debug.png'; import FilesImg from '@/assets/toolsIcon/files.png'; -import ProfilingImg from '@/assets/toolsIcon/profiling.png'; import PodProxyImg from '@/assets/toolsIcon/pod-proxy.png'; -import DebugImg from '@/assets/toolsIcon/debug.png'; -import ConfigMapImg from '@/assets/toolsIcon/config.png'; +import ProfilingImg from '@/assets/toolsIcon/profiling.png'; +import TcpdumpImg from '@/assets/toolsIcon/tcpdump.png'; +import TerminalImg from '@/assets/toolsIcon/terminal.png'; export enum ToolNames { Terminal = 'Terminal', diff --git a/ui/src/pages/ToolsMap/index.tsx b/ui/src/pages/ToolsMap/index.tsx index abc6303..3a1af3c 100644 --- a/ui/src/pages/ToolsMap/index.tsx +++ b/ui/src/pages/ToolsMap/index.tsx @@ -1,10 +1,10 @@ -import { ToolsMapArr } from '@/pages/ToolsMap/configs/configs'; +import { useTools } from '@/hooks/useTools'; import ToolItem from '@/pages/ToolsMap/components/ToolItem/ToolItem'; -import { StyledToolsMap, StyledToolsMapSpace } from '@/pages/ToolsMap/styles/index.styled'; +import { ToolsMapArr } from '@/pages/ToolsMap/configs/configs'; import { useResizeWindow } from '@/pages/ToolsMap/hooks/useResizeWindow'; -import { useEffect } from 'react'; +import { StyledToolsMap, StyledToolsMapSpace } from '@/pages/ToolsMap/styles/index.styled'; import { k8zStorageKeys, localStorageManage } from '@/utils/storageUtil'; -import { useTools } from '@/hooks/useTools'; +import { useEffect } from 'react'; const ToolsMap = () => { const { spaceWidth } = useResizeWindow(); diff --git a/ui/src/pages/ToolsMap/styles/index.styled.ts b/ui/src/pages/ToolsMap/styles/index.styled.ts index 27e08eb..3498b3a 100644 --- a/ui/src/pages/ToolsMap/styles/index.styled.ts +++ b/ui/src/pages/ToolsMap/styles/index.styled.ts @@ -1,5 +1,5 @@ -import styled from 'styled-components'; import { Space } from 'antd'; +import styled from 'styled-components'; export const StyledToolsMap = styled.div` margin: 18px 0; diff --git a/ui/src/preload/index.ts b/ui/src/preload/index.ts index f2f296e..81874f8 100644 --- a/ui/src/preload/index.ts +++ b/ui/src/preload/index.ts @@ -15,6 +15,11 @@ const api: any = { getMessage: (callback: (event: any, message: any) => void) => { ipcRenderer.on('message', callback); }, + openInBrowser: (url: string) => { + ipcRenderer.send('openBrowser', { + url, + }); + }, }; contextBridge.exposeInMainWorld(apiKey, api); diff --git a/ui/src/services/dependency.ts b/ui/src/services/dependency.ts new file mode 100644 index 0000000..81e016e --- /dev/null +++ b/ui/src/services/dependency.ts @@ -0,0 +1,9 @@ +export interface DependencyError { + dependency: string; + refer: string; +} + +export interface DependenciesResponse { + success: string; + dependencyErrors: DependencyError[]; +} diff --git a/ui/src/services/pods.ts b/ui/src/services/pods.ts index 36d24a4..93352ab 100644 --- a/ui/src/services/pods.ts +++ b/ui/src/services/pods.ts @@ -1,5 +1,5 @@ -import { request } from 'umi'; import type { WorkloadKinds } from '@/services/workload'; +import { request } from 'umi'; export interface Pod { cluster: string; diff --git a/ui/src/services/profiling.ts b/ui/src/services/profiling.ts index 4d7c321..3b66cb5 100644 --- a/ui/src/services/profiling.ts +++ b/ui/src/services/profiling.ts @@ -1,5 +1,6 @@ -import { request } from 'umi'; +import type { DependenciesResponse } from '@/services/dependency'; import type { WorkloadKinds } from '@/services/workload'; +import { request } from 'umi'; export interface Profile { url: string; @@ -81,8 +82,14 @@ export async function getProfiles(params: ProfilesParams) { } export async function runProfilesDiff(data: { baseUrl?: string; targetUrl?: string }) { - return request(`/api/v1/pprof/run-diff`, { + return request>(`/api/v1/pprof/run-diff`, { method: 'POST', data, }); } + +export async function checkProfilingDependencies() { + return request>(`/api/v1/pprof/check-dependencies`, { + method: 'GET', + }); +} diff --git a/ui/src/services/tcpdump.ts b/ui/src/services/tcpdump.ts index d6467f8..49a3860 100644 --- a/ui/src/services/tcpdump.ts +++ b/ui/src/services/tcpdump.ts @@ -1,4 +1,6 @@ +import type { DependenciesResponse } from '@/services/dependency'; import { getWSHost } from '@/utils/common'; +import { request } from 'umi'; export enum TcpdumpMode { stdout = 'stdout', @@ -35,3 +37,9 @@ export const getStartTcpdumpWsUrl = ({ }; export const DOWNLOAD_CAUGHT_PATH = '/api/v1/tcpdump/download?taskId='; + +export function checkTcpdumpWireshark() { + return request>(`/api/v1/tcpdump/check-dependencies`, { + method: 'GET', + }); +} diff --git a/ui/src/services/workload.ts b/ui/src/services/workload.ts index b8c0c38..1865eab 100644 --- a/ui/src/services/workload.ts +++ b/ui/src/services/workload.ts @@ -1,5 +1,5 @@ -import { request } from 'umi'; import type { Pod } from '@/services/pods'; +import { request } from 'umi'; export interface Workload { name: string; diff --git a/ui/src/types/index.d.ts b/ui/src/types/index.d.ts index 99b5a7b..7b8a149 100644 --- a/ui/src/types/index.d.ts +++ b/ui/src/types/index.d.ts @@ -6,6 +6,7 @@ declare global { baseUrl?: () => Promise; downloading?: (path: string) => void; getMessage?: (callback: (event: any, message: any) => void) => void; + openInBrowser?: (url: string) => void; }; } } diff --git a/ui/yarn.lock b/ui/yarn.lock index 7ff57fa..1ccd2d0 100644 --- a/ui/yarn.lock +++ b/ui/yarn.lock @@ -127,10 +127,10 @@ rc-util "^5.24.2" stylis "^4.0.13" -"@ant-design/cssinjs@^1.4.0": - version "1.4.0" - resolved "https://registry.npmmirror.com/@ant-design/cssinjs/-/cssinjs-1.4.0.tgz#c66aa468322d6fdec7f43c8ebd0f3171630d2711" - integrity sha512-siFyX5VyiJWKBQAffI8zE0WZ4OWfI35QnqesbtHaVg49QxHFAcFN9VbJ+Qoos24JxABcxfopEwMWe2joZ2QVBQ== +"@ant-design/cssinjs@^1.5.6": + version "1.5.6" + resolved "https://registry.npmmirror.com/@ant-design/cssinjs/-/cssinjs-1.5.6.tgz#9eb60822a307339d729624533205209c99429062" + integrity sha512-1S7LUPC9BMyQ/CUYgzfePJJwEfsbVHJe3Tpd9zhujTxRM/6LYpN9N4FTaPHVqpnPazm0S2vG0WBkh2T5Erwuug== dependencies: "@babel/runtime" "^7.11.1" "@emotion/hash" "^0.8.0" @@ -4384,12 +4384,12 @@ "@typescript-eslint/types" "5.48.1" eslint-visitor-keys "^3.3.0" -"@umijs/ast@4.0.46": - version "4.0.46" - resolved "https://registry.npmmirror.com/@umijs/ast/-/ast-4.0.46.tgz#eae54e50544e644f6f26fe6ed9e4497fd220f910" - integrity sha512-3woFxQ+VJssyW/CwbwcMtSf9IRoCRddJdlhD6mYqfZVwGFr6vUqAIUQGo0EOdP5SdmqjPiGppK1cjhXd9lkp1w== +"@umijs/ast@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/ast/-/ast-4.0.47.tgz#1152cc62e26957687ccfc659d5cc00af649cc846" + integrity sha512-P0/vvMjzBAsX3xH0fjqHmKBbvF71c0mb4g1FD5arejeKV8Hp53fo4uYWEMducnDFVbRRycevU5FXQBtDZjXOwg== dependencies: - "@umijs/bundler-utils" "4.0.46" + "@umijs/bundler-utils" "4.0.47" "@umijs/babel-preset-umi@4.0.40": version "4.0.40" @@ -4403,15 +4403,15 @@ babel-plugin-styled-components "2.0.7" core-js "3.22.4" -"@umijs/babel-preset-umi@4.0.46": - version "4.0.46" - resolved "https://registry.npmmirror.com/@umijs/babel-preset-umi/-/babel-preset-umi-4.0.46.tgz#1d70d86ba48ab376cbdcfa2a28f4acc03c2ac475" - integrity sha512-xs7E4rpUBxSNBjFYDfb9o8U6J7PS9CKsIKna4zO3RHYxwcw9ON6JESklNSKaT7m3myz8FhZRsXE5ULuspsWPeA== +"@umijs/babel-preset-umi@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/babel-preset-umi/-/babel-preset-umi-4.0.47.tgz#3ec2e0aaeec19594e13ae3726c1f859e60af8c92" + integrity sha512-cvBYPOgb7MDp4nPvlUx4ycce25pxkIlMvJwWmQAHo9DYDA/+GQSmGcU162TNhlNmUgTGNwFSSTM6j46r4IehRg== dependencies: "@babel/runtime" "7.20.7" "@bloomberg/record-tuple-polyfill" "0.0.4" - "@umijs/bundler-utils" "4.0.46" - "@umijs/utils" "4.0.46" + "@umijs/bundler-utils" "4.0.47" + "@umijs/utils" "4.0.47" babel-plugin-styled-components "2.0.7" core-js "3.27.1" @@ -4427,13 +4427,13 @@ postcss-flexbugs-fixes "5.0.2" postcss-preset-env "7.5.0" -"@umijs/bundler-esbuild@4.0.46": - version "4.0.46" - resolved "https://registry.npmmirror.com/@umijs/bundler-esbuild/-/bundler-esbuild-4.0.46.tgz#0c6ff22edb59bdc37ebbeabde7b8f3fca68d21d9" - integrity sha512-hZ+z4mMYGe7t6mllJcyEt3ksvP0tmR3YylJoJPsbnEwGKzC5W164Rm5BG5sBWV2Kqmf6uAu1mq+c0Ut41VIHkw== +"@umijs/bundler-esbuild@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/bundler-esbuild/-/bundler-esbuild-4.0.47.tgz#49755dabf49fcbb08a47181abeddf27c0e200d79" + integrity sha512-8W+v0SpSLFP57Quy8UID675EkP9yc1pEaDIv+0Efk8NH6j0pxLJrnBkO35RkenTjpRfirDBF8fvX4SeyuQVAdg== dependencies: - "@umijs/bundler-utils" "4.0.46" - "@umijs/utils" "4.0.46" + "@umijs/bundler-utils" "4.0.47" + "@umijs/utils" "4.0.47" enhanced-resolve "5.9.3" postcss "^8.4.21" postcss-flexbugs-fixes "5.0.2" @@ -4472,24 +4472,35 @@ regenerate-unicode-properties "10.0.1" spdy "^4.0.2" -"@umijs/bundler-vite@4.0.46": - version "4.0.46" - resolved "https://registry.npmmirror.com/@umijs/bundler-vite/-/bundler-vite-4.0.46.tgz#8afe6463f802b3066317837e030f412901b3742b" - integrity sha512-FdekcYIBJV9K30G8d/j40IVsURPtKhkG9XEIGEkUqP+6xjWZb3pFbv7AeLSniUuRGqTBnrX4k72uptZdVkg7Lg== +"@umijs/bundler-utils@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/bundler-utils/-/bundler-utils-4.0.47.tgz#6c4aa94fed75c7cd62320e402c985d9ae6bcb07a" + integrity sha512-TgpsAo6+gYa0mytNUBXP0LSOxGUNLzuxsBg0jSdqcAVTHNBkMic72JMo8hgXa8TDx7f4Pb6GSngWj5Jgh/Pq1w== + dependencies: + "@umijs/utils" "4.0.47" + esbuild "0.16.17" + regenerate "^1.4.2" + regenerate-unicode-properties "10.0.1" + spdy "^4.0.2" + +"@umijs/bundler-vite@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/bundler-vite/-/bundler-vite-4.0.47.tgz#bd2743ca0a6c85d4a1de8153f803b2a863e35765" + integrity sha512-QdEyUOnfe8bUxcJjy8i0xPsR+V83cESZ7JtkKKv39cPR1NKeQK8ihvio9aGSkw09ByZPLL7grSGWn/X7ql1fdg== dependencies: "@svgr/core" "6.2.1" - "@umijs/bundler-utils" "4.0.46" - "@umijs/utils" "4.0.46" + "@umijs/bundler-utils" "4.0.47" + "@umijs/utils" "4.0.47" "@vitejs/plugin-react" "2.2.0" less "4.1.3" postcss-preset-env "7.5.0" rollup-plugin-visualizer "5.9.0" vite "3.2.5" -"@umijs/bundler-webpack@4.0.46": - version "4.0.46" - resolved "https://registry.npmmirror.com/@umijs/bundler-webpack/-/bundler-webpack-4.0.46.tgz#459852fa69a4746bd57c81faac46997c775c69d0" - integrity sha512-AkR2gud/poEkH+BIe5fDmWtKagPge63IZYEzgN4d36v4z535Hm2HvBqcTRutTfldCj4eu/gE0bfB6ddTd6ynwQ== +"@umijs/bundler-webpack@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/bundler-webpack/-/bundler-webpack-4.0.47.tgz#1978c9e2c8e10b310035d4cef8d485f6a27771ca" + integrity sha512-sYFD8wPnHyyKTmQTR7rSRyHupoVIHt2OwlL7e4SsU8HhdurJEfFYvyhm9i1scETz4NC1SvoQ2Ztzi3chG/ndPw== dependencies: "@parcel/css" "1.9.0" "@pmmmwh/react-refresh-webpack-plugin" "0.5.7" @@ -4497,11 +4508,11 @@ "@svgr/plugin-jsx" "^6.2.1" "@svgr/plugin-svgo" "^6.2.0" "@types/hapi__joi" "17.1.9" - "@umijs/babel-preset-umi" "4.0.46" - "@umijs/bundler-utils" "4.0.46" + "@umijs/babel-preset-umi" "4.0.47" + "@umijs/bundler-utils" "4.0.47" "@umijs/case-sensitive-paths-webpack-plugin" "^1.0.1" - "@umijs/mfsu" "4.0.46" - "@umijs/utils" "4.0.46" + "@umijs/mfsu" "4.0.47" + "@umijs/utils" "4.0.47" cors "^2.8.5" css-loader "6.7.1" es5-imcompatible-versions "^0.1.73" @@ -4510,7 +4521,7 @@ node-libs-browser "2.2.1" postcss "^8.4.21" postcss-preset-env "7.5.0" - react-error-overlay "6.0.11" + react-error-overlay "6.0.9" react-refresh "0.14.0" "@umijs/bundler-webpack@latest": @@ -4545,13 +4556,13 @@ resolved "https://registry.npmmirror.com/@umijs/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-1.0.1.tgz#02655299f52912289f2df28fbeaea636e748c1df" integrity sha512-kDKJ8yTarxwxGJDInG33hOpaQRZ//XpNuuznQ/1Mscypw6kappzFmrBr2dOYave++K7JHouoANF354UpbEQw0Q== -"@umijs/core@4.0.46": - version "4.0.46" - resolved "https://registry.npmmirror.com/@umijs/core/-/core-4.0.46.tgz#5f898089b125dfb8ce5af500e53b2e367569124d" - integrity sha512-HT0UxlU35kYq/sVfo9qxO0jUJsRM94K1Zrd9mNeZsutvxLG84YzQKVX1Xi6+zOg6l976GUByEtYvzTikcafFzQ== +"@umijs/core@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/core/-/core-4.0.47.tgz#5b5afdb4b3e63dc31759655f78b3c61dda97263a" + integrity sha512-LnaJ6NX32bo9Ax1EwZgTJhHRMlFuP4vuuTA04So6RgQYhxZOjs3fZmuxTSGGMXLqYRX6IwqaOzO+76nnnSl4Yw== dependencies: - "@umijs/bundler-utils" "4.0.46" - "@umijs/utils" "4.0.46" + "@umijs/bundler-utils" "4.0.47" + "@umijs/utils" "4.0.47" "@umijs/did-you-know@^1.0.0": version "1.0.1" @@ -4644,17 +4655,17 @@ "@babel/runtime" "^7.7.6" query-string "^6.13.6" -"@umijs/lint@4.0.46": - version "4.0.46" - resolved "https://registry.npmmirror.com/@umijs/lint/-/lint-4.0.46.tgz#5b2baa92685eabf7b6a1d3fc592065122bcaf978" - integrity sha512-MSsCXEv8K/vIFfzleSJePwSth/CLfknGRXBw34f33e832Ej85WX/e1TXV5Uklol+UTOuN4uxVIHqnhJ46k/47A== +"@umijs/lint@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/lint/-/lint-4.0.47.tgz#8ecd8f7852aff8d8ad32b29b3a8209f4c4198b9d" + integrity sha512-HoxwLD0jDE9Bly5KlNPkQInFvNXaC8tLVSNQprDoSmMiu2BQrahCSeUq3EPZ0FNSBsjXB7fsJg+fZJ/yJ+owgQ== dependencies: "@babel/core" "7.20.12" "@babel/eslint-parser" "7.19.1" "@stylelint/postcss-css-in-js" "^0.38.0" "@typescript-eslint/eslint-plugin" "5.48.1" "@typescript-eslint/parser" "5.48.1" - "@umijs/babel-preset-umi" "4.0.46" + "@umijs/babel-preset-umi" "4.0.47" eslint-plugin-jest "26.1.5" eslint-plugin-react "7.29.4" eslint-plugin-react-hooks "4.5.0" @@ -4672,17 +4683,17 @@ serve-static "^1.15.0" swagger-ui-dist "^4.12.0" -"@umijs/max@^4.0.46": - version "4.0.46" - resolved "https://registry.npmmirror.com/@umijs/max/-/max-4.0.46.tgz#f7ad882677159013804ceb00cc892250c723078a" - integrity sha512-7/vyLjwH4OvHHRITMUsu7wqeFc26ixp0sYvlavehNhjr5seGLza/J/7yUQfAyEZVDyQR5J0GYwFDoo8kHrGZMg== +"@umijs/max@^4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/max/-/max-4.0.47.tgz#e7feaf1520e7991dd34c15f31f469bcb90cdf065" + integrity sha512-g/RNT8uCAk4h/nrGyaHVAY8KCnb+/XGnoJqgUje/krtIOJKZMzJRskQI7V1RUyvvcK+cnse/wqN1GO0GlY+GuA== dependencies: - "@umijs/lint" "4.0.46" - "@umijs/plugins" "4.0.46" + "@umijs/lint" "4.0.47" + "@umijs/plugins" "4.0.47" antd "^4.20.6" eslint "8.31.0" stylelint "14.8.2" - umi "4.0.46" + umi "4.0.47" "@umijs/mfsu@4.0.40": version "4.0.40" @@ -4695,14 +4706,14 @@ enhanced-resolve "5.9.3" is-equal "^1.6.4" -"@umijs/mfsu@4.0.46": - version "4.0.46" - resolved "https://registry.npmmirror.com/@umijs/mfsu/-/mfsu-4.0.46.tgz#c17f05eeadad1c5e3fa9cace933c39d4bed054e3" - integrity sha512-Q8QFjcNPkOEqQvJTzSzkSvtun9fIM0FdtvR2vbpuk/fY88SfV8eofJlsgzZ7ERPTLeIc1SwBSa1CoZ/AUvAKgg== +"@umijs/mfsu@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/mfsu/-/mfsu-4.0.47.tgz#ad8046bc247e8a2bd0428796f2c348dc22e4de5c" + integrity sha512-Sm/M8nQV8LeCNQ31xXBV22fpD7ZWeO5k9WMOFef5H058ElBuI/AfSYS6M5IfNNX5Ohm5QrT92TzVvfFv+k2bUQ== dependencies: - "@umijs/bundler-esbuild" "4.0.46" - "@umijs/bundler-utils" "4.0.46" - "@umijs/utils" "4.0.46" + "@umijs/bundler-esbuild" "4.0.47" + "@umijs/bundler-utils" "4.0.47" + "@umijs/utils" "4.0.47" enhanced-resolve "5.9.3" is-equal "^1.6.4" @@ -4727,10 +4738,10 @@ swagger2openapi "^7.0.4" tiny-pinyin "^1.3.2" -"@umijs/plugin-run@4.0.46": - version "4.0.46" - resolved "https://registry.npmmirror.com/@umijs/plugin-run/-/plugin-run-4.0.46.tgz#ec97ea07577115634d140b76c0fbd6b5fd471c35" - integrity sha512-0hlhxdEii46pIOnWjgosWgqoqK7AnxNqSqtpo+coj+a0azt/cqbe0D4DfUwnvzhJtP/kQRV2R/J4Me0D5OHBFA== +"@umijs/plugin-run@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/plugin-run/-/plugin-run-4.0.47.tgz#8551b28a1b7c04f3b5110d21706ccae152ff38b1" + integrity sha512-/7cMmrx8lBtMDmyzX0BTiLvIE0dOqrD8lHO6nGPA1l+IW73NVkZ6/az9rDDv9/pQNOlUdJcwZzSLzaT6o+HDUg== dependencies: tsx "^3.12.2" @@ -4763,7 +4774,40 @@ redux "^4.2.0" warning "^4.0.3" -"@umijs/plugins@4.0.46", "@umijs/plugins@^4.0.28": +"@umijs/plugins@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/plugins/-/plugins-4.0.47.tgz#5357a9c4320799655fc320ad24c641707ab0f1c8" + integrity sha512-kEofyV0LQv/kXzw5y2j5+I1JmxZRhssqx5bmAJhVUwcKd+ml8HYXNdzWPhPRogWIkKChUIYke85U9GZF3V8PdA== + dependencies: + "@ahooksjs/use-request" "^2.0.0" + "@ant-design/antd-theme-variable" "^1.0.0" + "@ant-design/icons" "^4.7.0" + "@ant-design/pro-components" "^2.0.1" + "@tanstack/react-query" "^4.22.0" + "@tanstack/react-query-devtools" "^4.22.0" + "@umijs/bundler-utils" "4.0.47" + "@umijs/valtio" "^1.0.2" + antd-dayjs-webpack-plugin "^1.0.6" + axios "^0.27.2" + babel-plugin-import "^1.13.6" + dayjs "^1.11.7" + dva-core "^2.0.4" + dva-immer "^1.0.0" + dva-loading "^3.0.22" + event-emitter "~0.3.5" + fast-deep-equal "3.1.3" + intl "1.2.5" + lodash "^4.17.21" + moment "^2.29.4" + qiankun "^2.8.4" + react-intl "3.12.1" + react-redux "^8.0.5" + redux "^4.2.0" + styled-components "6.0.0-beta.9" + tslib "^2" + warning "^4.0.3" + +"@umijs/plugins@^4.0.28": version "4.0.46" resolved "https://registry.npmmirror.com/@umijs/plugins/-/plugins-4.0.46.tgz#51260743f23c3e398591d4ee1eaa7022b75d25f6" integrity sha512-9emZWABOFGPM2+P4IW2/PaIekUwcuEfKTiVIyNHHQmyJWwdbhcwCcK5vBUHi8cbhsO6uCyyGPijR1GhYeg0SJg== @@ -4796,26 +4840,26 @@ tslib "^2" warning "^4.0.3" -"@umijs/preset-umi@4.0.46": - version "4.0.46" - resolved "https://registry.npmmirror.com/@umijs/preset-umi/-/preset-umi-4.0.46.tgz#7e25181e863791ab9a7036fb29f8667d1eac589d" - integrity sha512-OpWr4RqqCRZtK5PSvOZwZsWFA6LCKLOWmpMpVaCymdlKRQRPMdmP9jVh9oi6E8v2WjtiTagk9L0oM+wm7z68fw== +"@umijs/preset-umi@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/preset-umi/-/preset-umi-4.0.47.tgz#f98f7ee6e887123bab718133de9da2fd4e3af998" + integrity sha512-zuedWYC7AUxRq8sOtRz+ipuV6F4y4lOBQ+L4C1T4CJkITbhDhqKavh0rK9ij0p5OAHjDI3LtZa4/IEirpzD07Q== dependencies: "@iconify/utils" "2.0.9" "@svgr/core" "6.2.1" - "@umijs/ast" "4.0.46" - "@umijs/babel-preset-umi" "4.0.46" - "@umijs/bundler-utils" "4.0.46" - "@umijs/bundler-vite" "4.0.46" - "@umijs/bundler-webpack" "4.0.46" - "@umijs/core" "4.0.46" + "@umijs/ast" "4.0.47" + "@umijs/babel-preset-umi" "4.0.47" + "@umijs/bundler-utils" "4.0.47" + "@umijs/bundler-vite" "4.0.47" + "@umijs/bundler-webpack" "4.0.47" + "@umijs/core" "4.0.47" "@umijs/did-you-know" "^1.0.0" "@umijs/history" "5.3.1" - "@umijs/mfsu" "4.0.46" - "@umijs/plugin-run" "4.0.46" - "@umijs/renderer-react" "4.0.46" - "@umijs/server" "4.0.46" - "@umijs/utils" "4.0.46" + "@umijs/mfsu" "4.0.47" + "@umijs/plugin-run" "4.0.47" + "@umijs/renderer-react" "4.0.47" + "@umijs/server" "4.0.47" + "@umijs/utils" "4.0.47" babel-plugin-dynamic-import-node "2.3.3" click-to-react-component "^1.0.8" core-js "3.27.1" @@ -4832,10 +4876,10 @@ react-router-dom "6.3.0" regenerator-runtime "0.13.11" -"@umijs/renderer-react@4.0.46": - version "4.0.46" - resolved "https://registry.npmmirror.com/@umijs/renderer-react/-/renderer-react-4.0.46.tgz#5abbed9e084c250d6f5567334583f209ea413431" - integrity sha512-60wMUEnsEh5KRJeuJ2MofQ+u+aNOB4zpqJbZk4SomJ0f8029tyc6cnBkL4R08LMfCvlnpgs4G6lOiOLEV+YkEw== +"@umijs/renderer-react@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/renderer-react/-/renderer-react-4.0.47.tgz#77d646def386f4a2cdd230ca109cb325e3024b29" + integrity sha512-G8bUJ2P97QVzfn8JXFdHCb/CWJpnOkOaoPG1Ouzjno3qMCBQwzNIMGSE8y4v/PA8w4KiUJ/EB5x3GcPdC7n9Aw== dependencies: "@babel/runtime" "7.20.7" "@loadable/component" "5.15.2" @@ -4868,25 +4912,25 @@ resolved "https://registry.npmmirror.com/@umijs/route-utils/-/route-utils-4.0.1.tgz#156df5b3f2328059722d3ee7dd8f65e18c3cde8b" integrity sha512-+1ixf1BTOLuH+ORb4x8vYMPeIt38n9q0fJDwhv9nSxrV46mxbLF0nmELIo9CKQB2gHfuC4+hww6xejJ6VYnBHQ== -"@umijs/server@4.0.46": - version "4.0.46" - resolved "https://registry.npmmirror.com/@umijs/server/-/server-4.0.46.tgz#8344deae213ec089067f45e26702fbc8ac6df4ec" - integrity sha512-dsK2/RxEAERNSAGh79w8zTa8nLbiZI1j4BNRt6H3i2xQr43OsS9Zcqcipv2/QK8xa5mc9dkqAHKVbLVQCw2wEQ== +"@umijs/server@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/server/-/server-4.0.47.tgz#834a278901dba50d5a07794ac36994e9f1346545" + integrity sha512-8PK63PtCDpP+aA8jb5Lq5Q9ToyH1mPpfmEFslGLeTMldnVqnQfaISrxg1XGgG+a3Zc7XMBBW758UzMor98jFBA== dependencies: - "@umijs/bundler-utils" "4.0.46" + "@umijs/bundler-utils" "4.0.47" history "5.3.0" react "18.1.0" react-dom "18.1.0" react-router-dom "6.3.0" -"@umijs/test@4.0.46": - version "4.0.46" - resolved "https://registry.npmmirror.com/@umijs/test/-/test-4.0.46.tgz#f33828b5227100fee6516cb9fd39da0b6d19c88e" - integrity sha512-G99TvqiPX/EwKAvrKSmS6zw5SJr+O27CnnNw2bV59pm90Q9Zt8dZ7PMKolBzPJ9JAYUmvHmufrw+e7Ma7DtX+Q== +"@umijs/test@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/test/-/test-4.0.47.tgz#8361d6d7ea4022eafcd63dc0016bee3238516493" + integrity sha512-gg6zg3vuaL48hBkDf4ieK0XXWFH0CCs4dMDorKoBUeFKPI2Qs6O6X5H61cwr4Sqx7btrBLMz63PQan9PsAfaRA== dependencies: "@babel/plugin-transform-modules-commonjs" "7.20.11" "@jest/types" "27.5.1" - "@umijs/bundler-utils" "4.0.46" + "@umijs/bundler-utils" "4.0.47" babel-jest "^29.3.1" esbuild "0.16.17" identity-obj-proxy "3.0.0" @@ -4921,6 +4965,14 @@ chokidar "3.5.3" pino "7.11.0" +"@umijs/utils@4.0.47": + version "4.0.47" + resolved "https://registry.npmmirror.com/@umijs/utils/-/utils-4.0.47.tgz#e94e65eadce96d05d7131a3ddd7f40b041f5bab9" + integrity sha512-FLaLqutlCUPPb8EihUXd3Un8ycNTAqA0tYYQ81AF1UNon51EEhvnKpnICkLx7loNeenXaprM+fn/xDWQWsD3LA== + dependencies: + chokidar "3.5.3" + pino "7.11.0" + "@umijs/valtio@^1.0.0": version "1.0.1" resolved "https://registry.npmmirror.com/@umijs/valtio/-/valtio-1.0.1.tgz#d6cb458d4c7bde90884bdd31e79f03cf4db06083" @@ -5224,13 +5276,13 @@ antd@^4.20.6: rc-util "^5.22.5" scroll-into-view-if-needed "^2.2.25" -antd@^5.1.5: - version "5.1.5" - resolved "https://registry.npmmirror.com/antd/-/antd-5.1.5.tgz#792440a2ffbce965ef45670d020f272e541e8686" - integrity sha512-f1gfmDG8CApTu1h6gtM7i/krMTP6WH55w7pUPAMHlp9jsviKR+ElPqSQeLZV3UjuxVNn0DWvGwWEJ0Rv/kbeEQ== +antd@^5.1.6: + version "5.1.6" + resolved "https://registry.npmmirror.com/antd/-/antd-5.1.6.tgz#9ac912279f9f8e571674b3220b668897b4ffb0b3" + integrity sha512-9bn2B4rZ1c7IXtn5U95aNGJXmLOZyL1V5TiGq3pk3S3bGD13BA2eynSI//e3c2FAslZlqQlQEGV+NHms9ygAVA== dependencies: "@ant-design/colors" "^7.0.0" - "@ant-design/cssinjs" "^1.4.0" + "@ant-design/cssinjs" "^1.5.6" "@ant-design/icons" "^5.0.0" "@ant-design/react-slick" "~1.0.0" "@babel/runtime" "^7.18.3" @@ -5252,7 +5304,7 @@ antd@^5.1.5: rc-input "~0.1.4" rc-input-number "~7.4.0" rc-mentions "~1.13.1" - rc-menu "~9.8.0" + rc-menu "~9.8.2" rc-motion "^2.6.1" rc-notification "~5.0.0" rc-pagination "~3.2.0" @@ -14412,6 +14464,18 @@ rc-menu@^9.8.1, rc-menu@~9.8.0: rc-util "^5.12.0" shallowequal "^1.1.0" +rc-menu@~9.8.2: + version "9.8.2" + resolved "https://registry.npmmirror.com/rc-menu/-/rc-menu-9.8.2.tgz#179df4ea0fc46fffb7a21e18d3cddb901ce35986" + integrity sha512-EahOJVjLuEnJsThoPN+mGnVm431RzVzDLZWHRS/YnXTQULa7OsgdJa/Y7qXxc3Z5sz8mgT6xYtgpmBXLxrZFaQ== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-motion "^2.4.3" + rc-overflow "^1.2.8" + rc-trigger "^5.1.2" + rc-util "^5.27.0" + rc-motion@^2.0.0, rc-motion@^2.0.1, rc-motion@^2.2.0, rc-motion@^2.3.0, rc-motion@^2.3.4, rc-motion@^2.4.3, rc-motion@^2.4.4, rc-motion@^2.6.0, rc-motion@^2.6.1, rc-motion@^2.6.2: version "2.6.2" resolved "https://registry.npmmirror.com/rc-motion/-/rc-motion-2.6.2.tgz#3d31f97e41fb8e4f91a4a4189b6a98ac63342869" @@ -14879,16 +14943,16 @@ react-dom@^18.2.0: loose-envify "^1.1.0" scheduler "^0.23.0" -react-error-overlay@6.0.11, react-error-overlay@^6.0.11: - version "6.0.11" - resolved "https://registry.npmmirror.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz#92835de5841c5cf08ba00ddd2d677b6d17ff9adb" - integrity sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg== - react-error-overlay@6.0.9: version "6.0.9" resolved "https://registry.npmmirror.com/react-error-overlay/-/react-error-overlay-6.0.9.tgz#3c743010c9359608c375ecd6bc76f35d93995b0a" integrity sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew== +react-error-overlay@^6.0.11: + version "6.0.11" + resolved "https://registry.npmmirror.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz#92835de5841c5cf08ba00ddd2d677b6d17ff9adb" + integrity sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg== + react-fast-compare@^3.2.0: version "3.2.0" resolved "https://registry.npmmirror.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb" @@ -17438,21 +17502,21 @@ umi-utils@1.7.3, umi-utils@^1.5.1: prettier "1.15.3" slash2 "2.0.0" -umi@4.0.46: - version "4.0.46" - resolved "https://registry.npmmirror.com/umi/-/umi-4.0.46.tgz#ef785ae6c9591b4775c1a00011cd92e34768df55" - integrity sha512-boFmOlbv/9+T8MsvGuCzkTNkuPACdZN4IREX73+3W1pmuLU/B/tqm4GF0PGR5sZT8qOW/b7BPEdmn13jGGMP2w== +umi@4.0.47: + version "4.0.47" + resolved "https://registry.npmmirror.com/umi/-/umi-4.0.47.tgz#d9da283f7718e03cda69ae74e561d91fae85384c" + integrity sha512-oMoEF5xUW+SZ1AVpgd8e1kKt4LyhPiFWmsGlIpe5Ed0kAOguTinD3WAY49Tw/aAIBLoazu/y290SCRxQoAb18g== dependencies: "@babel/runtime" "7.20.7" - "@umijs/bundler-utils" "4.0.46" - "@umijs/bundler-webpack" "4.0.46" - "@umijs/core" "4.0.46" - "@umijs/lint" "4.0.46" - "@umijs/preset-umi" "4.0.46" - "@umijs/renderer-react" "4.0.46" - "@umijs/server" "4.0.46" - "@umijs/test" "4.0.46" - "@umijs/utils" "4.0.46" + "@umijs/bundler-utils" "4.0.47" + "@umijs/bundler-webpack" "4.0.47" + "@umijs/core" "4.0.47" + "@umijs/lint" "4.0.47" + "@umijs/preset-umi" "4.0.47" + "@umijs/renderer-react" "4.0.47" + "@umijs/server" "4.0.47" + "@umijs/test" "4.0.47" + "@umijs/utils" "4.0.47" prettier-plugin-organize-imports "^3.2.1" prettier-plugin-packagejson "^2.3.0"