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