feat: allow status dashboard header without room details
This commit is contained in:
@@ -82,6 +82,8 @@ export const STATUS_UPDATE_INTERVAL = 10000; // 10s
|
||||
export const USAGE_UPDATE_INTERVAL = 300000; // 5 minutes
|
||||
export const STATUS_SHOW_ROOMS =
|
||||
(getEnv('STATUS_SHOW_ROOMS') || 'true') !== 'false';
|
||||
export const STATUS_SHOW_ROOM_DETAILS =
|
||||
(getEnv('STATUS_SHOW_ROOM_DETAILS') || 'true') !== 'false';
|
||||
export const USAGE_DASHBOARD_ENABLED = getEnv('USAGE_DASHBOARD') === 'true';
|
||||
|
||||
// Timezone for scheduled tasks (cron expressions, etc.)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { STATUS_SHOW_ROOMS } from './config.js';
|
||||
import { STATUS_SHOW_ROOM_DETAILS, STATUS_SHOW_ROOMS } from './config.js';
|
||||
import {
|
||||
composeDashboardContent,
|
||||
type DashboardRoomLine,
|
||||
@@ -50,12 +50,15 @@ export function buildStatusContent(opts: DashboardOptions): string {
|
||||
})
|
||||
.filter((line): line is DashboardRoomLine => Boolean(line));
|
||||
|
||||
const header = `**에이전트 상태** (${opts.assistantName}) — 활성 ${totalActive} | 큐대기 ${totalWaiting} | 전체 ${roomLines.length}`;
|
||||
if (!STATUS_SHOW_ROOM_DETAILS) {
|
||||
return composeDashboardContent([header]);
|
||||
}
|
||||
|
||||
return composeDashboardContent([
|
||||
`**에이전트 상태** (${opts.assistantName}) — 활성 ${totalActive} | 큐대기 ${totalWaiting} | 전체 ${roomLines.length}\n\n${renderCategorizedRoomSections(
|
||||
{
|
||||
lines: roomLines,
|
||||
showCategoryHeaders: false,
|
||||
},
|
||||
)}`,
|
||||
`${header}\n\n${renderCategorizedRoomSections({
|
||||
lines: roomLines,
|
||||
showCategoryHeaders: false,
|
||||
})}`,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -38,16 +38,23 @@ function makeOptions(sessionId?: string): DashboardOptions {
|
||||
|
||||
describe('buildStatusContent', () => {
|
||||
async function loadBuildStatusContent(
|
||||
statusShowRooms = 'true',
|
||||
options: {
|
||||
statusShowRooms?: string;
|
||||
statusShowRoomDetails?: string;
|
||||
} = {},
|
||||
): Promise<(opts: DashboardOptions) => string> {
|
||||
vi.resetModules();
|
||||
process.env.STATUS_SHOW_ROOMS = statusShowRooms;
|
||||
process.env.STATUS_SHOW_ROOMS = options.statusShowRooms ?? 'true';
|
||||
if (options.statusShowRoomDetails !== undefined) {
|
||||
process.env.STATUS_SHOW_ROOM_DETAILS = options.statusShowRoomDetails;
|
||||
}
|
||||
const mod = await import('./dashboard-status-content.js');
|
||||
return mod.buildStatusContent;
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
delete process.env.STATUS_SHOW_ROOMS;
|
||||
delete process.env.STATUS_SHOW_ROOM_DETAILS;
|
||||
});
|
||||
|
||||
it('shows cleared sessions as empty', async () => {
|
||||
@@ -63,7 +70,19 @@ describe('buildStatusContent', () => {
|
||||
});
|
||||
|
||||
it('returns an empty string when room status display is disabled', async () => {
|
||||
const buildStatusContent = await loadBuildStatusContent('false');
|
||||
const buildStatusContent = await loadBuildStatusContent({
|
||||
statusShowRooms: 'false',
|
||||
});
|
||||
expect(buildStatusContent(makeOptions())).toBe('');
|
||||
});
|
||||
|
||||
it('renders only the status header when room details are disabled', async () => {
|
||||
const buildStatusContent = await loadBuildStatusContent({
|
||||
statusShowRooms: 'true',
|
||||
statusShowRoomDetails: 'false',
|
||||
});
|
||||
|
||||
expect(buildStatusContent(makeOptions())).toContain('**에이전트 상태**');
|
||||
expect(buildStatusContent(makeOptions())).not.toContain('**clone-test**');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { execSync } from 'child_process';
|
||||
import os from 'os';
|
||||
|
||||
import { STATUS_SHOW_ROOMS, USAGE_DASHBOARD_ENABLED } from './config.js';
|
||||
import {
|
||||
STATUS_SHOW_ROOM_DETAILS,
|
||||
STATUS_SHOW_ROOMS,
|
||||
USAGE_DASHBOARD_ENABLED,
|
||||
} from './config.js';
|
||||
import {
|
||||
fetchAllClaudeUsage,
|
||||
fetchAllClaudeProfiles,
|
||||
@@ -358,6 +362,10 @@ function buildStatusContent(): string {
|
||||
totalRooms,
|
||||
watchers: watcherSummary,
|
||||
});
|
||||
if (!STATUS_SHOW_ROOM_DETAILS) {
|
||||
return header;
|
||||
}
|
||||
|
||||
const sections = renderCategorizedRoomSections({
|
||||
lines: roomLines,
|
||||
showCategoryHeaders: channelMetaCache.size > 0,
|
||||
|
||||
Reference in New Issue
Block a user