⚡ 修改 websocket 连接逻辑.
This commit is contained in:
@@ -97,7 +97,7 @@ public class CodeGeneratorEngine extends VelocityTemplateEngine {
|
|||||||
// http 注释标识
|
// http 注释标识
|
||||||
objectMap.put("httpComment", "###");
|
objectMap.put("httpComment", "###");
|
||||||
// 版本
|
// 版本
|
||||||
objectMap.put("since", OrionOpsProConst.VERSION);
|
objectMap.put("version", OrionOpsProConst.VERSION);
|
||||||
// api 注释
|
// api 注释
|
||||||
Map<String, String> apiComment = new HashMap<>(12);
|
Map<String, String> apiComment = new HashMap<>(12);
|
||||||
String comment = tableInfo.getComment();
|
String comment = tableInfo.getComment();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import java.math.*;
|
|||||||
* $!{table.comment} 缓存对象
|
* $!{table.comment} 缓存对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
* $!{table.comment}缓存 key
|
* $!{table.comment}缓存 key
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
public interface ${type}CacheKeyDefine {
|
public interface ${type}CacheKeyDefine {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import java.util.List;
|
|||||||
* $!{table.comment} api
|
* $!{table.comment} api
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Tag(name = "${package.ModuleName} - $!{table.comment}服务")
|
@Tag(name = "${package.ModuleName} - $!{table.comment}服务")
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
* $!{table.comment} 内部对象转换器
|
* $!{table.comment} 内部对象转换器
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import java.math.*;
|
|||||||
* $!{table.comment} 实体对象
|
* $!{table.comment} 实体对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import java.math.*;
|
|||||||
* $!{table.comment} 导出对象
|
* $!{table.comment} 导出对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import java.math.*;
|
|||||||
* $!{table.comment} 创建请求对象
|
* $!{table.comment} 创建请求对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.math.*;
|
|||||||
* $!{table.comment} 查询请求对象
|
* $!{table.comment} 查询请求对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import java.math.*;
|
|||||||
* $!{table.comment} 更新请求对象
|
* $!{table.comment} 更新请求对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import java.math.*;
|
|||||||
* $!{table.comment} 视图响应对象
|
* $!{table.comment} 视图响应对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import ${mapperAnnotationClass.name};
|
|||||||
* $!{table.comment} Mapper 接口
|
* $!{table.comment} Mapper 接口
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
#if(${mapperAnnotationClass})
|
#if(${mapperAnnotationClass})
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLe
|
|||||||
* $!{table.comment} 操作日志类型
|
* $!{table.comment} 操作日志类型
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Module("${package.ModuleName}:${typeHyphen}")
|
@Module("${package.ModuleName}:${typeHyphen}")
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import java.util.stream.Collectors;
|
|||||||
* $!{table.comment} 服务实现类
|
* $!{table.comment} 服务实现类
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
* $!{table.comment} 服务类
|
* $!{table.comment} 服务类
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
public interface ${table.serviceName} {
|
public interface ${table.serviceName} {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import java.util.stream.Collectors;
|
|||||||
* $!{table.comment} 对外服务实现类
|
* $!{table.comment} 对外服务实现类
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.util.List;
|
|||||||
* $!{table.comment} 对外服务类
|
* $!{table.comment} 对外服务类
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
public interface ${type}Api {
|
public interface ${type}Api {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import java.util.List;
|
|||||||
* $!{table.comment} 对外服务对象转换器
|
* $!{table.comment} 对外服务对象转换器
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.math.*;
|
|||||||
* $!{table.comment} 创建请求业务对象
|
* $!{table.comment} 创建请求业务对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import java.math.*;
|
|||||||
* $!{table.comment} 查询请求业务对象
|
* $!{table.comment} 查询请求业务对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.math.*;
|
|||||||
* $!{table.comment} 更新请求业务对象
|
* $!{table.comment} 更新请求业务对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import java.math.*;
|
|||||||
* $!{table.comment} 业务对象
|
* $!{table.comment} 业务对象
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @version ${since}
|
* @version ${version}
|
||||||
* @since ${date}
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||||||
/**
|
/**
|
||||||
* $!{table.comment} 对外服务单元测试
|
* $!{table.comment} 对外服务单元测试
|
||||||
*
|
*
|
||||||
* @author Jiahang Li
|
* @author ${author}
|
||||||
* @version 1.0.0
|
* @version ${version}
|
||||||
* @since 2023/8/23 10:36
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Import({${type}ApiImpl.class, ${type}ServiceImpl.class})
|
@Import({${type}ApiImpl.class, ${type}ServiceImpl.class})
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||||||
/**
|
/**
|
||||||
* $!{table.comment} 服务单元测试
|
* $!{table.comment} 服务单元测试
|
||||||
*
|
*
|
||||||
* @author Jiahang Li
|
* @author ${author}
|
||||||
* @version 1.0.0
|
* @version ${version}
|
||||||
* @since 2023/8/23 10:36
|
* @since ${date}
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Import(${type}ServiceImpl.class)
|
@Import(${type}ServiceImpl.class)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.orion.ops.module.asset.controller;
|
|||||||
|
|
||||||
import com.orion.lang.define.wrapper.HttpWrapper;
|
import com.orion.lang.define.wrapper.HttpWrapper;
|
||||||
import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog;
|
import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||||
|
import com.orion.ops.framework.biz.operator.log.core.enums.ReturnType;
|
||||||
import com.orion.ops.framework.common.utils.Valid;
|
import com.orion.ops.framework.common.utils.Valid;
|
||||||
import com.orion.ops.framework.web.core.annotation.RestWrapper;
|
import com.orion.ops.framework.web.core.annotation.RestWrapper;
|
||||||
import com.orion.ops.module.asset.define.operator.ExecOperatorType;
|
import com.orion.ops.module.asset.define.operator.ExecOperatorType;
|
||||||
@@ -40,7 +41,7 @@ public class ExecController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ExecService execService;
|
private ExecService execService;
|
||||||
|
|
||||||
@OperatorLog(ExecOperatorType.EXEC_COMMAND)
|
@OperatorLog(value = ExecOperatorType.EXEC_COMMAND, ret = ReturnType.IGNORE)
|
||||||
@PostMapping("/exec-command")
|
@PostMapping("/exec-command")
|
||||||
@Operation(summary = "批量执行命令")
|
@Operation(summary = "批量执行命令")
|
||||||
@PreAuthorize("@ss.hasPermission('asset:exec:exec-command')")
|
@PreAuthorize("@ss.hasPermission('asset:exec:exec-command')")
|
||||||
@@ -48,7 +49,7 @@ public class ExecController {
|
|||||||
return execService.execCommand(request);
|
return execService.execCommand(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperatorLog(ExecOperatorType.EXEC_COMMAND)
|
@OperatorLog(value = ExecOperatorType.EXEC_COMMAND, ret = ReturnType.IGNORE)
|
||||||
@PostMapping("/re-exec-command")
|
@PostMapping("/re-exec-command")
|
||||||
@Operation(summary = "重新执行命令")
|
@Operation(summary = "重新执行命令")
|
||||||
@PreAuthorize("@ss.hasPermission('asset:exec:exec-command')")
|
@PreAuthorize("@ss.hasPermission('asset:exec:exec-command')")
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ public class ExecOperatorType extends InitializingOperatorTypes {
|
|||||||
return new OperatorType[]{
|
return new OperatorType[]{
|
||||||
new OperatorType(M, EXEC_COMMAND, "执行主机命令"),
|
new OperatorType(M, EXEC_COMMAND, "执行主机命令"),
|
||||||
new OperatorType(M, INTERRUPT_EXEC, "中断执行命令"),
|
new OperatorType(M, INTERRUPT_EXEC, "中断执行命令"),
|
||||||
new OperatorType(M, INTERRUPT_HOST, "中断主机执行命令 ${logId} ${hostName}"),
|
new OperatorType(M, INTERRUPT_HOST, "中断主机执行命令 <sb>${logId}</sb> <sb>${hostName}</sb>"),
|
||||||
new OperatorType(H, DELETE_LOG, "删除执行记录 ${count} 条"),
|
new OperatorType(H, DELETE_LOG, "删除执行记录 <sb>${count}</sb> 条"),
|
||||||
new OperatorType(H, CLEAR_LOG, "清理执行记录 ${count} 条"),
|
new OperatorType(H, CLEAR_LOG, "清理执行记录 <sb>${count}</sb> 条"),
|
||||||
new OperatorType(H, DELETE_HOST_LOG, "删除主机执行记录 ${logId} ${hostName}"),
|
new OperatorType(H, DELETE_HOST_LOG, "删除主机执行记录 <sb>${logId}</sb> <sb>${hostName}</sb>"),
|
||||||
new OperatorType(L, DOWNLOAD_HOST_LOG, "下载主机执行日志 ${logId} ${hostName}"),
|
new OperatorType(L, DOWNLOAD_HOST_LOG, "下载主机执行日志 <sb>${logId}</sb> <sb>${hostName}</sb>"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,11 +124,13 @@ export default class LogAppender implements ILogAppender {
|
|||||||
// 获取 token
|
// 获取 token
|
||||||
const { data } = await getExecLogTailToken(this.config);
|
const { data } = await getExecLogTailToken(this.config);
|
||||||
// 打开会话
|
// 打开会话
|
||||||
this.client = await createWebSocket(`${webSocketBaseUrl}/exec/log/${data}`);
|
try {
|
||||||
this.client.onerror = event => {
|
this.client = await createWebSocket(`${webSocketBaseUrl}/exec/log/${data}`);
|
||||||
|
} catch (e) {
|
||||||
Message.error('连接失败');
|
Message.error('连接失败');
|
||||||
console.error('log error', event);
|
console.error('log error', e);
|
||||||
};
|
return;
|
||||||
|
}
|
||||||
this.client.onclose = event => {
|
this.client.onclose = event => {
|
||||||
console.warn('log close', event);
|
console.warn('log close', event);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ export const resetObject = (obj: any, ignore: string[] = []) => {
|
|||||||
export const objectTruthKeyCount = (obj: any, ignore: string[] = []) => {
|
export const objectTruthKeyCount = (obj: any, ignore: string[] = []) => {
|
||||||
return Object.keys(obj)
|
return Object.keys(obj)
|
||||||
.filter(s => !ignore.includes(s))
|
.filter(s => !ignore.includes(s))
|
||||||
.reduce(function(acc, curr) {
|
.reduce(function (acc, curr) {
|
||||||
const currVal = obj[curr];
|
const currVal = obj[curr];
|
||||||
return acc + ~~(currVal !== undefined && currVal !== null && currVal?.length !== 0 && currVal !== '');
|
return acc + ~~(currVal !== undefined && currVal !== null && currVal?.length !== 0 && currVal !== '');
|
||||||
}, 0);
|
}, 0);
|
||||||
@@ -204,13 +204,13 @@ export const createWebSocket = async (url: string) => {
|
|||||||
return new Promise<WebSocket>((resolve, reject) => {
|
return new Promise<WebSocket>((resolve, reject) => {
|
||||||
const socket = new WebSocket(url);
|
const socket = new WebSocket(url);
|
||||||
|
|
||||||
socket.addEventListener('open', () => {
|
socket.onopen = () => {
|
||||||
resolve(socket);
|
resolve(socket);
|
||||||
});
|
};
|
||||||
|
|
||||||
socket.addEventListener('error', (error) => {
|
socket.onerror = e => {
|
||||||
reject(error);
|
reject(e);
|
||||||
});
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ export function detectZoom() {
|
|||||||
* 获取唯一的 UUID
|
* 获取唯一的 UUID
|
||||||
*/
|
*/
|
||||||
export function getUUID() {
|
export function getUUID() {
|
||||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||||
const r = Math.random() * 16 | 0;
|
const r = Math.random() * 16 | 0;
|
||||||
const v = c === 'x' ? r : (r & 0x3 | 0x8);
|
const v = c === 'x' ? r : (r & 0x3 | 0x8);
|
||||||
return v.toString(16);
|
return v.toString(16);
|
||||||
|
|||||||
@@ -3,7 +3,11 @@
|
|||||||
<!-- 表头 -->
|
<!-- 表头 -->
|
||||||
<div class="panel-header">
|
<div class="panel-header">
|
||||||
<h3>执行命令</h3>
|
<h3>执行命令</h3>
|
||||||
<span class="span-blue usn pointer" @click="openTemplate">从模板中选择</span>
|
<span v-permission="['asset:exec-template:query']"
|
||||||
|
class="span-blue usn pointer"
|
||||||
|
@click="openTemplate">
|
||||||
|
从模板中选择
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- 命令编辑器 -->
|
<!-- 命令编辑器 -->
|
||||||
<div class="editor-wrapper">
|
<div class="editor-wrapper">
|
||||||
|
|||||||
@@ -98,11 +98,12 @@ export default class SftpTransferManager implements ISftpTransferManager {
|
|||||||
// 获取 access
|
// 获取 access
|
||||||
const { data: accessToken } = await getTerminalAccessToken();
|
const { data: accessToken } = await getTerminalAccessToken();
|
||||||
// 打开会话
|
// 打开会话
|
||||||
this.client = await createWebSocket(`${webSocketBaseUrl}/host/transfer/${accessToken}`);
|
try {
|
||||||
this.client.onerror = event => {
|
this.client = await createWebSocket(`${webSocketBaseUrl}/host/transfer/${accessToken}`);
|
||||||
|
} catch (e) {
|
||||||
// 打开失败将传输列表置为失效
|
// 打开失败将传输列表置为失效
|
||||||
Message.error('会话打开失败');
|
Message.error('会话打开失败');
|
||||||
console.error('transfer error', event);
|
console.error('transfer error', e);
|
||||||
// 将等待中和传输中任务修改为失败状态
|
// 将等待中和传输中任务修改为失败状态
|
||||||
this.transferList.filter(s => {
|
this.transferList.filter(s => {
|
||||||
return s.status === TransferStatus.WAITING
|
return s.status === TransferStatus.WAITING
|
||||||
@@ -110,17 +111,18 @@ export default class SftpTransferManager implements ISftpTransferManager {
|
|||||||
}).forEach(s => {
|
}).forEach(s => {
|
||||||
s.status = TransferStatus.ERROR;
|
s.status = TransferStatus.ERROR;
|
||||||
});
|
});
|
||||||
};
|
// 关闭会话重置 run
|
||||||
|
this.run = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.client.onclose = event => {
|
this.client.onclose = event => {
|
||||||
// 关闭会话重置 run
|
// 关闭会话重置 run
|
||||||
this.run = false;
|
this.run = false;
|
||||||
console.warn('transfer close', event);
|
console.warn('transfer close', event);
|
||||||
};
|
};
|
||||||
this.client.onopen = () => {
|
|
||||||
// 打开后自动传输下一个任务
|
|
||||||
this.transferNextItem();
|
|
||||||
};
|
|
||||||
this.client.onmessage = this.resolveMessage.bind(this);
|
this.client.onmessage = this.resolveMessage.bind(this);
|
||||||
|
// 打开后自动传输下一个任务
|
||||||
|
this.transferNextItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 传输下一条任务
|
// 传输下一条任务
|
||||||
|
|||||||
@@ -22,11 +22,13 @@ export default class TerminalChannel implements ITerminalChannel {
|
|||||||
// 获取 access
|
// 获取 access
|
||||||
const { data: accessToken } = await getTerminalAccessToken();
|
const { data: accessToken } = await getTerminalAccessToken();
|
||||||
// 打开会话
|
// 打开会话
|
||||||
this.client = await createWebSocket(`${webSocketBaseUrl}/host/terminal/${accessToken}`);
|
try {
|
||||||
this.client.onerror = event => {
|
this.client = await createWebSocket(`${webSocketBaseUrl}/host/terminal/${accessToken}`);
|
||||||
|
} catch (e) {
|
||||||
Message.error('无法连接至服务器');
|
Message.error('无法连接至服务器');
|
||||||
console.error('terminal error', event);
|
console.error('terminal error', e);
|
||||||
};
|
throw e;
|
||||||
|
}
|
||||||
this.client.onclose = event => {
|
this.client.onclose = event => {
|
||||||
console.warn('terminal close', event);
|
console.warn('terminal close', event);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -65,12 +65,15 @@
|
|||||||
<!-- 颜色 -->
|
<!-- 颜色 -->
|
||||||
<template v-else-if="ValueType.COLOR === type">
|
<template v-else-if="ValueType.COLOR === type">
|
||||||
<a-input v-model="extraValue[name]"
|
<a-input v-model="extraValue[name]"
|
||||||
|
class="item-color-input"
|
||||||
:placeholder="`请输入 ${name}`"
|
:placeholder="`请输入 ${name}`"
|
||||||
allow-clear
|
allow-clear
|
||||||
hide-button />
|
hide-button />
|
||||||
<span class="item-extra-block" :style="{
|
<div class="item-color-block-wrapper">
|
||||||
background: extraValue[name] === '#' ? undefined : (extraValue[name] || undefined)
|
<span class="item-color-block" :style="{
|
||||||
}" />
|
background: extraValue[name] === '#' ? undefined : (extraValue[name] || undefined)
|
||||||
|
}" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
@@ -223,12 +226,22 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.item-extra-block {
|
.item-color-input {
|
||||||
width: 38px;
|
width: calc(100% - 40px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-color-block-wrapper {
|
||||||
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
padding: 4px;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background: var(--color-fill-2);
|
background: var(--color-fill-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-color-block {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|||||||
Reference in New Issue
Block a user