🎨 修改批量执行模块格式.
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
import useVisible from '@/hooks/visible';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { nextTick, ref } from 'vue';
|
||||
import { getExecLog } from '@/api/exec/exec-log';
|
||||
import { getExecCommandLog } from '@/api/exec/exec-command-log';
|
||||
import ExecLogPanel from '../panel/index.vue';
|
||||
|
||||
const { visible, setVisible } = useVisible();
|
||||
@@ -46,7 +46,7 @@
|
||||
setLoading(true);
|
||||
try {
|
||||
// 获取执行日志
|
||||
const { data } = await getExecLog(id);
|
||||
const { data } = await getExecCommandLog(id);
|
||||
// 打开日志
|
||||
await nextTick(() => {
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -41,14 +41,14 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ExecHostLogQueryResponse } from '@/api/exec/exec-log';
|
||||
import type { ExecCommandHostLogQueryResponse } from '@/api/exec/exec-command-log';
|
||||
import { useDictStore } from '@/store';
|
||||
import { execHostStatusKey } from './const';
|
||||
|
||||
const props = defineProps<{
|
||||
visibleBack: boolean;
|
||||
current: number;
|
||||
hosts: Array<ExecHostLogQueryResponse>;
|
||||
hosts: Array<ExecCommandHostLogQueryResponse>;
|
||||
}>();
|
||||
const emits = defineEmits(['back', 'selected']);
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ExecLogQueryResponse } from '@/api/exec/exec-log';
|
||||
import type { ExecCommandLogQueryResponse } from '@/api/exec/exec-command-log';
|
||||
import type { ILogAppender } from './const';
|
||||
import { onUnmounted, ref, nextTick, onMounted } from 'vue';
|
||||
import { getExecLogStatus } from '@/api/exec/exec-log';
|
||||
import { getExecCommandLogStatus } from '@/api/exec/exec-command-log';
|
||||
import { dictKeys, execHostStatus, execStatus } from './const';
|
||||
import ExecHost from './exec-host.vue';
|
||||
import LogView from './log-view.vue';
|
||||
@@ -43,11 +43,11 @@
|
||||
const currentHostExecId = ref();
|
||||
const statusIntervalId = ref();
|
||||
const finishIntervalId = ref();
|
||||
const execLog = ref<ExecLogQueryResponse>();
|
||||
const execLog = ref<ExecCommandLogQueryResponse>();
|
||||
const appender = ref<ILogAppender>();
|
||||
|
||||
// 打开
|
||||
const open = (record: ExecLogQueryResponse) => {
|
||||
const open = (record: ExecCommandLogQueryResponse) => {
|
||||
appender.value = new LogAppender({ execId: record.id });
|
||||
execLog.value = record;
|
||||
currentHostExecId.value = record.hosts[0].id;
|
||||
@@ -71,7 +71,7 @@
|
||||
return;
|
||||
}
|
||||
// 加载状态
|
||||
const { data: { logList, hostList } } = await getExecLogStatus([execLog.value.id]);
|
||||
const { data: { logList, hostList } } = await getExecCommandLogStatus([execLog.value.id]);
|
||||
if (logList.length) {
|
||||
execLog.value.status = logList[0].status;
|
||||
execLog.value.startTime = logList[0].startTime;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ILogAppender, LogAddons, LogAppenderConf, LogDomRef } from './const';
|
||||
import { AppenderOptions } from './const';
|
||||
import type { ExecTailRequest } from '@/api/exec/exec';
|
||||
import { getExecLogTailToken } from '@/api/exec/exec';
|
||||
import type { ExecCommandLogTailRequest } from '@/api/exec/exec-command-log';
|
||||
import { getExecCommandLogTailToken } from '@/api/exec/exec-command-log';
|
||||
import { webSocketBaseUrl } from '@/utils/env';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { createWebSocket } from '@/utils';
|
||||
@@ -21,7 +21,7 @@ export default class LogAppender implements ILogAppender {
|
||||
|
||||
private client?: WebSocket;
|
||||
|
||||
private readonly config: ExecTailRequest;
|
||||
private readonly config: ExecCommandLogTailRequest;
|
||||
|
||||
private readonly appenderRel: Record<string, LogAppenderConf>;
|
||||
|
||||
@@ -29,7 +29,7 @@ export default class LogAppender implements ILogAppender {
|
||||
|
||||
private readonly fitAllFn: () => {};
|
||||
|
||||
constructor(config: ExecTailRequest) {
|
||||
constructor(config: ExecCommandLogTailRequest) {
|
||||
this.current = undefined as unknown as LogAppenderConf;
|
||||
this.config = config;
|
||||
this.appenderRel = {};
|
||||
@@ -142,7 +142,7 @@ export default class LogAppender implements ILogAppender {
|
||||
// 初始化 client
|
||||
async openClient() {
|
||||
// 获取 token
|
||||
const { data } = await getExecLogTailToken(this.config);
|
||||
const { data } = await getExecCommandLogTailToken(this.config);
|
||||
// 打开会话
|
||||
try {
|
||||
this.client = await createWebSocket(`${webSocketBaseUrl}/exec/log/${data}`);
|
||||
|
||||
@@ -160,19 +160,19 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ExecHostLogQueryResponse } from '@/api/exec/exec-log';
|
||||
import type { ExecCommandHostLogQueryResponse } from '@/api/exec/exec-command-log';
|
||||
import type { ILogAppender } from './const';
|
||||
import { ref } from 'vue';
|
||||
import { execHostStatus, execHostStatusKey } from './const';
|
||||
import { formatDuration } from '@/utils';
|
||||
import { useDictStore } from '@/store';
|
||||
import { downloadExecLogFile } from '@/api/exec/exec';
|
||||
import { downloadExecCommandLogFile } from '@/api/exec/exec-command-log';
|
||||
import { downloadFile } from '@/utils/file';
|
||||
import XtermSearchModal from '@/components/xtrem/search-modal/index.vue';
|
||||
import 'xterm/css/xterm.css';
|
||||
|
||||
const props = defineProps<{
|
||||
host: ExecHostLogQueryResponse;
|
||||
host: ExecCommandHostLogQueryResponse;
|
||||
appender: ILogAppender
|
||||
}>();
|
||||
|
||||
@@ -204,7 +204,7 @@
|
||||
|
||||
// 下载文件
|
||||
const downloadLogFile = async (id: number) => {
|
||||
const data = await downloadExecLogFile(id);
|
||||
const data = await downloadExecCommandLogFile(id);
|
||||
downloadFile(data);
|
||||
};
|
||||
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { VNodeRef } from 'vue';
|
||||
import type { ExecHostLogQueryResponse } from '@/api/exec/exec-log';
|
||||
import type { ExecCommandHostLogQueryResponse } from '@/api/exec/exec-command-log';
|
||||
import type { LogDomRef, ILogAppender } from './const';
|
||||
import { nextTick, ref, watch } from 'vue';
|
||||
import LogItem from './log-item.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
current: number;
|
||||
hosts: Array<ExecHostLogQueryResponse>;
|
||||
hosts: Array<ExecCommandHostLogQueryResponse>;
|
||||
appender: ILogAppender;
|
||||
}>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user