Browse Source

(*)代码优化

master
peng.peng 2 years ago
parent
commit
5c9e3a6496
  1. 3
      api/app/lib/controllers/homepage/index.js
  2. 2
      web/client/src/sections/auth/containers/login.js
  3. 1
      web/client/src/sections/homePage/components/abnormalMonitoring.js
  4. 4
      web/client/src/sections/homePage/components/accessData.js
  5. 2
      web/client/src/sections/homePage/components/alarmList.js
  6. 2
      web/client/src/sections/homePage/components/centerTop.js
  7. 4
      web/client/src/sections/homePage/components/dataShare.js
  8. 2
      web/client/src/sections/homePage/components/public/carousel-list.js
  9. 2
      web/client/src/sections/homePage/nav-item.js

3
api/app/lib/controllers/homepage/index.js

@ -156,6 +156,7 @@ function getClusterInfo(opts) {
} }
} }
//获取restful统计信息
function getRestfulInfo(opts) { function getRestfulInfo(opts) {
return async function (ctx, next) { return async function (ctx, next) {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
@ -209,9 +210,9 @@ function getRestfulInfo(opts) {
} }
} }
//获取接入数据统计
function getAccessData(opts) { function getAccessData(opts) {
return async function (ctx, next) { return async function (ctx, next) {
const models = ctx.fs.dc.models;
try { try {
const projects = '2,35,37,45,70,111,170,187,210,275,276,279' const projects = '2,35,37,45,70,111,170,187,210,275,276,279'
const url = 'https://statistics.anxinyun.cn/statistic?projects=' + projects const url = 'https://statistics.anxinyun.cn/statistic?projects=' + projects

2
web/client/src/sections/auth/containers/login.js

@ -36,7 +36,7 @@ const Login = props => {
useEffect(() => { useEffect(() => {
if (user && user.authorized) { if (user && user.authorized) {
dispatch(push('/homePage')); user?.role == '数据消费者' ? dispatch(push('/metadataManagement/latestMetadata')) : dispatch(push('/homePage'));
} }
}, [user]) }, [user])

1
web/client/src/sections/homePage/components/abnormalMonitoring.js

@ -40,7 +40,6 @@ function AbnormalMonitoring(props) {
height={100} height={100}
multiellipsis multiellipsis
marginTop={-50} marginTop={-50}
// columnWidth={[200, 170, 120, 120]}
/> />
</div> </div>
} }

4
web/client/src/sections/homePage/components/accessData.js

@ -1,8 +1,8 @@
import React, { useEffect, useState } from 'react' import React from 'react'
import Box from './public/table-card'; import Box from './public/table-card';
import { useFsRequest } from '$utils'; import { useFsRequest } from '$utils';
import { mathRound } from './util' import { mathRound } from './util'
function AccessData(props) { function AccessData() {
const { data: accessdata = [] } = useFsRequest({ const { data: accessdata = [] } = useFsRequest({
url: 'homepage/accessdata', url: 'homepage/accessdata',

2
web/client/src/sections/homePage/components/alarmList.js

@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react' import React from 'react'
import Box from './public/table-card'; import Box from './public/table-card';
import CarouselList from './public/carousel-list'; import CarouselList from './public/carousel-list';
import { Tooltip } from 'antd'; import { Tooltip } from 'antd';

2
web/client/src/sections/homePage/components/centerTop.js

@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react' import React from 'react'
import './style.less' import './style.less'
function CenterTop(props) { function CenterTop(props) {

4
web/client/src/sections/homePage/components/dataShare.js

@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react' import React from 'react'
import Box from './public/table-card'; import Box from './public/table-card';
import { ApiTable, useFsRequest } from '$utils'; import { useFsRequest } from '$utils';
import { mathRound } from './util'; import { mathRound } from './util';
function DataShare(props) { function DataShare(props) {

2
web/client/src/sections/homePage/components/public/carousel-list.js

@ -1,7 +1,6 @@
/* 轮播列表组件 */ /* 轮播列表组件 */
import React from 'react'; import React from 'react';
import ScrollBoard from './scrollBoard'; import ScrollBoard from './scrollBoard';
// import { ScrollBoard } from '@jiaminghi/data-view-react';
import NoData from './noData'; import NoData from './noData';
import './index.less'; import './index.less';
function CarouselList(props) { function CarouselList(props) {
@ -26,7 +25,6 @@ function CarouselList(props) {
config={config} config={config}
style={{ height }} style={{ height }}
className={multiellipsis ? 'scroll-board-multi' : 'scroll-board'} className={multiellipsis ? 'scroll-board-multi' : 'scroll-board'}
// eslint-disable-next-line react/jsx-props-no-spreading
{...restProps} {...restProps}
/> />
) : <NoData marginTop={marginTop || 0} />; ) : <NoData marginTop={marginTop || 0} />;

2
web/client/src/sections/homePage/nav-item.js

@ -2,7 +2,7 @@ import React from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Menu } from 'antd'; import { Menu } from 'antd';
import { HomeOutlined } from '@ant-design/icons'; import { HomeOutlined } from '@ant-design/icons';
export function getNavItem({ user }) { export function getNavItem(user) {
return ( return (
user?.role == '系统管理员' && <Menu.Item key="homePage" icon={<HomeOutlined />}> user?.role == '系统管理员' && <Menu.Item key="homePage" icon={<HomeOutlined />}>
<Link to="/homePage">数据监控平台</Link> <Link to="/homePage">数据监控平台</Link>

Loading…
Cancel
Save