fix(tui): route shell termination by location
This commit is contained in:
parent
59790380de
commit
fd4497e6b9
2 changed files with 9 additions and 10 deletions
|
|
@ -831,15 +831,6 @@ export const { use: useData, provider: DataProvider } = createSimpleContext({
|
||||||
shell: Object.fromEntries(mutable(result.data).map((info) => [info.id, info])),
|
shell: Object.fromEntries(mutable(result.data).map((info) => [info.id, info])),
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async remove(id: string) {
|
|
||||||
await sdk.api.shell.remove({ id })
|
|
||||||
setStore(
|
|
||||||
"location",
|
|
||||||
produce((draft) => {
|
|
||||||
for (const data of Object.values(draft)) delete data.shell?.[id]
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
location: {
|
location: {
|
||||||
default() {
|
default() {
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,16 @@ import { createMemo, For, Show, createEffect, onMount, onCleanup } from "solid-j
|
||||||
import { createStore } from "solid-js/store"
|
import { createStore } from "solid-js/store"
|
||||||
import { TextAttributes, RGBA, ScrollBoxRenderable } from "@opentui/core"
|
import { TextAttributes, RGBA, ScrollBoxRenderable } from "@opentui/core"
|
||||||
import { useData } from "../../../context/data"
|
import { useData } from "../../../context/data"
|
||||||
|
import { useLocation } from "../../../context/location"
|
||||||
|
import { useSDK } from "../../../context/sdk"
|
||||||
import { useTheme, selectedForeground } from "../../../context/theme"
|
import { useTheme, selectedForeground } from "../../../context/theme"
|
||||||
import { useBindings, useCommandShortcut } from "../../../keymap"
|
import { useBindings, useCommandShortcut } from "../../../keymap"
|
||||||
import { useComposerTab } from "./index"
|
import { useComposerTab } from "./index"
|
||||||
|
|
||||||
export function ShellTab(props: { sessionID: string }) {
|
export function ShellTab(props: { sessionID: string }) {
|
||||||
const data = useData()
|
const data = useData()
|
||||||
|
const location = useLocation()
|
||||||
|
const sdk = useSDK()
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
const fg = selectedForeground(theme)
|
const fg = selectedForeground(theme)
|
||||||
const composer = useComposerTab()
|
const composer = useComposerTab()
|
||||||
|
|
@ -79,7 +83,11 @@ export function ShellTab(props: { sessionID: string }) {
|
||||||
run() {
|
run() {
|
||||||
const entry = selectedEntry()
|
const entry = selectedEntry()
|
||||||
if (!entry) return
|
if (!entry) return
|
||||||
void data.shell.remove(entry.id)
|
const ref = location()
|
||||||
|
void sdk.api.shell.remove({
|
||||||
|
id: entry.id,
|
||||||
|
location: ref ? { directory: ref.directory, workspace: ref.workspaceID } : undefined,
|
||||||
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue