| @@ -147,6 +147,7 @@ export default async function initCloudrainSow() { | |||||
| let logContentDom = document.querySelector(`#log${max}${version_name}`); | let logContentDom = document.querySelector(`#log${max}${version_name}`); | ||||
| let ID = $(`#accordion${version_name}`).data("jobid"); | let ID = $(`#accordion${version_name}`).data("jobid"); | ||||
| let repoPath = $(`#accordion${version_name}`).data("repopath"); | let repoPath = $(`#accordion${version_name}`).data("repopath"); | ||||
| let start_line = $(`#log${version_name} input[name=end_line${max}]`).val(); | |||||
| $(`#log_file${max}${version_name}`).siblings("pre").remove(); | $(`#log_file${max}${version_name}`).siblings("pre").remove(); | ||||
| $(`#log${max}${version_name} .ui.inverted.active.dimmer`).css({ | $(`#log${max}${version_name} .ui.inverted.active.dimmer`).css({ | ||||
| "background-color": "#fff", | "background-color": "#fff", | ||||
| @@ -178,7 +179,45 @@ export default async function initCloudrainSow() { | |||||
| }, 1000); | }, 1000); | ||||
| } | } | ||||
| } | } | ||||
| scrollAnimation(logContentDom, logContentDom.scrollTop, 0); | |||||
| $.get( | |||||
| `/api/v1/repos/${repoPath}/${ID}/log?version_name=${version_name}&base_line=${data.StartLine}&lines=${lines}&order=asc`, | |||||
| (data) => { | |||||
| $(`#log${max}${version_name} .ui.inverted.active.dimmer`).css( | |||||
| "display", | |||||
| "none" | |||||
| ); | |||||
| if (data.Lines == 0) { | |||||
| if (max) { | |||||
| $("body").toast({ | |||||
| class: "black", | |||||
| message: `您已翻阅至日志顶部,请稍后再试!`, | |||||
| }); | |||||
| } else { | |||||
| $(`.message${version_name} #header`).text("您已翻阅至日志顶部"); | |||||
| $(`.message${version_name}`).css("display", "block"); | |||||
| setTimeout(function () { | |||||
| $(`.message${version_name}`).css("display", "none"); | |||||
| }, 1000); | |||||
| } | |||||
| } else { | |||||
| if (start_line === data.StartLine || start_line === "") { | |||||
| return; | |||||
| } else { | |||||
| $(`#log${version_name} input[name=start_line${max}]`).val( | |||||
| data.StartLine | |||||
| ); | |||||
| $(`#log${max}${version_name}`).prepend("<pre>" + data.Content); | |||||
| } | |||||
| } | |||||
| } | |||||
| ).fail(function (err) { | |||||
| $(`#log${max}${version_name} .ui.inverted.active.dimmer`).css( | |||||
| "display", | |||||
| "none" | |||||
| ); | |||||
| console.log(err); | |||||
| }); | |||||
| scrollAnimation(logContentDom, logContentDom.scrollTop, 10); | |||||
| } | } | ||||
| ).fail((err) => { | ).fail((err) => { | ||||
| $(`#log${max}${version_name} .ui.inverted.active.dimmer`).css( | $(`#log${max}${version_name} .ui.inverted.active.dimmer`).css( | ||||