mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 14:57:59 -05:00
Remove the "No secrets found" which is unnecessary (#10126)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
@@ -112,12 +112,21 @@ describe("Content", () => {
|
||||
screen.getByTestId("git-settings-screen");
|
||||
});
|
||||
|
||||
it("should render a message if there are no existing secrets", async () => {
|
||||
it("should render an empty table when there are no existing secrets", async () => {
|
||||
const getSecretsSpy = vi.spyOn(SecretsService, "getSecrets");
|
||||
getSecretsSpy.mockResolvedValue([]);
|
||||
renderSecretsSettings();
|
||||
|
||||
await screen.findByTestId("no-secrets-message");
|
||||
// Should show the add secret button
|
||||
await screen.findByTestId("add-secret-button");
|
||||
|
||||
// Should show an empty table with headers but no secret items
|
||||
expect(screen.queryAllByTestId("secret-item")).toHaveLength(0);
|
||||
|
||||
// Should still show the table headers
|
||||
expect(screen.getByText("SETTINGS$NAME")).toBeInTheDocument();
|
||||
expect(screen.getByText("SECRETS$DESCRIPTION")).toBeInTheDocument();
|
||||
expect(screen.getByText("SETTINGS$ACTIONS")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should render existing secrets", async () => {
|
||||
@@ -127,7 +136,6 @@ describe("Content", () => {
|
||||
|
||||
const secrets = await screen.findAllByTestId("secret-item");
|
||||
expect(secrets).toHaveLength(2);
|
||||
expect(screen.queryByTestId("no-secrets-message")).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -399,19 +407,22 @@ describe("Secret actions", () => {
|
||||
expect(screen.queryByText("My_Secret_2")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should hide the no items message when in form view", async () => {
|
||||
it("should hide the table and add button when in form view", async () => {
|
||||
const getSecretsSpy = vi.spyOn(SecretsService, "getSecrets");
|
||||
getSecretsSpy.mockResolvedValue([]);
|
||||
renderSecretsSettings();
|
||||
|
||||
// render form & hide items
|
||||
expect(screen.queryByTestId("no-secrets-message")).not.toBeInTheDocument();
|
||||
// Initially should show the add button and table
|
||||
const button = await screen.findByTestId("add-secret-button");
|
||||
expect(screen.getByText("SETTINGS$NAME")).toBeInTheDocument(); // table header
|
||||
|
||||
await userEvent.click(button);
|
||||
|
||||
// When in form view, should hide the add button and table
|
||||
const secretForm = screen.getByTestId("add-secret-form");
|
||||
expect(secretForm).toBeInTheDocument();
|
||||
expect(screen.queryByTestId("no-secrets-message")).not.toBeInTheDocument();
|
||||
expect(screen.queryByTestId("add-secret-button")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("SETTINGS$NAME")).not.toBeInTheDocument(); // table header should be hidden
|
||||
});
|
||||
|
||||
it("should not allow spaces in secret names", async () => {
|
||||
|
||||
@@ -44,7 +44,6 @@ export enum I18nKey {
|
||||
SECRETS$SECRET_VALUE_REQUIRED = "SECRETS$SECRET_VALUE_REQUIRED",
|
||||
SECRETS$ADD_SECRET = "SECRETS$ADD_SECRET",
|
||||
SECRETS$EDIT_SECRET = "SECRETS$EDIT_SECRET",
|
||||
SECRETS$NO_SECRETS_FOUND = "SECRETS$NO_SECRETS_FOUND",
|
||||
SECRETS$ADD_NEW_SECRET = "SECRETS$ADD_NEW_SECRET",
|
||||
SECRETS$CONFIRM_DELETE_KEY = "SECRETS$CONFIRM_DELETE_KEY",
|
||||
SETTINGS$MCP_TITLE = "SETTINGS$MCP_TITLE",
|
||||
|
||||
@@ -703,22 +703,6 @@
|
||||
"de": "Geheimnis bearbeiten",
|
||||
"uk": "Редагувати секрет"
|
||||
},
|
||||
"SECRETS$NO_SECRETS_FOUND": {
|
||||
"en": "No secrets found",
|
||||
"ja": "シークレットが見つかりません",
|
||||
"zh-CN": "未找到密钥",
|
||||
"zh-TW": "未找到密鑰",
|
||||
"ko-KR": "비밀을 찾을 수 없습니다",
|
||||
"no": "Ingen hemmeligheter funnet",
|
||||
"it": "Nessun segreto trovato",
|
||||
"pt": "Nenhum segredo encontrado",
|
||||
"es": "No se encontraron secretos",
|
||||
"ar": "لم يتم العثور على أسرار",
|
||||
"fr": "Aucun secret trouvé",
|
||||
"tr": "Gizli bulunamadı",
|
||||
"de": "Keine Geheimnisse gefunden",
|
||||
"uk": "Секретів не знайдено"
|
||||
},
|
||||
"SECRETS$ADD_NEW_SECRET": {
|
||||
"en": "Add a new secret",
|
||||
"ja": "新しいシークレットを追加",
|
||||
|
||||
@@ -96,10 +96,6 @@ function SecretsSettingsScreen() {
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{secrets?.length === 0 && view === "list" && (
|
||||
<p data-testid="no-secrets-message">{t("SECRETS$NO_SECRETS_FOUND")}</p>
|
||||
)}
|
||||
|
||||
{!shouldRenderConnectToGitButton && view === "list" && (
|
||||
<BrandButton
|
||||
testId="add-secret-button"
|
||||
|
||||
Reference in New Issue
Block a user