diff --git a/frontend/src/lib/plugin-host/VerstakPluginAPI.js b/frontend/src/lib/plugin-host/VerstakPluginAPI.js index 4ba0d31..fc68dd6 100644 --- a/frontend/src/lib/plugin-host/VerstakPluginAPI.js +++ b/frontend/src/lib/plugin-host/VerstakPluginAPI.js @@ -225,6 +225,23 @@ export function createPluginAPI(pluginId) { } }, + backend: { + call: async function(method, ...args) { + assertActive('backend.call(' + method + ')'); + try { + const App = window['go']?.['api']?.['App']; + if (!App || typeof App[method] !== 'function') { + throw new Error('Backend method not found: ' + method); + } + const result = await App[method](...args); + return result; + } catch (e) { + const message = e && e.message ? e.message : String(e); + throw new Error('[plugin:' + pluginId + '] backend.call(' + method + ') failed: ' + message); + } + } + }, + workbench: { openResource: async function(request) { assertActive('workbench.openResource'); diff --git a/frontend/src/lib/shell/WorkspaceTree.svelte b/frontend/src/lib/shell/WorkspaceTree.svelte index e9eaa92..abf3dd4 100644 --- a/frontend/src/lib/shell/WorkspaceTree.svelte +++ b/frontend/src/lib/shell/WorkspaceTree.svelte @@ -1,7 +1,7 @@ -{#if depth === 0} -
-
- Workspace - -
+
+
+ Workspaces + +
- {#if loading} -
Loading...
- {:else if localError} -
{localError}
- {:else} - {#each roots() as node (node.id)} - - {/each} - {/if} + {#if loading} +
Loading...
+ {:else if localError} +
{localError}
+ {/if} - {#if showCreate} -
-
- New {newNodeType} - -
- -
- - +
+ {#each workspaces as workspace (wsName(workspace))} + {@const id = wsName(workspace)} +
+
+ + {#if renamingId === id} + { + if (e.key === 'Enter') commitRename(workspace); + if (e.key === 'Escape') cancelRename(); + }} + /> + + + {:else} + + + + {/if}
- {/if} + {/each}
-{:else} -
-
- {#if hasKids(node.id)} - - {:else} - - {/if} - - - {#if node.type !== 'case'} - - {/if} + + {#if showCreate} +
+
+ New workspace + +
+ +
+ + +
- {#if expandedNodes[node.id]} - {#each childrenOf(node.id) as child (child.id)} - - {/each} - {/if} -
-{/if} + {/if} +