fix(workspace): show .app children in tree and fix cron tab opening
App folders are now expandable when hidden files are shown, and cron items properly open in tabs.
This commit is contained in:
parent
92b32fdf21
commit
e92419760b
@ -177,16 +177,18 @@ async function buildTree(
|
||||
const isSymlink = entry.isSymbolicLink();
|
||||
|
||||
if (effectiveType === "directory") {
|
||||
// Detect .dench.app folders -- treat as app nodes (no children exposed)
|
||||
// Detect .dench.app folders -- treat as app nodes
|
||||
if (entry.name.endsWith(".dench.app")) {
|
||||
const manifest = await readAppManifest(absPath);
|
||||
const displayName = manifest?.name || entry.name.replace(/\.dench\.app$/, "");
|
||||
const children = showHidden ? await buildTree(absPath, relPath, dbObjects, showHidden) : undefined;
|
||||
nodes.push({
|
||||
name: displayName,
|
||||
path: relPath,
|
||||
type: "app",
|
||||
icon: manifest?.icon,
|
||||
appManifest: manifest ?? { name: displayName, entry: "index.html", runtime: "static" },
|
||||
...(children && children.length > 0 && { children }),
|
||||
...(isSymlink && { symlink: true }),
|
||||
});
|
||||
continue;
|
||||
|
||||
@ -470,7 +470,7 @@ function DraggableNode({
|
||||
// Workspace root in browse mode: non-expandable entry point back to workspace
|
||||
const isWorkspaceRoot = !!workspaceRoot && node.path === workspaceRoot;
|
||||
const hasChildren = node.children && node.children.length > 0;
|
||||
const isExpandable = isWorkspaceRoot ? false : node.type === "app" ? false : (hasChildren || node.type === "folder" || node.type === "object");
|
||||
const isExpandable = isWorkspaceRoot ? false : node.type === "app" ? !!hasChildren : (hasChildren || node.type === "folder" || node.type === "object");
|
||||
const isExpanded = isWorkspaceRoot ? false : expandedPaths.has(node.path);
|
||||
const isActive = activePath === node.path;
|
||||
const isSelected = selectedPath === node.path;
|
||||
|
||||
@ -184,6 +184,17 @@ export type DenchAppManifest = {
|
||||
entry?: string;
|
||||
runtime?: "static" | "esbuild" | "build";
|
||||
permissions?: string[];
|
||||
display?: "full" | "widget";
|
||||
widget?: {
|
||||
width?: number;
|
||||
height?: number;
|
||||
refreshInterval?: number;
|
||||
};
|
||||
tools?: Array<{
|
||||
name: string;
|
||||
description: string;
|
||||
inputSchema?: unknown;
|
||||
}>;
|
||||
};
|
||||
|
||||
type SidebarPreviewContent =
|
||||
@ -1063,6 +1074,7 @@ function WorkspacePageInner() {
|
||||
// Clicking the cron directory → show cron dashboard
|
||||
if (node.path === openclawDir + "/cron") {
|
||||
setBrowseDir(null);
|
||||
openTabForNode({ path: "~cron", name: "Cron", type: "folder" });
|
||||
setActivePath("~cron");
|
||||
setContent({ kind: "cron-dashboard" });
|
||||
return;
|
||||
@ -1105,6 +1117,7 @@ function WorkspacePageInner() {
|
||||
const jobId = node.path.slice("~cron/".length);
|
||||
const job = cronJobs.find((j) => j.id === jobId);
|
||||
if (job) {
|
||||
openTabForNode(node);
|
||||
setActivePath(node.path);
|
||||
setContent({ kind: "cron-job", jobId, job });
|
||||
return;
|
||||
@ -1112,6 +1125,7 @@ function WorkspacePageInner() {
|
||||
}
|
||||
// Clicking the Cron folder itself opens the dashboard
|
||||
if (node.path === "~cron") {
|
||||
openTabForNode(node);
|
||||
setActivePath(node.path);
|
||||
setContent({ kind: "cron-dashboard" });
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user