Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2486a6e11 | ||
|
|
68f7f97b0d |
@@ -229,6 +229,7 @@ def _sidebar_data(request: Request, owner: str = "", repo: str = "") -> dict:
|
|||||||
gitea_workspace = False
|
gitea_workspace = False
|
||||||
gitea_owner = ""
|
gitea_owner = ""
|
||||||
gitea_repo = ""
|
gitea_repo = ""
|
||||||
|
has_active_workspace = False
|
||||||
|
|
||||||
if ws_cookie and ws_cookie.startswith("gitea:"):
|
if ws_cookie and ws_cookie.startswith("gitea:"):
|
||||||
# Gitea workspace: preserve context across pages
|
# Gitea workspace: preserve context across pages
|
||||||
@@ -238,6 +239,7 @@ def _sidebar_data(request: Request, owner: str = "", repo: str = "") -> dict:
|
|||||||
gitea_repo = parts[2]
|
gitea_repo = parts[2]
|
||||||
active_ws_name = f"{gitea_owner}/{gitea_repo}"
|
active_ws_name = f"{gitea_owner}/{gitea_repo}"
|
||||||
gitea_workspace = True
|
gitea_workspace = True
|
||||||
|
has_active_workspace = True
|
||||||
workspace_pages = [] # loaded client-side
|
workspace_pages = [] # loaded client-side
|
||||||
# Get local workspace ID for mirror
|
# Get local workspace ID for mirror
|
||||||
if user:
|
if user:
|
||||||
@@ -262,6 +264,7 @@ def _sidebar_data(request: Request, owner: str = "", repo: str = "") -> dict:
|
|||||||
if row:
|
if row:
|
||||||
active_ws_name = row["name"]
|
active_ws_name = row["name"]
|
||||||
workspace_pages = _load_workspace_pages(ws_cookie)
|
workspace_pages = _load_workspace_pages(ws_cookie)
|
||||||
|
has_active_workspace = True
|
||||||
except (ValueError, Exception):
|
except (ValueError, Exception):
|
||||||
pass
|
pass
|
||||||
local_ws_id = 0
|
local_ws_id = 0
|
||||||
@@ -376,7 +379,8 @@ def _sidebar_data(request: Request, owner: str = "", repo: str = "") -> dict:
|
|||||||
"user": user,
|
"user": user,
|
||||||
"auth_method": auth_method,
|
"auth_method": auth_method,
|
||||||
"gitea_linked": gitea_linked,
|
"gitea_linked": gitea_linked,
|
||||||
"github_linked": github_linked}
|
"github_linked": github_linked,
|
||||||
|
"has_active_workspace": has_active_workspace}
|
||||||
|
|
||||||
|
|
||||||
def _extract_ai_keywords(owner: str, repo: str, labels: list[dict], body: str = ""):
|
def _extract_ai_keywords(owner: str, repo: str, labels: list[dict], body: str = ""):
|
||||||
|
|||||||
@@ -73,8 +73,9 @@ def _sidebar_data(request: Request, repos: list[dict], include_workspace: bool =
|
|||||||
gitea_workspace = False
|
gitea_workspace = False
|
||||||
gitea_owner = ""
|
gitea_owner = ""
|
||||||
gitea_repo = ""
|
gitea_repo = ""
|
||||||
|
has_active_workspace = False
|
||||||
|
|
||||||
if include_workspace and ws_cookie and ws_cookie.startswith("gitea:"):
|
if ws_cookie and ws_cookie.startswith("gitea:"):
|
||||||
# Gitea workspace: set owner/repo for client-side tree loading
|
# Gitea workspace: set owner/repo for client-side tree loading
|
||||||
# BUT keep local workspace pages — they go in the "Private" section
|
# BUT keep local workspace pages — they go in the "Private" section
|
||||||
parts = ws_cookie.split(":", 2)
|
parts = ws_cookie.split(":", 2)
|
||||||
@@ -83,6 +84,7 @@ def _sidebar_data(request: Request, repos: list[dict], include_workspace: bool =
|
|||||||
gitea_repo = parts[2]
|
gitea_repo = parts[2]
|
||||||
active_ws_name = f"{gitea_owner}/{gitea_repo}"
|
active_ws_name = f"{gitea_owner}/{gitea_repo}"
|
||||||
gitea_workspace = True
|
gitea_workspace = True
|
||||||
|
has_active_workspace = True
|
||||||
# workspace_pages stays as-is (local tree, loaded above)
|
# workspace_pages stays as-is (local tree, loaded above)
|
||||||
elif include_workspace and ws_cookie and user:
|
elif include_workspace and ws_cookie and user:
|
||||||
try:
|
try:
|
||||||
@@ -96,6 +98,7 @@ def _sidebar_data(request: Request, repos: list[dict], include_workspace: bool =
|
|||||||
if row:
|
if row:
|
||||||
active_ws_name = row["name"]
|
active_ws_name = row["name"]
|
||||||
workspace_pages = _load_workspace_pages(ws_cookie)
|
workspace_pages = _load_workspace_pages(ws_cookie)
|
||||||
|
has_active_workspace = True
|
||||||
# else: stale cookie from another user — ignore
|
# else: stale cookie from another user — ignore
|
||||||
except (ValueError, Exception):
|
except (ValueError, Exception):
|
||||||
pass
|
pass
|
||||||
@@ -169,6 +172,7 @@ def _sidebar_data(request: Request, repos: list[dict], include_workspace: bool =
|
|||||||
"auth_method": auth_method,
|
"auth_method": auth_method,
|
||||||
"gitea_linked": gitea_linked,
|
"gitea_linked": gitea_linked,
|
||||||
"github_linked": github_linked,
|
"github_linked": github_linked,
|
||||||
|
"has_active_workspace": has_active_workspace,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+29
-3
@@ -202,20 +202,30 @@
|
|||||||
<div class="sidebar-section-header" @click="toggleSection('workspace')">
|
<div class="sidebar-section-header" @click="toggleSection('workspace')">
|
||||||
<div class="sidebar-section-title">
|
<div class="sidebar-section-title">
|
||||||
<span class="chevron" :class="{ open: sectionsOpen.workspace }" x-text="sectionsOpen.workspace ? '▼' : '▶'"></span>
|
<span class="chevron" :class="{ open: sectionsOpen.workspace }" x-text="sectionsOpen.workspace ? '▼' : '▶'"></span>
|
||||||
|
{% if has_active_workspace %}
|
||||||
<span>{% if gitea_workspace %}📁 {{ active_ws_name }}{% elif workspace_key and '/' in workspace_key %}🔗{% else %}📁{% endif %} {{ active_ws_name if not gitea_workspace else '' }}</span>
|
<span>{% if gitea_workspace %}📁 {{ active_ws_name }}{% elif workspace_key and '/' in workspace_key %}🔗{% else %}📁{% endif %} {{ active_ws_name if not gitea_workspace else '' }}</span>
|
||||||
|
{% else %}
|
||||||
|
<span>📁 No workspace open</span>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
{% if has_active_workspace %}
|
||||||
<div class="sidebar-section-actions">
|
<div class="sidebar-section-actions">
|
||||||
<button class="section-action-btn" title="New Page" @click.stop="window.FlowDeck.createPage()">📄</button>
|
<button class="section-action-btn" title="New Page" @click.stop="window.FlowDeck.createPage()">📄</button>
|
||||||
<button class="section-action-btn" title="New Folder" @click.stop="window.FlowDeck.showCreateFolderModal()">📁</button>
|
<button class="section-action-btn" title="New Folder" @click.stop="window.FlowDeck.showCreateFolderModal()">📁</button>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% from '_workspace_tree_macro.html' import render_workspace_tree %}
|
{% from '_workspace_tree_macro.html' import render_workspace_tree %}
|
||||||
<div class="sidebar-section-items" x-show="sectionsOpen.workspace" x-transition>
|
<div class="sidebar-section-items" x-show="sectionsOpen.workspace" x-transition>
|
||||||
<ul class="sidebar-items" data-section="workspace" id="sidebar-workspace-items">
|
<ul class="sidebar-items" data-section="workspace" id="sidebar-workspace-items">
|
||||||
{% if workspace_pages %}
|
{% if has_active_workspace %}
|
||||||
{{ render_workspace_tree(workspace_pages) }}
|
{% if workspace_pages %}
|
||||||
|
{{ render_workspace_tree(workspace_pages) }}
|
||||||
|
{% else %}
|
||||||
|
<li class="sidebar-item empty-hint"><span class="page-icon">📄</span><span class="page-name text-dim">No pages yet</span></li>
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<li class="sidebar-item empty-hint"><span class="page-icon">📄</span><span class="page-name text-dim">No pages yet</span></li>
|
<li class="sidebar-item empty-hint"><span class="page-icon">📁</span><span class="page-name text-dim">Open a workspace to see your files</span></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="sidebar-item" style="margin-top:4px;border-top:1px solid var(--border);padding-top:8px;" onclick="window.location='/workspaces'">
|
<li class="sidebar-item" style="margin-top:4px;border-top:1px solid var(--border);padding-top:8px;" onclick="window.location='/workspaces'">
|
||||||
<span class="page-icon">⚙</span><span class="page-name text-dim">Manage Workspaces</span>
|
<span class="page-icon">⚙</span><span class="page-name text-dim">Manage Workspaces</span>
|
||||||
@@ -1122,6 +1132,14 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
newPageInWorkspace() {
|
newPageInWorkspace() {
|
||||||
|
// Guard: no workspace active — redirect to workspaces page
|
||||||
|
if (!this.workspaceKey || this.workspaceKey === this.workspaceName) {
|
||||||
|
if (!this.giteaWorkspace && !this.localWsId) {
|
||||||
|
this.toast('No workspace open — create one first', 'info');
|
||||||
|
setTimeout(() => { window.location.href = '/workspaces'; }, 1200);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
const name = prompt('File name:');
|
const name = prompt('File name:');
|
||||||
if (!name || !name.trim()) return;
|
if (!name || !name.trim()) return;
|
||||||
const wk = this.workspaceKey || '';
|
const wk = this.workspaceKey || '';
|
||||||
@@ -1149,6 +1167,14 @@
|
|||||||
.catch(err => { this.toast('Failed: ' + err.message, 'error'); });
|
.catch(err => { this.toast('Failed: ' + err.message, 'error'); });
|
||||||
},
|
},
|
||||||
newFolderInWorkspace() {
|
newFolderInWorkspace() {
|
||||||
|
// Guard: no workspace active — redirect to workspaces page
|
||||||
|
if (!this.workspaceKey || this.workspaceKey === this.workspaceName) {
|
||||||
|
if (!this.giteaWorkspace && !this.localWsId) {
|
||||||
|
this.toast('No workspace open — create one first', 'info');
|
||||||
|
setTimeout(() => { window.location.href = '/workspaces'; }, 1200);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
const name = prompt('Folder name:');
|
const name = prompt('Folder name:');
|
||||||
if (!name || !name.trim()) return;
|
if (!name || !name.trim()) return;
|
||||||
const wk = this.workspaceKey || '';
|
const wk = this.workspaceKey || '';
|
||||||
|
|||||||
Reference in New Issue
Block a user