Workflow independence audit, store tests, InstallPackage decomposition
Fix RenderWorkflow() handler (was a stub that never loaded data), remove dead chat UI from workflow.html, align stage mode naming with Go constants, add 17 SQLite store tests, decompose 400-line InstallPackage into 7 phases, add E2E workflow-without-chat test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"armature/config"
|
||||
"armature/models"
|
||||
"armature/store"
|
||||
)
|
||||
|
||||
@@ -631,18 +632,20 @@ func (e *Engine) RenderLogin() gin.HandlerFunc {
|
||||
|
||||
// WorkflowPageData is passed to the workflow.html template via PageData.Data.
|
||||
type WorkflowPageData struct {
|
||||
ChannelID string
|
||||
ChannelTitle string
|
||||
ChannelDescription string
|
||||
SessionID string
|
||||
SessionName string
|
||||
StageMode string // custom | form_only | form_chat | review
|
||||
StageName string
|
||||
FormTemplateJSON string // typed form template JSON (empty if custom)
|
||||
TotalStages int
|
||||
CurrentStage int
|
||||
SurfacePkgID string
|
||||
BrandingJSON string
|
||||
EntryToken string
|
||||
WorkflowTitle string
|
||||
WorkflowDescription string
|
||||
SessionID string
|
||||
SessionName string
|
||||
StageMode string // form | review | delegated | automated
|
||||
StageName string
|
||||
FormTemplateJSON string // typed form template JSON (empty if delegated)
|
||||
TotalStages int
|
||||
CurrentStage int
|
||||
SurfacePkgID string
|
||||
BrandingJSON string
|
||||
InstanceID string // workflow instance ID (used for API calls)
|
||||
Status string // pending | active | completed | cancelled | stale
|
||||
}
|
||||
|
||||
// WorkflowLandingPageData is passed to workflow-landing.html.
|
||||
@@ -660,49 +663,91 @@ type WorkflowLandingPageData struct {
|
||||
PersonaName string
|
||||
PersonaIcon string
|
||||
StageCount int
|
||||
FirstStageMode string // custom | form_only | form_chat
|
||||
FirstStageMode string // form | review | delegated | automated
|
||||
ResumeURL string // non-empty if visitor has an active session
|
||||
}
|
||||
|
||||
// RenderWorkflow renders the workflow entry page for anonymous session visitors.
|
||||
// RenderWorkflow renders the workflow execution page for a running instance.
|
||||
// Route: /w/:id — :id is either an instance ID or a public entry token.
|
||||
// The middleware (AuthOrSession) has already created/resumed the session.
|
||||
func (e *Engine) RenderWorkflow() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
// :id is the public entry token (from /w/:id)
|
||||
channelID := c.Param("id")
|
||||
ctx := c.Request.Context()
|
||||
entryToken := c.Param("id")
|
||||
sessionID := c.GetString("session_id")
|
||||
|
||||
var title, description string
|
||||
if title == "" {
|
||||
title = "Workflow"
|
||||
}
|
||||
|
||||
// Load session display name
|
||||
sessionName := "Visitor"
|
||||
|
||||
// Load workflow stage info for form rendering
|
||||
var stageMode, stageName, formTplJSON, surfacePkgID, brandingJSON string
|
||||
var totalStages, currentStage int
|
||||
stageMode = "custom" // default
|
||||
|
||||
instanceName, _, _ := e.loadBranding()
|
||||
|
||||
// Try to load instance by entry token, then by ID
|
||||
var inst *models.WorkflowInstance
|
||||
if e.stores.Workflows != nil {
|
||||
inst, _ = e.stores.Workflows.GetInstanceByToken(ctx, entryToken)
|
||||
if inst == nil {
|
||||
inst, _ = e.stores.Workflows.GetInstance(ctx, entryToken)
|
||||
}
|
||||
}
|
||||
|
||||
if inst == nil {
|
||||
c.String(http.StatusNotFound, "Workflow instance not found")
|
||||
return
|
||||
}
|
||||
|
||||
// Load workflow definition for title, description, branding
|
||||
title, description := "Workflow", ""
|
||||
var brandingJSON string
|
||||
wf, _ := e.stores.Workflows.GetByID(ctx, inst.WorkflowID)
|
||||
if wf != nil {
|
||||
title = wf.Name
|
||||
description = wf.Description
|
||||
if len(wf.Branding) > 0 {
|
||||
brandingJSON = string(wf.Branding)
|
||||
}
|
||||
}
|
||||
|
||||
// Load stages to resolve current stage info
|
||||
var stageMode, stageName, formTplJSON, surfacePkgID string
|
||||
var totalStages, currentStage int
|
||||
stageMode = "form" // default
|
||||
|
||||
stages, _ := e.stores.Workflows.ListStages(ctx, inst.WorkflowID)
|
||||
totalStages = len(stages)
|
||||
for i, s := range stages {
|
||||
if s.ID == inst.CurrentStage || s.Name == inst.CurrentStage {
|
||||
currentStage = i
|
||||
stageName = s.Name
|
||||
stageMode = s.StageMode
|
||||
if stageMode == "" {
|
||||
stageMode = "form"
|
||||
}
|
||||
if len(s.FormTemplate) > 0 && string(s.FormTemplate) != "null" {
|
||||
formTplJSON = string(s.FormTemplate)
|
||||
}
|
||||
if s.SurfacePkgID != nil {
|
||||
surfacePkgID = *s.SurfacePkgID
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
e.Render(c, "workflow.html", PageData{
|
||||
Surface: "workflow",
|
||||
InstanceName: instanceName,
|
||||
Data: WorkflowPageData{
|
||||
ChannelID: channelID,
|
||||
ChannelTitle: title,
|
||||
ChannelDescription: description,
|
||||
SessionID: sessionID,
|
||||
SessionName: sessionName,
|
||||
StageMode: stageMode,
|
||||
StageName: stageName,
|
||||
FormTemplateJSON: formTplJSON,
|
||||
TotalStages: totalStages,
|
||||
CurrentStage: currentStage,
|
||||
SurfacePkgID: surfacePkgID,
|
||||
BrandingJSON: brandingJSON,
|
||||
EntryToken: entryToken,
|
||||
WorkflowTitle: title,
|
||||
WorkflowDescription: description,
|
||||
SessionID: sessionID,
|
||||
SessionName: sessionName,
|
||||
StageMode: stageMode,
|
||||
StageName: stageName,
|
||||
FormTemplateJSON: formTplJSON,
|
||||
TotalStages: totalStages,
|
||||
CurrentStage: currentStage,
|
||||
SurfacePkgID: surfacePkgID,
|
||||
BrandingJSON: brandingJSON,
|
||||
InstanceID: inst.ID,
|
||||
Status: inst.Status,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -146,19 +146,15 @@
|
||||
<p class="wf-description">{{.Data.Description}}</p>
|
||||
{{end}}
|
||||
|
||||
{{if and .Data.PersonaName (ne .Data.FirstStageMode "form_only")}}
|
||||
{{if and .Data.PersonaName (ne .Data.FirstStageMode "form")}}
|
||||
<div class="wf-persona">
|
||||
<div class="wf-persona-icon">{{if .Data.PersonaIcon}}{{.Data.PersonaIcon}}{{else}}🤖{{end}}</div>
|
||||
{{if eq .Data.FirstStageMode "form_chat"}}
|
||||
<span>Fill out a form and chat with <strong>{{.Data.PersonaName}}</strong></span>
|
||||
{{else}}
|
||||
<span>You'll be chatting with <strong>{{.Data.PersonaName}}</strong></span>
|
||||
{{end}}
|
||||
<span>You'll be working with <strong>{{.Data.PersonaName}}</strong></span>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<button class="wf-start-btn" id="startBtn" onclick="startWorkflow()">
|
||||
{{if eq .Data.FirstStageMode "form_only"}}Fill Out Form{{else}}Start{{end}}
|
||||
{{if eq .Data.FirstStageMode "form"}}Fill Out Form{{else if eq .Data.FirstStageMode "review"}}Start Review{{else}}Start{{end}}
|
||||
</button>
|
||||
|
||||
{{if .Data.ResumeURL}}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{.Data.ChannelTitle}} — {{.InstanceName}}</title>
|
||||
<title>{{.Data.WorkflowTitle}} — {{.InstanceName}}</title>
|
||||
<link rel="icon" type="image/svg+xml" href="{{.BasePath}}/favicon.svg?v={{.Version}}">
|
||||
<link rel="icon" type="image/x-icon" href="{{.BasePath}}/favicon.ico?v={{.Version}}">
|
||||
<link rel="stylesheet" href="{{.BasePath}}/css/variables.css?v={{.Version}}">
|
||||
@@ -93,52 +93,22 @@
|
||||
.wf-form-success h3 { font-size: 18px; margin-bottom: 8px; }
|
||||
.wf-form-success p { color: var(--text-2); }
|
||||
|
||||
/* ── Chat ───────────────────────── */
|
||||
.wf-chat {
|
||||
flex: 1; overflow-y: auto; padding: 16px 24px;
|
||||
}
|
||||
.wf-chat .message {
|
||||
margin-bottom: 12px; padding: 10px 14px;
|
||||
border-radius: 8px; max-width: 80%;
|
||||
}
|
||||
.wf-chat .message.user { background: var(--accent-dim); margin-left: auto; }
|
||||
.wf-chat .message.assistant { background: var(--bg-raised); }
|
||||
.wf-chat .message .meta { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
|
||||
.wf-chat .message .content { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
|
||||
|
||||
.wf-input {
|
||||
padding: 12px 24px; border-top: 1px solid var(--border);
|
||||
background: var(--bg-surface); display: flex; gap: 8px;
|
||||
}
|
||||
.wf-input textarea {
|
||||
flex: 1; resize: none; background: var(--input-bg); color: var(--text);
|
||||
border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px;
|
||||
font-family: var(--font); font-size: 14px; min-height: 42px; max-height: 160px;
|
||||
}
|
||||
.wf-input textarea:focus { outline: none; border-color: var(--accent); }
|
||||
.wf-input button {
|
||||
background: var(--accent); color: #fff; border: none; border-radius: 8px;
|
||||
padding: 0 20px; font-weight: 600; cursor: pointer; font-size: 14px;
|
||||
}
|
||||
.wf-input button:hover { background: var(--accent-hover); }
|
||||
.wf-input button:disabled { opacity: 0.5; cursor: default; }
|
||||
|
||||
.wf-session-info {
|
||||
padding: 8px 24px; font-size: 12px; color: var(--text-3);
|
||||
border-top: 1px solid var(--border); background: var(--bg);
|
||||
}
|
||||
|
||||
/* ── Form+Chat layout ───────────── */
|
||||
.wf-body-split { display: flex; flex: 1; overflow: hidden; }
|
||||
.wf-body-split .wf-form { flex: 1; border-right: 1px solid var(--border); overflow-y: auto; }
|
||||
.wf-body-split .wf-chat-col { flex: 1; display: flex; flex-direction: column; }
|
||||
.wf-body-split .wf-chat { flex: 1; }
|
||||
/* ── Unsupported mode fallback ─── */
|
||||
.wf-unsupported {
|
||||
flex: 1; display: flex; align-items: center; justify-content: center;
|
||||
padding: 24px; text-align: center; color: var(--text-2);
|
||||
}
|
||||
|
||||
/* ── Branding (v0.35.0) ────────── */
|
||||
/* ── Branding ────────────────────── */
|
||||
.wf-branding-logo { max-height: 32px; margin-bottom: 4px; }
|
||||
.wf-branding-tagline { font-size: 13px; color: var(--text-2); margin-top: 2px; }
|
||||
|
||||
/* ── Progressive Forms (v0.35.0) ── */
|
||||
/* ── Progressive Forms ────────── */
|
||||
.wf-fieldset-nav {
|
||||
display: flex; justify-content: space-between; align-items: center;
|
||||
margin-bottom: 16px; padding-bottom: 12px;
|
||||
@@ -175,8 +145,8 @@
|
||||
<body>
|
||||
<div class="wf-shell">
|
||||
<div class="wf-header" id="wfHeader">
|
||||
<h1>{{.Data.ChannelTitle}}</h1>
|
||||
{{if .Data.ChannelDescription}}<p>{{.Data.ChannelDescription}}</p>{{end}}
|
||||
<h1>{{.Data.WorkflowTitle}}</h1>
|
||||
{{if .Data.WorkflowDescription}}<p>{{.Data.WorkflowDescription}}</p>{{end}}
|
||||
</div>
|
||||
|
||||
{{if .Data.StageName}}
|
||||
@@ -188,62 +158,55 @@
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<!-- Stage surface mount point (v0.30.2) -->
|
||||
<!-- Modes: form_only, form_chat, chat_only, review, or custom surface via SurfacePkgID -->
|
||||
<!-- Stage surface: form, review, delegated (custom surface), or automated -->
|
||||
|
||||
{{if .Data.SurfacePkgID}}
|
||||
<div id="customSurfaceMount" style="flex:1;overflow-y:auto"></div>
|
||||
{{else if eq .Data.StageMode "form_only"}}
|
||||
{{else if eq .Data.StageMode "form"}}
|
||||
<div class="wf-form" id="formArea"></div>
|
||||
{{else if eq .Data.StageMode "form_chat"}}
|
||||
<div class="wf-body-split">
|
||||
<div class="wf-form" id="formArea"></div>
|
||||
<div class="wf-chat-col">
|
||||
<div class="wf-chat" id="chatMessages"></div>
|
||||
<div class="wf-input">
|
||||
<textarea id="chatInput" placeholder="Type a message…" rows="1"
|
||||
onkeydown="if(event.key==='Enter'&&!event.shiftKey){event.preventDefault();sendMessage()}"></textarea>
|
||||
<button id="sendBtn" onclick="sendMessage()">Send</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{else if eq .Data.StageMode "review"}}
|
||||
<div id="reviewArea" style="flex:1;overflow-y:auto;display:flex">
|
||||
<div id="reviewDataPanel" style="flex:1;overflow-y:auto;border-right:1px solid var(--border)"></div>
|
||||
<div id="reviewActionPanel" style="flex:1;overflow-y:auto;display:flex;flex-direction:column"></div>
|
||||
</div>
|
||||
{{else if eq .Data.Status "completed"}}
|
||||
<div class="wf-form-success" style="flex:1;display:flex;flex-direction:column;justify-content:center">
|
||||
<h3>Completed</h3>
|
||||
<p>This workflow has been completed. Thank you for your submission.</p>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="wf-chat" id="chatMessages"></div>
|
||||
<div class="wf-input">
|
||||
<textarea id="chatInput" placeholder="Type a message…" rows="1"
|
||||
onkeydown="if(event.key==='Enter'&&!event.shiftKey){event.preventDefault();sendMessage()}"></textarea>
|
||||
<button id="sendBtn" onclick="sendMessage()">Send</button>
|
||||
<div class="wf-unsupported">
|
||||
<p>This stage type ({{.Data.StageMode}}) does not have an interactive surface.</p>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<div class="wf-session-info">
|
||||
{{if .Data.SurfacePkgID}}Session:{{else if eq .Data.StageMode "form_only"}}Submitting as{{else if eq .Data.StageMode "review"}}Reviewing as{{else}}Chatting as{{end}} <strong>{{.Data.SessionName}}</strong>
|
||||
{{if .Data.SurfacePkgID}}Session:{{else if eq .Data.StageMode "form"}}Submitting as{{else if eq .Data.StageMode "review"}}Reviewing as{{else}}Session:{{end}} <strong>{{.Data.SessionName}}</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
const BASE = '{{.BasePath}}';
|
||||
const CHAN_ID = '{{.Data.ChannelID}}';
|
||||
const INSTANCE_ID = '{{.Data.InstanceID}}';
|
||||
const ENTRY_TOKEN = '{{.Data.EntryToken}}';
|
||||
const SESSION_ID = '{{.Data.SessionID}}';
|
||||
const STAGE_MODE = '{{.Data.StageMode}}';
|
||||
const TOTAL_STAGES = {{.Data.TotalStages}};
|
||||
const CURRENT_STAGE = {{.Data.CurrentStage}};
|
||||
const SURFACE_PKG_ID = '{{.Data.SurfacePkgID}}';
|
||||
const STATUS = '{{.Data.Status}}';
|
||||
|
||||
// API calls use the entry token (public) or instance ID
|
||||
const API_ID = ENTRY_TOKEN || INSTANCE_ID;
|
||||
|
||||
var FORM_TPL = null;
|
||||
try { FORM_TPL = JSON.parse('{{.Data.FormTemplateJSON}}' || 'null'); } catch(e) {}
|
||||
|
||||
// v0.35.0: Branding
|
||||
var BRANDING = null;
|
||||
try { BRANDING = JSON.parse('{{.Data.BrandingJSON}}' || 'null'); } catch(e) {}
|
||||
|
||||
// v0.35.0: Apply branding
|
||||
// Apply branding
|
||||
(function() {
|
||||
if (!BRANDING) return;
|
||||
var header = document.getElementById('wfHeader');
|
||||
@@ -279,11 +242,11 @@
|
||||
}
|
||||
})();
|
||||
|
||||
// ── Form rendering (v0.35.0: progressive forms + conditional fields) ──
|
||||
// ── Form rendering (progressive forms + conditional fields) ──
|
||||
var _fieldsetIndex = 0;
|
||||
var _fieldsetCount = 0;
|
||||
|
||||
if ((STAGE_MODE === 'form_only' || STAGE_MODE === 'form_chat') && FORM_TPL) {
|
||||
if (STAGE_MODE === 'form' && FORM_TPL) {
|
||||
var formArea = document.getElementById('formArea');
|
||||
if (FORM_TPL.fieldsets && FORM_TPL.fieldsets.length > 0) {
|
||||
renderProgressiveForm(formArea, FORM_TPL);
|
||||
@@ -326,7 +289,6 @@
|
||||
html += '</div></div>';
|
||||
}
|
||||
container.innerHTML = html;
|
||||
// Apply conditional fields for all fieldsets
|
||||
for (var s = 0; s < tpl.fieldsets.length; s++) {
|
||||
applyConditionalFields(tpl.fieldsets[s].fields);
|
||||
}
|
||||
@@ -350,7 +312,7 @@
|
||||
var handler = function() { evaluateCondition(field); };
|
||||
srcEl.addEventListener('change', handler);
|
||||
srcEl.addEventListener('input', handler);
|
||||
handler(); // initial evaluation
|
||||
handler();
|
||||
})(f);
|
||||
}
|
||||
}
|
||||
@@ -448,7 +410,7 @@
|
||||
el.textContent = '';
|
||||
});
|
||||
|
||||
// Collect form data (v0.35.0: get all fields from fieldsets or top-level)
|
||||
// Collect form data (get all fields from fieldsets or top-level)
|
||||
var allFields = FORM_TPL.fields || [];
|
||||
if (FORM_TPL.fieldsets && FORM_TPL.fieldsets.length > 0) {
|
||||
allFields = [];
|
||||
@@ -461,7 +423,7 @@
|
||||
var f = allFields[i];
|
||||
var el = document.getElementById('ff_' + f.key);
|
||||
if (!el) continue;
|
||||
// v0.35.0: Skip hidden conditional fields
|
||||
// Skip hidden conditional fields
|
||||
var fieldWrap = document.querySelector('.wf-form-field[data-key="' + f.key + '"]');
|
||||
if (fieldWrap && fieldWrap.classList.contains('cond-hidden')) continue;
|
||||
if (f.type === 'checkbox') {
|
||||
@@ -474,7 +436,7 @@
|
||||
}
|
||||
|
||||
try {
|
||||
var resp = await fetch(BASE + '/api/v1/public/workflows/advance/' + CHAN_ID, {
|
||||
var resp = await fetch(BASE + '/api/v1/public/workflows/advance/' + API_ID, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ data: data }),
|
||||
@@ -524,22 +486,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
// ── Chat ───────────────────────────
|
||||
var chatEl = document.getElementById('chatMessages');
|
||||
var inputEl = document.getElementById('chatInput');
|
||||
var sendBtn = document.getElementById('sendBtn');
|
||||
var sending = false;
|
||||
|
||||
function addMessage(role, content, name) {
|
||||
if (!chatEl) return;
|
||||
var div = document.createElement('div');
|
||||
div.className = 'message ' + role;
|
||||
var meta = name ? '<div class="meta">' + escHtml(name) + '</div>' : '';
|
||||
div.innerHTML = meta + '<div class="content">' + escHtml(content) + '</div>';
|
||||
chatEl.appendChild(div);
|
||||
chatEl.scrollTop = chatEl.scrollHeight;
|
||||
}
|
||||
|
||||
function escHtml(s) {
|
||||
var d = document.createElement('div');
|
||||
d.textContent = s;
|
||||
@@ -550,46 +496,7 @@
|
||||
return String(s).replace(/&/g,'&').replace(/"/g,'"').replace(/</g,'<').replace(/>/g,'>');
|
||||
}
|
||||
|
||||
window.sendMessage = async function() {
|
||||
if (!inputEl || !sendBtn) return;
|
||||
var text = inputEl.value.trim();
|
||||
if (!text || sending) return;
|
||||
sending = true;
|
||||
sendBtn.disabled = true;
|
||||
inputEl.value = '';
|
||||
|
||||
addMessage('user', text, '{{.Data.SessionName}}');
|
||||
|
||||
try {
|
||||
// TODO(v0.8+): form_chat completions endpoint not yet implemented
|
||||
var resp = { ok: false, statusText: 'Chat mode not yet available', json: function() { return Promise.resolve({ error: 'Chat mode not yet available' }); } };
|
||||
if (resp.ok) {
|
||||
var data = await resp.json();
|
||||
if (data.content) {
|
||||
addMessage('assistant', data.content, data.persona_name || 'Assistant');
|
||||
}
|
||||
} else {
|
||||
var err = await resp.json().catch(function() { return {}; });
|
||||
addMessage('assistant', 'Error: ' + (err.error || resp.statusText));
|
||||
}
|
||||
} catch(e) {
|
||||
addMessage('assistant', 'Network error: ' + e.message);
|
||||
}
|
||||
|
||||
sending = false;
|
||||
sendBtn.disabled = false;
|
||||
inputEl.focus();
|
||||
};
|
||||
|
||||
// Auto-resize textarea
|
||||
if (inputEl) {
|
||||
inputEl.addEventListener('input', function() {
|
||||
this.style.height = 'auto';
|
||||
this.style.height = Math.min(this.scrollHeight, 160) + 'px';
|
||||
});
|
||||
}
|
||||
|
||||
// ── Custom surface (v0.37.14: legacy registry removed) ──────────
|
||||
// ── Custom surface (delegated mode) ──────────
|
||||
if (SURFACE_PKG_ID) {
|
||||
var mount = document.getElementById('customSurfaceMount');
|
||||
if (mount) {
|
||||
@@ -607,7 +514,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
// ── Review surface (v0.35.0: structured review with side-by-side + comments) ──
|
||||
// ── Review surface (structured review with side-by-side + comments) ──
|
||||
if (STAGE_MODE === 'review') {
|
||||
var dataPanel = document.getElementById('reviewDataPanel');
|
||||
var actionPanel = document.getElementById('reviewActionPanel');
|
||||
@@ -624,7 +531,7 @@
|
||||
html += '<h3 style="margin-bottom:16px">Collected Data</h3>';
|
||||
|
||||
try {
|
||||
var resp = await fetch(BASE + '/api/v1/public/workflows/resume/' + CHAN_ID, {
|
||||
var resp = await fetch(BASE + '/api/v1/public/workflows/resume/' + API_ID, {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
});
|
||||
if (resp.ok) {
|
||||
@@ -666,7 +573,7 @@
|
||||
actHtml += '</div>';
|
||||
actionPanel.innerHTML = actHtml;
|
||||
|
||||
// Keyboard shortcuts (v0.35.0)
|
||||
// Keyboard shortcuts
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.ctrlKey && e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
@@ -681,7 +588,7 @@
|
||||
document.getElementById('reviewAdvanceBtn').addEventListener('click', async function() {
|
||||
this.disabled = true;
|
||||
try {
|
||||
var r = await fetch(BASE + '/api/v1/public/workflows/advance/' + CHAN_ID, {
|
||||
var r = await fetch(BASE + '/api/v1/public/workflows/advance/' + API_ID, {
|
||||
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ data: {} }),
|
||||
});
|
||||
@@ -702,7 +609,7 @@
|
||||
if (!reason) return;
|
||||
this.disabled = true;
|
||||
try {
|
||||
var r = await fetch(BASE + '/api/v1/public/workflows/advance/' + CHAN_ID, {
|
||||
var r = await fetch(BASE + '/api/v1/public/workflows/advance/' + API_ID, {
|
||||
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ data: { _action: 'reject', reason: reason } }),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user