Skip to content

Commit

Permalink
fix(console): fix corhpa page error
Browse files Browse the repository at this point in the history
  • Loading branch information
Johnny Wu authored and tke-robot committed Sep 28, 2020
1 parent 2749bb2 commit e019a96
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from '@tencent/tea-component';
import { RecordSet } from '@tencent/ff-redux/src';
import { Resource } from '@src/modules/common/models';
import { namespace } from '@config/resource/k8sConfig';

// 下边props没有用这个interface因为使用后Select会你报一些类型的问题,感觉还不太好整合,有时间整合下
interface NamespaceSelectProps {
Expand All @@ -34,15 +35,19 @@ const NamespaceSelect = React.memo((props: {
* 初始化namespace选项为第一个,对应初始化浏览器URL数据
*/
useEffect(() => {
if (!isEmpty(namespaces)) {
console.log(namespaces, '---+++');
if (!isEmpty(namespaces) && namespaces.recordCount > 0) {
hpaDispatch({
type: CHANGE_NAMESPACE,
payload: { namespaceValue: namespaces.records[0].value }
});

// 如果是业务侧,
if (projectName && !namespaces.records[0].spec.clusterName) {
router.navigate(urlParams, { ...route.queries, clusterId: namespaces.records[0].spec.clusterName });
router.navigate(urlParams, {
...route.queries,
clusterId: namespaces.records[0].spec.clusterName
});
}
// router.navigate(urlParams, { ...route.queries, clusterId: namespaces.records[0].spec.clusterName });
}
Expand Down

0 comments on commit e019a96

Please sign in to comment.