🚧 可配置预览阈值.
This commit is contained in:
@@ -207,6 +207,9 @@ public class TerminalPreferenceModel implements PreferenceModel {
|
||||
@Schema(description = "命令编辑器")
|
||||
private Boolean commandEditor;
|
||||
|
||||
@Schema(description = "打开 SFTP")
|
||||
private Boolean openSftp;
|
||||
|
||||
@Schema(description = "清空")
|
||||
private Boolean clear;
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ public class TerminalPreferenceStrategy implements IPreferenceStrategy<TerminalP
|
||||
.fontSizePlus(false)
|
||||
.fontSizeSubtract(false)
|
||||
.commandEditor(true)
|
||||
.openSftp(true)
|
||||
.clear(true)
|
||||
.disconnect(false)
|
||||
.closeTab(true)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
VITE_API_BASE_URL= 'http://127.0.0.1:9200/orion-api'
|
||||
VITE_WS_BASE_URL= 'ws://127.0.0.1:9200/orion/keep-alive'
|
||||
VITE_APP_VERSION= '1.0.0'
|
||||
VITE_SFTP_PREVIEW_MB= 2
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
VITE_API_BASE_URL= 'http://127.0.0.1:9200/orion-api'
|
||||
VITE_WS_BASE_URL= 'ws://127.0.0.1:9200/orion/keep-alive'
|
||||
VITE_APP_VERSION= '1.0.0'
|
||||
VITE_SFTP_PREVIEW_MB= 2
|
||||
|
||||
1
orion-ops-ui/src/env.d.ts
vendored
1
orion-ops-ui/src/env.d.ts
vendored
@@ -11,6 +11,7 @@ interface ImportMetaEnv {
|
||||
readonly VITE_API_BASE_URL: string;
|
||||
readonly VITE_WS_BASE_URL: string;
|
||||
readonly VITE_APP_VERSION: string;
|
||||
readonly VITE_SFTP_PREVIEW_MB: number;
|
||||
}
|
||||
|
||||
// editor
|
||||
|
||||
@@ -152,6 +152,8 @@
|
||||
import columns from './types/table.columns';
|
||||
import { FILE_TYPE, openSftpChmodModalKey, openSftpMoveModalKey } from '../../types/terminal.const';
|
||||
|
||||
const previewSize = import.meta.env.VITE_SFTP_PREVIEW_MB;
|
||||
|
||||
const props = defineProps<{
|
||||
session: ISftpSession | undefined;
|
||||
list: Array<SftpFile>;
|
||||
@@ -204,10 +206,10 @@
|
||||
// 是否可编辑
|
||||
const canEditable = (sizeByte: number, attr: string) => {
|
||||
const typeValue = formatFileType(attr).value;
|
||||
// 非文件夹和链接文件 并且文件大小小于 2MB 可以编辑
|
||||
// 非文件夹和链接文件 并且文件小于 配置大小(MB) 可以编辑
|
||||
return FILE_TYPE.DIRECTORY.value !== typeValue
|
||||
&& FILE_TYPE.LINK_FILE.value !== typeValue
|
||||
&& sizeByte <= 2 * 1024 * 1024;
|
||||
&& sizeByte <= previewSize * 1024 * 1024;
|
||||
};
|
||||
|
||||
// 点击文件名称
|
||||
|
||||
@@ -19,6 +19,7 @@ const columns = [
|
||||
title: '大小',
|
||||
dataIndex: 'sizeByte',
|
||||
slotName: 'size',
|
||||
ellipsis: true,
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
@@ -26,6 +27,7 @@ const columns = [
|
||||
title: '属性',
|
||||
dataIndex: 'attr',
|
||||
slotName: 'attr',
|
||||
ellipsis: true,
|
||||
}, {
|
||||
title: '修改时间',
|
||||
dataIndex: 'modifyTime',
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { Terminal } from 'xterm';
|
||||
import useCopy from '@/hooks/copy';
|
||||
import html2canvas from 'html2canvas';
|
||||
import { useTerminalStore, useUserStore } from '@/store';
|
||||
import { TerminalShortcutItems } from '../types/terminal.const';
|
||||
import { PanelSessionType, TerminalShortcutItems } from '../types/terminal.const';
|
||||
import { saveAs } from 'file-saver';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { dateFormat } from '@/utils';
|
||||
@@ -76,6 +76,7 @@ export default class SshSessionHandler implements ISshSessionHandler {
|
||||
case 'interrupt':
|
||||
case 'enter':
|
||||
case 'commandEditor':
|
||||
case 'openSftp':
|
||||
case 'checkAppendMissing':
|
||||
return this.session.canWrite;
|
||||
case 'disconnect':
|
||||
@@ -194,6 +195,16 @@ export default class SshSessionHandler implements ISshSessionHandler {
|
||||
this.domRef.editorModal?.open('', '');
|
||||
}
|
||||
|
||||
// 打开 sftp
|
||||
openSftp() {
|
||||
const terminalStore = useTerminalStore();
|
||||
const host = terminalStore.hosts.hostList
|
||||
.find(s => s.id === this.session.hostId);
|
||||
if (host) {
|
||||
terminalStore.openSession(host, PanelSessionType.SFTP);
|
||||
}
|
||||
}
|
||||
|
||||
// ctrl + c
|
||||
interrupt() {
|
||||
this.inst.paste(String.fromCharCode(3));
|
||||
|
||||
@@ -159,6 +159,10 @@ export const ActionBarItems = [
|
||||
item: 'commandEditor',
|
||||
icon: 'icon-code-square',
|
||||
content: '命令编辑器',
|
||||
}, {
|
||||
item: 'openSftp',
|
||||
icon: 'icon-folder',
|
||||
content: '打开 SFTP',
|
||||
}, {
|
||||
item: 'clear',
|
||||
icon: 'icon-delete',
|
||||
|
||||
@@ -288,6 +288,8 @@ export interface ISshSessionHandler {
|
||||
fontSizeSubtract: () => void;
|
||||
// 打开命令编辑器
|
||||
commandEditor: () => void;
|
||||
// 打开 sftp
|
||||
openSftp: () => void;
|
||||
// 中断
|
||||
interrupt: () => void;
|
||||
// 回车
|
||||
|
||||
Reference in New Issue
Block a user