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