Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(frontend): add advanced search default placeholder (#20546)
boojackae381da2aacb
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 7f50b7f185..a2319b5e3a 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -324,6 +324,7 @@"import": "Import","in-progress": "In progress","info": "Info",+ "input-value-press-enter": "Input value, press Enter to confirm","instance": "Instance","instances": "Instances","is-required": "is required",@@ -420,6 +421,7 @@"scope": "Scope","search": "Search","search-for-more": "Search for more",+ "search-no-result": "No matching result found","select": "Please Select","select-all": "Select all","selected": "selected",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 07cf31dce1..0d178660be 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -324,6 +324,7 @@"import": "Importar","in-progress": "En progreso","info": "Información",+ "input-value-press-enter": "Ingrese el valor, presione Enter para confirmar","instance": "Instancia","instances": "Instancias","is-required": "es obligatorio",@@ -420,6 +421,7 @@"scope": "Alcance","search": "Buscar","search-for-more": "Buscar más",+ "search-no-result": "No se encontraron resultados coincidentes","select": "Seleccionar","select-all": "Seleccionar todo","selected": "seleccionado",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 920c763402..7e7e0cb7f4 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -324,6 +324,7 @@"import": "インポート","in-progress": "進行中","info": "情報",+ "input-value-press-enter": "値を入力し、Enter キーを押して確定します","instance": "インスタンス","instances": "インスタンス","is-required": "は必須です",@@ -420,6 +421,7 @@"scope": "スコープ","search": "検索","search-for-more": "さらに検索",+ "search-no-result": "一致する結果が見つかりません","select": "選択してください","select-all": "すべて選択","selected": "選択済み",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 948a59e01a..d66ea58a5a 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -324,6 +324,7 @@"import": "Nhập","in-progress": "Đang thực hiện","info": "Thông tin",+ "input-value-press-enter": "Nhập giá trị, nhấn Enter để xác nhận","instance": "Phiên bản","instances": "Phiên bản","is-required": "là bắt buộc",@@ -420,6 +421,7 @@"scope": "Phạm vi","search": "Tìm kiếm","search-for-more": "Tìm kiếm thêm",+ "search-no-result": "Không tìm thấy kết quả phù hợp","select": "Vui lòng chọn","select-all": "Chọn tất cả","selected": "đã chọn",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex b7e1e53dc8..7ca2300805 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -324,6 +324,7 @@"import": "导入","in-progress": "进行中","info": "信息",+ "input-value-press-enter": "输入值,按回车确认","instance": "实例","instances": "实例","is-required": "为必填项",@@ -420,6 +421,7 @@"scope": "范围","search": "搜索","search-for-more": "搜索更多",+ "search-no-result": "未找到匹配的结果","select": "请选择","select-all": "全选","selected": "已选择",diff --git a/frontend/src/react/components/AdvancedSearch.test.tsx b/frontend/src/react/components/AdvancedSearch.test.tsxnew file mode 100644index 0000000000..77fcb41a99--- /dev/null+++ b/frontend/src/react/components/AdvancedSearch.test.tsx@@ -0,0 +1,63 @@+import { fireEvent, render, screen } from "@testing-library/react";+import { describe, expect, test, vi } from "vitest";+import { AdvancedSearch, emptySearchParams } from "./AdvancedSearch";++vi.mock("react-i18next", () => ({+ initReactI18next: {+ type: "3rdParty",+ init: vi.fn(),+ },+ useTranslation: () => ({+ t: (key: string) => key,+ }),+}));++class ResizeObserverMock {+ observe() {}+ unobserve() {}+ disconnect() {}+}++globalThis.ResizeObserver =+ ResizeObserverMock as unknown as typeof ResizeObserver;++describe("AdvancedSearch", () => {+ test("renders a default placeholder when none is provided", () => {+ render(+ <AdvancedSearch+ params={emptySearchParams()}+ scopeOptions={[]}+ onParamsChange={vi.fn()}+ />+ );++ expect(screen.getByPlaceholderText("common.filter")).toBeInTheDocument();+ });++ test("renders an empty placeholder when scope values have no matches", () => {+ render(+ <AdvancedSearch+ params={emptySearchParams()}+ scopeOptions={[+ {+ id: "state",+ title: "State",+ options: [+ { value: "OPEN", keywords: ["open"] },+ { value: "CLOSED", keywords: ["closed"] },+ ],+ },+ ]}+ onParamsChange={vi.fn()}+ />+ );++ fireEvent.click(screen.getByRole("textbox"));+ fireEvent.click(screen.getByText("state"));+ fireEvent.change(screen.getByRole("textbox"), {+ target: { value: "state:missing" },+ });++ expect(screen.getByText("common.search-no-result")).toBeInTheDocument();+ });+});diff --git a/frontend/src/react/components/AdvancedSearch.tsx b/frontend/src/react/components/AdvancedSearch.tsxindex a945d7e853..e02c6b2545 100644--- a/frontend/src/react/components/AdvancedSearch.tsx+++ b/frontend/src/react/components/AdvancedSearch.tsx@@ -725,7 +725,9 @@ export function AdvancedSearch({visibleTags.length > 0 ? "min-w-[40px]" : "min-w-[120px]")}value={inputText}- placeholder={visibleTags.length > 0 ? "" : placeholder}+ placeholder={+ visibleTags.length > 0 ? "" : (placeholder ?? t("common.filter"))+ }onClick={handleInputClick}onChange={(e) => handleInputChange(e.target.value)}onKeyDown={handleKeyDown}@@ -861,11 +863,11 @@ export function AdvancedSearch({) : !(currentScopeOption.options ?? []).length &&!isAsyncScope ? (<div className="px-3 py-2 text-xs text-control-light border-t border-block-border">- Type a value and press Enter+ {t("common.input-value-press-enter")}</div>) : (<div className="py-4 text-center text-sm text-control-placeholder">- —+ {t("common.search-no-result")}</div>)}{valueMenuFade.showStart && (diff --git a/frontend/src/react/components/IssueTable.test.tsx b/frontend/src/react/components/IssueTable.test.tsxnew file mode 100644index 0000000000..213de30053--- /dev/null+++ b/frontend/src/react/components/IssueTable.test.tsx@@ -0,0 +1,43 @@+import { render, screen } from "@testing-library/react";+import { describe, expect, test, vi } from "vitest";+import { emptySearchParams } from "./AdvancedSearch";+import { IssueSearchBar } from "./IssueTable";++vi.mock("react-i18next", () => ({+ initReactI18next: {+ type: "3rdParty",+ init: vi.fn(),+ },+ useTranslation: () => ({+ t: (key: string) => key,+ }),+}));++vi.mock("@/react/components/TimeRangePicker", () => ({+ TimeRangePicker: () => <div data-testid="time-range-picker" />,+}));++class ResizeObserverMock {+ observe() {}+ unobserve() {}+ disconnect() {}+}++globalThis.ResizeObserver =+ ResizeObserverMock as unknown as typeof ResizeObserver;++describe("IssueSearchBar", () => {+ test("renders the default advanced search placeholder", () => {+ render(+ <IssueSearchBar+ params={emptySearchParams()}+ onParamsChange={vi.fn()}+ orderBy=""+ onOrderByChange={vi.fn()}+ scopeOptions={[]}+ />+ );++ expect(screen.getByPlaceholderText("common.filter")).toBeInTheDocument();+ });+});