From 17eb255f443924ae34cd9f918e306a9b3a14ab38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=A4=E6=9C=88?= <17949154+yazhouio@users.noreply.github.com> Date: Thu, 19 Sep 2024 12:04:09 +0800 Subject: [PATCH] fix: Fix devops bugs (#4299) * fix: Fix workspace devops list page bugs (#4924) * locale: fix devops locales Signed-off-by: yazhou * fix: fix devops cluster options Signed-off-by: yazhou * fix: Fix devops list modal and styles Signed-off-by: yazhou --------- Signed-off-by: yazhou * locale: update locales (#4935) Signed-off-by: yazhou --------- Signed-off-by: yazhou --- locales/en/custom.js | 1 + locales/es/custom.js | 1 + locales/tc/custom.js | 1 + locales/zh/custom.js | 2 +- .../containers/Devops/ClusterSelect.tsx | 5 ++-- .../workspaces/containers/Devops/index.tsx | 23 +++++++++---------- .../src/components/GlobalStyles/index.tsx | 9 ++++++++ 7 files changed, 27 insertions(+), 15 deletions(-) diff --git a/locales/en/custom.js b/locales/en/custom.js index 92249aed15c..093fa7ef3bb 100644 --- a/locales/en/custom.js +++ b/locales/en/custom.js @@ -541,4 +541,5 @@ module.exports = { 'Observer of the DevOps project, capable of viewing the running status of pipelines', DEVOPS_PROJECT_DESC: "DevOps projects are used to group resources for management and to control different users' resource management permissions.", + PLEASE_SELECT_CLUSTER: 'Please select a cluster', }; diff --git a/locales/es/custom.js b/locales/es/custom.js index 92249aed15c..093fa7ef3bb 100644 --- a/locales/es/custom.js +++ b/locales/es/custom.js @@ -541,4 +541,5 @@ module.exports = { 'Observer of the DevOps project, capable of viewing the running status of pipelines', DEVOPS_PROJECT_DESC: "DevOps projects are used to group resources for management and to control different users' resource management permissions.", + PLEASE_SELECT_CLUSTER: 'Please select a cluster', }; diff --git a/locales/tc/custom.js b/locales/tc/custom.js index 92249aed15c..1f06e030c86 100644 --- a/locales/tc/custom.js +++ b/locales/tc/custom.js @@ -541,4 +541,5 @@ module.exports = { 'Observer of the DevOps project, capable of viewing the running status of pipelines', DEVOPS_PROJECT_DESC: "DevOps projects are used to group resources for management and to control different users' resource management permissions.", + PLEASE_SELECT_CLUSTER: '請選擇集群', }; diff --git a/locales/zh/custom.js b/locales/zh/custom.js index 91ecf0d5241..f63356032fa 100644 --- a/locales/zh/custom.js +++ b/locales/zh/custom.js @@ -461,7 +461,7 @@ module.exports = { pipeline_developer: 'DevOps 业务的开发者,可以进行流水线的触发以及查看', pipeline_reporter: 'DevOps 业务的观察者,可以查看流水线的运行情况', DEVOPS_PROJECT_DESC: 'DevOps 业务用于对资源进行分组管理以及控制不同用户的资源管理权限。', - + PLEASE_SELECT_CLUSTER: '请选择集群', // 应用介绍 NO_DOCUMENT_DESC: '未发现应用介绍。', DOCUMENTATION: '应用介绍', diff --git a/packages/console/src/pages/workspaces/containers/Devops/ClusterSelect.tsx b/packages/console/src/pages/workspaces/containers/Devops/ClusterSelect.tsx index b158783b1d4..d53c860a4da 100644 --- a/packages/console/src/pages/workspaces/containers/Devops/ClusterSelect.tsx +++ b/packages/console/src/pages/workspaces/containers/Devops/ClusterSelect.tsx @@ -56,8 +56,9 @@ const useWorkspaceClusterSelect = (initParams: ProjectSelectInitValue = {}) => { // select first React.useEffect(() => { - if (!cluster && clusterList?.filter(i => !i.disabled)?.length) { - setCluster(first(clusterList)?.name); + const clusters = clusterList?.filter(i => !i.disabled) ?? []; + if (!cluster && clusters.length) { + setCluster(first(clusters)?.name); } }, [clusterList]); diff --git a/packages/console/src/pages/workspaces/containers/Devops/index.tsx b/packages/console/src/pages/workspaces/containers/Devops/index.tsx index 34cad9bb0fe..5efbaf51304 100644 --- a/packages/console/src/pages/workspaces/containers/Devops/index.tsx +++ b/packages/console/src/pages/workspaces/containers/Devops/index.tsx @@ -10,23 +10,21 @@ import { FormattedDevops, getDisplayName, getLocalTime, - PodsStore, StatusIndicator, tableState2Query, useBatchActions, - useCacheStore, useCommonActions, useItemActions, useTableActions, useUrlSearchParamsStatus, useV3action, } from '@ks-console/shared'; +import { Banner, BannerTip, Card, DataTable } from '@kubed/components'; +import { Pen, StrategyGroup, Trash } from '@kubed/icons'; import { ColumnDef, Table } from '@tanstack/react-table'; import * as React from 'react'; import { useParams } from 'react-router-dom'; import useWorkspaceClusterSelect from './ClusterSelect'; -import { Pen, StrategyGroup, Trash } from '@kubed/icons'; -import { Banner, BannerTip, Card, DataTable, notify } from '@kubed/components'; const module = devopsStore.module; @@ -45,7 +43,7 @@ const Devops = () => { const { cluster } = params; const { state, setState } = useUrlSearchParamsStatus([]); - const { open: openV3Modal } = useV3action(); + const { open: openV3Modal, render } = useV3action(); const commonParams = { cluster: cluster, @@ -90,7 +88,7 @@ const Devops = () => { v3Module: 'devopsStore', ...commonParams, detail: record, - v3StoreParams: '', + v3StoreParams: {}, action: 'devops.edit', success: () => { refetch(); @@ -299,7 +297,7 @@ const Devops = () => { if (!cluster) { return { image: , - description: t('PLEASE_SELECT_CLUSTER_OR_PROJECT'), + description: t('PLEASE_SELECT_CLUSTER'), }; } return { @@ -316,18 +314,18 @@ const Devops = () => { const banner = { icon: , - title: t('DEVOPS.DEVOPS_PROJECT_PL'), - description: t('DEVOPS.DEVOPS_DESCRIPTION'), + title: t('DEVOPS_PROJECT_PL'), + description: t('DEVOPS_DESCRIPTION'), }; const tips = [ { - title: t('DEVOPS.DEVOPS_TIP_GITOPS_Q'), + title: t('DEVOPS_TIP_GITOPS_Q'), description: t('DEVOPS_TIP_GITOPS_A'), }, { - title: t('DEVOPS.DEVOPS_TIP_TYPE_Q'), - description: t('DEVOPS.DEVOPS_TIP_TYPE_A'), + title: t('DEVOPS_TIP_TYPE_Q'), + description: t('DEVOPS_TIP_TYPE_A'), }, ]; @@ -343,6 +341,7 @@ const Devops = () => { + {render()} ); }; diff --git a/packages/core/src/components/GlobalStyles/index.tsx b/packages/core/src/components/GlobalStyles/index.tsx index 2bfa10fd733..60db7bad302 100644 --- a/packages/core/src/components/GlobalStyles/index.tsx +++ b/packages/core/src/components/GlobalStyles/index.tsx @@ -147,6 +147,15 @@ const GlobalStyles = createGlobalStyle` visibility: visible; } } + .kube-table { + td.table-cell { + word-break: break-word; + + .field-label { + max-width: 350px; + } + } + } `; export default GlobalStyles;