Remember last used binary and show environment variables
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Component, createSignal, Show, For, onMount, onCleanup } from "solid-js"
|
||||
import { Component, createSignal, Show, For, onMount, onCleanup, createEffect } from "solid-js"
|
||||
import { Folder, Clock, Trash2, FolderPlus, Settings, ChevronDown, ChevronUp } from "lucide-solid"
|
||||
import { recentFolders, removeRecentFolder, preferences } from "../stores/preferences"
|
||||
import { recentFolders, removeRecentFolder, preferences, updateLastUsedBinary } from "../stores/preferences"
|
||||
import OpenCodeBinarySelector from "./opencode-binary-selector"
|
||||
import EnvironmentVariablesEditor from "./environment-variables-editor"
|
||||
|
||||
@@ -17,6 +17,14 @@ const FolderSelectionView: Component<FolderSelectionViewProps> = (props) => {
|
||||
|
||||
const folders = () => recentFolders()
|
||||
|
||||
// Update selected binary when preferences change
|
||||
createEffect(() => {
|
||||
const lastUsed = preferences().lastUsedBinary
|
||||
if (lastUsed && lastUsed !== selectedBinary()) {
|
||||
setSelectedBinary(lastUsed)
|
||||
}
|
||||
})
|
||||
|
||||
function scrollToIndex(index: number) {
|
||||
const element = document.querySelector(`[data-folder-index="${index}"]`)
|
||||
if (element) {
|
||||
@@ -115,13 +123,19 @@ const FolderSelectionView: Component<FolderSelectionViewProps> = (props) => {
|
||||
}
|
||||
|
||||
function handleFolderSelect(path: string) {
|
||||
updateLastUsedBinary(selectedBinary())
|
||||
props.onSelectFolder(path, selectedBinary())
|
||||
}
|
||||
|
||||
function handleBrowse() {
|
||||
updateLastUsedBinary(selectedBinary())
|
||||
props.onSelectFolder(undefined, selectedBinary())
|
||||
}
|
||||
|
||||
function handleBinaryChange(binary: string) {
|
||||
setSelectedBinary(binary)
|
||||
}
|
||||
|
||||
function handleRemove(path: string, e?: Event) {
|
||||
e?.stopPropagation()
|
||||
removeRecentFolder(path)
|
||||
@@ -271,7 +285,7 @@ const FolderSelectionView: Component<FolderSelectionViewProps> = (props) => {
|
||||
<div class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">OpenCode Binary</div>
|
||||
<OpenCodeBinarySelector
|
||||
selectedBinary={selectedBinary()}
|
||||
onBinaryChange={setSelectedBinary}
|
||||
onBinaryChange={handleBinaryChange}
|
||||
disabled={props.isLoading}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -142,6 +142,28 @@ const InstanceInfo: Component<InstanceInfoProps> = (props) => {
|
||||
</div>
|
||||
</Show>
|
||||
|
||||
<Show when={props.instance.environmentVariables && Object.keys(props.instance.environmentVariables).length > 0}>
|
||||
<div>
|
||||
<div class="text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide mb-1.5">
|
||||
Environment Variables ({Object.keys(props.instance.environmentVariables!).length})
|
||||
</div>
|
||||
<div class="space-y-1">
|
||||
<For each={Object.entries(props.instance.environmentVariables!)}>
|
||||
{([key, value]) => (
|
||||
<div class="flex items-center gap-2 px-2 py-1.5 bg-gray-50 dark:bg-gray-900 rounded border border-gray-200 dark:border-gray-700">
|
||||
<span class="text-xs text-gray-900 dark:text-gray-100 font-mono font-medium flex-1" title={key}>
|
||||
{key}
|
||||
</span>
|
||||
<span class="text-xs text-gray-600 dark:text-gray-400 font-mono flex-1" title={value}>
|
||||
{value}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</For>
|
||||
</div>
|
||||
</div>
|
||||
</Show>
|
||||
|
||||
<Show when={!isLoadingMetadata() && mcpServers().length > 0}>
|
||||
<div>
|
||||
<div class="text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide mb-1.5">
|
||||
|
||||
@@ -82,6 +82,27 @@ const LogsView: Component<LogsViewProps> = (props) => {
|
||||
<h3 class="text-sm font-medium text-gray-700 dark:text-gray-300">Server Logs</h3>
|
||||
</div>
|
||||
|
||||
<Show when={instance()?.environmentVariables && Object.keys(instance()?.environmentVariables!).length > 0}>
|
||||
<div class="px-4 py-3 bg-blue-50 dark:bg-blue-900/20 border-b border-blue-200 dark:border-blue-800">
|
||||
<div class="text-xs font-medium text-blue-800 dark:text-blue-200 mb-2">
|
||||
Environment Variables ({Object.keys(instance()?.environmentVariables!).length})
|
||||
</div>
|
||||
<div class="space-y-1">
|
||||
<For each={Object.entries(instance()?.environmentVariables!)}>
|
||||
{([key, value]) => (
|
||||
<div class="flex items-center gap-2 text-xs">
|
||||
<span class="font-mono font-medium text-blue-800 dark:text-blue-200 min-w-0 flex-1">{key}</span>
|
||||
<span class="text-blue-600 dark:text-blue-400">=</span>
|
||||
<span class="font-mono text-blue-700 dark:text-blue-300 min-w-0 flex-1" title={value}>
|
||||
{value}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</For>
|
||||
</div>
|
||||
</div>
|
||||
</Show>
|
||||
|
||||
<div
|
||||
ref={scrollRef}
|
||||
onScroll={handleScroll}
|
||||
|
||||
Reference in New Issue
Block a user