mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-20 09:09:35 +02:00
feat(session-options): show the session's working folder with a copy button
This commit is contained in:
1 parent
3d59e59e37
commit
0fced6ea97
4 files changed
+39
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'aicodeman': patch
|
||||
---
|
||||
|
||||
Session Options > Session now shows the working folder the session's CLI runs in on the Codeman host, with a Copy button.
|
||||
@@ -1407,6 +1407,16 @@
|
||||
<input type="text" id="modalSessionName" class="set-input" maxlength="128" placeholder="Auto (directory name)" onblur="app.saveSessionName()">
|
||||
</div>
|
||||
</div>
|
||||
<div class="set-row">
|
||||
<div class="set-row-text">
|
||||
<span class="set-row-label">Working folder</span>
|
||||
<span class="set-row-desc">Where this session's CLI runs, on the machine hosting Codeman.</span>
|
||||
</div>
|
||||
<div class="set-row-actions">
|
||||
<code id="modalSessionPath" class="set-static mono" style="word-break: break-all; user-select: all;"></code>
|
||||
<button type="button" class="btn-toolbar btn-sm" id="modalSessionPathCopy" onclick="app.copySessionPath()">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="set-row set-row-block">
|
||||
<div class="set-row-text">
|
||||
<span class="set-row-label">Session color</span>
|
||||
|
||||
@@ -2473,6 +2473,14 @@ Object.assign(CodemanApp.prototype, {
|
||||
if (tab) tab.classList.toggle('tab-show-detach', !!on);
|
||||
},
|
||||
|
||||
/** Copy the open session's working folder (Session Options > Session > Working folder). */
|
||||
async copySessionPath() {
|
||||
const session = this.sessions.get(this.editingSessionId);
|
||||
if (!session?.workingDir) return;
|
||||
const ok = await this._copyText(session.workingDir);
|
||||
this.showToast(ok ? 'Path copied' : 'Copy failed', ok ? 'success' : 'error');
|
||||
},
|
||||
|
||||
openSessionOptions(sessionId) {
|
||||
const session = this.sessions.get(sessionId);
|
||||
if (!session) return;
|
||||
@@ -2552,6 +2560,12 @@ Object.assign(CodemanApp.prototype, {
|
||||
document.getElementById('modalSessionName').placeholder = 'Auto (directory name)';
|
||||
}
|
||||
|
||||
// Working folder: the path the CLI was launched in on the Codeman host
|
||||
const _pathEl = document.getElementById('modalSessionPath');
|
||||
_pathEl.textContent = session.workingDir || '';
|
||||
_pathEl.title = session.workingDir || '';
|
||||
document.getElementById('modalSessionPathCopy').disabled = !session.workingDir;
|
||||
|
||||
// Initialize color picker with current session color
|
||||
const currentColor = session.color || 'default';
|
||||
const colorPicker = document.getElementById('sessionColorPicker');
|
||||
|
||||
@@ -103,4 +103,14 @@ describe('Session Options modal structure', () => {
|
||||
);
|
||||
expect(styles).not.toMatch(/@media \(min-width: 680px\)[\s\S]{0,1200}#sessionOptionsModal #context-tab/);
|
||||
});
|
||||
|
||||
it('shows the session working folder with a copy button', () => {
|
||||
const modal = optionsModal();
|
||||
expect(modal).toContain('id="modalSessionPath"');
|
||||
expect(modal).toContain('app.copySessionPath()');
|
||||
const open = methodBody('openSessionOptions(sessionId)');
|
||||
expect(open).toContain("getElementById('modalSessionPath')");
|
||||
expect(open).toContain('session.workingDir');
|
||||
expect(methodBody('async copySessionPath()')).toContain('_copyText(session.workingDir)');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user