filemanager: open terminal in cwd

This commit is contained in:
Girish Ramakrishnan
2026-02-12 20:26:14 +01:00
parent c5cf8eef1a
commit ae09c19b69
4 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -521,7 +521,7 @@ onMounted(async () => {
<Button style="margin: 0 20px;" v-tooltip="$t('filemanager.toolbar.restartApp')" secondary tool :loading="busyRestart" icon="fa-solid fa-arrows-rotate" @click="onRestartApp" v-show="resourceType === 'app'"/>
<ButtonGroup>
<Button :href="'/terminal.html?id=' + resourceId" target="_blank" v-show="resourceType === 'app'" secondary tool icon="fa-solid fa-terminal" v-tooltip="$t('terminal.title')" />
<Button :href="'/terminal.html?id=' + resourceId + '&cwd=/app/data' + cwd" target="_blank" v-show="resourceType === 'app'" secondary tool icon="fa-solid fa-terminal" v-tooltip="$t('terminal.title')" />
<Button :href="'/logs.html?appId=' + resourceId" target="_blank" v-show="resourceType === 'app'" secondary tool icon="fa-solid fa-align-left" v-tooltip="$t('logs.title')" />
</ButtonGroup>
</template>
+5 -1
View File
@@ -28,6 +28,7 @@ const showFilemanager = ref(false);
const manifestVersion = ref('');
const schedulerMenuModel = ref([]);
const id = ref('');
const cwd = ref('');
const name = ref('');
const link = ref('');
const downloadFileDownloadUrl = ref('');
@@ -165,7 +166,9 @@ async function connect(retry = false) {
let execId;
try {
const result = await fetcher.post(`${API_ORIGIN}/api/v1/apps/${id.value}/exec`, { cmd: [ '/bin/bash' ], tty: true, lang: 'C.UTF-8' }, { access_token: accessToken });
const execBody = { cmd: [ '/bin/bash' ], tty: true, lang: 'C.UTF-8' };
if (cwd.value) execBody.cwd = cwd.value;
const result = await fetcher.post(`${API_ORIGIN}/api/v1/apps/${id.value}/exec`, execBody, { access_token: accessToken });
execId = result.body.id;
} catch (error) {
console.error('Cannot create socket.', error);
@@ -216,6 +219,7 @@ onMounted(async () => {
const urlParams = new URLSearchParams(window.location.search);
id.value = urlParams.get('id');
cwd.value = urlParams.get('cwd') || '';
if (!id.value) {
console.error('No app id specified');