Skip to content

Commit

Permalink
fix delete cluste disable and deletedParameters in Parameter table
Browse files Browse the repository at this point in the history
  • Loading branch information
TianWuwt committed Dec 25, 2024
1 parent cd09566 commit 96d7508
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
3 changes: 2 additions & 1 deletion ui/src/i18n/strings/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1247,5 +1247,6 @@
"src.components.TopoComponent.2494A473": "Restart the server",
"src.pages.Tenant.Detail.Overview.892E62C7": "Delete protection modified successfully",
"src.pages.Tenant.Detail.Overview.EE772326": "Delete protection",
"src.pages.Overview.E15A1FED": "metrics-server has not been installed in the K8s cluster, and the usage of node resources cannot be obtained."
"src.pages.Overview.E15A1FED": "metrics-server has not been installed in the K8s cluster, and the usage of node resources cannot be obtained.",
"src.pages.Cluster.Detail.Overview.FF85D01F": "Unmanaged Successfully"
}
3 changes: 2 additions & 1 deletion ui/src/i18n/strings/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1269,5 +1269,6 @@
"src.components.TopoComponent.2494A473": "重启server",
"src.pages.Tenant.Detail.Overview.892E62C7": "修改删除保护已成功",
"src.pages.Tenant.Detail.Overview.EE772326": "删除保护",
"src.pages.Overview.E15A1FED": "K8s 集群中尚未安装 metrics-server,无法获取节点资源用量"
"src.pages.Overview.E15A1FED": "K8s 集群中尚未安装 metrics-server,无法获取节点资源用量",
"src.pages.Cluster.Detail.Overview.FF85D01F": "解除托管已成功"
}
37 changes: 35 additions & 2 deletions ui/src/pages/Cluster/Detail/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,23 @@ const ClusterOverview: React.FC = () => {
},
});

const { runAsync: patchOBCluster, loading: patchOBClusterloading } =
useRequest(obcluster.patchOBCluster, {
manual: true,
onSuccess: (res) => {
if (res.successful) {
message.success(
intl.formatMessage({
id: 'src.pages.Cluster.Detail.Overview.FF85D01F',
defaultMessage: '解除托管已成功',
}),
);
refresh();
clusterDetailRefresh();
}
},
});

const handleDelete = async () => {
const res = await deleteClusterReportWrap({ ns: ns!, name: name! });
if (res.successful) {
Expand Down Expand Up @@ -189,6 +206,10 @@ const ClusterOverview: React.FC = () => {
label: (
<Button
type="text"
disabled={
!isEmpty(clusterDetail) &&
(clusterDetail?.status !== 'running' || deletionProtection)
}
onClick={() =>
showDeleteConfirm({
onOk: handleDelete,
Expand Down Expand Up @@ -262,7 +283,8 @@ const ClusterOverview: React.FC = () => {
};
};

const { parameters, storage, resource } = clusterDetail?.info || {};
const { parameters, storage, resource, deletionProtection } =
clusterDetail?.info || {};

const resourceinit = [
{
Expand Down Expand Up @@ -348,6 +370,7 @@ const ClusterOverview: React.FC = () => {
})}
</Tag>
),

value: true,
},
{
Expand All @@ -359,6 +382,7 @@ const ClusterOverview: React.FC = () => {
})}
</Tag>
),

value: false,
},
];
Expand Down Expand Up @@ -438,6 +462,7 @@ const ClusterOverview: React.FC = () => {
})}
/>
),

dataIndex: 'accordance',
width: 100,
render: (text: boolean) => {
Expand Down Expand Up @@ -478,7 +503,15 @@ const ClusterOverview: React.FC = () => {
})}
</Button>
{text && (
<Button type="link" onClick={() => {}}>
<Button
type="link"
loading={patchOBClusterloading}
onClick={() => {
patchOBCluster(ns, name, {
deletedParameters: [record.name],
});
}}
>
{intl.formatMessage({
id: 'src.pages.Cluster.Detail.Overview.5FACF7C0',
defaultMessage: '解除托管',
Expand Down

0 comments on commit 96d7508

Please sign in to comment.