mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-08 10:41:16 +08:00
feat: The runtime terminal supports specifying a user (#9461)
This commit is contained in:
parent
4c7b04cf27
commit
96208c786d
1 changed files with 27 additions and 2 deletions
|
|
@ -9,7 +9,16 @@
|
|||
:autoClose="false"
|
||||
>
|
||||
<template #content>
|
||||
<Terminal style="height: calc(100vh - 180px)" ref="terminalRef" v-if="terminalOpen"></Terminal>
|
||||
<el-form ref="formRef" :model="form" label-position="top">
|
||||
<el-form-item :label="$t('commons.table.user')" prop="user">
|
||||
<el-input placeholder="root" clearable v-model="form.user">
|
||||
<template #append>
|
||||
<el-button @click="reConnect">{{ $t('commons.button.conn') }}</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<Terminal class="terminal" ref="terminalRef" v-if="terminalOpen"></Terminal>
|
||||
</template>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
|
|
@ -48,7 +57,9 @@ const acceptParams = async (params: DialogProps): Promise<void> => {
|
|||
form.containerID = params.containerID;
|
||||
title.value = params.container;
|
||||
form.isCustom = false;
|
||||
form.user = params.user;
|
||||
if (params.user && params.user != '') {
|
||||
form.user = params.user;
|
||||
}
|
||||
form.command = '/bin/bash';
|
||||
initTerm();
|
||||
};
|
||||
|
|
@ -64,6 +75,15 @@ const initTerm = async () => {
|
|||
});
|
||||
};
|
||||
|
||||
const reConnect = async () => {
|
||||
if (terminalRef.value) {
|
||||
terminalRef.value.onClose();
|
||||
}
|
||||
terminalOpen.value = false;
|
||||
await nextTick();
|
||||
initTerm();
|
||||
};
|
||||
|
||||
const onClose = () => {
|
||||
terminalRef.value?.onClose();
|
||||
terminalOpen.value = false;
|
||||
|
|
@ -78,3 +98,8 @@ defineExpose({
|
|||
acceptParams,
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.terminal {
|
||||
height: calc(100vh - 180px);
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue