Skip to content

Commit eefc2eb

Browse files
committed
feat: add support for terminal experience
1 parent 5e9b279 commit eefc2eb

File tree

3 files changed

+64
-27
lines changed

3 files changed

+64
-27
lines changed

src/components/agents/remotebg/TerminalManager.vue

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,17 @@
1313
inline
1414
color="primary"
1515
@update:model-value="onShellChange"
16-
@dblclick="onOptionDblClick"
1716
class="q-ml-sm q-gutter-lg"
1817
/>
18+
<div>
19+
<q-btn
20+
label="Edit Path"
21+
color="primary"
22+
@click="handleCustomEdit"
23+
class="q-px-sm q-ml-lg q-pb-0 text-caption text-capitalize"
24+
dense
25+
/>
26+
</div>
1927
</div>
2028
<div class="terminal-wrapper">
2129
<div ref="xtermContainer" class="xterm-container"></div>
@@ -98,12 +106,17 @@ const shellOptions = computed<ShellOption[]>(() => {
98106
]
99107
: [{ label: "Bash", value: "bash" }];
100108
109+
let customLabel = "Custom Shell";
110+
if (loading.value && pendingCustomShell.value) {
111+
customLabel = "Custom (Shell loading...)";
112+
} else if (invalidCustomShell.value) {
113+
customLabel = "Custom (Shell path doesn't exist)";
114+
} else if (customShellPath.value) {
115+
customLabel = `Custom (${customShellPath.value})`;
116+
}
117+
101118
base.push({
102-
label: invalidCustomShell.value
103-
? "Custom (Shell path doesn't exist)"
104-
: customShellPath.value
105-
? `Custom (${customShellPath.value})`
106-
: "Custom Shell",
119+
label: customLabel,
107120
value: "custom",
108121
});
109122
@@ -180,6 +193,14 @@ function markSessionReadyAndResize() {
180193
started = true;
181194
loading.value = false;
182195
196+
if (pendingCustomShell.value) {
197+
customShellPath.value = pendingCustomShell.value;
198+
selectedShell.value = "custom";
199+
showCustomShellDialog.value = false;
200+
pendingCustomShell.value = null;
201+
invalidCustomShell.value = false;
202+
}
203+
183204
void waitForLayout().then(() => {
184205
if (!term || !started) return;
185206
fit.fit();
@@ -237,14 +258,6 @@ function initWS(shell: string) {
237258
if (!started) {
238259
markSessionReadyAndResize();
239260
}
240-
241-
if (pendingCustomShell.value) {
242-
customShellPath.value = pendingCustomShell.value;
243-
selectedShell.value = "custom";
244-
showCustomShellDialog.value = false;
245-
pendingCustomShell.value = null;
246-
invalidCustomShell.value = false;
247-
}
248261
}
249262
250263
if (msg.data?.done) {
@@ -285,12 +298,6 @@ function initWS(shell: string) {
285298
}, 50);
286299
}
287300
288-
function onOptionDblClick() {
289-
if (selectedShell.value === "custom") {
290-
handleCustomEdit();
291-
}
292-
}
293-
294301
function handleCustomEdit() {
295302
showCustomShellDialog.value = true;
296303
customShellInput.value = customShellPath.value || "";

src/components/modals/coresettings/EditCoreSettings.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,19 @@
220220
:rules="[(val) => val >= 0 || 'Minimum is 0']"
221221
/>
222222
</q-card-section>
223+
<q-card-section class="row items-start content-between">
224+
<div class="col-6">Terminal Experience</div>
225+
<div class="col-6">
226+
<q-option-group
227+
class="q-gutter-lg"
228+
v-model="settings.terminal_mode"
229+
:options="terminalModeOptions"
230+
type="radio"
231+
inline
232+
dense
233+
/>
234+
</div>
235+
</q-card-section>
223236
<q-card-section class="row items-start content-between">
224237
<div class="col-6">Windows Default Terminal</div>
225238
<div class="col-6">
@@ -860,6 +873,12 @@ export default {
860873
hosted() {
861874
return this.$store.state.hosted;
862875
},
876+
terminalModeOptions() {
877+
return [
878+
{ label: "Use new terminal", value: "new" },
879+
{ label: "Use legacy terminal", value: "legacy" },
880+
];
881+
},
863882
windowsShellOptions() {
864883
return [
865884
{ label: "CMD", value: "cmd" },

src/views/RemoteBackground.vue

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,20 @@
3939
<q-separator />
4040
<q-tab-panels v-model="tab">
4141
<q-tab-panel name="terminal" class="q-pa-none">
42-
<!-- <iframe
42+
<TerminalManager
43+
v-if="terminalMode === 'new'"
44+
:agent_id="agent_id"
45+
:agentPlatform="$route.query.agentPlatform"
46+
/>
47+
<iframe
48+
v-else
4349
allow="clipboard-read; clipboard-write"
4450
:src="terminal"
4551
:style="{
4652
height: `${$q.screen.height - 30}px`,
4753
width: `${$q.screen.width}px`,
4854
}"
49-
></iframe> -->
50-
<TerminalManager
51-
:agent_id="agent_id"
52-
:agentPlatform="$route.query.agentPlatform"
53-
/>
55+
></iframe>
5456
</q-tab-panel>
5557
<q-tab-panel name="processes" class="q-pa-none">
5658
<ProcessManager :agent_id="agent_id" />
@@ -102,7 +104,7 @@ import { ref, computed, onMounted } from "vue";
102104
import { useRoute } from "vue-router";
103105
import { useQuasar, useMeta } from "quasar";
104106
import { fetchAgentMeshCentralURLs } from "@/api/agents";
105-
import { fetchDashboardInfo } from "@/api/core";
107+
import { fetchCoreSettings, fetchDashboardInfo } from "@/api/core";
106108
107109
// ui imports
108110
import ProcessManager from "@/components/agents/remotebg/ProcessManager.vue";
@@ -132,6 +134,7 @@ export default {
132134
const terminal = ref("");
133135
const file = ref("");
134136
const tab = ref("terminal");
137+
const terminalMode = ref("legacy");
135138
136139
const agent_id = computed(() => params.agent_id);
137140
@@ -150,10 +153,17 @@ export default {
150153
$q.loadingBar.setDefaults({ size: "0px" });
151154
}
152155
156+
async function getCoreSettings() {
157+
const settingsData = await fetchCoreSettings();
158+
terminalMode.value =
159+
settingsData?.terminal_mode === "new" ? "new" : "legacy";
160+
}
161+
153162
// vue lifecycle hooks
154163
onMounted(() => {
155164
getDashInfo();
156165
getMeshURLs();
166+
getCoreSettings();
157167
});
158168
159169
return {
@@ -163,6 +173,7 @@ export default {
163173
tab,
164174
agent_id,
165175
registryIcon,
176+
terminalMode,
166177
};
167178
},
168179
};

0 commit comments

Comments
 (0)