Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Remove git authentication requirement for secrets in SaaS mode (#10903)

sp.wack831084df4c61
diff --git a/frontend/__tests__/routes/secrets-settings.test.tsx b/frontend/__tests__/routes/secrets-settings.test.tsx
index 47b1b09dec..08c7d6f65b 100644
--- a/frontend/__tests__/routes/secrets-settings.test.tsx
+++ b/frontend/__tests__/routes/secrets-settings.test.tsx
@@ -86,28 +86,21 @@ describe("Content", () => {
expect(screen.queryByTestId("connect-git-button")).not.toBeInTheDocument();
});
- it("should render a button to connect with git if they havent already in saas", async () => {
+ it("should render add secret button in saas mode", async () => {
const getConfigSpy = vi.spyOn(OpenHands, "getConfig");
- const getSettingsSpy = vi.spyOn(OpenHands, "getSettings");
const getSecretsSpy = vi.spyOn(SecretsService, "getSecrets");
// @ts-expect-error - only return the config we need
getConfigSpy.mockResolvedValue({
APP_MODE: "saas",
});
- getSettingsSpy.mockResolvedValue({
- ...MOCK_DEFAULT_USER_SETTINGS,
- provider_tokens_set: {},
- });
renderSecretsSettings();
- // In SAAS mode, getSecrets is still called because the user is authenticated
+ // In SAAS mode, getSecrets is called and add secret button should be available
await waitFor(() => expect(getSecretsSpy).toHaveBeenCalled());
- await waitFor(() =>
- expect(screen.queryByTestId("add-secret-button")).not.toBeInTheDocument(),
- );
- const button = await screen.findByTestId("connect-git-button");
- expect(button).toHaveAttribute("href", "/settings/integrations");
+ const button = await screen.findByTestId("add-secret-button");
+ expect(button).toBeInTheDocument();
+ expect(screen.queryByTestId("connect-git-button")).not.toBeInTheDocument();
});
it("should render an empty table when there are no existing secrets", async () => {
diff --git a/frontend/src/routes/secrets-settings.tsx b/frontend/src/routes/secrets-settings.tsx
index 83114627b9..a86f5acf31 100644
--- a/frontend/src/routes/secrets-settings.tsx
+++ b/frontend/src/routes/secrets-settings.tsx
@@ -1,6 +1,5 @@
import { useQueryClient } from "@tanstack/react-query";
import React from "react";
-import { Link } from "react-router";
import { useTranslation } from "react-i18next";
import { useGetSecrets } from "#/hooks/query/use-get-secrets";
import { useDeleteSecret } from "#/hooks/mutation/use-delete-secret";
@@ -12,21 +11,14 @@ import {
import { BrandButton } from "#/components/features/settings/brand-button";
import { ConfirmationModal } from "#/components/shared/modals/confirmation-modal";
import { GetSecretsResponse } from "#/api/secrets-service.types";
-import { useUserProviders } from "#/hooks/use-user-providers";
import { I18nKey } from "#/i18n/declaration";
-import { useConfig } from "#/hooks/query/use-config";
function SecretsSettingsScreen() {
const queryClient = useQueryClient();
const { t } = useTranslation();
- const { data: config } = useConfig();
const { data: secrets, isLoading: isLoadingSecrets } = useGetSecrets();
const { mutate: deleteSecret } = useDeleteSecret();
- const { providers } = useUserProviders();
-
- const isSaas = config?.APP_MODE === "saas";
- const hasProviderSet = providers.length > 0;
const [view, setView] = React.useState<
"list" | "add-secret-form" | "edit-secret-form"
@@ -69,8 +61,6 @@ function SecretsSettingsScreen() {
setConfirmationModalIsVisible(false);
};
- const shouldRenderConnectToGitButton = isSaas && !hasProviderSet;
-
return (
<div
data-testid="secrets-settings-screen"
@@ -84,20 +74,7 @@ function SecretsSettingsScreen() {
</ul>
)}
- {shouldRenderConnectToGitButton && (
- <Link
- to="/settings/integrations"
- data-testid="connect-git-button"
- type="button"
- className="self-start"
- >
- <BrandButton type="button" variant="secondary">
- {t(I18nKey.SECRETS$CONNECT_GIT_PROVIDER)}
- </BrandButton>
- </Link>
- )}
-
- {!shouldRenderConnectToGitButton && view === "list" && (
+ {view === "list" && (
<BrandButton
testId="add-secret-button"
type="button"