Skip to content

Commit

Permalink
fix(portal-web): 门户系统仪表盘区分停用集群和集群不可连接时的页面渲染 (#1285)
Browse files Browse the repository at this point in the history
### 问题

在集群停用中,结合在线集群数据,在集群没有停用但是没有获得集群的返回信息时也将页面渲染为了无可用集群
与原有页面样式不一致

![image](https://github.com/PKUHPC/SCOW/assets/43978285/0bf61f81-695d-44ce-a620-e47bd1f88e71)

### 修复后

集群全部停用时的页面

![image](https://github.com/PKUHPC/SCOW/assets/43978285/9cf54fae-dd00-40ce-9c41-c7679d1b5540)

集群未停用但特殊原因导致无信息返回时

![image](https://github.com/PKUHPC/SCOW/assets/43978285/d652da94-d19e-4da7-8821-4af70d9e8301)
  • Loading branch information
piccaSun authored Jun 10, 2024
1 parent 785e722 commit eacda16
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/clean-falcons-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scow/portal-web": patch
---

修复集群未停用但数据无法获取时的仪表盘页面显示
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { Table, Tag } from "antd";
import React, { useMemo, useState } from "react";
import { Localized, prefix, useI18n, useI18nTranslateToString } from "src/i18n";
import { InfoPanes } from "src/pageComponents/dashboard/InfoPanes";
import { Cluster } from "src/utils/cluster";
import { compareWithUndefined } from "src/utils/dashboard";
import { styled } from "styled-components";

Expand All @@ -32,6 +33,7 @@ export interface ClusterInfo extends PartitionInfo {
interface Props {
clusterInfo: ClusterInfo[];
failedClusters: ({clusterName: I18nStringType})[];
currentClusters: Cluster[];
isLoading: boolean;
}

Expand Down Expand Up @@ -88,7 +90,7 @@ const Container = styled.div`

const p = prefix("pageComp.dashboard.overviewTable.");

export const OverviewTable: React.FC<Props> = ({ clusterInfo, failedClusters, isLoading }) => {
export const OverviewTable: React.FC<Props> = ({ clusterInfo, failedClusters, currentClusters, isLoading }) => {
const t = useI18nTranslateToString();
const languageId = useI18n().currentLanguage.id;

Expand All @@ -104,7 +106,7 @@ export const OverviewTable: React.FC<Props> = ({ clusterInfo, failedClusters, is
};

return (
(isLoading || clusterInfo.length > 0) ? (
(isLoading || currentClusters.length > 0) ? (
<Container>
<Table
title={() => t(p("title"))}
Expand Down
1 change: 1 addition & 0 deletions apps/portal-web/src/pages/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export const DashboardPage: NextPage<Props> = requireAuth(() => true)(() => {
isLoading={isLoading}
clusterInfo={data?.clustersInfo ? data.clustersInfo.map((item, idx) => ({ ...item, id:idx })) : []}
failedClusters={data?.failedClusters ?? []}
currentClusters={currentClusters}
/>
</DashboardPageContent>
);
Expand Down

0 comments on commit eacda16

Please sign in to comment.