mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-11 20:20:48 +08:00
fix: Fix the problem of failed task log acquisition (#8604)
This commit is contained in:
parent
bb5f04a9b0
commit
02a9267fa1
5 changed files with 24 additions and 8 deletions
|
|
@ -120,12 +120,17 @@ class RequestHttp {
|
||||||
get<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
get<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
||||||
return this.service.get(url, { params, ..._object });
|
return this.service.get(url, { params, ..._object });
|
||||||
}
|
}
|
||||||
post<T>(url: string, params?: object, timeout?: number): Promise<ResultData<T>> {
|
post<T>(url: string, params?: object, timeout?: number, headers?: object): Promise<ResultData<T>> {
|
||||||
return this.service.post(url, params, {
|
let config = {
|
||||||
baseURL: import.meta.env.VITE_API_URL as string,
|
baseURL: import.meta.env.VITE_API_URL as string,
|
||||||
timeout: timeout ? timeout : (ResultEnum.TIMEOUT as number),
|
timeout: timeout ? timeout : (ResultEnum.TIMEOUT as number),
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
});
|
headers: headers,
|
||||||
|
};
|
||||||
|
if (headers) {
|
||||||
|
config.headers = headers;
|
||||||
|
}
|
||||||
|
return this.service.post(url, params, config);
|
||||||
}
|
}
|
||||||
postLocalNode<T>(url: string, params?: object, timeout?: number): Promise<ResultData<T>> {
|
postLocalNode<T>(url: string, params?: object, timeout?: number): Promise<ResultData<T>> {
|
||||||
return this.service.post(url, params, {
|
return this.service.post(url, params, {
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,10 @@ export const addFavorite = (path: string) => {
|
||||||
return http.post<any>('files/favorite', { path: path });
|
return http.post<any>('files/favorite', { path: path });
|
||||||
};
|
};
|
||||||
|
|
||||||
export const readByLine = (req: File.FileReadByLine) => {
|
export const readByLine = (req: File.FileReadByLine, operateNode?: string) => {
|
||||||
|
if (operateNode) {
|
||||||
|
return http.post<any>('files/read', req, TimeoutEnum.T_40S, { CurrentNode: operateNode });
|
||||||
|
}
|
||||||
return http.post<any>('files/read', req);
|
return http.post<any>('files/read', req);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@ interface LogProps {
|
||||||
taskType?: string;
|
taskType?: string;
|
||||||
taskOperate?: string;
|
taskOperate?: string;
|
||||||
resourceID?: number;
|
resourceID?: number;
|
||||||
|
|
||||||
|
operateNode?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
|
@ -64,6 +66,8 @@ const props = defineProps({
|
||||||
taskOperate: '',
|
taskOperate: '',
|
||||||
resourceID: 0,
|
resourceID: 0,
|
||||||
taskID: '',
|
taskID: '',
|
||||||
|
|
||||||
|
operateNode: '',
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
defaultButton: {
|
defaultButton: {
|
||||||
|
|
@ -201,7 +205,7 @@ const getContent = async (pre: boolean) => {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
emit('update:isReading', true);
|
emit('update:isReading', true);
|
||||||
|
|
||||||
const res = await readByLine(readReq);
|
const res = await readByLine(readReq, props.config.operateNode || '');
|
||||||
logPath.value = res.data.path;
|
logPath.value = res.data.path;
|
||||||
firstLoading.value = false;
|
firstLoading.value = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,25 +42,29 @@ const config = reactive({
|
||||||
taskType: '',
|
taskType: '',
|
||||||
tail: true,
|
tail: true,
|
||||||
colorMode: 'task',
|
colorMode: 'task',
|
||||||
|
|
||||||
|
operateNode: '',
|
||||||
});
|
});
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
const showTail = ref(true);
|
const showTail = ref(true);
|
||||||
|
|
||||||
const openWithTaskID = (id: string, tail: boolean) => {
|
const openWithTaskID = (id: string, tail: boolean, operateNode?: string) => {
|
||||||
config.taskID = id;
|
config.taskID = id;
|
||||||
if (tail === undefined) {
|
if (tail === undefined) {
|
||||||
config.tail = true;
|
config.tail = true;
|
||||||
} else {
|
} else {
|
||||||
config.tail = tail;
|
config.tail = tail;
|
||||||
}
|
}
|
||||||
|
config.operateNode = operateNode || '';
|
||||||
open.value = true;
|
open.value = true;
|
||||||
bus.emit('refreshTask', true);
|
bus.emit('refreshTask', true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const openWithResourceID = (taskType: string, taskOperate: string, resourceID: number) => {
|
const openWithResourceID = (taskType: string, taskOperate: string, resourceID: number, operateNode?: string) => {
|
||||||
config.taskType = taskType;
|
config.taskType = taskType;
|
||||||
config.resourceID = resourceID;
|
config.resourceID = resourceID;
|
||||||
config.taskOperate = taskOperate;
|
config.taskOperate = taskOperate;
|
||||||
|
config.operateNode = operateNode || '';
|
||||||
open.value = true;
|
open.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ const onSync = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const openTaskLog = (taskID: string) => {
|
const openTaskLog = (taskID: string) => {
|
||||||
taskLogRef.value.openWithTaskID(taskID);
|
taskLogRef.value.openWithTaskID(taskID, true, 'local');
|
||||||
};
|
};
|
||||||
|
|
||||||
const search = async () => {
|
const search = async () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue