From c1ef1441891c6823ac29456976d31d2d3c60cb4f Mon Sep 17 00:00:00 2001 From: zwwhdls Date: Wed, 4 Sep 2024 11:08:07 +0800 Subject: [PATCH] feat: trigger upgrade in dashboard Signed-off-by: zwwhdls --- dashboard-ui-v2/src/components/containers.tsx | 31 ++++++++++- dashboard-ui-v2/src/hooks/use-api.ts | 16 ++++++ dashboard-ui-v2/src/icons/index.tsx | 21 +++++++- pkg/config/config.go | 34 +++++++++++++ pkg/controller/app_controller_test.go | 4 +- pkg/dashboard/api.go | 2 + pkg/dashboard/pod.go | 51 +++++++++++++++++++ pkg/juicefs/mount/builder/pod_test.go | 4 +- pkg/k8sclient/client.go | 19 +++++++ pkg/util/resource/terminal.go | 32 ++++++++++++ 10 files changed, 206 insertions(+), 8 deletions(-) diff --git a/dashboard-ui-v2/src/components/containers.tsx b/dashboard-ui-v2/src/components/containers.tsx index 3dfee03bf7..aa68ec4563 100644 --- a/dashboard-ui-v2/src/components/containers.tsx +++ b/dashboard-ui-v2/src/components/containers.tsx @@ -15,7 +15,8 @@ */ import { ProCard } from '@ant-design/pro-components' -import { Button, Space, Table, Tag, Tooltip } from 'antd' +import { Button, Space, Table, Tag, Tooltip, Popconfirm, message } from 'antd' +import type { PopconfirmProps } from 'antd' import { ContainerStatus } from 'kubernetes-types/core/v1' import { FormattedMessage } from 'react-intl' import { useParams } from 'react-router-dom' @@ -28,12 +29,13 @@ import { AccessLogIcon, DebugIcon, LogIcon, - TerminalIcon, + TerminalIcon, UpgradeIcon, WarmupIcon, } from '@/icons' import { DetailParams } from '@/types' import { Pod } from '@/types/k8s' import { isMountPod, supportDebug } from '@/utils' +import { useMountPodImage, useMountUpgrade } from '@/hooks/use-api.ts' const Containers: React.FC<{ pod: Pod @@ -42,7 +44,17 @@ const Containers: React.FC<{ const { pod, containerStatuses } = props const { namespace, name } = useParams() + const [, actions] = useMountUpgrade() + const confirm: PopconfirmProps['onConfirm'] = () => { + actions.execute( + namespace, + name, + ) + message.success("Successfully trigger smoothly upgrade") + } + + const { data } = useMountPodImage(namespace, name) return ( }> )} + + + +