mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
fix: show selected organizations' statistics in dashboard page (#2805)
* fix: show selected organizations' statistics in dashboard page * Update get-dashboard.go * Update saml_idp.go --------- Co-authored-by: Eric Luo <hsluoyz@qq.com>
This commit is contained in:
parent
e1e5943a3e
commit
2cb6ff69ae
@ -31,6 +31,11 @@ const Dashboard = (props) => {
|
|||||||
return () => window.removeEventListener("storageTourChanged", handleTourChange);
|
return () => window.removeEventListener("storageTourChanged", handleTourChange);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
window.addEventListener("storageOrganizationChanged", handleOrganizationChange);
|
||||||
|
return () => window.removeEventListener("storageOrganizationChanged", handleOrganizationChange);
|
||||||
|
}, [props.owner]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (!Setting.isLocalAdminUser(props.account)) {
|
if (!Setting.isLocalAdminUser(props.account)) {
|
||||||
props.history.push("/apps");
|
props.history.push("/apps");
|
||||||
@ -54,6 +59,22 @@ const Dashboard = (props) => {
|
|||||||
setIsTourVisible(TourConfig.getTourVisible());
|
setIsTourVisible(TourConfig.getTourVisible());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleOrganizationChange = () => {
|
||||||
|
if (!Setting.isLocalAdminUser(props.account)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newOrganization = localStorage.getItem("organization") === "All" ? "" : localStorage.getItem("organization");
|
||||||
|
|
||||||
|
DashboardBackend.getDashboard(newOrganization).then((res) => {
|
||||||
|
if (res.status === "ok") {
|
||||||
|
setDashboardData(res.data);
|
||||||
|
} else {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const setIsTourToLocal = () => {
|
const setIsTourToLocal = () => {
|
||||||
TourConfig.setIsTourVisible(false);
|
TourConfig.setIsTourVisible(false);
|
||||||
setIsTourVisible(false);
|
setIsTourVisible(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user