Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Remove dead frontend exports (#13891)

Tim O'Farrella06b9ccffa2c
diff --git a/frontend/__tests__/utils/is-number.test.ts b/frontend/__tests__/utils/is-number.test.ts
deleted file mode 100644
index 9291080357..0000000000
--- a/frontend/__tests__/utils/is-number.test.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { test, expect } from "vitest";
-import { isNumber } from "../../src/utils/is-number";
-
-test("isNumber", () => {
- expect(isNumber(1)).toBe(true);
- expect(isNumber(0)).toBe(true);
- expect(isNumber("3")).toBe(true);
- expect(isNumber("0")).toBe(true);
-});
diff --git a/frontend/__tests__/utils/utils.test.ts b/frontend/__tests__/utils/utils.test.ts
index 8fc286d4b1..268064d6df 100644
--- a/frontend/__tests__/utils/utils.test.ts
+++ b/frontend/__tests__/utils/utils.test.ts
@@ -1,9 +1,4 @@
import { describe, it, expect, vi, test } from "vitest";
-import {
- formatTimestamp,
- getExtension,
- removeApiKey,
-} from "../../src/utils/utils";
import { getStatusText } from "#/utils/utils";
import { AgentState } from "#/types/agent-state";
import { I18nKey } from "#/i18n/declaration";
@@ -22,25 +17,6 @@ const t = (key: string) => {
return translations[key] || key;
};
-test("removeApiKey", () => {
- const data = [{ args: { LLM_API_KEY: "key", LANGUAGE: "en" } }];
- expect(removeApiKey(data)).toEqual([{ args: { LANGUAGE: "en" } }]);
-});
-
-test("getExtension", () => {
- expect(getExtension("main.go")).toBe("go");
- expect(getExtension("get-extension.test.ts")).toBe("ts");
- expect(getExtension("directory")).toBe("");
-});
-
-test("formatTimestamp", () => {
- const morningDate = new Date("2021-10-10T10:10:10.000").toISOString();
- expect(formatTimestamp(morningDate)).toBe("10/10/2021, 10:10:10");
-
- const eveningDate = new Date("2021-10-10T22:10:10.000").toISOString();
- expect(formatTimestamp(eveningDate)).toBe("10/10/2021, 22:10:10");
-});
-
describe("getStatusText", () => {
it("returns STOPPING when pausing", () => {
const result = getStatusText({
diff --git a/frontend/src/utils/is-number.ts b/frontend/src/utils/is-number.ts
deleted file mode 100644
index 8ac961d9c0..0000000000
--- a/frontend/src/utils/is-number.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export const isNumber = (value: string | number): boolean =>
- !Number.isNaN(Number(value));
diff --git a/frontend/src/utils/utils.ts b/frontend/src/utils/utils.ts
index 80f40158f6..0efdb09ad1 100644
--- a/frontend/src/utils/utils.ts
+++ b/frontend/src/utils/utils.ts
@@ -146,28 +146,6 @@ export const removeUnwantedKeys = (
});
};
-export const removeApiKey = (
- data: EventActionHistory[],
-): EventActionHistory[] =>
- data.map((item) => {
- // Create a shallow copy of item
- const newItem = { ...item };
-
- // Check if LLM_API_KEY exists and delete it from a new args object
- if (newItem.args?.LLM_API_KEY) {
- const newArgs = { ...newItem.args };
- delete newArgs.LLM_API_KEY;
- newItem.args = newArgs;
- }
-
- return newItem;
- });
-
-export const getExtension = (code: string) => {
- if (code.includes(".")) return code.split(".").pop() || "";
- return "";
-};
-
/**
* Get file extension from file name in uppercase format
* @param fileName The file name to extract extension from
@@ -183,25 +161,6 @@ export const getFileExtension = (fileName: string): string => {
return extension || "FILE";
};
-/**
- * Format a timestamp to a human-readable format
- * @param timestamp The timestamp to format (ISO 8601)
- * @returns The formatted timestamp
- *
- * @example
- * formatTimestamp("2021-10-10T10:10:10.000") // "10/10/2021, 10:10:10"
- * formatTimestamp("2021-10-10T22:10:10.000") // "10/10/2021, 22:10:10"
- */
-export const formatTimestamp = (timestamp: string) =>
- new Date(timestamp).toLocaleString("en-GB", {
- day: "2-digit",
- month: "2-digit",
- year: "numeric",
- hour: "2-digit",
- minute: "2-digit",
- second: "2-digit",
- });
-
export const shouldUseInstallationRepos = (
provider: Provider,
app_mode: "saas" | "oss" | undefined,