mirror of
https://github.com/nxshock/gron.git
synced 2024-11-27 03:41:00 +05:00
Add workaround for spaces in job config file names
This commit is contained in:
parent
b118d18516
commit
f575d71369
7
job.go
7
job.go
@ -84,8 +84,13 @@ func readJob(filePath string) (*Job, error) {
|
|||||||
return nil, fmt.Errorf("unknown job type id: %v", int(jobConfig.Type)) // TODO: add job name to log
|
return nil, fmt.Errorf("unknown job type id: %v", int(jobConfig.Type)) // TODO: add job name to log
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jobName := strings.TrimSuffix(filepath.Base(filePath), filepath.Ext(filePath))
|
||||||
|
jobName = strings.ReplaceAll(jobName, " ", "")
|
||||||
|
jobName = strings.ReplaceAll(jobName, "_", "")
|
||||||
|
jobName = strings.ReplaceAll(jobName, "#", "")
|
||||||
|
|
||||||
job := &Job{
|
job := &Job{
|
||||||
Name: strings.TrimSuffix(filepath.Base(filePath), filepath.Ext(filePath)),
|
Name: jobName,
|
||||||
Status: Inactive,
|
Status: Inactive,
|
||||||
JobConfig: jobConfig}
|
JobConfig: jobConfig}
|
||||||
|
|
||||||
|
@ -76,25 +76,27 @@
|
|||||||
html4 = '<span class="orange">⟳ restarting</span>'
|
html4 = '<span class="orange">⟳ restarting</span>'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elementId = encodeURIComponent(message.Name)
|
||||||
|
|
||||||
if (message.CurrentRunningCount > 0) {
|
if (message.CurrentRunningCount > 0) {
|
||||||
document.querySelector("#" + message.Name + " > td:nth-child(1) > button").className = "runningbg"
|
document.querySelector("#" + elementId + " > td:nth-child(1) > button").className = "runningbg"
|
||||||
} else if (message.LastError != "") {
|
} else if (message.LastError != "") {
|
||||||
document.querySelector("#" + message.Name + " > td:nth-child(1) > button").className = "errorbg"
|
document.querySelector("#" + elementId + " > td:nth-child(1) > button").className = "errorbg"
|
||||||
} else {
|
} else {
|
||||||
document.querySelector("#" + message.Name + " > td:nth-child(1) > button").removeAttribute("class")
|
document.querySelector("#" + elementId + " > td:nth-child(1) > button").removeAttribute("class")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.CurrentRunningCount > 0) {
|
if (message.CurrentRunningCount > 0) {
|
||||||
document.querySelector("#" + message.Name + " > td:nth-child(1) > button").setAttribute("disabled", "true")
|
document.querySelector("#" + elementId + " > td:nth-child(1) > button").setAttribute("disabled", "true")
|
||||||
} else {
|
} else {
|
||||||
document.querySelector("#" + message.Name + " > td:nth-child(1) > button").removeAttribute("disabled")
|
document.querySelector("#" + elementId + " > td:nth-child(1) > button").removeAttribute("disabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector("#" + message.Name + " > td:nth-child(4)").innerHTML = html4
|
document.querySelector("#" + elementId + " > td:nth-child(4)").innerHTML = html4
|
||||||
document.querySelector("#" + message.Name + " > td:nth-child(5)").innerHTML = message.LastStartTime
|
document.querySelector("#" + elementId + " > td:nth-child(5)").innerHTML = message.LastStartTime
|
||||||
document.querySelector("#" + message.Name + " > td:nth-child(6)").innerHTML = message.LastEndTime
|
document.querySelector("#" + elementId + " > td:nth-child(6)").innerHTML = message.LastEndTime
|
||||||
document.querySelector("#" + message.Name + " > td:nth-child(7)").innerHTML = message.LastExecutionDuration
|
document.querySelector("#" + elementId + " > td:nth-child(7)").innerHTML = message.LastExecutionDuration
|
||||||
document.querySelector("#" + message.Name + " > td:nth-child(8)").innerHTML = message.NextLaunch
|
document.querySelector("#" + elementId + " > td:nth-child(8)").innerHTML = message.NextLaunch
|
||||||
}
|
}
|
||||||
|
|
||||||
function startJob(jobName) {
|
function startJob(jobName) {
|
||||||
|
Loading…
Reference in New Issue
Block a user