Skip to content

Commit

Permalink
Merge simplified UI, fixes sidekiq#481
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Nov 2, 2012
2 parents 858e7ef + 1767c9c commit f19167b
Show file tree
Hide file tree
Showing 25 changed files with 587 additions and 19,531 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
HEAD
-----------

- Remove asset pipeline from Web UI for much faster, simpler runtime. [#499, #490, #481]
- Add -g option so the procline better identifies a Sidekiq process, defaults to File.basename(Rails.root). [#486]

sidekiq 2.5.1 myapp [0 of 25 busy]
Expand Down
4 changes: 0 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ gemspec

gem 'celluloid', "~> 0.12.0"
gem 'slim'
gem 'sass'
gem 'rails', '3.2.8'
gem 'sqlite3', :platform => :mri

group :test do
Expand All @@ -13,7 +11,5 @@ end

group :development do
gem 'pry', :platform => :mri
gem 'sprockets-sass'
gem 'compass'
gem 'shotgun'
end
61 changes: 2 additions & 59 deletions lib/sidekiq/web.rb
Original file line number Diff line number Diff line change
@@ -1,75 +1,17 @@
require 'sinatra/base'
require 'slim'
require 'sprockets'
require 'sprockets-sass'
require 'sass'
require 'compass'
require 'sidekiq/paginator'

module Sidekiq
class SprocketsMiddleware
def initialize(app, options={})
@app = app
@root = options[:root]
path = options[:path] || 'assets'
@matcher = /^\/#{path}\/*/
@environment = ::Sprockets::Environment.new(@root)
@environment.append_path 'assets/javascripts'
@environment.append_path 'assets/javascripts/vendor'
@environment.append_path 'assets/stylesheets'
@environment.append_path 'assets/stylesheets/vendor'
@environment.append_path 'assets/images'

Compass.configuration do |config|

config.project_path = "#{@root}/assets"

config.images_dir = 'images'
config.sass_dir = 'stylesheets'
config.css_dir = 'stylesheets'
config.javascripts_dir = 'javascripts'
config.fonts_dir = 'stylesheets/fonts'

config.http_images_path = '/assets'
config.http_generated_images_path = '/assets'
config.http_javascripts_path = '/assets'
config.http_stylesheets_path = '/assets'

# You can select your preferred output style here (can be overridden via the command line):
output_style = :compressed

# To enable relative paths to assets via compass helper functions. Uncomment:
relative_assets = true

# To disable debugging comments that display the original location of your selectors. Uncomment:
line_comments = false
end


end

def call(env)
# Solve the problem of people requesting /sidekiq when they need to request /sidekiq/ so
# that relative links in templates resolve correctly.
return [301, { 'Location' => "#{env['SCRIPT_NAME']}/", 'Content-Type' => 'text/html' }, ['redirecting']] if env['SCRIPT_NAME'] == env['REQUEST_PATH']

return @app.call(env) unless @matcher =~ env["PATH_INFO"]
env['PATH_INFO'].sub!(@matcher,'')
@environment.call(env)
end
end

class Web < Sinatra::Base
include Sidekiq::Paginator

dir = File.expand_path(File.dirname(__FILE__) + "/../../web")
set :public_folder, "#{dir}/assets"
set :views, "#{dir}/views"
set :root, "#{dir}/public"
set :slim, :pretty => true

use SprocketsMiddleware, :root => dir


helpers do

def reset_worker_list
Expand Down Expand Up @@ -295,3 +237,4 @@ def self.tabs
end

end

3 changes: 0 additions & 3 deletions sidekiq.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ Gem::Specification.new do |gem|
gem.add_dependency 'connection_pool', '~> 0.9.2'
gem.add_dependency 'celluloid', '~> 0.12.0'
gem.add_dependency 'multi_json', '~> 1'
gem.add_dependency 'sprockets-sass'
gem.add_dependency 'sass', '~> 3.2'
gem.add_dependency 'compass'
gem.add_development_dependency 'minitest', '~> 3'
gem.add_development_dependency 'sinatra'
gem.add_development_dependency 'slim'
Expand Down
17 changes: 6 additions & 11 deletions web/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
//= require vendor/jquery
//= require vendor/jquery.timeago
//= require bootstrap
//= require_tree .

$(function() {
$.timeago.settings.allowFuture = true;
$.timeago.settings.refreshMillis = 0;
Expand All @@ -25,12 +20,12 @@ $(function() {

$('a[name=poll]').data('polling', false);

pollStatus = $('.poll-status')
var pollStatus = $('.poll-status');

pollStatusText = pollStatus.find('.text')
pollStatusBadge = pollStatus.find('.badge')
var pollStatusText = pollStatus.find('.text');
var pollStatusBadge = pollStatus.find('.badge');
pollStatusBadge.hide();
pollStatusMarkup = pollStatus.html();
var pollStatusMarkup = pollStatus.html();

$('a[name=poll]').on('click', function(e) {
e.preventDefault();
Expand Down Expand Up @@ -75,9 +70,9 @@ $(function() {
$('time').timeago();
});
var currentTime = new Date();
$('.poll-status .text').text('Last polled: ')
$('.poll-status .text').text('Last polled: ');
$('.poll-status .time').show().text(currentTime.getHours() + ':' + pad(currentTime.getMinutes()) + ':' + pad(currentTime.getSeconds()));
}
};
});

$(function() {
Expand Down
2,032 changes: 6 additions & 2,026 deletions web/assets/javascripts/vendor/bootstrap.js

Large diffs are not rendered by default.

9,267 changes: 2 additions & 9,265 deletions web/assets/javascripts/vendor/jquery.js

Large diffs are not rendered by default.

548 changes: 544 additions & 4 deletions web/assets/stylesheets/application.css

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions web/assets/stylesheets/bootstrap.css

Large diffs are not rendered by default.

30 changes: 0 additions & 30 deletions web/assets/stylesheets/layout.css

This file was deleted.

116 changes: 0 additions & 116 deletions web/assets/stylesheets/partials/_base.scss

This file was deleted.

46 changes: 0 additions & 46 deletions web/assets/stylesheets/partials/_colors.scss

This file was deleted.

3 changes: 0 additions & 3 deletions web/assets/stylesheets/partials/_fonts.scss

This file was deleted.

Loading

0 comments on commit f19167b

Please sign in to comment.