diff --git a/spug_api/apps/home/views.py b/spug_api/apps/home/views.py index 45f9446..22938d9 100644 --- a/spug_api/apps/home/views.py +++ b/spug_api/apps/home/views.py @@ -62,7 +62,7 @@ def get_request(request): data = {x.id: {'name': x.name, 'count': 0} for x in App.objects.all()} for req in DeployRequest.objects.filter(created_at__gt=s_date, created_at__lt=e_date): data[req.deploy.app_id]['count'] += 1 - data = sorted(data.values(), key=lambda x: x['count'], reverse=True)[:10] + data = sorted(data.values(), key=lambda x: x['count'], reverse=True)[:20] return json_response(data) return json_response(error=error) diff --git a/spug_web/src/pages/dashboard/LoginActive.js b/spug_web/src/pages/dashboard/LoginActive.js deleted file mode 100644 index d26fe29..0000000 --- a/spug_web/src/pages/dashboard/LoginActive.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) OpenSpug Organization. https://github.com/openspug/spug - * Copyright (c) - * Released under the AGPL-3.0 License. - */ -import React, { useState, useEffect } from 'react'; -import { Card, List, Tag } from 'antd'; -import { http } from 'libs'; -import styles from './index.module.css'; - -export default function () { - const [name, setName] = useState(null); - const [ip, setIp] = useState(null); - const [rawData, setRawData] = useState([]); - const [dataSource, setDataSource] = useState([]); - const [loading, setLoading] = useState(true); - - useEffect(() => { - http.get('/api/account/login/history/') - .then(res => setRawData(res)) - .finally(() => setLoading(false)) - }, []) - - useEffect(() => { - let data = rawData; - if (name) data = data.filter(x => x.nickname === name); - if (ip) data = data.filter(x => x.ip === ip); - setDataSource(data) - }, [name, ip, rawData]) - - return ( - - {name !== null && setName(null)}>{name}} - {ip !== null && setIp(null)}>{ip}} - - )}> - ( - - {item.created_at} - setName(item.nickname)}>{item.nickname} - 通过 - setIp(item.ip)}>{item.ip} - 登录 - - )}/> - - ) -} diff --git a/spug_web/src/pages/dashboard/RequestTop.js b/spug_web/src/pages/dashboard/RequestTop.js index db22eaa..2beaed2 100644 --- a/spug_web/src/pages/dashboard/RequestTop.js +++ b/spug_web/src/pages/dashboard/RequestTop.js @@ -50,7 +50,7 @@ export default function () { } return ( - handleClick('day')}>今日 diff --git a/spug_web/src/pages/dashboard/index.js b/spug_web/src/pages/dashboard/index.js index 7445929..3273bd3 100644 --- a/spug_web/src/pages/dashboard/index.js +++ b/spug_web/src/pages/dashboard/index.js @@ -4,12 +4,10 @@ * Released under the AGPL-3.0 License. */ import React from 'react'; -import { Row, Col } from 'antd'; import { AuthDiv } from 'components'; import StatisticsCard from './StatisticCard'; import AlarmTrend from './AlarmTrend'; import RequestTop from './RequestTop'; -import LoginActive from './LoginActive'; class HomeIndex extends React.Component { render() { @@ -17,14 +15,7 @@ class HomeIndex extends React.Component { - - - - - - - - + ) }