Updates can send progress update status

This commit is contained in:
Clément Renault 2020-10-20 12:28:10 +02:00
parent 341046c96c
commit eb92e72e6c
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
2 changed files with 18 additions and 1 deletions

View File

@ -52,7 +52,13 @@ $(window).on('load', function () {
if (status.type == "Processing") {
const id = 'update-' + status.update_id;
const content = $(`#${id} .updateStatus.content`);
content.html('processing');
content.html('processing...');
}
if (status.type == "Progressing") {
const id = 'update-' + status.update_id;
const content = $(`#${id} .updateStatus.content`);
content.html('progressing...');
}
if (status.type == "Processed") {

View File

@ -96,6 +96,7 @@ struct UpdatesTemplate<M: Serialize + Send> {
enum UpdateStatus<M> {
Pending { update_id: u64, meta: M },
Processing { update_id: u64, meta: M },
Progressing { update_id: u64, meta: M },
Processed { update_id: u64, meta: M },
}
@ -132,6 +133,16 @@ pub fn run(opt: Opt) -> anyhow::Result<()> {
std::thread::sleep(Duration::from_secs(3));
let progress = UpdateStatus::Progressing { update_id, meta: meta.clone() };
let _ = update_status_sender_cloned.send(progress);
std::thread::sleep(Duration::from_secs(3));
let progress = UpdateStatus::Progressing { update_id, meta: meta.clone() };
let _ = update_status_sender_cloned.send(progress);
std::thread::sleep(Duration::from_secs(3));
let processed = UpdateStatus::Processed { update_id, meta: meta.clone() };
let _ = update_status_sender_cloned.send(processed);
Ok(meta)