feat(project): meeting task table - pick an existing task to add a subtask; title opens task panel

- New "작업" column (migration 026 parent_task_id): empty = new task in the section,
  chosen task = register as its subtask (candidates = open main tasks of that section)
- Server validates the task belongs to the project, clears it when the project changes,
  and rejects apply if the chosen task was deleted/moved
- Removed the in-table subtask rows (hover button, Tab/Shift+Tab, right-click) from UI/API
- Registered row title opens the task editor on the right (iframe ?embed=1, waits for the
  task window to save before switching/closing, like the inbox panel)
- Help + docs (DEPLOYMENT 026); tests (real PostgreSQL, jsdom)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 16:35:18 +09:00
parent bc62e53270
commit e130bbe577
20 changed files with 395 additions and 331 deletions
+43 -39
View File
@@ -523,7 +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,
parent_task_id: r.parent_task_id || null, parent_task_title: r.parent_task_id ? (r.parent_task_title || "상세페이지 리뉴얼") : "",
registered: r.task_id != null, visible: r.visible !== false, task_exists: true };
};
env.route("GET", /\/goals\/meetings\/([\d-]+)\/quick-tasks$/, function (u) {
@@ -660,7 +660,9 @@ function meetServer(env, st) {
// ════════════════════ [2g3] 작업 등록 = 주차별 서버 표 · 다른 사람 줄도 보임 · 제목 "N주차 작업 등록" · 브라우저 예전 표는 서버로 ════════════════════
await section(async function () {
const titles = function (d) { return Array.from(d.querySelectorAll('#pj-meet-quick tbody input[data-field="title"]')).map(function (i) { return i.value; }); };
// 제목 — 입력칸(등록 전) 또는 등록된 줄의 제목 버튼·글자
const titleOf = function (tr) { const i = tr.querySelector('input[data-field="title"]'); return i ? i.value : (tr.querySelector(".pj-meet-quick-open") || {}).textContent || ""; };
const titles = function (d) { return Array.from(d.querySelectorAll("#pj-meet-quick tbody tr")).map(titleOf); };
const env = makeEnv(PAGE.meeting_admin, MEET_URL);
meetServer(env);
quickServer(env, { rows: [
@@ -674,9 +676,9 @@ function meetServer(env, st) {
const ts = titles(d);
check("[2g3] 다른 사람이 적은·등록한 줄도 보임(이 주차만)", ts.indexOf("다른 사람이 적은 줄") >= 0 && ts.indexOf("다른 사람이 등록한 줄") >= 0 &&
ts.indexOf("다른 주차 줄") < 0, ts);
const hidden = Array.from(d.querySelectorAll("#pj-meet-quick tbody tr")).find(function (tr) { return tr.querySelector("input").value === "남의 프로젝트 줄"; });
const hidden = Array.from(d.querySelectorAll("#pj-meet-quick tbody tr")).find(function (tr) { return titleOf(tr) === "남의 프로젝트 줄"; });
check("[2g3] 내가 멤버가 아닌 프로젝트 줄 — 이름 가림·작업 링크·삭제 없음", /볼 수 없는 프로젝트/.test(hidden.textContent) && /등록됨/.test(hidden.textContent) &&
!hidden.querySelector("a") && !hidden.querySelector('[data-quick="delete"]'));
!hidden.querySelector("a") && !hidden.querySelector('[data-quick="delete"]') && !hidden.querySelector('[data-quick="open"]'));
// 이 브라우저에만 있던 예전 표(이 주차 키 · 이번 주면 주차 없는 예전 키) → 서버로 옮기고 지움
for (const isNow of [false, true]) {
const e2 = makeEnv(PAGE.meeting_admin, MEET_URL);
@@ -693,50 +695,52 @@ function meetServer(env, st) {
}
});
// ════════════════════ [2g4] 세부 작업 줄(↳·Tab·Shift+Tab) · [크게 열기] ════════════════════
// ════════════════════ [2g4] 작업 칸(이미 있는 작업의 세부 작업으로) · 등록된 제목 = 오른쪽 작업 창 · [크게 열기] ════════════════════
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: "브랜드" }] });
const q = quickServer(env, { rows: [{ id: 1, title: "배너 시안", project_id: 7, project_name: "브랜드", stage_id: 71, stage_name: "할 일" }] });
env.route("GET", /\/project\/api\/projects\/7\/tasks$/, function () { return { body: { tasks: [
{ id: 300, title: "상세페이지 리뉴얼", project_id: 7, stage_id: 71 },
{ id: 301, title: "다른 섹션 작업", project_id: 7, stage_id: 72 },
{ id: 302, title: "끝난 작업", project_id: 7, stage_id: 71, completed_at: "2026-09-01T00:00:00+09:00" },
{ id: 303, title: "이미 세부 작업", project_id: 7, stage_id: null, parent_task_id: 300 }] } }; });
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 === "둘째"; })));
const row = function () { return d.querySelector("#pj-meet-quick tbody tr"); };
check("[2g4] 표 머리에 '작업' 칸, 예전 ↳(줄 세부 작업) 버튼 없음",
Array.from(d.querySelectorAll("#pj-meet-quick thead th")).map(function (t) { return t.textContent; }).indexOf("작업") === 4 &&
!d.querySelector('[data-quick="add-sub"]'));
row().querySelector('[data-pick="task"]').click(); await settle(); await wait(5); await settle();
const labels = Array.from(d.querySelectorAll(".pj-ctxmenu-item")).map(itemLabel);
check("[2g4] 작업 칸 목록 = '새 작업(섹션에)' + 그 섹션의 진행 중 메인 작업만", labels[0] === "새 작업 (‘할 일’ 섹션에)" &&
labels.indexOf("상세페이지 리뉴얼") >= 0 && labels.indexOf("다른 섹션 작업") < 0 && labels.indexOf("끝난 작업") < 0 && labels.indexOf("이미 세부 작업") < 0, labels);
Array.from(d.querySelectorAll(".pj-ctxmenu-item")).find(function (n) { return itemLabel(n) === "상세페이지 리뉴얼"; }).click();
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);
check("[2g4] 작업을 고르면 ↳ 표시·섹션 '—'·제목 칸 '세부 작업 제목'·서버 줄에 parent_task_id",
/↳ 상세페이지 리뉴얼/.test(row().querySelector('[data-pick="task"]').textContent) && /—/.test(row().children[3].textContent) &&
row().querySelector('input[data-field="title"]').placeholder === "세부 작업 제목" && q.rows[1].parent_task_id === 300, q.rows[1]);
row().querySelector('[data-quick="apply"]').click(); await settle(); await wait(5); await settle();
check("[2g4] 적용 → 서버 [적용](고른 작업 밑 세부 작업)", q.applied.length === 1 && q.applied[0].parent_task_id === 300, q.applied);
// 등록된 줄 — 제목을 누르면 오른쪽 작업 창(iframe, embed). 저장 확인이 '계속 편집'이면 닫히지 않음
const open = row().querySelector('[data-quick="open"]');
check("[2g4] 등록된 줄 제목 = 작업 창 열기 버튼", !!open && open.textContent === "배너 시안");
open.click(); await settle();
const panel = d.body.querySelector(".pj-meet-task-panel");
check("[2g4] 오른쪽 작업 창(body 에) = /project/t/{id}?embed=1", !!panel && panel.classList.contains("is-open") &&
panel.querySelector("iframe").getAttribute("src") === "/project/t/555?embed=1");
let answer = false;
panel.querySelector("iframe").contentWindow.__pjEmbedSettle = function () { return Promise.resolve(answer); };
d.dispatchEvent(new env.w.KeyboardEvent("keydown", { key: "Escape", bubbles: true })); await settle();
check("[2g4] 작업 창 저장 실패에 '계속 편집' → 창 그대로", panel.classList.contains("is-open"));
answer = true;
d.dispatchEvent(new env.w.KeyboardEvent("keydown", { key: "Escape", bubbles: true })); await settle();
check("[2g4] 저장이 끝나면 Esc 로 닫힘", !panel.classList.contains("is-open"));
// 크게 열기 — 같은 표가 넓은 창으로(줄 그대로), Esc 로 제자리
const nRows = trs().length;
const nRows = d.querySelectorAll("#pj-meet-quick tbody tr").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) &&
check("[2g4] 크게 열기 → 같은 표를 넓은 창으로(제목 'N주차 작업 등록')", !!modal && /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"));
+30 -26
View File
@@ -1196,12 +1196,19 @@ def test_review_meeting_section_move():
_drop_meetings([w1, w2])
def _clear_quick(*weeks) -> None:
"""작업 등록 표 테스트 주차 비우기(로컬 테스트 DB — 앞선 실패한 실행의 줄이 남지 않게)."""
with ST._pool.connection() as conn: # noqa: SLF001
conn.execute("DELETE FROM goal_meeting_tasks WHERE week_start = ANY(%s)", (list(weeks),))
def test_review_meeting_quick_tasks_shared():
"""작업 등록 표(025) — 주차별 한 표를 모두가 같이 본다. 남의 프로젝트 이름은 가리고, [적용]은 동시에 눌러도 작업 하나."""
from app.modules.project import store
w = store.month_weeks(2031, 12)[1][0]
other = store.month_weeks(2031, 12)[2][0]
_clear_quick(w, other)
p = _project("P-quick", ADMIN, (BOB,))
s = _stage(p["id"], by=ADMIN)
done = _stage(p["id"], name="완료", done=True, by=ADMIN)
@@ -1229,9 +1236,10 @@ def test_review_meeting_quick_tasks_shared():
assert t["stage_id"] == s["id"] and t["assignee_email"] == BOB
# 등록된 줄은 더 못 고침(409), 다시 [적용]해도 그대로
assert req("PUT", f"/project/api/goals/meeting-quick-tasks/{row['id']}", BOB, json={"title": "x"}).status_code == 409
# 세부 작업 줄 — 위 줄의 작업 밑에 만든다(섹션 없음)
r = req("POST", url, BOB, json={"title": "세부 하나", "project_id": p["id"], "parent_id": row["id"]})
# 작업 칸 — 방금 만든 작업을 고르면 그 작업의 세부 작업으로(섹션 없음)
r = req("POST", url, BOB, json={"title": "세부 하나", "project_id": p["id"], "parent_task_id": tid})
sub = r.json()["task"]
assert sub["parent_task_id"] == tid and sub["parent_task_title"] == "상세페이지 수정2"
r = req("POST", f"/project/api/goals/meeting-quick-tasks/{sub['id']}/apply", BOB)
assert r.status_code == 201, r.text
st_ = ST.get_task(task_id=r.json()["task"]["task_id"])
@@ -1246,39 +1254,35 @@ def test_review_meeting_quick_tasks_shared():
finally:
_drop_meetings([w])
assert req("DELETE", f"/project/api/goals/meeting-quick-tasks/{row['id']}", BOB).status_code == 200
assert req("GET", url, BOB).json()["tasks"] == [] # 세부 작업 줄도 함께
assert req("DELETE", f"/project/api/goals/meeting-quick-tasks/{sub['id']}", BOB).status_code == 200
assert req("GET", url, BOB).json()["tasks"] == []
_ = done
def test_review_meeting_quick_subtask_rows():
"""세부 작업 줄 — 한 단계만, Tab(위 줄 밑으로)·Shift+Tab, [적용]은 위 줄 작업 밑에(위 줄 프로젝트)."""
def test_review_meeting_quick_parent_task_column():
"""작업 칸(026) — 그 프로젝트의 작업만, 프로젝트를 바꾸면 비움, 고른 작업이 사라지면 [적용] 400."""
from app.modules.project import store
w = store.month_weeks(2032, 1)[1][0]
p = _project("P-quick-sub", ADMIN, (BOB,))
_clear_quick(w)
p = _project("P-quick-pt", ADMIN, (BOB,))
q = _project("P-quick-pt2", ADMIN, (BOB,))
s = _stage(p["id"], by=ADMIN)
base = ST.create_task(project_id=p["id"], title="기존 작업", stage_id=s["id"], created_by=ADMIN)
other = ST.create_task(project_id=q["id"], title="다른 프로젝트 작업", created_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"] == []
assert req("POST", url, BOB, json={"title": "x", "project_id": p["id"], "parent_task_id": other["id"]}).status_code == 400
row = req("POST", url, BOB, json={"title": "세부", "project_id": p["id"], "parent_task_id": base["id"]}).json()["task"]
assert row["parent_task_id"] == base["id"]
moved = put(row["id"], {"project_id": q["id"]}).json()["task"]
assert moved["parent_task_id"] is None and moved["stage_id"] is None # 프로젝트가 바뀌면 작업·섹션을 비움
assert put(row["id"], {"project_id": p["id"], "parent_task_id": base["id"]}).json()["task"]["parent_task_id"] == base["id"]
# 고른 작업이 지워지면 [적용]은 400(줄은 그대로)
ST.delete_task(task_id=base["id"], deleted_by=ADMIN)
assert req("POST", f"/project/api/goals/meeting-quick-tasks/{row['id']}/apply", BOB).status_code == 400
assert req("GET", url, BOB).json()["tasks"][0]["task_id"] is None
req("DELETE", f"/project/api/goals/meeting-quick-tasks/{row['id']}", BOB)
if __name__ == "__main__":