feat: edit suggestions before accepting worklog

This commit is contained in:
2026-06-05 00:53:13 +08:00
parent eb6a861310
commit 02d68ca3f4
10 changed files with 92 additions and 21 deletions
+13
View File
@@ -162,6 +162,14 @@ async function runReadyScenario(cdp, url) {
await clickText(cdp, '.tab', 'Журнал')
await assertText(cdp, 'Manual smoke entry', 'worklog: entry visible')
await clickText(cdp, '.worklog-tab-suggestions .suggestion-actions .btn', 'Изменить')
await waitForSelector(cdp, '.modal-worklog')
await setInputValue(cdp, '.modal-worklog input[type="text"]', 'GUI smoke accepted suggestion')
await setInputValue(cdp, '.modal-worklog input[type="number"]', '35')
await setInputValue(cdp, '.modal-worklog textarea', 'Accepted after manual edit')
await clickText(cdp, '.modal-worklog .btn', 'Сохранить')
await waitForGone(cdp, '.modal-worklog')
await assertText(cdp, 'GUI smoke accepted suggestion', 'worklog: edited suggestion accepted')
await clickText(cdp, '.worklog-toolbar .btn', 'Добавить запись')
await waitForSelector(cdp, '.modal-worklog')
await setInputValue(cdp, '.modal-worklog input[type="text"]', 'GUI smoke worklog')
@@ -768,6 +776,11 @@ function wailsMockSource() {
events,
}],
AcceptSuggestionWith: async () => true,
AcceptSuggestionFull: async (nodeId, summary, details, date, minutes, approximate, billable) => {
const entry = { id: 'wl-suggestion-' + Date.now(), nodeId, summary, details, date: date || '2026-06-04', minutes, approximate, billable, source: 'suggestion', createdAt: now };
state.worklog[nodeId] = [...(state.worklog[nodeId] || []), entry];
return clone(entry);
},
ListWorklogReport: async () => clone(state.worklog['node-project'].map((entry) => ({ ...entry, nodeTitle: 'Smoke Project', nodePath: '/Smoke Project', _hasEvents: false }))),
WorklogReportSummary: async () => ({ totalMinutes: 45, totalEntries: 1, byDay: [{ label: '2026-06-04', minutes: 45, count: 1 }], byNode: [{ label: 'Smoke Project', minutes: 45, count: 1 }] }),
GetWorklogEntryEvents: async () => [],