{#snippet menuItems()} {#each systemSections as section}
{section.devices ? $i18n.t('Your devices') : $i18n.t('Terminals')} {#if !section.devices}
{#if writable.length} {/if} {#if $user?.role === 'admin'} {/if}
{/if}
{#each section.terminals as terminal} {@const label = terminal.name || $i18n.t('Terminal')} {@const owned = canManage(terminal, manageable)} {@const reachable = terminal.scope !== 'chat' || isSavedChatId($activeChatId)}
machineStatus(terminal.id) : null} onRestart={() => confirmLifecycle(terminal.id, label, 'restart')} onStop={() => confirmLifecycle(terminal.id, label, 'stop')} onStart={() => runLifecycle(terminal.id, label, 'start')} onInfo={reachable ? () => openInfo(terminal.id, label) : null} onFiles={reachable ? () => openFiles(terminal.id, label) : null} onSettings={owned ? () => openTerminalDialog(terminal.id) : null} />
{/each} {/each} {/snippet} {#if inMenu} {#if tab === ''}
{:else if tab === 'terminal'}
{@render menuItems()}
{/if} {:else}
{#if disabled} {:else}
{@render menuItems()}
{/if}
{/if} {#if info} {#key info} (info = null)} /> {/key} {/if} {#if folderTarget && (selectedSystemTerminal?.scope !== 'chat' || isSavedChatId(chatId))} {#key `${$user?.id}:${folderTarget.selector}:${chatId ?? ''}`} { if (isSavedChatId(chatId)) { await updateChatById(localStorage.token, chatId!, { working_directory: path }); } }} {disabled} /> {/key} {/if} {#if showTerminals} selectTerminal(selectedTerminalId, id, chatId)} /> {/if} {#if files} {#key files} (files = null)} /> {/key} {/if} pending && runLifecycle(pending.id, pending.name, pending.action)} />