✨ 创建文件.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package com.orion.ops.module.asset.handler.host.terminal.handler;
|
package com.orion.ops.module.asset.handler.host.terminal.handler;
|
||||||
|
|
||||||
|
import com.orion.lang.exception.argument.InvalidArgumentException;
|
||||||
|
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||||
import com.orion.ops.framework.websocket.core.utils.WebSockets;
|
import com.orion.ops.framework.websocket.core.utils.WebSockets;
|
||||||
import com.orion.ops.module.asset.handler.host.terminal.enums.OutputTypeEnum;
|
import com.orion.ops.module.asset.handler.host.terminal.enums.OutputTypeEnum;
|
||||||
import com.orion.ops.module.asset.handler.host.terminal.manager.TerminalManager;
|
import com.orion.ops.module.asset.handler.host.terminal.manager.TerminalManager;
|
||||||
@@ -57,4 +59,20 @@ public abstract class AbstractTerminalHandler<T extends TerminalBasePayload> imp
|
|||||||
return (E) channel.getAttributes().get(attr);
|
return (E) channel.getAttributes().get(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 sftp 错误信息
|
||||||
|
*
|
||||||
|
* @param ex ex
|
||||||
|
* @return msg
|
||||||
|
*/
|
||||||
|
protected String getErrorMessage(Exception ex) {
|
||||||
|
if (ex == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (ex instanceof InvalidArgumentException) {
|
||||||
|
return ex.getMessage();
|
||||||
|
}
|
||||||
|
return ErrorMessage.OPERATE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class SftpChangeModHandler extends AbstractTerminalHandler<SftpChangeModR
|
|||||||
SftpBaseResponse.builder()
|
SftpBaseResponse.builder()
|
||||||
.sessionId(payload.getSessionId())
|
.sessionId(payload.getSessionId())
|
||||||
.result(BooleanBit.of(ex == null).getValue())
|
.result(BooleanBit.of(ex == null).getValue())
|
||||||
.msg(ex == null ? null : ex.getMessage())
|
.msg(this.getErrorMessage(ex))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class SftpGetContentHandler extends AbstractTerminalHandler<SftpBaseReque
|
|||||||
.sessionId(payload.getSessionId())
|
.sessionId(payload.getSessionId())
|
||||||
.result(BooleanBit.of(ex == null).getValue())
|
.result(BooleanBit.of(ex == null).getValue())
|
||||||
.content(content)
|
.content(content)
|
||||||
.msg(ex == null ? null : ex.getMessage())
|
.msg(this.getErrorMessage(ex))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class SftpMakeDirectoryHandler extends AbstractTerminalHandler<SftpBaseRe
|
|||||||
SftpBaseResponse.builder()
|
SftpBaseResponse.builder()
|
||||||
.sessionId(payload.getSessionId())
|
.sessionId(payload.getSessionId())
|
||||||
.result(BooleanBit.of(ex == null).getValue())
|
.result(BooleanBit.of(ex == null).getValue())
|
||||||
.msg(ex == null ? null : ex.getMessage())
|
.msg(this.getErrorMessage(ex))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class SftpMoveHandler extends AbstractTerminalHandler<SftpMoveRequest> {
|
|||||||
SftpBaseResponse.builder()
|
SftpBaseResponse.builder()
|
||||||
.sessionId(payload.getSessionId())
|
.sessionId(payload.getSessionId())
|
||||||
.result(BooleanBit.of(ex == null).getValue())
|
.result(BooleanBit.of(ex == null).getValue())
|
||||||
.msg(ex == null ? null : ex.getMessage())
|
.msg(this.getErrorMessage(ex))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class SftpSetContentHandler extends AbstractTerminalHandler<SftpSetConten
|
|||||||
SftpBaseResponse.builder()
|
SftpBaseResponse.builder()
|
||||||
.sessionId(payload.getSessionId())
|
.sessionId(payload.getSessionId())
|
||||||
.result(BooleanBit.of(ex == null).getValue())
|
.result(BooleanBit.of(ex == null).getValue())
|
||||||
.msg(ex == null ? null : ex.getMessage())
|
.msg(this.getErrorMessage(ex))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class SftpTouchHandler extends AbstractTerminalHandler<SftpBaseRequest> {
|
|||||||
SftpBaseResponse.builder()
|
SftpBaseResponse.builder()
|
||||||
.sessionId(payload.getSessionId())
|
.sessionId(payload.getSessionId())
|
||||||
.result(BooleanBit.of(ex == null).getValue())
|
.result(BooleanBit.of(ex == null).getValue())
|
||||||
.msg(ex == null ? null : ex.getMessage())
|
.msg(this.getErrorMessage(ex))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class SftpTruncateHandler extends AbstractTerminalHandler<SftpBaseRequest
|
|||||||
SftpBaseResponse.builder()
|
SftpBaseResponse.builder()
|
||||||
.sessionId(payload.getSessionId())
|
.sessionId(payload.getSessionId())
|
||||||
.result(BooleanBit.of(ex == null).getValue())
|
.result(BooleanBit.of(ex == null).getValue())
|
||||||
.msg(ex == null ? null : ex.getMessage())
|
.msg(this.getErrorMessage(ex))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -281,8 +281,11 @@ export const TerminalShortcutItems: Array<ShortcutKeyItem> = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
// 打开 sshModal key
|
// 打开 sshSettingModal key
|
||||||
export const openSshModalKey = Symbol();
|
export const openSshSettingModalKey = Symbol();
|
||||||
|
|
||||||
|
// 打开 sftpCreateModal key
|
||||||
|
export const openSftpCreateModalKey = Symbol();
|
||||||
|
|
||||||
// 字体后缀 兜底
|
// 字体后缀 兜底
|
||||||
export const fontFamilySuffix = ',courier-new, courier, monospace';
|
export const fontFamilySuffix = ',courier-new, courier, monospace';
|
||||||
|
|||||||
Reference in New Issue
Block a user