feat: suffix naming rules, extension consistency, column widths, compact layout
- suffix rows are named by the suffix at creation (prompt); names are immutable afterwards; duplicates auto-suffix -1/-2 (global) - new-group dialog takes group name + first suffix name; backend creates group and its first workspace row in one transaction - upload validation: file extension must match the row's suffix (whole-row consistency), enforced client- and server-side - column sort dialog gains per-column width inputs (persisted via PATCH /columns/:id, table renders fixed widths, 0 = auto) - compact layout: denser tables/bars, viewport-height shell with independent scrollbars, cleanup step in e2e flow
This commit is contained in:
@@ -115,14 +115,34 @@ func TestSuffixAdminIntegration(t *testing.T) {
|
||||
if w.Code != 409 {
|
||||
t.Fatalf("重名分组 status=%d, want 409", w.Code)
|
||||
}
|
||||
w = authed(http.MethodPost, "/api/v1/suffix-admin/suffixes", fmt.Sprintf(`{"group_id":%d}`, groupID))
|
||||
w = authed(http.MethodPost, "/api/v1/suffix-admin/suffixes", fmt.Sprintf(`{"group_id":%d,"name":"cos4"}`, groupID))
|
||||
if w.Code != 201 {
|
||||
t.Fatalf("建后缀 status=%d body=%s", w.Code, w.Body.String())
|
||||
}
|
||||
suffixID := uint64(getJSON(w)["data"].(map[string]any)["id"].(float64))
|
||||
w = authed(http.MethodPut, fmt.Sprintf("/api/v1/suffix-admin/suffixes/%d", suffixID), `{"name":"cos4"}`)
|
||||
if w.Code != 200 {
|
||||
t.Fatalf("改后缀名 status=%d body=%s", w.Code, w.Body.String())
|
||||
// 建组带首个后缀名 → 自动工作行
|
||||
w = authed(http.MethodPost, "/api/v1/suffix-admin/groups", `{"name":"广西自治区","first_suffix_name":"xml"}`)
|
||||
if w.Code != 201 {
|
||||
t.Fatalf("建组带后缀 status=%d body=%s", w.Code, w.Body.String())
|
||||
}
|
||||
gx := uint64(getJSON(w)["data"].(map[string]any)["id"].(float64))
|
||||
sx := getJSON(w)["data"].(map[string]any)["suffixes"].([]any)
|
||||
if len(sx) != 1 || sx[0].(map[string]any)["name"] != "xml" {
|
||||
t.Fatalf("首后缀自动行不符: %v", sx)
|
||||
}
|
||||
_ = gx
|
||||
// 同名再建 → 自动 -1
|
||||
w = authed(http.MethodPost, "/api/v1/suffix-admin/suffixes", fmt.Sprintf(`{"group_id":%d,"name":"cos4"}`, groupID))
|
||||
if w.Code != 201 {
|
||||
t.Fatalf("同名后缀 status=%d body=%s", w.Code, w.Body.String())
|
||||
}
|
||||
if got := getJSON(w)["data"].(map[string]any)["name"]; got != "cos4-1" {
|
||||
t.Fatalf("同名自动 -1: got %v", got)
|
||||
}
|
||||
// 空名 → 400
|
||||
w = authed(http.MethodPost, "/api/v1/suffix-admin/suffixes", fmt.Sprintf(`{"group_id":%d,"name":""}`, groupID))
|
||||
if w.Code != 400 {
|
||||
t.Fatalf("空名 status=%d, want 400", w.Code)
|
||||
}
|
||||
|
||||
// 目录树:根 + 子目录 + 改名 + 删除保护
|
||||
@@ -240,6 +260,13 @@ func TestSuffixAdminIntegration(t *testing.T) {
|
||||
content := []byte("COS4-skeleton-demo")
|
||||
sum := sha256.Sum256(content)
|
||||
b64 := base64.StdEncoding.EncodeToString(content)
|
||||
// 扩展名与本行后缀不符 → 400
|
||||
w = authed(http.MethodPost, fmt.Sprintf("/api/v1/suffix-admin/suffixes/%d/files", suffixID),
|
||||
fmt.Sprintf(`{"file_name":"骨架.xml","size":%d,"sha256":"%s","content_base64":"%s"}`,
|
||||
len(content), hex.EncodeToString(sum[:]), b64))
|
||||
if w.Code != 400 {
|
||||
t.Fatalf("扩展名不符 status=%d, want 400", w.Code)
|
||||
}
|
||||
w = authed(http.MethodPost, fmt.Sprintf("/api/v1/suffix-admin/suffixes/%d/files", suffixID),
|
||||
fmt.Sprintf(`{"file_name":"骨架.cos4","size":%d,"sha256":"%s","content_base64":"%s"}`,
|
||||
len(content), hex.EncodeToString(sum[:]), b64))
|
||||
|
||||
Reference in New Issue
Block a user