From 8d6c41003cb0888502f2837411edde30f56b69a9 Mon Sep 17 00:00:00 2001 From: Huiwen Date: Thu, 21 Sep 2023 12:52:03 +0000 Subject: [PATCH] [dashboard] add org image warning to start workspace page --- components/dashboard/src/start/StartWorkspace.tsx | 15 +++++++++++++++ components/dashboard/src/teams/TeamSettings.tsx | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/components/dashboard/src/start/StartWorkspace.tsx b/components/dashboard/src/start/StartWorkspace.tsx index 8f8291279e8570..9c0726ab78c5db 100644 --- a/components/dashboard/src/start/StartWorkspace.tsx +++ b/components/dashboard/src/start/StartWorkspace.tsx @@ -30,6 +30,7 @@ import { StartPage, StartPhase, StartWorkspaceError } from "./StartPage"; import ConnectToSSHModal from "../workspaces/ConnectToSSHModal"; import Alert from "../components/Alert"; import { workspacesService } from "../service/public-api"; +import { useDefaultWorkspaceImageQuery } from "../data/workspaces/default-workspace-image-query"; const sessionId = v4(); @@ -708,6 +709,7 @@ export default class StartWorkspace extends React.ComponentOpen Workspace + ); break; @@ -806,3 +808,16 @@ function ImageBuildView(props: ImageBuildViewProps) { ); } + +function OrgDefaultWorkspaceWarningView(props: { workspaceId: string }) { + const { data: imageInfo } = useDefaultWorkspaceImageQuery(props.workspaceId); + if (imageInfo?.source === "installation") { + return null; + } + return ( + + A custom default workspace image is set for this organization. Contact + an organization owner or specify a different image in .gitpod.yml. + + ); +} diff --git a/components/dashboard/src/teams/TeamSettings.tsx b/components/dashboard/src/teams/TeamSettings.tsx index 780946c6b1830e..33a2abe2adf6a9 100644 --- a/components/dashboard/src/teams/TeamSettings.tsx +++ b/components/dashboard/src/teams/TeamSettings.tsx @@ -172,7 +172,7 @@ export default function TeamSettingsPage() { function OrgSettingsForm(props: { org?: OrganizationInfo }) { const { org } = props; const { data: settings, isLoading } = useOrgSettingsQuery(); - const { data: globalDefaultImage } = useDefaultWorkspaceImageQuery(); + const { data: imageInfo } = useDefaultWorkspaceImageQuery(); const updateTeamSettings = useUpdateOrgSettingsMutation(); const [showImageEditModal, setShowImageEditModal] = useState(false); @@ -229,14 +229,14 @@ function OrgSettingsForm(props: { org?: OrganizationInfo }) { setShowImageEditModal(true)} /> {showImageEditModal && ( setShowImageEditModal(false)} /> )}