Skip to content

Commit 591e08e

Browse files
committed
feat: show modal for custom shell path
1 parent 0c681e4 commit 591e08e

1 file changed

Lines changed: 41 additions & 1 deletion

File tree

src/components/agents/remotebg/TerminalManager.vue

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@
2121
<q-inner-loading :showing="loading" color="primary" />
2222
</div>
2323
</div>
24+
<q-dialog v-model="showCustomShellDialog">
25+
<q-card style="min-width: 400px">
26+
<q-card-section class="text-h6"> Enter Custom Shell Path </q-card-section>
27+
28+
<q-card-section>
29+
<q-input
30+
v-model="customShellInput"
31+
label="Shell Path"
32+
dense
33+
autofocus
34+
/>
35+
</q-card-section>
36+
37+
<q-card-actions align="right">
38+
<q-btn flat label="Cancel" v-close-popup />
39+
<q-btn color="primary" label="Start" @click="startCustomShell" />
40+
</q-card-actions>
41+
</q-card>
42+
</q-dialog>
2443
</template>
2544

2645
<script setup lang="ts">
@@ -50,6 +69,8 @@ interface ShellOption {
5069
const props = defineProps<{ agent_id: string; agentPlatform: string }>();
5170
const loading = ref(false);
5271
const customShellPath = ref<string | null>(null);
72+
const showCustomShellDialog = ref(false);
73+
const customShellInput = ref("");
5374
5475
const shellOptions = computed<ShellOption[]>(() => {
5576
const isWindows = props.agentPlatform === "windows";
@@ -65,7 +86,6 @@ const shellOptions = computed<ShellOption[]>(() => {
6586
? `Custom (${customShellPath.value})`
6687
: "Custom Shell",
6788
value: customShellPath.value || "custom",
68-
disable: !customShellPath.value,
6989
});
7090
7191
return base;
@@ -149,13 +169,33 @@ function initWS(shell: string) {
149169
150170
async function onShellChange(newShell: string) {
151171
if (!term) return;
172+
if (newShell === "custom") {
173+
if (!customShellPath.value) {
174+
showCustomShellDialog.value = true;
175+
selectedShell.value = "";
176+
return;
177+
}
178+
newShell = customShellPath.value;
179+
}
152180
loading.value = true;
153181
started = false;
154182
term.reset();
155183
fit.fit();
156184
initWS(newShell);
157185
}
158186
187+
function startCustomShell() {
188+
if (!customShellInput.value) return;
189+
customShellPath.value = customShellInput.value;
190+
showCustomShellDialog.value = false;
191+
selectedShell.value = "custom";
192+
loading.value = true;
193+
started = false;
194+
term?.reset();
195+
fit.fit();
196+
initWS(customShellInput.value);
197+
}
198+
159199
async function setupXTerm() {
160200
term = new Terminal({
161201
convertEol: true,

0 commit comments

Comments
 (0)