feat(project): subtask rows and a wide view for the meeting task table

- Subtask rows (one level, parent_id): hover button / right-click to add, Tab to make a row the
  subtask of the row above, Shift+Tab to move it back; inherits the parent's project, no section
- Apply on a subtask row creates the task under the parent row's task (server-checked)
- "크게 열기" moves the same table into a wide window (same rows and saves), Esc/x to close
- Server: PUT parent_id with one-level rules; add rejects grandchildren
- Help + docs; tests (real PostgreSQL rules + parent apply, jsdom rows/Tab/wide view)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 16:20:05 +09:00
parent 1bdcd59287
commit 6fd01314d5
17 changed files with 343 additions and 60 deletions
+50
View File
@@ -523,6 +523,7 @@ function meetServer(env, st) {
const out = function (r) {
return { id: r.id, title: r.title || "", assignee_email: r.assignee_email || "", project_id: r.project_id || null,
project_name: r.project_name || "", stage_id: r.stage_id || null, stage_name: r.stage_name || "", task_id: r.task_id,
parent_id: r.parent_id || null,
registered: r.task_id != null, visible: r.visible !== false, task_exists: true };
};
env.route("GET", /\/goals\/meetings\/([\d-]+)\/quick-tasks$/, function (u) {
@@ -692,6 +693,55 @@ function meetServer(env, st) {
}
});
// ════════════════════ [2g4] 세부 작업 줄(↳·Tab·Shift+Tab) · [크게 열기] ════════════════════
await section(async function () {
const env = makeEnv(PAGE.meeting_admin, MEET_URL);
meetServer(env);
const q = quickServer(env, { rows: [{ id: 1, title: "부모 작업", project_id: 7, project_name: "브랜드" }] });
await boot(env); await settle(); await wait(5); await settle();
const d = env.d;
const trs = function () { return Array.from(d.querySelectorAll("#pj-meet-quick tbody tr")); };
const inputOf = function (tr) { return tr.querySelector('input[data-field="title"]'); };
const type = async function (inp, v) {
inp.value = v; inp.dispatchEvent(new env.w.Event("input", { bubbles: true }));
inp.dispatchEvent(new env.w.Event("focusout", { bubbles: true })); await settle(); await wait(5); await settle();
};
trs()[0].querySelector('[data-quick="add-sub"]').click(); await settle();
const sub = trs()[1];
check("[2g4] ↳ → 바로 아래 세부 작업 줄(들여쓰기·프로젝트는 위 줄·섹션 없음)", sub.classList.contains("is-sub") &&
inputOf(sub).placeholder === "세부 작업 제목" && /브랜드/.test(sub.querySelector(".pj-meet-quick-inherit").textContent) &&
d.activeElement === inputOf(sub));
await type(inputOf(sub), "세부 하나");
const saved = Object.values(q.rows).find(function (r) { return r.title === "세부 하나"; });
check("[2g4] 세부 작업 줄 저장 = parent_id(위 줄), 프로젝트 칸 없이", !!saved && saved.parent_id === 1 && !saved.project_id, saved);
check("[2g4] 위 줄 [적용] 전에는 세부 작업 [적용] 못 함", trs()[1].querySelector('[data-quick="apply"]').disabled);
// 아래 빈 맨 위 단계 줄 — 제목을 쓰고 Tab = 위 줄(부모 작업)의 세부 작업으로, Shift+Tab = 다시 위 단계로
const top = trs().find(function (tr) { return !tr.classList.contains("is-sub") && !inputOf(tr).value; });
await type(inputOf(top), "둘째");
const key = function (inp, shift) {
const e = new env.w.KeyboardEvent("keydown", { key: "Tab", shiftKey: !!shift, bubbles: true, cancelable: true });
inp.dispatchEvent(e); return e.defaultPrevented;
};
const tabbed = key(inputOf(trs().find(function (tr) { return inputOf(tr).value === "둘째"; })));
await settle(); await wait(5); await settle();
const second = Object.values(q.rows).find(function (r) { return r.title === "둘째"; });
check("[2g4] Tab = 위 줄의 세부 작업으로(저장)", tabbed && second.parent_id === 1 &&
trs().find(function (tr) { return inputOf(tr).value === "둘째"; }).classList.contains("is-sub"), second);
key(inputOf(trs().find(function (tr) { return inputOf(tr).value === "둘째"; })), true);
await settle(); await wait(5); await settle();
check("[2g4] Shift+Tab = 위 단계로(저장)", second.parent_id === null &&
!trs().find(function (tr) { return inputOf(tr).value === "둘째"; }).classList.contains("is-sub"), second);
// 크게 열기 — 같은 표가 넓은 창으로(줄 그대로), Esc 로 제자리
const nRows = trs().length;
d.querySelector('#pj-meet-quick [data-quick="expand"]').click(); await settle();
const modal = d.body.querySelector(".pj-meet-quick-modal");
check("[2g4] 크게 열기 → 같은 표를 넓은 창으로(body 에, 제목 'N주차 작업 등록')", !!modal && !!modal.querySelector("table.pj-meet-quick-table") &&
!d.querySelector("#pj-meet-quick table") && /4주차 작업 등록/.test(modal.querySelector("h3").textContent) &&
modal.querySelectorAll("tbody tr").length === nRows && nRows > 0);
d.dispatchEvent(new env.w.KeyboardEvent("keydown", { key: "Escape", bubbles: true, cancelable: true })); await settle();
check("[2g4] Esc → 닫히고 표는 제자리", !d.body.querySelector(".pj-meet-quick-modal") && !!d.querySelector("#pj-meet-quick table.pj-meet-quick-table"));
});
// ════════════════════ [2h] 회의록은 누구나 수정 · [회의 완료](관리자)면 잠금 ════════════════════
await section(async function () {
const env = makeEnv(PAGE.meeting_member, MEET_URL);
+31
View File
@@ -1250,6 +1250,37 @@ def test_review_meeting_quick_tasks_shared():
_ = done
def test_review_meeting_quick_subtask_rows():
"""세부 작업 줄 — 한 단계만, Tab(위 줄 밑으로)·Shift+Tab, [적용]은 위 줄 작업 밑에(위 줄 프로젝트)."""
from app.modules.project import store
w = store.month_weeks(2032, 1)[1][0]
p = _project("P-quick-sub", ADMIN, (BOB,))
s = _stage(p["id"], by=ADMIN)
url = f"/project/api/goals/meetings/{w}/quick-tasks"
put = lambda i, body: req("PUT", f"/project/api/goals/meeting-quick-tasks/{i}", BOB, json=body)
top = req("POST", url, BOB, json={"title": "부모", "project_id": p["id"], "stage_id": s["id"]}).json()["task"]
sub = req("POST", url, BOB, json={"title": "자식", "parent_id": top["id"]}).json()["task"]
other = req("POST", url, BOB, json={"title": "다른 줄"}).json()["task"]
assert req("POST", url, BOB, json={"title": "손자", "parent_id": sub["id"]}).status_code == 400 # 한 단계만
assert put(other["id"], {"parent_id": sub["id"]}).status_code == 400 # 세부 작업 줄 밑 X
assert put(top["id"], {"parent_id": other["id"]}).status_code == 400 # 자식 딸린 줄은 세부 작업 X
assert put(other["id"], {"parent_id": other["id"]}).status_code == 400
assert put(other["id"], {"parent_id": top["id"]}).json()["task"]["parent_id"] == top["id"] # Tab
assert put(other["id"], {"parent_id": None}).json()["task"]["parent_id"] is None # Shift+Tab
# 위 줄 전에는 세부 작업 [적용] 불가 → 위 줄 [적용] 뒤 세부 작업은 위 줄 작업 밑(섹션 없음)
assert req("POST", f"/project/api/goals/meeting-quick-tasks/{sub['id']}/apply", BOB).status_code == 400
r = req("POST", f"/project/api/goals/meeting-quick-tasks/{top['id']}/apply", BOB)
parent_task = r.json()["task"]["task_id"]
r = req("POST", f"/project/api/goals/meeting-quick-tasks/{sub['id']}/apply", BOB)
assert r.status_code == 201, r.text
t = ST.get_task(task_id=r.json()["task"]["task_id"])
assert (t["parent_task_id"], t["project_id"], t["stage_id"]) == (parent_task, p["id"], None)
for row in (top, other):
req("DELETE", f"/project/api/goals/meeting-quick-tasks/{row['id']}", BOB)
assert req("GET", url, BOB).json()["tasks"] == []
if __name__ == "__main__":
if not ENABLED:
print("SKIP: PROJECT_TEST_DB_URL(localhost) not set")