Skip to content

Commit fb89d41

Browse files
[dashboard] Don't show User Notifications and Feedback on Dedicated (#20583)
* [dashboard] Don't show User Notifications and Feedback on Dedicated Tool: gitpod/catfood.gitpod.cloud * fix import Tool: gitpod/catfood.gitpod.cloud * Fixe-da-imports-a Tool: gitpod/catfood.gitpod.cloud * Fix second place where Feedback menu item appears Tool: gitpod/catfood.gitpod.cloud
1 parent ba2f367 commit fb89d41

14 files changed

+55
-32
lines changed

components/dashboard/src/Insights.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { useTemporaryState } from "./hooks/use-temporary-value";
2626
import { DownloadIcon } from "lucide-react";
2727
import { Button } from "@podkit/buttons/Button";
2828
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@podkit/dropdown/DropDown";
29-
import { useInstallationConfiguration } from "./data/installation/default-workspace-image-query";
29+
import { useInstallationConfiguration } from "./data/installation/installation-config-query";
3030

3131
export const Insights = () => {
3232
const toDate = useMemo(() => Timestamp.fromDate(new Date()), []);

components/dashboard/src/data/installation/default-workspace-image-query.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,3 @@ export const useInstallationDefaultWorkspaceImageQuery = () => {
1717
},
1818
});
1919
};
20-
21-
export const useInstallationConfiguration = () => {
22-
return useQuery({
23-
queryKey: ["installation-configuration"],
24-
staleTime: 1000 * 60 * 10, // 10 minute
25-
queryFn: async () => {
26-
const response = await installationClient.getInstallationConfiguration({});
27-
return response.configuration;
28-
},
29-
});
30-
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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 { useQuery } from "@tanstack/react-query";
8+
import { installationClient } from "../../service/public-api";
9+
10+
export const useInstallationConfiguration = () => {
11+
return useQuery({
12+
queryKey: ["installation-configuration"],
13+
staleTime: 1000 * 60 * 30, // 30 minutes
14+
cacheTime: 1000 * 60 * 60 * 24, // 24 hours
15+
queryFn: async () => {
16+
const response = await installationClient.getInstallationConfiguration({});
17+
return response.configuration;
18+
},
19+
});
20+
};

components/dashboard/src/dedicated-setup/use-needs-setup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import { useQuery } from "@tanstack/react-query";
88
import { noPersistence } from "../data/setup";
99
import { installationClient } from "../service/public-api";
1010
import { GetOnboardingStateRequest } from "@gitpod/public-api/lib/gitpod/v1/installation_pb";
11-
import { useInstallationConfiguration } from "../data/installation/default-workspace-image-query";
11+
import { useInstallationConfiguration } from "../data/installation/installation-config-query";
1212

1313
/**
14-
* @description Returns a flage stating if the current installation still needs setup before it can be used. Also returns an isLoading indicator as the check is async
14+
* @description Returns a flag stating if the current installation still needs setup before it can be used. Also returns an isLoading indicator as the check is async
1515
*/
1616
export const useNeedsSetup = () => {
1717
const { data: onboardingState, isLoading } = useOnboardingState();

components/dashboard/src/dedicated-setup/use-show-dedicated-setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import { useQueryParams } from "../hooks/use-query-params";
88
import { useCallback, useState } from "react";
99
import { isCurrentHostExcludedFromSetup, useNeedsSetup } from "./use-needs-setup";
10-
import { useInstallationConfiguration } from "../data/installation/default-workspace-image-query";
10+
import { useInstallationConfiguration } from "../data/installation/installation-config-query";
1111

1212
const FORCE_SETUP_PARAM = "dedicated-setup";
1313
const FORCE_SETUP_PARAM_VALUE = "force";

components/dashboard/src/menu/Menu.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ import { Separator } from "../components/Separator";
1515
import PillMenuItem from "../components/PillMenuItem";
1616
import { PaymentContext } from "../payment-context";
1717
import FeedbackFormModal from "../feedback-form/FeedbackModal";
18-
import { isGitpodIo } from "../utils";
1918
import OrganizationSelector from "./OrganizationSelector";
2019
import { getAdminTabs } from "../admin/admin.routes";
2120
import classNames from "classnames";
2221
import { User, RoleOrPermission } from "@gitpod/public-api/lib/gitpod/v1/user_pb";
2322
import { getPrimaryEmail } from "@gitpod/public-api-common/lib/user-utils";
2423
import { ConfigurationsMigrationCoachmark } from "../repositories/coachmarks/MigrationCoachmark";
24+
import { useInstallationConfiguration } from "../data/installation/installation-config-query";
2525

2626
interface Entry {
2727
title: string;
@@ -35,6 +35,9 @@ export default function Menu() {
3535
const { setCurrency } = useContext(PaymentContext);
3636
const [isFeedbackFormVisible, setFeedbackFormVisible] = useState<boolean>(false);
3737

38+
const { data: installationConfig, isLoading: isInstallationConfigLoading } = useInstallationConfiguration();
39+
const isGitpodIo = isInstallationConfigLoading ? false : !installationConfig?.isDedicatedInstallation;
40+
3841
useEffect(() => {
3942
const { server } = getGitpodService();
4043
server.getClientRegion().then((v) => {
@@ -95,7 +98,7 @@ export default function Menu() {
9598
/>
9699
</li>
97100
)}
98-
{isGitpodIo() && (
101+
{isGitpodIo && (
99102
<li className="cursor-pointer">
100103
<PillMenuItem name="Feedback" onClick={handleFeedbackFormClick} />
101104
</li>
@@ -163,6 +166,9 @@ type UserMenuProps = {
163166
onFeedback?: () => void;
164167
};
165168
const UserMenu: FC<UserMenuProps> = ({ user, className, withAdminLink, withFeedbackLink, onFeedback }) => {
169+
const { data: installationConfig, isLoading: isInstallationConfigLoading } = useInstallationConfiguration();
170+
const isGitpodIo = isInstallationConfigLoading ? false : !installationConfig?.isDedicatedInstallation;
171+
166172
const extraSection = useMemo(() => {
167173
const items: ContextMenuEntry[] = [];
168174

@@ -172,7 +178,7 @@ const UserMenu: FC<UserMenuProps> = ({ user, className, withAdminLink, withFeedb
172178
link: "/admin",
173179
});
174180
}
175-
if (withFeedbackLink && isGitpodIo()) {
181+
if (withFeedbackLink && isGitpodIo) {
176182
items.push({
177183
title: "Feedback",
178184
onClick: onFeedback,
@@ -185,7 +191,7 @@ const UserMenu: FC<UserMenuProps> = ({ user, className, withAdminLink, withFeedb
185191
}
186192

187193
return items;
188-
}, [onFeedback, user?.rolesOrPermissions, withAdminLink, withFeedbackLink]);
194+
}, [isGitpodIo, onFeedback, user?.rolesOrPermissions, withAdminLink, withFeedbackLink]);
189195

190196
const menuEntries = useMemo(() => {
191197
return [

components/dashboard/src/menu/OrganizationSelector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import { useOrgBillingMode } from "../data/billing-mode/org-billing-mode-query";
1414
import { useIsOwner, useListOrganizationMembers, useHasRolePermission } from "../data/organizations/members-query";
1515
import { isAllowedToCreateOrganization } from "@gitpod/public-api-common/lib/user-utils";
1616
import { OrganizationRole } from "@gitpod/public-api/lib/gitpod/v1/organization_pb";
17-
import { useInstallationConfiguration } from "../data/installation/default-workspace-image-query";
1817
import { useFeatureFlag } from "../data/featureflag-query";
1918
import { PlusIcon } from "lucide-react";
19+
import { useInstallationConfiguration } from "../data/installation/installation-config-query";
2020

2121
export default function OrganizationSelector() {
2222
const user = useCurrentUser();

components/dashboard/src/teams/OrgSettingsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { useCurrentOrg } from "../data/organizations/orgs-query";
1515
import { useFeatureFlag } from "../data/featureflag-query";
1616
import { Organization } from "@gitpod/public-api/lib/gitpod/v1/organization_pb";
1717
import { useIsOwner } from "../data/organizations/members-query";
18-
import { useInstallationConfiguration } from "../data/installation/default-workspace-image-query";
18+
import { useInstallationConfiguration } from "../data/installation/installation-config-query";
1919

2020
export interface OrgSettingsPageProps {
2121
children: React.ReactNode;

components/dashboard/src/teams/policies/MaxParallelWorkspaces.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { NumberInput } from "../../components/forms/TextInputField";
1313
import { LoadingButton } from "@podkit/buttons/LoadingButton";
1414
import { MAX_PARALLEL_WORKSPACES_FREE, MAX_PARALLEL_WORKSPACES_PAID } from "@gitpod/gitpod-protocol";
1515
import { PlainMessage } from "@bufbuild/protobuf";
16-
import { useInstallationConfiguration } from "../../data/installation/default-workspace-image-query";
16+
import { useInstallationConfiguration } from "../../data/installation/installation-config-query";
1717

1818
type Props = {
1919
isOwner: boolean;

components/dashboard/src/user-settings/PageWithSettingsSubMenu.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import { PageWithSubMenu } from "../components/PageWithSubMenu";
8+
import { useInstallationConfiguration } from "../data/installation/installation-config-query";
89
import {
910
settingsPathAccount,
1011
settingsPathIntegrations,
@@ -23,24 +24,31 @@ export interface PageWithAdminSubMenuProps {
2324
}
2425

2526
export function PageWithSettingsSubMenu({ children }: PageWithAdminSubMenuProps) {
26-
const settingsMenu = getSettingsMenu();
27+
const settingsMenu = useUserSettingsMenu();
2728
return (
2829
<PageWithSubMenu subMenu={settingsMenu} title="User Settings" subtitle="Manage your personal account settings.">
2930
{children}
3031
</PageWithSubMenu>
3132
);
3233
}
3334

34-
function getSettingsMenu() {
35+
function useUserSettingsMenu() {
36+
const { data: installationConfig } = useInstallationConfiguration();
37+
const isGitpodIo = installationConfig?.isDedicatedInstallation === false;
38+
3539
return [
3640
{
3741
title: "Account",
3842
link: [settingsPathAccount, settingsPathMain],
3943
},
40-
{
41-
title: "Notifications",
42-
link: [settingsPathNotifications],
43-
},
44+
...(isGitpodIo
45+
? [
46+
{
47+
title: "Notifications",
48+
link: [settingsPathNotifications],
49+
},
50+
]
51+
: []),
4452
{
4553
title: "Variables",
4654
link: [settingsPathVariables],

components/dashboard/src/workspaces/CreateWorkspacePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import { flattenPagedConfigurations } from "../data/git-providers/unified-reposi
5959
import { Configuration } from "@gitpod/public-api/lib/gitpod/v1/configuration_pb";
6060
import { useMemberRole } from "../data/organizations/members-query";
6161
import { OrganizationPermission } from "@gitpod/public-api/lib/gitpod/v1/organization_pb";
62-
import { useInstallationConfiguration } from "../data/installation/default-workspace-image-query";
62+
import { useInstallationConfiguration } from "../data/installation/installation-config-query";
6363

6464
type NextLoadOption = "searchParams" | "autoStart" | "allDone";
6565

components/dashboard/src/workspaces/EmptyWorkspacesContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Heading2, Subheading } from "@podkit/typography/Headings";
99
import { StartWorkspaceModalKeyBinding } from "../App";
1010
import { VideoSection } from "../onboarding/VideoSection";
1111
import { trackVideoClick } from "../Analytics";
12-
import { useInstallationConfiguration } from "../data/installation/default-workspace-image-query";
12+
import { useInstallationConfiguration } from "../data/installation/installation-config-query";
1313

1414
export const EmptyWorkspacesContent = () => {
1515
const { data: installationConfig } = useInstallationConfiguration();

components/dashboard/src/workspaces/Workspaces.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ import Modal, { ModalBaseFooter, ModalBody, ModalHeader } from "../components/Mo
3232
import { VideoSection } from "../onboarding/VideoSection";
3333
import { trackVideoClick } from "../Analytics";
3434
import { cn } from "@podkit/lib/cn";
35-
import { useInstallationConfiguration } from "../data/installation/default-workspace-image-query";
3635
import { useUpdateCurrentUserMutation } from "../data/current-user/update-mutation";
3736
import { useUserLoader } from "../hooks/use-user-loader";
3837
import Tooltip from "../components/Tooltip";
3938
import { useFeatureFlag } from "../data/featureflag-query";
39+
import { useInstallationConfiguration } from "../data/installation/installation-config-query";
4040
import { SuggestedOrgRepository, useOrgSuggestedRepos } from "../data/organizations/suggested-repositories-query";
4141
import { useSuggestedRepositories } from "../data/git-providers/suggested-repositories-query";
4242
import PillLabel from "../components/PillLabel";

components/dashboard/src/workspaces/WorkspacesSearchBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { StartWorkspaceModalKeyBinding } from "../App";
99
import DropDown from "../components/DropDown";
1010
import search from "../icons/search.svg";
1111
import { LinkButton } from "@podkit/buttons/LinkButton";
12-
import { useInstallationConfiguration } from "../data/installation/default-workspace-image-query";
12+
import { useInstallationConfiguration } from "../data/installation/installation-config-query";
1313

1414
type WorkspacesSearchBarProps = {
1515
searchTerm: string;

0 commit comments

Comments
 (0)