fix: Gitea sidebar now has separate Repository section below Private
Backend: - _sidebar_data() no longer clears workspace_pages for Gitea workspaces The local tree stays intact in the 'Private' section - workspace_pages is always loaded from DB (local files) Sidebar template (base.html): - Workspace section renamed to 'Private' when gitea_workspace is true - New 'Repository (Gitea)' section added below, visible only for Gitea workspaces, with its own toggle (sectionsOpen.gitea) and refresh button - Uses #sidebar-gitea-items container for the remote file tree Gitea workspace: - loadSidebarTree() now targets #sidebar-gitea-items - window._gwData exposed for sidebar refresh button - sectionsOpen now includes gitea: true by default
This commit is contained in:
@@ -229,9 +229,11 @@ function giteaWorkspace() {
|
||||
},
|
||||
|
||||
init() {
|
||||
// Expose globally for header to access
|
||||
window._gwData = this;
|
||||
// Set cookie for sidebar
|
||||
document.cookie = 'flowdeck_workspace=gitea:' + this.owner + ':' + this.repo + ';path=/;SameSite=Lax';
|
||||
// Load sidebar tree
|
||||
// Load sidebar tree (into gitea section)
|
||||
this.loadSidebarTree();
|
||||
// Load main content tree
|
||||
this.loadMainTree('');
|
||||
@@ -312,17 +314,17 @@ function giteaWorkspace() {
|
||||
var r = await fetch('/api/gitea/projects/' + this.owner + '/' + this.repo + '/tree');
|
||||
if (!r.ok) {
|
||||
// If API fails (e.g. no Gitea token), set a message
|
||||
var container = document.getElementById('sidebar-workspace-items');
|
||||
var container = document.getElementById('sidebar-gitea-items');
|
||||
if (container) container.innerHTML = '<li class="sidebar-item empty-hint"><span class="page-icon">🔗</span><span class="page-name text-dim">Connect Gitea to browse files</span></li>';
|
||||
return;
|
||||
}
|
||||
var d = await r.json();
|
||||
var items = d.tree || [];
|
||||
var container = document.getElementById('sidebar-workspace-items');
|
||||
var container = document.getElementById('sidebar-gitea-items');
|
||||
if (!container) return;
|
||||
// Ensure workspace section is visible
|
||||
if (window.appState && window.appState.sectionsOpen && !window.appState.sectionsOpen.workspace) {
|
||||
window.appState.sectionsOpen.workspace = true;
|
||||
// Ensure gitea section is visible
|
||||
if (window.appState && window.appState.sectionsOpen && !window.appState.sectionsOpen.gitea) {
|
||||
window.appState.sectionsOpen.gitea = true;
|
||||
}
|
||||
container.innerHTML = '';
|
||||
// Build tree HTML as string and set once (more performant)
|
||||
|
||||
Reference in New Issue
Block a user