UI doesn't update when builds start/end/fail - require full page reload

ui
#22

We’ve been using nativefier with CircleCI for a while, and it’s great. Luckily, nativefier also makes it easy to fix this issue locally.

You make a local JS script called reloadPageInactivity.js with the following (based on StackOverflow):

var refresh_rate = 30; //<-- In seconds, change to your needs
var last_user_action = 0;
var has_focus = false;
var lost_focus_count = 0;
var focus_margin = 10; // If we lose focus more then the margin we want to refresh


function reset() {
    last_user_action = 0;
    console.log("Reset");
}

function windowHasFocus() {
    has_focus = true;
}

function windowLostFocus() {
    has_focus = false;
    lost_focus_count++;
    console.log(lost_focus_count + " <~ Lost Focus");
}

setInterval(function () {
    last_user_action++;
    refreshCheck();
}, 1000);

function refreshCheck() {
    var focus = window.onfocus;
    if ((last_user_action >= refresh_rate && !has_focus && document.readyState == "complete") || lost_focus_count > focus_margin) {
        window.location.reload(); // If this is called no reset is needed
        reset(); // We want to reset just to make sure the location reload is not called.
    }

}
window.addEventListener("focus", windowHasFocus, false);
window.addEventListener("blur", windowLostFocus, false);
window.addEventListener("click", reset, false);
window.addEventListener("mousemove", reset, false);
window.addEventListener("keypress", reset, false);
window.addEventListener("scroll", reset, false);
document.addEventListener("touchMove", reset, false);
document.addEventListener("touchEnd", reset, false);

Then you run nativefier:

nativefier https://circleci.com/gh/RuneAI --internal-urls "(.*?)(github\.com|circleci\.com)(.*?)" --name "CircleCI" --inject reloadPageInactivity.js

Voila! You now have a local CircleCI app that refreshes after 30 sec of inactivity. Hope that’s useful to anyone.

3 Likes
#23

Good work! :trophy:

#24

@drazisil Any update on the redesign? Dashboards outright don’t work if they don’t automatically refresh.

#25

Sorry for the silence, I was on vacation, but I see it’s been escalated while I was away)

I understand the frustration, and I may have mispoke when I said that the team was waiting on the new UI. The team responsible for this will be looking at it soon (still in nextup), and we will hopefully have an update/fix shortly, but I do not want to put a timeline in another team’s mouth as we still don’t know what’s causing this.

#26

Hi Folks!

I’m told this should be fixed, can you please confirm?

3 Likes
#28

Yes! It works as expected! Thank you!

1 Like
#29

This appears to be automatically updating individual jobs for me when I’m viewing a workflow run instance, but the main workflow dashboard with all the branches and list of all workflow runs still isn’t updating automatically.

#30

Hi Adam,

Can you try clearing your cache and open a ticket if this persists? I think this is a separate issue.

#31

I tried clearing my entire cache, and it’s still persisting. Isn’t this issue directly related to what I described above (UI not automatically updating)? A build started, it completed a while ago, with that branch selected the UI still says it’s running, and that latest build never appeared in the left hand sidebar.

#32

This issue was related to the job details not updating. The dashboard uses different technology and thus would be a separate issue.

It looks like two issues did get mixed in this thread though. Let me dig deeper.

1 Like
#33

Thanks again fellow workers! Working for me :fist:

2 Likes
#34

I can confirm that after about 6 weeks this is finally working for me again and the UI is updating when new jobs start/complete. Thanks!

1 Like