!114 feat:rdp优化,mssql迁移优化,term支持trzsz

* fix: 合并代码
* refactor: rdp优化,mssql迁移优化,term支持trzsz
This commit is contained in:
zongyangleo
2024-04-12 07:53:42 +00:00
committed by Coder慌
parent abc015aec0
commit 8998a21626
20 changed files with 551 additions and 360 deletions

View File

@@ -79,6 +79,7 @@
<machine-rdp
v-if="dt.params.protocol != MachineProtocolEnum.Ssh.value"
:machine-id="dt.params.id"
:auth-cert="dt.authCert"
:ref="(el: any) => setTerminalRef(el, dt.key)"
@status-change="terminalStatusChange(dt.key, $event)"
/>
@@ -343,7 +344,8 @@ const openTerminal = (machine: any, ex?: boolean) => {
const { href } = router.resolve({
path: `/machine/terminal-rdp`,
query: {
id: machine.id,
machineId: machine.id,
ac: ac,
name: machine.name,
},
});
@@ -367,6 +369,7 @@ const openTerminal = (machine: any, ex?: boolean) => {
key,
label: `${label}${sameIndex === 1 ? '' : ':' + sameIndex}`, // label组成为:总打开term次数+name+同一个机器打开的次数
params: machine,
authCert: ac,
socketUrl: getMachineTerminalSocketUrl(ac),
};

View File

@@ -1,19 +1,26 @@
<template>
<div class="terminal-wrapper" ref="terminalWrapperRef">
<machine-rdp ref="rdpRef" :machine-id="route.query.ac" />
<machine-rdp ref="rdpRef" :auth-cert="state.authCert" :machine-id="state.machineId" />
</div>
</template>
<script lang="ts" setup>
import { useRoute } from 'vue-router';
import MachineRdp from '@/components/terminal-rdp/MachineRdp.vue';
import { onMounted, ref } from 'vue';
import { computed, onMounted, ref } from 'vue';
import { TerminalExpose } from '@/components/terminal-rdp';
const route = useRoute();
const rdpRef = ref({} as TerminalExpose);
const terminalWrapperRef = ref({} as any);
const state = computed(() => {
return {
authCert: route.query.ac as string,
machineId: Number(route.query.machineId),
};
});
onMounted(() => {
let width = terminalWrapperRef.value.clientWidth;
let height = terminalWrapperRef.value.clientHeight;

View File

@@ -154,7 +154,7 @@
<SvgIcon :size="15" name="folder" color="#007AFF" />
</span>
<span v-else>
<SvgIcon :size="15" name="document" />
<SvgIcon :size="15" :name="scope.row.icon" />
</span>
<span class="ml5" style="display: inline-block; width: 90%">
@@ -520,8 +520,84 @@ const lsFile = async (path: string) => {
const type = file.type;
if (type == folderType) {
file.isFolder = true;
file.iocn = 'folder';
} else {
file.isFolder = false;
const fileExtension = file.name.split('.').pop().toLowerCase();
switch (fileExtension) {
case 'doc':
case 'docx':
file.icon = 'iconfont icon-word';
break;
case 'xls':
case 'xlsx':
file.icon = 'iconfont icon-excel';
break;
case 'ppt':
case 'pptx':
file.icon = 'iconfont icon-ppt';
break;
case 'pdf':
file.icon = 'iconfont icon-pdf';
break;
case 'xml':
file.icon = 'iconfont icon-xml';
break;
case 'html':
file.icon = 'iconfont icon-html';
break;
case 'yaml':
case 'yml':
file.icon = 'iconfont icon-yaml';
break;
case 'css':
file.icon = 'iconfont icon-file-css';
break;
case 'js':
case 'ts':
file.icon = 'iconfont icon-file-js';
break;
case 'mp4':
case 'rmvb':
file.icon = 'iconfont icon-file-video';
break;
case 'mp3':
file.icon = 'iconfont icon-file-audio';
break;
case 'bmp':
case 'jpg':
case 'jpeg':
case 'png':
case 'tif':
case 'gif':
case 'pcx':
case 'tga':
case 'exif':
case 'svg':
case 'psd':
case 'ai':
case 'webp':
file.icon = 'iconfont icon-file-image';
break;
case 'md':
file.icon = 'iconfont icon-md';
break;
case 'txt':
file.icon = 'iconfont icon-txt';
break;
case 'zip':
case 'rar':
case '7z':
case 'gz':
case 'tar':
case 'tgz':
file.icon = 'iconfont icon-file-zip';
break;
default:
file.icon = 'iconfont icon-file';
break;
}
}
}
return res;
@@ -631,8 +707,9 @@ const downloadFile = (data: any) => {
const a = document.createElement('a');
a.setAttribute(
'href',
`${config.baseApiUrl}/machines/${props.machineId}/files/${props.fileId}/download?path=${data.path}&machineId=${props.machineId}&authCertName=${props.authCertName}&protocol=${props.protocol}&${joinClientParams()}`
`${config.baseApiUrl}/machines/${props.machineId}/files/${props.fileId}/download?path=${data.path}&machineId=${props.machineId}&authCertName=${props.authCertName}&fileId=${props.fileId}&protocol=${props.protocol}&${joinClientParams()}`
);
a.setAttribute('target', '_blank');
a.click();
};