()
| 4437 | }; |
| 4438 | |
| 4439 | const queueMcpAutotagJob = async () => { |
| 4440 | const mcpUserId = String(mcpAutotagUserEl?.value || '').trim(); |
| 4441 | const folder = String(mcpAutotagFolderEl?.value || 'root').trim() || 'root'; |
| 4442 | const file = String(mcpAutotagFileEl?.value || '').trim(); |
| 4443 | const tagName = String(mcpAutotagTagNameEl?.value || '').trim(); |
| 4444 | const tagColor = String(mcpAutotagTagColorEl?.value || '').trim(); |
| 4445 | if (!mcpUserId) { |
| 4446 | throw new Error(tf('gateway_mcp_user_required', 'MCP user is required.')); |
| 4447 | } |
| 4448 | if (!file || !tagName) { |
| 4449 | throw new Error(tf('gateway_autotag_fields_required', 'File and tag are required.')); |
| 4450 | } |
| 4451 | const tags = [{ name: tagName, color: tagColor }]; |
| 4452 | const data = await apiPost('/api/pro/gateways/jobs/autotag.php', { |
| 4453 | mcpUserId, |
| 4454 | folder, |
| 4455 | file, |
| 4456 | tags, |
| 4457 | }); |
| 4458 | setMcpJobsStatus( |
| 4459 | tf('gateway_job_queued', 'Job queued: {id}').replace('{id}', String(data?.jobId || '0')), |
| 4460 | 'success' |
| 4461 | ); |
| 4462 | }; |
| 4463 | |
| 4464 | const buildPayload = () => { |
| 4465 | const name = String(nameEl?.value || '').trim(); |
no test coverage detected