mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-05-01 18:28:38 +00:00
refactor(projects): rename getProjects with getProjectsWithSessions
This commit is contained in:
@@ -27,7 +27,7 @@ import { promises as fsPromises } from 'fs';
|
||||
import { spawn } from 'child_process';
|
||||
import pty from 'node-pty';
|
||||
import mime from 'mime-types';
|
||||
import { getProjects } from '@/modules/projects';
|
||||
import { getProjectsWithSessions } from '@/modules/projects';
|
||||
|
||||
import {
|
||||
getSessionsById,
|
||||
@@ -142,7 +142,7 @@ async function setupProjectsWatcher() {
|
||||
clearProjectDirectoryCache();
|
||||
|
||||
// Get updated projects list
|
||||
const updatedProjects = await getProjects(broadcastProgress);
|
||||
const updatedProjects = await getProjectsWithSessions(broadcastProgress);
|
||||
|
||||
// Notify all connected clients about the project changes
|
||||
const updateMessage = JSON.stringify({
|
||||
@@ -431,7 +431,7 @@ app.post('/api/system/update', authenticateToken, async (req, res) => {
|
||||
|
||||
app.get('/api/projects', authenticateToken, async (req, res) => {
|
||||
try {
|
||||
const projects = await getProjects(broadcastProgress);
|
||||
const projects = await getProjectsWithSessions(broadcastProgress);
|
||||
res.json(projects);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
@@ -2375,7 +2375,7 @@ async function startServer() {
|
||||
// Start watching the projects folder for changes
|
||||
await setupProjectsWatcher();
|
||||
|
||||
// await getProjects(); // TODO: REMOVE THIS
|
||||
// await getProjectsWithSessions(); // TODO: REMOVE THIS
|
||||
// Start server-side plugin processes for enabled plugins
|
||||
startEnabledPluginServers().catch(err => {
|
||||
console.error('[Plugins] Error during startup:', err.message);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export {
|
||||
createProjectsSnapshot,
|
||||
generateDisplayName,
|
||||
getProjects,
|
||||
getProjectsWithSessions,
|
||||
writeSnapshot,
|
||||
} from './services/projects.service.js';
|
||||
@@ -175,7 +175,7 @@ export async function writeSnapshot(projects: ProjectListItem[]): Promise<void>
|
||||
/**
|
||||
* Reads all projects from DB and returns provider-bucketed session summaries.
|
||||
*/
|
||||
export async function getProjects(progressCallback: ProgressCallback = null): Promise<ProjectListItem[]> {
|
||||
export async function getProjectsWithSessions(progressCallback: ProgressCallback = null): Promise<ProjectListItem[]> {
|
||||
await sessionSynchronizerService.synchronizeSessions();
|
||||
|
||||
const projectRows = projectsDb.getProjectPaths() as Array<{
|
||||
|
||||
@@ -872,7 +872,7 @@ async function renameProject(projectName, newDisplayName) {
|
||||
* ID-based wrapper around `renameProject`.
|
||||
*
|
||||
* Writes the new display name to the `projects.custom_project_name` column
|
||||
* (the source of truth for the DB-driven getProjects() response) and also
|
||||
* (the source of truth for the DB-driven getProjectsWithSessions() response) and also
|
||||
* keeps the legacy project-config.json in sync for backwards compatibility
|
||||
* with any code that still reads it.
|
||||
*/
|
||||
@@ -883,7 +883,7 @@ async function renameProjectById(projectId, newDisplayName) {
|
||||
}
|
||||
|
||||
const trimmed = typeof newDisplayName === 'string' ? newDisplayName.trim() : '';
|
||||
// Persist on the DB row so getProjects() immediately reflects the change.
|
||||
// Persist on the DB row so getProjectsWithSessions() immediately reflects the change.
|
||||
projectsDb.updateCustomProjectNameById(projectId, trimmed.length > 0 ? trimmed : null);
|
||||
|
||||
// Keep the legacy file-based project config in lockstep so historic readers
|
||||
|
||||
Reference in New Issue
Block a user