fix(library): tab Workspace affiche le contenu du workspace local actif
FlowDeck CI / test (push) Failing after 4s
FlowDeck CI / docker (push) Has been skipped

- Nouvel endpoint /api/library/local-workspace?workspace_id=X
  interroge local_workspace_items et formate pour la Library
- Nouvel endpoint /api/library/local-workspace-children/{id}
  pour l'expansion d'arborescence des items du workspace local
- Frontend: détecte workspaceId + !isGiteaActive → appelle local-workspace
- Frontend: toggleExpand route vers le bon endpoint selon source_type
This commit is contained in:
2026-07-19 14:12:04 -04:00
parent d3923c1d9a
commit 1bafbf1eff
2 changed files with 153 additions and 3 deletions
+14 -3
View File
@@ -464,8 +464,14 @@ function libraryPage() {
try {
var url = '/api/library/' + this.tab;
var sep = '?';
if (this.workspaceId && (this.tab === 'recents')) {
url += sep + 'workspace_id=' + this.workspaceId; sep = '&';
// Workspace tab: if local workspace is active, show local workspace items
if (this.tab === 'workspace' && this.workspaceId && !this.isGiteaActive) {
url = '/api/library/local-workspace' + sep + 'workspace_id=' + this.workspaceId;
sep = '&';
} else {
if (this.workspaceId && (this.tab === 'recents')) {
url += sep + 'workspace_id=' + this.workspaceId; sep = '&';
}
}
if (this.tab === 'repository' && this.isGiteaActive) {
url += sep + 'gitea_owner=' + encodeURIComponent(this.giteaOwner) + '&gitea_repo=' + encodeURIComponent(this.giteaRepo);
@@ -522,7 +528,12 @@ function libraryPage() {
this.expanded = Object.assign({}, this.expanded);
if (!item.children || !item.children.length) {
try {
var r = await fetch('/api/library/children/' + item.id);
// Route to correct children endpoint based on source type
var childrenUrl = '/api/library/children/' + item.id;
if (item.source_type === 'local-ws') {
childrenUrl = '/api/library/local-workspace-children/' + item.id;
}
var r = await fetch(childrenUrl);
var d = await r.json();
item.children = d.items || [];
// Mark the tree for depth calculation