mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-08 00:19:42 +02:00
COD-139 add session pinning (float pinned sessions to top of session manager list)
Pin/unpin a session via POST /api/sessions/:id/pin {pinned}; pinned sessions
sort above unpinned in the unified session manager list (COD-121), ordered by
pinnedAt descending. Pin state lives on SessionState, persists to state.json,
and survives reload/reconnect/restart (persisted-input carries pinned; the
merge skips undefined so a recovered live session can't clobber it). New SSE
event session:pinned re-sorts the open list live across clients. Pin/Unpin
affordance in the session-row kebab menu with a 📌 glyph + amber highlight.
(cherry picked from commit 82749747039afcd4a3104f6a97ce7d3c2ddd048d)
This commit is contained in:
@@ -229,6 +229,8 @@ export class MockSession extends EventEmitter {
|
||||
color: this.color,
|
||||
mode: this.mode,
|
||||
muxName: this._muxName,
|
||||
pinned: this.pinned || undefined,
|
||||
pinnedAt: this.pinned ? (this.pinnedAt ?? undefined) : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -241,6 +243,14 @@ export class MockSession extends EventEmitter {
|
||||
if (!enabled) this.autoResumeAt = null;
|
||||
});
|
||||
|
||||
/** Pin state (COD-139) */
|
||||
pinned: boolean = false;
|
||||
pinnedAt: number | null = null;
|
||||
setPinned = vi.fn((pinned: boolean) => {
|
||||
this.pinned = pinned;
|
||||
this.pinnedAt = pinned ? Date.now() : null;
|
||||
});
|
||||
|
||||
/** Check if session is busy */
|
||||
isBusy = vi.fn(() => false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user