Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[skip] When not browser focused on a view that refreshes, don’t refresh #139

Open
wants to merge 40 commits into
base: 0.9-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
16f63a0
[skip] Set version to 0.9.0-dev (1m)
boblail Feb 18, 2017
bdacb48
[skip] Dropped features deprecated in 0.8.0 (1m)
boblail Jan 30, 2017
e34b18e
[ski] Dropped users.environments_subscribed_to (2m)
boblail Jan 30, 2017
9a7ea2d
[refactor] Replaced Redcarpet with Kramdown and extracted Slackdown (3h)
boblail Jan 31, 2017
01120d9
[skip] Dropped settings (2m)
boblail Feb 5, 2017
4752872
[skip] Dropped hstore (1m)
boblail Feb 6, 2017
997a908
[skip] Dropped legacy columns from users (1m)
boblail Feb 6, 2017
cad3575
[skip] Tweaked banner button styles (1m)
boblail Feb 8, 2017
0d7200f
[skip] Added a helper for confirming the deletion of resources (8m)
boblail Feb 8, 2017
c5fb6c4
[refactor] Renamed projects.color to projects.color_name (5m)
boblail Feb 9, 2017
aae8a8e
[skip] Extracted LDAP authentication from Houston Core (20m)
boblail Feb 9, 2017
db0218d
[skip] Bumped versions of dependencies (1m)
boblail Feb 9, 2017
4ca8189
[skip] Mounted Instance routes before module routes so that instances…
boblail Feb 13, 2017
56cce5d
[fix] Fixed checking that authorization has been granted for authoriz…
boblail Feb 13, 2017
9dbe4bb
[refactor] Tied Authorizations to users, defined Providers via extens…
boblail Feb 13, 2017
017da9a
[skip] Added props to authorizations (4m)
boblail Feb 15, 2017
29968dd
[skip] Added a short URL for requesting an authorization (1m)
boblail Feb 15, 2017
e4dc315
[skip] Added events for when an authorization is granted or revoked (4m)
boblail Feb 15, 2017
da49e90
[skip] Tied persistent triggers to users (5m)
boblail Feb 16, 2017
085e486
[fix] Fixed serializing serialized attributes (1h)
boblail Feb 17, 2017
1d2ca0e
[skip] Added the ability to unregister an observer given an event nam…
boblail Feb 17, 2017
1c8e5a1
[skip] Added the ability to stop a timer (20m)
boblail Feb 17, 2017
4ae138f
[skip] Unregistered a PersistentTrigger when it is deleted (25m)
boblail Feb 17, 2017
241f759
[skip] Used https for Oauth callback URL (1m)
boblail Feb 17, 2017
01ddd5a
[refactor] Moved secret_key_base to Houston.config (20m)
boblail Feb 18, 2017
5f6bd1a
[skip] Removed deprecated methods (1m)
boblail Feb 18, 2017
798a13a
[refactor] Extracted module houston-credentials (30m)
boblail Feb 18, 2017
43dbd20
[skip] Deleted puts (1m)
boblail Feb 19, 2017
87ced8b
[skip] Handled authorization fails (5m)
boblail Feb 19, 2017
4442beb
[skip] Corrected the label of a block of methods (1m)
boblail Feb 24, 2017
ed63cd4
[fix] Restored the followers method on projects (1m)
boblail Feb 24, 2017
278d4d5
[skip] Upgraded rufus-scheduler (5m)
boblail Feb 26, 2017
b955856
[skip] Upgraded cancan (5m)
boblail Feb 26, 2017
7ba6fc7
[skip] Updated dependencies (5m)
boblail Feb 26, 2017
b4f83d4
[skip] Fixed a deprecation notice for Rails 5.1 (1m)
boblail Feb 26, 2017
90adb6b
[skip] Optimized Projects view by eager-loading teams (1m)
boblail Feb 26, 2017
c1bd084
[refactor] Replaced `Role` model with `Follow` (20m)
boblail Feb 26, 2017
c9350ef
[skip] Deleted unused module (1m)
boblail Feb 26, 2017
a291028
[refactor] Extracted Nosync to houston-tickets (1m)
boblail Feb 26, 2017
2548473
[skip] When not browser focused on a view that refreshes, don’t refre…
lukebooth Feb 27, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 21 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
PATH
remote: .
specs:
houston-core (0.8.3)
houston-core (0.9.0.pre.dev)
activerecord-import
activerecord-pluck_in_batches (~> 0.2.0)
addressable (~> 2.3.8)
attentive (>= 0.3.6)
attentive (>= 0.3.9)
browser (~> 2.3.0)
cancan (~> 1.6.10)
cancancan (~> 1.16.0)
coffee-rails (~> 4.1.0)
concurrent-ruby (~> 1.0.2)
devise
Expand All @@ -17,8 +17,8 @@ PATH
faraday-raise-errors (~> 0.2.0)
gemoji (~> 2.1.0)
handlebars_assets (~> 0.23.0)
houston-devise_ldap_authenticatable
houston-vestal_versions
kramdown
neat-rails
nested_editor_for
nokogiri
Expand All @@ -27,14 +27,13 @@ PATH
openxml-xlsx (>= 0.2.0)
pg (~> 0.19.0)
pg_search (~> 1.0.5)
premailer (~> 1.8.6)
premailer (~> 1.10.0)
progressbar (~> 0.21.0)
rack-utf8_sanitizer (~> 1.3.1)
rails (~> 5.0.0)
redcarpet (~> 3.3.2)
rufus-scheduler (~> 3.2.0)
rufus-scheduler (~> 3.3.4)
sass-rails (~> 5.0)
strongbox (~> 0.7.2)
slackdown (>= 0.2.1)
thor
uglifier (>= 2.7.2)

Expand Down Expand Up @@ -85,12 +84,12 @@ GEM
addressable (2.3.8)
ansi (1.5.0)
arel (7.1.4)
attentive (0.3.8)
thread_safe
attentive (0.3.9)
concurrent-ruby
bcrypt (3.1.11)
browser (2.3.0)
builder (3.2.3)
cancan (1.6.10)
cancancan (1.16.0)
capybara (2.12.1)
addressable
mime-types (>= 1.16)
Expand All @@ -106,10 +105,10 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.4)
concurrent-ruby (1.0.5)
crack (0.4.3)
safe_yaml (~> 1.0.0)
css_parser (1.4.8)
css_parser (1.4.9)
addressable
devise (4.2.0)
bcrypt (~> 3.0)
Expand Down Expand Up @@ -143,16 +142,14 @@ GEM
sprockets (>= 2.0.0)
tilt (>= 1.2)
hashdiff (0.3.2)
houston-devise_ldap_authenticatable (0.7.1)
devise (>= 3.0.0)
net-ldap (~> 0.12.1)
houston-vestal_versions (2.0.1)
activerecord (>= 3, < 6)
activesupport (>= 3, < 6)
htmlentities (4.3.4)
i18n (0.8.0)
i18n (0.8.1)
json (2.0.3)
jwt (1.5.6)
kramdown (1.13.2)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
Expand All @@ -175,7 +172,6 @@ GEM
multipart-post (2.0.0)
neat-rails (0.5.0)
nested_editor_for (0.1.1)
net-ldap (0.12.1)
nio4r (1.2.1)
nokogiri (1.7.0.1)
mini_portile2 (~> 2.1.0)
Expand All @@ -200,8 +196,8 @@ GEM
activerecord (>= 3.1)
activesupport (>= 3.1)
arel
premailer (1.8.7)
css_parser (>= 1.4.5)
premailer (1.10.0)
css_parser (>= 1.4.9)
htmlentities (>= 4.0.0)
progressbar (0.21.0)
pry (0.10.4)
Expand Down Expand Up @@ -237,13 +233,13 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.0.0)
redcarpet (3.3.4)
responders (2.3.0)
railties (>= 4.2.0, < 5.1)
rr (1.2.0)
ruby-progressbar (1.8.1)
rubyzip (1.1.7)
rufus-scheduler (3.2.2)
rufus-scheduler (3.3.4)
tzinfo
safe_yaml (1.0.4)
sass (3.4.23)
sass-rails (5.0.6)
Expand All @@ -261,6 +257,8 @@ GEM
simplecov-json (0.2)
json
simplecov
slackdown (0.2.2)
kramdown (~> 1.13.2)
slop (3.6.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
Expand All @@ -269,10 +267,8 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
strongbox (0.7.2)
activerecord
thor (0.19.4)
thread_safe (0.3.5)
thread_safe (0.3.6)
tilt (2.0.6)
timecop (0.8.1)
tzinfo (1.2.2)
Expand Down
40 changes: 9 additions & 31 deletions app/assets/javascripts/houston/core/app.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -91,49 +91,27 @@ window.App =
date = new Date(date.getTime())
App.truncateDate(date)

promptForCredentialsTo: (service)->
confirmDelete: (options)->
html = """
<div class="modal hide fade">
<form class="form-horizontal" id="user_credentials_form">
<div class="modal hide">
<form class="form-horizontal" action="#{options.url}" method="POST">
<input type="hidden" name="_method" value="delete">
<input type="hidden" name="#{App.meta('csrf-param')}" value="#{App.meta('csrf-token')}">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Log in to #{service}</h3>
<h3>Delete #{options.resource}</h3>
</div>
<div class="modal-body">
<div class="control-group">
<label class="control-label" for="user_credentials_login">Login</label>
<div class="controls">
<input type="text" id="user_credentials_login">
</div>
</div>
<div class="control-group">
<label class="control-label" for="user_credentials_password">Password</label>
<div class="controls">
<input type="password" id="user_credentials_password">
</div>
</div>
#{options.message}
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Sign in</button>
<button data-dismiss="modal" class="btn btn-default">Cancel</button>
<button type="submit" class="btn btn-danger">Delete #{options.resource}</button>
</div>
</form>
</div>
"""
$modal = $(html).modal()
$modal.on 'hidden', -> $(@).remove()
$modal.on 'shown', (e)=>
$input = $modal.find('input[type="text"]:first').select()
$modal.find('button[type="submit"]').click (e)=>
e.preventDefault()
xhr = $.put '/credentials',
service: service
login: $modal.find('#user_credentials_login').val()
password: $modal.find('#user_credentials_password').val()
xhr.success ->
$modal.modal('hide')
xhr.error (response)->
$form = $('#user_credentials_form')
$form.find('.alert').remove()
Errors.fromResponse(response).renderToAlert().prependTo $form

window.Houston = window.App
13 changes: 1 addition & 12 deletions app/assets/javascripts/houston/core/errors.coffee
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
class window.Errors

constructor: (response)->
if response.status == 401
if response.getResponseHeader('X-Credentials') == 'Missing Credentials'
@missingCredentials = true
else if response.getResponseHeader('X-Credentials') == 'Invalid Credentials'
@invalidCredentials = true
else if response.getResponseHeader('X-Credentials') == 'Oauth'
@oauthLocation = response.getResponseHeader('Location')
else
message = response.responseText ? "You are not authorized"
@errors = {base: [message]}
else
@errors = JSON.parse(response.responseText)
@errors = JSON.parse(response.responseText)

renderToAlert: ->
sentences = []
Expand Down
13 changes: 10 additions & 3 deletions app/assets/javascripts/houston/dashboard/refresher.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class @Refresher
@innerRadius = @width / 3
@outerRadius = @width / 2
@_container = 'body'
@$window = $(window)

rate: (@_rate)-> @
container: (@_container)-> @
Expand Down Expand Up @@ -46,7 +47,9 @@ class @Refresher
.attr('d', @arc)

@tween = _.bind(@arcTween, @)
setInterval(_.bind(@tick, @), @_rate)
@tickInterval = setInterval(_.bind(@tick, @), @_rate)
@$window.on "blur", => clearInterval(@tickInterval)
@$window.on "focus", => @restart()
@start()

start: ->
Expand All @@ -60,11 +63,15 @@ class @Refresher
.ease('linear')
.call(@tween, (@_rate / @_interval) * τ)

restart: ->
@_callback() if @_callback
@tickInterval = setInterval(_.bind(@tick, @), @_rate)
@start()

tick: ->
time = +(new Date())
if time > @_endTime
@_callback() if @_callback
@start()
@restart()
else
percent = (time + @_rate - @_startTime) / @_interval
@foreground.transition()
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/houston/application/navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ $current-project-active-bg: #222;
font-size: 2em;


a.btn { color: white ;}
a.btn { font-weight: normal; }

.buttons { float: right; }

Expand Down
15 changes: 0 additions & 15 deletions app/concerns/historical_weekly_stats.rb

This file was deleted.

21 changes: 0 additions & 21 deletions app/concerns/nosync.rb

This file was deleted.

12 changes: 0 additions & 12 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ class ApplicationController < ActionController::Base
end
end

rescue_from UserCredentials::MissingCredentials do
head 401, "X-Credentials" => "Missing Credentials"
end

rescue_from UserCredentials::InvalidCredentials do
head 401, "X-Credentials" => "Invalid Credentials"
end

rescue_from UserCredentials::InsufficientPermissions do |exception|
render plain: exception.message, status: 401
end

rescue_from ActiveRecord::RecordNotFound do
render file: Houston.root.join("public/404"), layout: false
end
Expand Down
Loading