Syncs board after a period of inactivity#278
Conversation
config/routes.rb
Outdated
|
|
||
|
|
||
| namespace :api do | ||
| get 'logged_in' => 'api#logged_in' |
There was a problem hiding this comment.
NIT: _ in a URL are 👎 prefer -
There was a problem hiding this comment.
Is that a common convention (honest question) ? Easy change to make
There was a problem hiding this comment.
yeah, it is for me. It goes back a pretty long ways to HTML webpage dev days - imagine http://www.bob.com/this_is_awesome where the default link underlining is in play
vs
There was a problem hiding this comment.
Also this url is a query, for a pure RESTafarian- 💩 head - should it be ~/session?exist kind of thing? again, this is purely surface stuff.
| flashMessages: Ember.inject.service(), | ||
| syncFlashNotifier: function(){ | ||
| if(this.get('syncInProgress')){ | ||
| this.get('flashMessages').add(this.messageData); |
There was a problem hiding this comment.
It occurs to me that this.messageData should be cloned lest we modify the original messageData object later.
…rowser-session" service
…nd model methods for fetching issues
…ne sync can run at a time
de2f10f to
224d420
Compare
| var since = new Date(new Date().getTime() - _self.browserCheckInterval); | ||
| this.validateCredentials().success((response)=>{ | ||
| _self.get('boardSyncing').syncIssues(_self.get('model.board'), {since: since.toISOString()}); | ||
| }).fail((error)=>{ |
There was a problem hiding this comment.
Rather than separately/explicitly check if the user is logged in here, it seems like we should just handle a 403 when we attempt to fetch latest. More generally, could we use jQuery.ajaxSetup (or a more Ember-y equivalent?) to do something like:
$.ajaxSetup({
statusCode: {
403: function() {
alert( "Access denied! Do you need to [login|grant private access]?" );
},
500: function() {
alert( "Oh noes, something went wrong! Try again?" );
}
}
});(With better UX than alerts, of course.)
There was a problem hiding this comment.
We already have a global ajax handler picking up failed requests and transition to a "unauthorized" modal. User login may be the wrong criteria, I honestly didn't think that part of it through too much.
I would like to avoid using ajax catch-alls as much as possible, I see this feature as a way to "latch" on focus and fail before any unauthorized tasks are performed to begin with.
There was a problem hiding this comment.
I see this feature as a way to "latch" on focus and fail before any unauthorized tasks are performed to begin with.
I'm not sure what that actually gains us, though. Server-side, we're checking logged_in? in either case, we just have to make two requests if we have an explicit login check.
I'm curious what scenarios we have (or might have) in the app that would require different experiences when a 403 or 500 are encountered?
There was a problem hiding this comment.
I'm curious what scenarios we have (or might have) in the app that would require different experiences when a 403 or 500 are encountered?
Not entirely clear on the question. A session token can get stale, in which case all actions on the board will cause 403's. We handle this with the unauthorized modal right now, but it would be nice to let users know they need to "relogin" before they attempt to even do something that will fail
There was a problem hiding this comment.
Right. My question is: is there any situation in the app where we wouldn't want to handle a 403 with a unified UX to give a chance to restore authorization?
Is there some way to make it read-only? |
We have a CSS overlay (like on issue fullscreen) that I think would be a good touch. |
Well I was thinking read-only but otherwise functional. Let me click on issues to see detail (and edit from there, since we always* hit GitHub for latest), but don't let me rearrange stuff in column view. * right? |
Only in partial, see: #90 (I need to rewrite this to take advantage of #276 which should actually let us start keeping issues completely in-sync)
I am nervous about pushing the limits of the Ember run loop here. If you happen to make an edit on an issue that is being synced within the bounds of the same run loop, Ember will throw either a deprecation or possibly worse an exception. |
Hrm... would we be able to compare last-modified timestamps before actually updating an issue from the sync payload? Strictly speaking, the same condition seems possible from an incoming event while the sync is happening. I'm content with completely disabling the board while syncing, but I do think it would be preferable for the sync to less intrusive. My 2¢. |
…els underlying data
…uccess message lifecycle
|
I am not sure, thats an interesting thought... Probably outside the scope of this PR though (its flash message styling)? EDIT: @cwramsey seems to like the subtle sync message better as well. |
Eh, I would rather see the change here if there is agreement that subtler is better. |
👍 |
|
@dahlbyk @cwramsey @drusellers what do you think? |
|
It does look better, but I think just setting the background to |
|
@discorick did raise a good point that simple transparency won't work when the board has been scrolled (at least until we're able to fix the header): I just pushed up a commit to try out using a semi-transparent drop shadow that matches the background: But not sure if the shadow is really necessary? I also noticed that the header has a subtle gradient from F3F3F3 to F9F9F9, which makes the non-transparent background not an exact match. I'm wondering if such a subtle gradient is worth keeping altogether? |
|
I can live with no shadow, the reason I left it is like you mentioned - the gradient on the navbar makes it look funny without any additional definition. |
|
Before we merge this, I have been thinking about thresholds over which a sync would be impractical and a "refresh" recommended toast should be sent. Does 24 hours of no board focus seem reasonable? |
|
@discorick imo, 24 hours seems like a lot. I'd set it at like 2 hours maybe. I don't have any proof as to why that's better, but a lot can happen in that timeframe and if it's not automatically caught up (like if the connection is lost after sleeping your computer or something) a sync would be good then. |
|
@cwramsey the 24 hour interval is for forced refresh, thats the point where we say "sorry you need to hit the refresh button now" |
| var flash = this.get('flashMessages.queue').find((flash)=>{ | ||
| return flash.identifier === 'sync-message'; | ||
| }); | ||
| Ember.set(flash.progress, 'status', false); |
There was a problem hiding this comment.
Is there any need to guard against flash being null here?










Syncs the boards issues after a period of inactivity (currently 1 hour)
BrowserSessionServicewhich currently tracks browser focus and blurs and events on them usingEmber.Evented, this is injected into all controllers and componentsBoardSyncServicewhich currently can sync the boards issuesTODO:
https://huboard.com/huboard/huboard#/sync-issuesImplement failure handlers (i.e issue count >= 100)I Don't think this is going to be necessary with highly frequent syncsIf the logged in validation fails, throw unauthorized (maybe a seperate PR)Should Fix #226 & alleviate huboard/huboard#214