mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-08 04:00:51 +08:00
feat: add a loading animation in DashboardPage (#4117)
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import {ArrowUpOutlined} from "@ant-design/icons";
|
import {ArrowUpOutlined} from "@ant-design/icons";
|
||||||
import {Card, Col, Row, Statistic, Tour} from "antd";
|
import {Card, Col, Row, Spin, Statistic, Tour} from "antd";
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
@@ -74,6 +74,8 @@ const Dashboard = (props) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setDashboardData(null);
|
||||||
|
|
||||||
const organization = getOrganizationName();
|
const organization = getOrganizationName();
|
||||||
DashboardBackend.getDashboard(organization).then((res) => {
|
DashboardBackend.getDashboard(organization).then((res) => {
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
@@ -110,11 +112,22 @@ const Dashboard = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const renderEChart = () => {
|
const renderEChart = () => {
|
||||||
|
const chartDom = document.getElementById("echarts-chart");
|
||||||
|
|
||||||
if (dashboardData === null) {
|
if (dashboardData === null) {
|
||||||
return;
|
if (chartDom) {
|
||||||
|
const instance = echarts.getInstanceByDom(chartDom);
|
||||||
|
if (instance) {
|
||||||
|
instance.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div style={{display: "flex", justifyContent: "center", alignItems: "center"}}>
|
||||||
|
<Spin size="large" tip={i18next.t("login:Loading")} style={{paddingTop: "10%"}} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const chartDom = document.getElementById("echarts-chart");
|
|
||||||
const myChart = echarts.init(chartDom);
|
const myChart = echarts.init(chartDom);
|
||||||
const currentDate = new Date();
|
const currentDate = new Date();
|
||||||
const dateArray = [];
|
const dateArray = [];
|
||||||
|
Reference in New Issue
Block a user