refactor(user-setting): 移除任务执行器监控何版本标识
This commit is contained in:
parent
c9ff96d7fa
commit
7c403a41c9
|
@ -38,7 +38,7 @@ export interface ISystemStatus {
|
||||||
storage: Storage;
|
storage: Storage;
|
||||||
database: Database;
|
database: Database;
|
||||||
redis: Redis;
|
redis: Redis;
|
||||||
task_executor_heartbeat: Record<string, TaskExecutorHeartbeatItem[]>;
|
// task_executor_heartbeat: Record<string, TaskExecutorHeartbeatItem[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Redis {
|
interface Redis {
|
||||||
|
|
|
@ -1,19 +1,13 @@
|
||||||
import SvgIcon from '@/components/svg-icon';
|
import SvgIcon from '@/components/svg-icon';
|
||||||
import { useFetchSystemStatus } from '@/hooks/user-setting-hooks';
|
import { useFetchSystemStatus } from '@/hooks/user-setting-hooks';
|
||||||
import {
|
import { ISystemStatus } from '@/interfaces/database/user-setting';
|
||||||
ISystemStatus,
|
import { toFixed } from '@/utils/common-util';
|
||||||
TaskExecutorHeartbeatItem,
|
|
||||||
} from '@/interfaces/database/user-setting';
|
|
||||||
import { Badge, Card, Flex, Spin, Typography } from 'antd';
|
import { Badge, Card, Flex, Spin, Typography } from 'antd';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import lowerCase from 'lodash/lowerCase';
|
import lowerCase from 'lodash/lowerCase';
|
||||||
import upperFirst from 'lodash/upperFirst';
|
import upperFirst from 'lodash/upperFirst';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
import { toFixed } from '@/utils/common-util';
|
|
||||||
import { isObject } from 'lodash';
|
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
import TaskBarChat from './task-bar-chat';
|
|
||||||
|
|
||||||
const { Text } = Typography;
|
const { Text } = Typography;
|
||||||
|
|
||||||
|
@ -28,11 +22,9 @@ const TitleMap = {
|
||||||
storage: 'Object Storage',
|
storage: 'Object Storage',
|
||||||
redis: 'Redis',
|
redis: 'Redis',
|
||||||
database: 'Database',
|
database: 'Database',
|
||||||
task_executor_heartbeats: 'Task Executor',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const IconMap = {
|
const IconMap = {
|
||||||
es: 'es',
|
|
||||||
doc_engine: 'storage',
|
doc_engine: 'storage',
|
||||||
redis: 'redis',
|
redis: 'redis',
|
||||||
storage: 'minio',
|
storage: 'minio',
|
||||||
|
@ -56,15 +48,16 @@ const SystemInfo = () => {
|
||||||
<Flex gap={16} vertical>
|
<Flex gap={16} vertical>
|
||||||
{Object.keys(systemStatus).map((key) => {
|
{Object.keys(systemStatus).map((key) => {
|
||||||
const info = systemStatus[key as keyof ISystemStatus];
|
const info = systemStatus[key as keyof ISystemStatus];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
type="inner"
|
type="inner"
|
||||||
title={
|
title={
|
||||||
<Flex align="center" gap={10}>
|
<Flex align="center" gap={10}>
|
||||||
{key === 'task_executor_heartbeats' ? (
|
{key === 'task_executor_heartbeats' ? (
|
||||||
<img src="/logo.svg" alt="" width={26} />
|
<div></div>
|
||||||
) : (
|
) : (
|
||||||
|
// <img src="/logo.svg" alt="" width={26} />
|
||||||
|
// 各组件Icon
|
||||||
<SvgIcon
|
<SvgIcon
|
||||||
name={IconMap[key as keyof typeof IconMap]}
|
name={IconMap[key as keyof typeof IconMap]}
|
||||||
width={26}
|
width={26}
|
||||||
|
@ -82,15 +75,7 @@ const SystemInfo = () => {
|
||||||
key={key}
|
key={key}
|
||||||
>
|
>
|
||||||
{key === 'task_executor_heartbeats' ? (
|
{key === 'task_executor_heartbeats' ? (
|
||||||
isObject(info) ? (
|
<div> </div>
|
||||||
<TaskBarChat
|
|
||||||
data={info as Record<string, TaskExecutorHeartbeatItem[]>}
|
|
||||||
></TaskBarChat>
|
|
||||||
) : (
|
|
||||||
<Text className={styles.error}>
|
|
||||||
{typeof info.error === 'string' ? info.error : ''}
|
|
||||||
</Text>
|
|
||||||
)
|
|
||||||
) : (
|
) : (
|
||||||
Object.keys(info)
|
Object.keys(info)
|
||||||
.filter((x) => x !== 'status')
|
.filter((x) => x !== 'status')
|
||||||
|
@ -103,6 +88,7 @@ const SystemInfo = () => {
|
||||||
className={styles.text}
|
className={styles.text}
|
||||||
>
|
>
|
||||||
<b>{upperFirst(lowerCase(x))}:</b>
|
<b>{upperFirst(lowerCase(x))}:</b>
|
||||||
|
{/* 卡片具体文字数值 */}
|
||||||
<Text
|
<Text
|
||||||
className={classNames({
|
className={classNames({
|
||||||
[styles.error]: x === 'error',
|
[styles.error]: x === 'error',
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
import { Domain } from '@/constants/common';
|
|
||||||
import { useTranslate } from '@/hooks/common-hooks';
|
import { useTranslate } from '@/hooks/common-hooks';
|
||||||
import { useLogout } from '@/hooks/login-hooks';
|
import { useLogout } from '@/hooks/login-hooks';
|
||||||
import { useSecondPathName } from '@/hooks/route-hook';
|
import { useSecondPathName } from '@/hooks/route-hook';
|
||||||
import { useFetchSystemVersion } from '@/hooks/user-setting-hooks';
|
|
||||||
import type { MenuProps } from 'antd';
|
import type { MenuProps } from 'antd';
|
||||||
import { Flex, Menu } from 'antd';
|
import { Flex, Menu } from 'antd';
|
||||||
import React, { useEffect, useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { useNavigate } from 'umi';
|
import { useNavigate } from 'umi';
|
||||||
import {
|
import {
|
||||||
UserSettingBaseKey,
|
UserSettingBaseKey,
|
||||||
|
@ -21,13 +19,6 @@ const SideBar = () => {
|
||||||
const pathName = useSecondPathName();
|
const pathName = useSecondPathName();
|
||||||
const { logout } = useLogout();
|
const { logout } = useLogout();
|
||||||
const { t } = useTranslate('setting');
|
const { t } = useTranslate('setting');
|
||||||
const { version, fetchSystemVersion } = useFetchSystemVersion();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (location.host !== Domain) {
|
|
||||||
fetchSystemVersion();
|
|
||||||
}
|
|
||||||
}, [fetchSystemVersion]);
|
|
||||||
|
|
||||||
function getItem(
|
function getItem(
|
||||||
label: string,
|
label: string,
|
||||||
|
@ -43,9 +34,7 @@ const SideBar = () => {
|
||||||
label: (
|
label: (
|
||||||
<Flex justify={'space-between'}>
|
<Flex justify={'space-between'}>
|
||||||
{t(label)}
|
{t(label)}
|
||||||
<span className={styles.version}>
|
<span className={styles.version}>{label === 'system'}</span>
|
||||||
{label === 'system' && version}
|
|
||||||
</span>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
),
|
),
|
||||||
type,
|
type,
|
||||||
|
|
Loading…
Reference in New Issue