diff --git a/docs/current/frontend-ui.md b/docs/current/frontend-ui.md index 2501924..3daf0ea 100644 --- a/docs/current/frontend-ui.md +++ b/docs/current/frontend-ui.md @@ -16,10 +16,11 @@ 除非用户对本页另有说明,控制台业务列表一律满足: -1. **筛选条件**:表格上方工具条左侧提供常用查询条件(至少含名称类模糊搜索;有归属/类型/状态列时一并提供下拉)。「新建」等页面按钮靠右。筛选为草稿态:点「查询」才请求后端,「重置」清空条件并重新请求;禁止输入即筛。无匹配与真正空列表文案区分。 -2. **表头排序与分页**:数据列 `sortable="custom"`,排序与分页一律走后端 SQL(`sort_by`/`sort_order`/`page`/`page_size`);操作列不排序。禁止只对当前页做前端排序。分页用 `ElPagination`(`total, sizes, prev, pager, next` + `background`)。 -3. **操作列宽度**:按行内 link 按钮数量取固定 `width`(`align="right"`),用 `actionsColumnWidth(n)`(`src/tableLayout.ts`):1→72,2→120,3→168,4→216(约 48px/钮 + 24 边距)。禁止用过大 `min-width` 把操作列撑宽。 -4. **行内操作**:只放本模块明确需要的行操作;删除、版本切换等若需求未授权则不做。 +1. **筛选条件**:表格上方工具条左侧提供常用查询条件(至少含名称;有归属/类型/状态列时一并提供下拉)。「新建」等页面按钮靠右。筛选为草稿态:点「查询」才请求后端,「重置」清空条件并重新请求;禁止输入即筛。无匹配与真正空列表文案区分。 +2. **自适应布局**:列表页整页不纵向滚动。工具条置顶、分页固定在页脚(`border-t`,右对齐),中间表格区 `flex-1` 且 `ElTable` 设 `height="100%"`,只在表体内滚动。空状态/报错占满中间区,可不显示分页脚。 +3. **表头排序与分页**:数据列 `sortable="custom"`,排序与分页一律走后端 SQL(`sort_by`/`sort_order`/`page`/`page_size`);操作列不排序。禁止只对当前页做前端排序。分页用 `ElPagination`(`total, sizes, prev, pager, next` + `background`),放在页脚而非表格下方随内容移动。 +4. **操作列宽度**:按行内 link 按钮数量取固定 `width`(`align="right"`),用 `actionsColumnWidth(n)`(`src/tableLayout.ts`):1→72,2→120,3→168,4→216(约 48px/钮 + 24 边距)。禁止用过大 `min-width` 把操作列撑宽。 +5. **行内操作**:只放本模块明确需要的行操作;删除、版本切换等若需求未授权则不做。 ## 数据源(D23) diff --git a/docs/evidence/M03/ui/datasource-list.png b/docs/evidence/M03/ui/datasource-list.png index d636662..101dd0d 100644 Binary files a/docs/evidence/M03/ui/datasource-list.png and b/docs/evidence/M03/ui/datasource-list.png differ diff --git a/docs/evidence/M04/ui/query-list.png b/docs/evidence/M04/ui/query-list.png index 94202ba..3a698cc 100644 Binary files a/docs/evidence/M04/ui/query-list.png and b/docs/evidence/M04/ui/query-list.png differ diff --git a/web/apps/console/e2e/datasources.spec.ts b/web/apps/console/e2e/datasources.spec.ts index d6852fc..44538c3 100644 --- a/web/apps/console/e2e/datasources.spec.ts +++ b/web/apps/console/e2e/datasources.spec.ts @@ -313,14 +313,21 @@ test.describe("datasources console", () => { await expect(page.getByTestId("datasource-filter-search")).toBeVisible(); await expect(page.getByTestId("datasource-filter-reset")).toBeVisible(); - // 新建 sits above the table, right aligned. + // 新建 sits above the table, right aligned; pagination is a page footer below the table. const create = await page.getByTestId("datasource-create").boundingBox(); const table = await page.getByTestId("datasource-table").boundingBox(); + const pager = await page.getByTestId("datasource-pagination").boundingBox(); const viewport = page.viewportSize(); - expect(create && table && viewport).toBeTruthy(); + expect(create && table && pager && viewport).toBeTruthy(); expect(create!.y + create!.height).toBeLessThanOrEqual(table!.y); expect(create!.x + create!.width).toBeGreaterThan(table!.x + table!.width - 40); - // No page footer on the list. + expect(pager!.y).toBeGreaterThanOrEqual(table!.y + table!.height - 2); + // The list page itself does not scroll; only the table body does. + const listScrolls = await page + .getByTestId("datasource-list") + .evaluate((el) => el.scrollHeight > el.clientHeight + 1); + expect(listScrolls).toBe(false); + // Detail-style action footer is not used on the list. await expect(page.getByTestId("datasource-footer")).toHaveCount(0); // Disabled row: visible, 测试 disabled, no 停用, no "停用后不能测试" copy. diff --git a/web/apps/console/e2e/queries.spec.ts b/web/apps/console/e2e/queries.spec.ts index b5d285e..13ae93a 100644 --- a/web/apps/console/e2e/queries.spec.ts +++ b/web/apps/console/e2e/queries.spec.ts @@ -516,8 +516,14 @@ test.describe("queries console", () => { const create = (await page.getByTestId("query-create").boundingBox())!; const box = (await table.boundingBox())!; + const pager = (await page.getByTestId("query-pagination").boundingBox())!; expect(create.y + create.height).toBeLessThanOrEqual(box.y); expect(create.x + create.width).toBeGreaterThan(box.x + box.width - 40); + expect(pager.y).toBeGreaterThanOrEqual(box.y + box.height - 2); + const listScrolls = await page + .getByTestId("query-list") + .evaluate((el) => el.scrollHeight > el.clientHeight + 1); + expect(listScrolls).toBe(false); await expect(page.getByTestId("query-footer")).toHaveCount(0); await expect(page.getByTestId("query-list-toolbar")).toBeVisible(); diff --git a/web/apps/console/locales/en/common.json b/web/apps/console/locales/en/common.json index 7699a4c..4e7f91c 100644 --- a/web/apps/console/locales/en/common.json +++ b/web/apps/console/locales/en/common.json @@ -48,7 +48,7 @@ "loadFailed": "Failed to load data sources", "empty": "No data sources yet", "emptyHint": "An administrator can create the first data source.", - "filterName": "Name (contains)", + "filterName": "Name", "filterEngine": "Engine", "filterStatus": "Status", "filterSearch": "Search", @@ -183,7 +183,7 @@ "loadFailed": "Failed to load queries", "empty": "No queries yet", "emptyHint": "An administrator can create the first query: pick a data source, write a parameterized SQL template, and declare its parameters and output contract.", - "filterName": "Name (contains)", + "filterName": "Name", "filterDatasource": "Data source", "filterStatus": "Status", "filterSearch": "Search", diff --git a/web/apps/console/locales/th/common.json b/web/apps/console/locales/th/common.json index d25a03a..cec72a6 100644 --- a/web/apps/console/locales/th/common.json +++ b/web/apps/console/locales/th/common.json @@ -48,7 +48,7 @@ "loadFailed": "โหลดแหล่งข้อมูลไม่สำเร็จ", "empty": "ยังไม่มีแหล่งข้อมูล", "emptyHint": "ผู้ดูแลสามารถสร้างแหล่งข้อมูลแรกได้", - "filterName": "ชื่อ (ค้นหาบางส่วน)", + "filterName": "ชื่อ", "filterEngine": "เอนจิน", "filterStatus": "สถานะ", "filterSearch": "ค้นหา", @@ -183,7 +183,7 @@ "loadFailed": "โหลดคิวรีไม่สำเร็จ", "empty": "ยังไม่มีคิวรี", "emptyHint": "ผู้ดูแลสามารถสร้างคิวรีแรกได้ โดยเลือกแหล่งข้อมูล เขียนเทมเพลต SQL แบบมีพารามิเตอร์ และประกาศพารามิเตอร์กับสัญญาเอาต์พุต", - "filterName": "ชื่อ (ค้นหาบางส่วน)", + "filterName": "ชื่อ", "filterDatasource": "แหล่งข้อมูล", "filterStatus": "สถานะ", "filterSearch": "ค้นหา", diff --git a/web/apps/console/locales/zh-CN/common.json b/web/apps/console/locales/zh-CN/common.json index 20ad8a8..79f8aae 100644 --- a/web/apps/console/locales/zh-CN/common.json +++ b/web/apps/console/locales/zh-CN/common.json @@ -49,7 +49,7 @@ "loadFailed": "数据源加载失败", "empty": "还没有数据源", "emptyHint": "管理者可以新建第一个数据源。", - "filterName": "名称(模糊)", + "filterName": "名称", "filterEngine": "引擎", "filterStatus": "状态", "filterSearch": "查询", @@ -184,7 +184,7 @@ "loadFailed": "查询加载失败", "empty": "还没有查询", "emptyHint": "管理者可以新建第一个查询定义:选择数据源,写参数化 SQL,声明参数与输出契约。", - "filterName": "名称(模糊)", + "filterName": "名称", "filterDatasource": "数据源", "filterStatus": "状态", "filterSearch": "查询", diff --git a/web/apps/console/locales/zh-TW/common.json b/web/apps/console/locales/zh-TW/common.json index 8bdfad2..63ee301 100644 --- a/web/apps/console/locales/zh-TW/common.json +++ b/web/apps/console/locales/zh-TW/common.json @@ -48,7 +48,7 @@ "loadFailed": "資料來源載入失敗", "empty": "還沒有資料來源", "emptyHint": "管理者可以新增第一個資料來源。", - "filterName": "名稱(模糊)", + "filterName": "名稱", "filterEngine": "引擎", "filterStatus": "狀態", "filterSearch": "查詢", @@ -183,7 +183,7 @@ "loadFailed": "查詢載入失敗", "empty": "還沒有查詢", "emptyHint": "管理者可以新建第一個查詢定義:選擇資料來源,撰寫參數化 SQL,宣告參數與輸出契約。", - "filterName": "名稱(模糊)", + "filterName": "名稱", "filterDatasource": "資料來源", "filterStatus": "狀態", "filterSearch": "查詢", diff --git a/web/apps/console/src/datasources/DatasourceList.vue b/web/apps/console/src/datasources/DatasourceList.vue index bd63fbe..61d0649 100644 --- a/web/apps/console/src/datasources/DatasourceList.vue +++ b/web/apps/console/src/datasources/DatasourceList.vue @@ -218,8 +218,12 @@ onMounted(load); diff --git a/web/apps/console/src/queries/QueryList.vue b/web/apps/console/src/queries/QueryList.vue index 79a2371..4c9086a 100644 --- a/web/apps/console/src/queries/QueryList.vue +++ b/web/apps/console/src/queries/QueryList.vue @@ -202,8 +202,9 @@ onMounted(async () => {