Skip to content

Commit bb481d9

Browse files
authored
Merge pull request #80 from odefun/feat/settings-ui-workspace-controls-17707017
Improve settings workspace UX and reduce routine log noise
2 parents bfd5cc0 + c2931cf commit bb481d9

File tree

7 files changed

+100
-59
lines changed

7 files changed

+100
-59
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ode",
3-
"version": "0.0.49",
3+
"version": "0.0.50",
44
"description": "Coding anywhere with your coding agents connected",
55
"module": "packages/core/index.ts",
66
"type": "module",

packages/agents/opencode/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ export function stopAllSessions(): void {
516516

517517
runtimeState.clientByBaseUrl.clear();
518518

519-
log.info("All OpenCode sessions stopped");
519+
log.debug("All OpenCode sessions stopped");
520520
}
521521

522522
// Get URL from any available instance

packages/core/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ async function stopSlackRuntime(reason: string): Promise<void> {
6868
slackApps = [];
6969
slackAppTokens = [];
7070
resetSlackState();
71-
log.info("Slack connections stopped", { reason });
71+
log.debug("Slack connections stopped", { reason });
7272
}
7373

7474
async function startSlackRuntime(reason: string): Promise<void> {
@@ -263,7 +263,7 @@ async function main(): Promise<void> {
263263

264264
// Handle shutdown gracefully
265265
const shutdown = async (signal: string) => {
266-
log.info("Shutting down...", { signal });
266+
log.debug("Shutting down...", { signal });
267267

268268
try {
269269
stopOAuthServer();
@@ -278,7 +278,7 @@ async function main(): Promise<void> {
278278
}
279279
stopAutoUpgradeScheduler();
280280
await stopAllServers();
281-
log.info("Cleanup complete");
281+
log.debug("Cleanup complete");
282282
process.exit(0);
283283
} catch (err) {
284284
log.error("Error during cleanup", { error: String(err) });
@@ -299,8 +299,7 @@ async function main(): Promise<void> {
299299
log.debug("Bot is running in Socket Mode");
300300
}
301301

302-
log.info("Configure Ode settings at", { url: getLocalSettingsUrl() });
303-
log.info("Ode is ready! Waiting for messages...");
302+
console.log(`Ode is ready! Waiting for messages, setting UI is accessible at ${getLocalSettingsUrl()}`);
304303
}
305304

306305
main().catch((err) => {

packages/core/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function setWorktreeGitIdentity(params: {
6060
["user.name", gitIdentity.gitName],
6161
["user.email", gitIdentity.gitEmail],
6262
];
63-
log.info("Setting git identity in worktree config", {
63+
log.debug("Setting git identity in worktree config", {
6464
channelId,
6565
threadId,
6666
hasName: Boolean(gitIdentity.gitName),

packages/core/web/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,5 +584,5 @@ export function stopLocalWebServer(): void {
584584
if (!webServer) return;
585585
webServer.stop();
586586
webServer = null;
587-
log.info("Web UI server stopped");
587+
log.debug("Web UI server stopped");
588588
}

packages/ims/slack/message-router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export function registerSlackMessageRouter(deps: RouterDeps): void {
199199
const threadActive = deps.isThreadActive(channelId, threadId);
200200

201201
if (shouldDropForThreadContext(isMention, threadActive)) {
202-
log.info("[DROP] Not mentioned and thread inactive", { channelId, threadId });
202+
log.debug("[DROP] Not mentioned and thread inactive", { channelId, threadId });
203203
return;
204204
}
205205

packages/web-ui/src/routes/local-setting/+layout.svelte

Lines changed: 91 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
let activeSection: "general" | "agents" | "slack" = "general";
1212
let pendingSlackAppToken = "";
1313
let pendingSlackBotToken = "";
14+
let isAddWorkspaceDialogOpen = false;
1415
1516
$: pathname = $page.url.pathname;
1617
$: normalizedPathname = pathname.endsWith("/") && pathname.length > 1 ? pathname.slice(0, -1) : pathname;
@@ -31,9 +32,18 @@
3132
if (!workspace) return;
3233
pendingSlackAppToken = "";
3334
pendingSlackBotToken = "";
35+
isAddWorkspaceDialogOpen = false;
3436
await goto(getWorkspacePath(workspace));
3537
}
3638
39+
function openAddWorkspaceDialog(): void {
40+
isAddWorkspaceDialogOpen = true;
41+
}
42+
43+
function closeAddWorkspaceDialog(): void {
44+
isAddWorkspaceDialogOpen = false;
45+
}
46+
3747
function onPendingSlackAppTokenInput(event: Event): void {
3848
pendingSlackAppToken = (event.currentTarget as HTMLInputElement).value;
3949
}
@@ -104,50 +114,22 @@
104114
<span class="empty-tip">No workspaces</span>
105115
{:else}
106116
{#each $localSettingStore.config.workspaces as workspace}
107-
<div class="workspace-row">
108-
<button
109-
class="nav-item {selectedWorkspace?.id === workspace.id && activeSection === 'slack' ? 'active' : ''}"
110-
on:click={() => goto(getWorkspacePath(workspace))}
111-
>
112-
{workspace.name || workspace.id}
113-
</button>
114-
<button
115-
class="workspace-remove"
116-
type="button"
117-
on:click={() => removeWorkspace(workspace.id)}
118-
disabled={$localSettingStore.isLoading || $localSettingStore.isSaving || $localSettingStore.isSyncingSlack || $localSettingStore.isAddingWorkspace || $localSettingStore.isCheckingCli}
119-
>
120-
Remove
121-
</button>
122-
</div>
117+
<button
118+
class="nav-item {selectedWorkspace?.id === workspace.id && activeSection === 'slack' ? 'active' : ''}"
119+
on:click={() => goto(getWorkspacePath(workspace))}
120+
>
121+
{workspace.name || workspace.id}
122+
</button>
123123
{/each}
124124
{/if}
125125

126-
<label for="new-workspace-app-token">Slack App Token</label>
127-
<input
128-
id="new-workspace-app-token"
129-
type="text"
130-
value={pendingSlackAppToken}
131-
on:input={onPendingSlackAppTokenInput}
132-
placeholder="xapp-..."
133-
/>
134-
135-
<label for="new-workspace-bot-token">Slack Bot Token</label>
136-
<input
137-
id="new-workspace-bot-token"
138-
type="text"
139-
value={pendingSlackBotToken}
140-
on:input={onPendingSlackBotTokenInput}
141-
placeholder="xoxb-..."
142-
/>
143-
144126
<button
145127
class="nav-item add-workspace"
146128
type="button"
147-
on:click={() => void addWorkspace()}
129+
on:click={openAddWorkspaceDialog}
148130
disabled={$localSettingStore.isLoading || $localSettingStore.isSaving || $localSettingStore.isSyncingSlack || $localSettingStore.isAddingWorkspace || $localSettingStore.isCheckingCli}
149131
>
150-
{$localSettingStore.isAddingWorkspace ? "Adding..." : "Add workspace"}
132+
Add Workspace
151133
</button>
152134
</div>
153135
</aside>
@@ -156,6 +138,16 @@
156138
<slot />
157139

158140
<footer class="actions">
141+
{#if activeSection === "slack" && selectedWorkspace}
142+
<button
143+
class="danger-action"
144+
type="button"
145+
on:click={() => removeWorkspace(selectedWorkspace.id)}
146+
disabled={$localSettingStore.isLoading || $localSettingStore.isSaving || $localSettingStore.isSyncingSlack || $localSettingStore.isAddingWorkspace || $localSettingStore.isCheckingCli}
147+
>
148+
Remove Workspace
149+
</button>
150+
{/if}
159151
<button
160152
on:click={() => void localSettingStore.saveConfig()}
161153
disabled={$localSettingStore.isLoading || $localSettingStore.isSaving || $localSettingStore.isSyncingSlack || $localSettingStore.isAddingWorkspace || $localSettingStore.isCheckingCli}
@@ -172,6 +164,43 @@
172164
</div>
173165
</main>
174166

167+
{#if isAddWorkspaceDialogOpen}
168+
<div class="dialog-backdrop" role="presentation" on:click={closeAddWorkspaceDialog}>
169+
<div class="dialog card" role="dialog" aria-modal="true" aria-labelledby="add-workspace-title" on:click|stopPropagation>
170+
<h2 id="add-workspace-title">Add Workspace</h2>
171+
172+
<label for="new-workspace-app-token">Slack App Token</label>
173+
<input
174+
id="new-workspace-app-token"
175+
type="text"
176+
value={pendingSlackAppToken}
177+
on:input={onPendingSlackAppTokenInput}
178+
placeholder="xapp-..."
179+
/>
180+
181+
<label for="new-workspace-bot-token">Slack Bot Token</label>
182+
<input
183+
id="new-workspace-bot-token"
184+
type="text"
185+
value={pendingSlackBotToken}
186+
on:input={onPendingSlackBotTokenInput}
187+
placeholder="xoxb-..."
188+
/>
189+
190+
<div class="dialog-actions">
191+
<button type="button" on:click={closeAddWorkspaceDialog}>Cancel</button>
192+
<button
193+
type="button"
194+
on:click={() => void addWorkspace()}
195+
disabled={$localSettingStore.isLoading || $localSettingStore.isSaving || $localSettingStore.isSyncingSlack || $localSettingStore.isAddingWorkspace || $localSettingStore.isCheckingCli}
196+
>
197+
{$localSettingStore.isAddingWorkspace ? "Adding..." : "Add Workspace"}
198+
</button>
199+
</div>
200+
</div>
201+
</div>
202+
{/if}
203+
175204
<style>
176205
:global(body) {
177206
background: var(--bg);
@@ -248,19 +277,6 @@
248277
color: var(--ink-soft);
249278
}
250279
251-
.workspace-row {
252-
display: grid;
253-
grid-template-columns: minmax(0, 1fr) auto;
254-
gap: 8px;
255-
}
256-
257-
.workspace-remove {
258-
border-color: var(--line);
259-
color: var(--ink-soft);
260-
background: var(--bg-soft);
261-
padding: 9px 8px;
262-
}
263-
264280
.nav-item {
265281
width: 100%;
266282
text-align: left;
@@ -298,6 +314,32 @@
298314
justify-content: flex-end;
299315
}
300316
317+
.danger-action {
318+
border-color: #bf3a2b;
319+
color: #bf3a2b;
320+
}
321+
322+
.dialog-backdrop {
323+
position: fixed;
324+
inset: 0;
325+
background: color-mix(in srgb, var(--ink) 24%, transparent);
326+
display: grid;
327+
place-items: center;
328+
z-index: 50;
329+
padding: 16px;
330+
}
331+
332+
.dialog {
333+
width: min(520px, 100%);
334+
margin: 0;
335+
}
336+
337+
.dialog-actions {
338+
display: flex;
339+
justify-content: flex-end;
340+
gap: 8px;
341+
}
342+
301343
.message,
302344
.empty-tip {
303345
margin: 0;

0 commit comments

Comments
 (0)