Session-Menü: Agent/Session bearbeiten + Rücksprung zum Chat
Zwei neue Menü-Einträge im Session-Header-Menü (rechts oben): - Sparte "Agent" → "Agent bearbeiten" (Sprung zur Agent-Edit-Page) - Sparte "Session" → "Session bearbeiten" (Sprung zur Session-Edit-Page) Beide Sparten sind jetzt immer sichtbar (vorher nur bei vorhandenen Custom-Commands). Speichern/Abbrechen auf beiden Edit-Pages springt kontextabhängig zurück: zum Chat, wenn die Page von dort geöffnet wurde (returnTo/returnId), sonst wie bisher zum Dashboard. Löschen bleibt → Dashboard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
4d29b09488
commit
1a0f3b507e
3 files changed
+50
-11
No files matched your search
@@ -93,6 +93,15 @@ registerPage('agent', {
|
|||||||
const saveBtn = document.getElementById('agentSaveBtn');
|
const saveBtn = document.getElementById('agentSaveBtn');
|
||||||
const cancelBtn = document.getElementById('agentCancelBtn');
|
const cancelBtn = document.getElementById('agentCancelBtn');
|
||||||
const deleteBtn = document.getElementById('agentDeleteBtn');
|
const deleteBtn = document.getElementById('agentDeleteBtn');
|
||||||
|
|
||||||
|
// Rücksprung nach Speichern/Abbrechen: zurück zum Chat, wenn von dort geöffnet – sonst Dashboard
|
||||||
|
const goBack = () => {
|
||||||
|
if (params.returnTo === 'chat' && params.returnId) {
|
||||||
|
navigateTo('chat', { id: params.returnId });
|
||||||
|
} else {
|
||||||
|
navigateTo('dashboard');
|
||||||
|
}
|
||||||
|
};
|
||||||
const commandsList = document.getElementById('agentCommandsList');
|
const commandsList = document.getElementById('agentCommandsList');
|
||||||
const addCommandBtn = document.getElementById('agentAddCommandBtn');
|
const addCommandBtn = document.getElementById('agentAddCommandBtn');
|
||||||
const skillsSection = document.getElementById('agentSkillsSection');
|
const skillsSection = document.getElementById('agentSkillsSection');
|
||||||
@@ -200,11 +209,11 @@ registerPage('agent', {
|
|||||||
const selectedSlugs = getSelectedSkills(skillList);
|
const selectedSlugs = getSelectedSkills(skillList);
|
||||||
await apiSetAgentSkills(agentId, selectedSlugs);
|
await apiSetAgentSkills(agentId, selectedSlugs);
|
||||||
}
|
}
|
||||||
navigateTo('dashboard');
|
goBack();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Abbrechen
|
// Abbrechen
|
||||||
cancelBtn.addEventListener('click', () => navigateTo('dashboard'));
|
cancelBtn.addEventListener('click', () => goBack());
|
||||||
|
|
||||||
// Löschen
|
// Löschen
|
||||||
deleteBtn.addEventListener('click', async () => {
|
deleteBtn.addEventListener('click', async () => {
|
||||||
|
|||||||
@@ -472,9 +472,8 @@ registerPage('chat', {
|
|||||||
let sessionCmds = [];
|
let sessionCmds = [];
|
||||||
try { sessionCmds = JSON.parse(session.customCommands || '[]') || []; } catch(e) {}
|
try { sessionCmds = JSON.parse(session.customCommands || '[]') || []; } catch(e) {}
|
||||||
|
|
||||||
const addCmdSection = (cmds, label) => {
|
// Sektions-Kopf (Separator + Label)
|
||||||
const validCmds = cmds.filter(c => c.name && c.command);
|
const addSectionHeader = (label) => {
|
||||||
if (validCmds.length === 0) return;
|
|
||||||
const sep = document.createElement('div');
|
const sep = document.createElement('div');
|
||||||
sep.className = 'header-menu-separator';
|
sep.className = 'header-menu-separator';
|
||||||
chatMenuDropdown.appendChild(sep);
|
chatMenuDropdown.appendChild(sep);
|
||||||
@@ -482,8 +481,23 @@ registerPage('chat', {
|
|||||||
lbl.className = 'header-menu-label';
|
lbl.className = 'header-menu-label';
|
||||||
lbl.textContent = label;
|
lbl.textContent = label;
|
||||||
chatMenuDropdown.appendChild(lbl);
|
chatMenuDropdown.appendChild(lbl);
|
||||||
validCmds.forEach(cmd => {
|
};
|
||||||
if (!cmd.name || !cmd.command) return;
|
|
||||||
|
// Navigations-Eintrag (z.B. "Agent bearbeiten" → Sprung zur Edit-Page)
|
||||||
|
const addNavItem = (label, icon, target, targetParams) => {
|
||||||
|
const btn = document.createElement('button');
|
||||||
|
btn.className = 'header-menu-item';
|
||||||
|
btn.innerHTML = `<i class="fa ${icon}"></i> ${label}`;
|
||||||
|
btn.addEventListener('click', () => {
|
||||||
|
chatMenuDropdown.hidden = true;
|
||||||
|
navigateTo(target, targetParams);
|
||||||
|
});
|
||||||
|
chatMenuDropdown.appendChild(btn);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Custom-Command-Buttons einer Sparte anhängen
|
||||||
|
const addCmdButtons = (cmds) => {
|
||||||
|
cmds.filter(c => c.name && c.command).forEach(cmd => {
|
||||||
const type = cmd.type || 'background';
|
const type = cmd.type || 'background';
|
||||||
const btn = document.createElement('button');
|
const btn = document.createElement('button');
|
||||||
btn.className = 'header-menu-item header-menu-cmd';
|
btn.className = 'header-menu-item header-menu-cmd';
|
||||||
@@ -519,8 +533,15 @@ registerPage('chat', {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
addCmdSection(agentCmds, 'Agent');
|
// Sparte "Agent": bearbeiten + Agent-Befehle
|
||||||
addCmdSection(sessionCmds, 'Session');
|
addSectionHeader('Agent');
|
||||||
|
if (currentAgentId) addNavItem('Agent bearbeiten', 'fa-pencil', 'agent', { id: currentAgentId, returnTo: 'chat', returnId: sessionId });
|
||||||
|
addCmdButtons(agentCmds);
|
||||||
|
|
||||||
|
// Sparte "Session": bearbeiten + Session-Befehle
|
||||||
|
addSectionHeader('Session');
|
||||||
|
addNavItem('Session bearbeiten', 'fa-pencil', 'session', { id: sessionId, returnTo: 'chat', returnId: sessionId });
|
||||||
|
addCmdButtons(sessionCmds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zurück zum Dashboard
|
// Zurück zum Dashboard
|
||||||
|
|||||||
@@ -36,6 +36,15 @@ registerPage('session', {
|
|||||||
const saveBtn = document.getElementById('sessionSaveBtn');
|
const saveBtn = document.getElementById('sessionSaveBtn');
|
||||||
const cancelBtn = document.getElementById('sessionCancelBtn');
|
const cancelBtn = document.getElementById('sessionCancelBtn');
|
||||||
const deleteBtn = document.getElementById('sessionDeleteBtn');
|
const deleteBtn = document.getElementById('sessionDeleteBtn');
|
||||||
|
|
||||||
|
// Rücksprung nach Speichern/Abbrechen: zurück zum Chat, wenn von dort geöffnet – sonst Dashboard
|
||||||
|
const goBack = () => {
|
||||||
|
if (params.returnTo === 'chat' && params.returnId) {
|
||||||
|
navigateTo('chat', { id: params.returnId });
|
||||||
|
} else {
|
||||||
|
navigateTo('dashboard');
|
||||||
|
}
|
||||||
|
};
|
||||||
const commandsList = document.getElementById('customCommandsList');
|
const commandsList = document.getElementById('customCommandsList');
|
||||||
const addCommandBtn = document.getElementById('addCommandBtn');
|
const addCommandBtn = document.getElementById('addCommandBtn');
|
||||||
const mcpServersList = document.getElementById('mcpServersList');
|
const mcpServersList = document.getElementById('mcpServersList');
|
||||||
@@ -246,11 +255,11 @@ registerPage('session', {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
navigateTo('dashboard');
|
goBack();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Abbrechen
|
// Abbrechen
|
||||||
cancelBtn.addEventListener('click', () => navigateTo('dashboard'));
|
cancelBtn.addEventListener('click', () => goBack());
|
||||||
|
|
||||||
// Löschen
|
// Löschen
|
||||||
deleteBtn.addEventListener('click', async () => {
|
deleteBtn.addEventListener('click', async () => {
|
||||||
|
|||||||
Reference in new issue
Block a user