Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/dashboard/src/org-admin/AdminPage.tsx
2499 views
1
/**
2
* Copyright (c) 2025 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import React, { useEffect } from "react";
8
import { useHistory } from "react-router-dom";
9
import { useUserLoader } from "../hooks/use-user-loader";
10
import { useCurrentOrg } from "../data/organizations/orgs-query";
11
import { useIsOwner } from "../data/organizations/members-query";
12
import Header from "../components/Header";
13
import { SpinnerLoader } from "../components/Loader";
14
import { RunningWorkspacesCard } from "./RunningWorkspacesCard";
15
import { MaintenanceModeCard } from "./MaintenanceModeCard";
16
import { MaintenanceNotificationCard } from "./MaintenanceNotificationCard";
17
import { Heading2 } from "@podkit/typography/Headings";
18
19
const AdminPage: React.FC = () => {
20
const history = useHistory();
21
const { loading: userLoading } = useUserLoader();
22
const { data: currentOrg, isLoading: orgLoading } = useCurrentOrg();
23
const isOwner = useIsOwner();
24
25
useEffect(() => {
26
if (userLoading || orgLoading) {
27
return;
28
}
29
if (!isOwner) {
30
history.replace("/workspaces");
31
}
32
}, [isOwner, userLoading, orgLoading, history, currentOrg?.id]);
33
34
return (
35
<div className="flex flex-col w-full">
36
<Header title="Organization Administration" subtitle="Manage Infrastructure Rollouts" />
37
<div className="app-container py-6 flex flex-col gap-4">
38
<Heading2>Infrastructure Rollout</Heading2>
39
40
{userLoading ||
41
orgLoading ||
42
(!isOwner && (
43
<div className="flex items-center justify-center w-full p-8">
44
<SpinnerLoader />
45
</div>
46
))}
47
48
{!orgLoading && !currentOrg && (
49
<div className="text-red-500 p-4 bg-red-100 dark:bg-red-900 border border-red-500 rounded-md">
50
Could not load organization details. Please ensure you are part of an organization.
51
</div>
52
)}
53
54
{currentOrg && (
55
<>
56
<MaintenanceNotificationCard />
57
<MaintenanceModeCard />
58
<RunningWorkspacesCard />
59
</>
60
)}
61
</div>
62
</div>
63
);
64
};
65
66
export default AdminPage;
67
68