feat(updates): live operation log with page lock in progress modal
The progress modal faked its steps on a timer because the worker only wrote to syslog. Now every updates_log line is appended to <job>.log (UPDATES_JOB_LOG), the running state advertises log_path, the log survives job completion until the TTL sweep, and the new component_action_log CLI mode serves it from a byte offset. The UI polls it into a monospace panel with auto-scroll, exposes a Copy log button, and the modal cannot be closed while the job runs (only the disabled progress button is shown).
This commit is contained in:
@@ -172,8 +172,26 @@ function log_message(message, level) {
|
||||
command_success_from_args([ "logger", "-t", "tachyon", "[" + level + "] " + as_string(message) ]);
|
||||
}
|
||||
|
||||
function job_log_time() {
|
||||
let seconds = int(clock()[0]);
|
||||
return sprintf("%02d:%02d:%02d", int(seconds / 3600) % 24, int(seconds / 60) % 60, seconds % 60);
|
||||
}
|
||||
|
||||
function job_log_append(message, level) {
|
||||
let path = getenv("UPDATES_JOB_LOG");
|
||||
if (path == "")
|
||||
return;
|
||||
let file = fs.open(path, "a");
|
||||
if (!file)
|
||||
return;
|
||||
file.write(sprintf("[%s] [%s] %s\n", job_log_time(), as_string(level), as_string(message)));
|
||||
file.close();
|
||||
}
|
||||
|
||||
function updates_log(message, level) {
|
||||
log_message("Updates: " + as_string(message), level || "info");
|
||||
level = as_string(level || "info");
|
||||
log_message("Updates: " + as_string(message), level);
|
||||
job_log_append(message, level);
|
||||
}
|
||||
|
||||
function module_command(args) {
|
||||
|
||||
Reference in New Issue
Block a user