mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-06-08 06:25:34 +08:00
Add fast project display names option
This commit is contained in:
@@ -71,10 +71,14 @@ router.get(
|
|||||||
const skipSynchronization =
|
const skipSynchronization =
|
||||||
readQueryStringValue(req.query.skipSynchronization).trim() === '1' ||
|
readQueryStringValue(req.query.skipSynchronization).trim() === '1' ||
|
||||||
readQueryStringValue(req.query.skipSync).trim() === '1';
|
readQueryStringValue(req.query.skipSync).trim() === '1';
|
||||||
|
const fastDisplayNames =
|
||||||
|
readQueryStringValue(req.query.fastDisplayNames).trim() === '1' ||
|
||||||
|
readQueryStringValue(req.query.fastNames).trim() === '1';
|
||||||
const sessionsLimit = readOptionalNumericQueryValue(req.query.sessionsLimit) ?? undefined;
|
const sessionsLimit = readOptionalNumericQueryValue(req.query.sessionsLimit) ?? undefined;
|
||||||
const sessionsOffset = readOptionalNumericQueryValue(req.query.sessionsOffset) ?? undefined;
|
const sessionsOffset = readOptionalNumericQueryValue(req.query.sessionsOffset) ?? undefined;
|
||||||
const projects = await getProjectsWithSessions({
|
const projects = await getProjectsWithSessions({
|
||||||
skipSynchronization,
|
skipSynchronization,
|
||||||
|
fastDisplayNames,
|
||||||
sessionsLimit,
|
sessionsLimit,
|
||||||
sessionsOffset,
|
sessionsOffset,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ type ProgressUpdate = {
|
|||||||
|
|
||||||
type GetProjectsWithSessionsOptions = {
|
type GetProjectsWithSessionsOptions = {
|
||||||
skipSynchronization?: boolean;
|
skipSynchronization?: boolean;
|
||||||
|
fastDisplayNames?: boolean;
|
||||||
sessionsLimit?: number;
|
sessionsLimit?: number;
|
||||||
sessionsOffset?: number;
|
sessionsOffset?: number;
|
||||||
};
|
};
|
||||||
@@ -116,6 +117,15 @@ export async function generateDisplayName(projectName: string, actualProjectDir:
|
|||||||
return projectPath;
|
return projectPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateFastDisplayName(projectPath: string): string {
|
||||||
|
if (projectPath.startsWith('/')) {
|
||||||
|
const parts = projectPath.split('/').filter(Boolean);
|
||||||
|
return parts[parts.length - 1] || projectPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
return projectPath.replace(/-/g, '/');
|
||||||
|
}
|
||||||
|
|
||||||
function normalizeSessionPagination(options: SessionPaginationOptions = {}): { limit: number; offset: number } {
|
function normalizeSessionPagination(options: SessionPaginationOptions = {}): { limit: number; offset: number } {
|
||||||
const rawLimit = Number.isFinite(options.limit) ? Math.floor(Number(options.limit)) : DEFAULT_PROJECT_SESSIONS_PAGE_SIZE;
|
const rawLimit = Number.isFinite(options.limit) ? Math.floor(Number(options.limit)) : DEFAULT_PROJECT_SESSIONS_PAGE_SIZE;
|
||||||
const rawOffset = Number.isFinite(options.offset) ? Math.floor(Number(options.offset)) : 0;
|
const rawOffset = Number.isFinite(options.offset) ? Math.floor(Number(options.offset)) : 0;
|
||||||
@@ -239,7 +249,9 @@ export async function getProjectsWithSessions(
|
|||||||
const displayName =
|
const displayName =
|
||||||
row.custom_project_name && row.custom_project_name.trim().length > 0
|
row.custom_project_name && row.custom_project_name.trim().length > 0
|
||||||
? row.custom_project_name
|
? row.custom_project_name
|
||||||
: await generateDisplayName(path.basename(projectPath) || projectPath, projectPath);
|
: options.fastDisplayNames
|
||||||
|
? generateFastDisplayName(projectPath)
|
||||||
|
: await generateDisplayName(path.basename(projectPath) || projectPath, projectPath);
|
||||||
|
|
||||||
const sessionsPage = readProjectSessionsPageByPath(projectPath, {
|
const sessionsPage = readProjectSessionsPageByPath(projectPath, {
|
||||||
limit: options.sessionsLimit,
|
limit: options.sessionsLimit,
|
||||||
|
|||||||
Reference in New Issue
Block a user