Skip to content

Commit

Permalink
fix: 优化日志效果 (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
langren1353 committed Aug 8, 2023
1 parent aa49b50 commit 8cfde6b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion client/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func backup(backupConf entity.BackupConfig, encryptKey string, s3Conf entity.S3C
if util.IsGBK(outputBytes) {
outputBytes, _ = util.GbkToUtf8(outputBytes)
}
log.Printf("<span title=\"%s\">%s 执行shell的输出: 鼠标移动此处查看</span>\n", util.EscapeShell(string(outputBytes)), backupConf.ProjectName)
log.Printf("<span style='color: #7983f5;font-weight: bold;'>%s</span> 执行shell的输出: <span title=\"%s\" style='cursor: pointer; color: #4a3a3a; font-weight: bold'>鼠标[停留]此处查看</span>\n", backupConf.ProjectName, util.EscapeShell(string(outputBytes)))
} else {
log.Printf("执行shell的输出为空\n")
}
Expand Down
23 changes: 12 additions & 11 deletions web/writing.html
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,16 @@ <h5 class="portlet__head">对象存储配置</h5>

<script>
let contentIdx = 0
let logType = 1
let logList = [] // 0:所有日志;1:日常日志;2:登录日志

function contentChange(i) {
contentIdx = i
}

function changeLog(type = 0) {
const curLogList = logList[type]
logType = type
const curLogList = logList[logType]
const totalLogList = logList[0]

const failedCount = totalLogList.filter(one => one.includes('登录失败')).length
Expand Down Expand Up @@ -328,6 +330,9 @@ <h5 class="portlet__head">对象存储配置</h5>
// ok
$('.alert').addClass("alert-success").removeClass("alert-danger")
$('#resultMsg').html("保存成功")
setTimeout(() => {
getLogs()
}, 800)
setTimeout(function(){
$('.alert').css("display", "none");
}, 3000)
Expand All @@ -345,19 +350,16 @@ <h5 class="portlet__head">对象存储配置</h5>
function projectNameChange(that) {
let id = $(that).attr("id").split("_")[1]
let name = $(that).val()
let enabled = $("#Enabled_"+id).val()
$("#id_"+id).html(enabled === 0?name:name+'<span class="badge badge-pill badge-warning">停用</span>')
let enabled = +$("#Enabled_"+id).val() === 0
$("#id_"+id).html(enabled ? name:name+'<span class="badge badge-pill badge-warning">停用</span>')
}
// enabledChange
function enabledChange(that) {
let id = $(that).attr("id").split("_")[1]
let name = $("#ProjectName_"+id).val()
let enabled = $(that).val()
$("#id_"+id).html(enabled === 0?name:name+'<span class="badge badge-pill badge-warning">停用</span>')
let enabled = +$(that).val() === 0
$("#id_"+id).html(enabled ? name:name+'<span class="badge badge-pill badge-warning">停用</span>')
}



</script>

<script>
Expand All @@ -366,11 +368,10 @@ <h5 class="portlet__head">对象存储配置</h5>
const curList = result.split("<br/>").filter(one => one.length)

logList[0] = curList.map(one => one)

logList[1] = curList.filter(one => !one.includes("登录"))
logList[2] = curList.filter(one => one.includes("登录"))

changeLog(1)
changeLog(logType)
})
}
getLogs()
Expand Down Expand Up @@ -413,5 +414,5 @@ <h5 class="portlet__head">对象存储配置</h5>
})
})
</script>

</body>
</html>

0 comments on commit 8cfde6b

Please sign in to comment.