Skip to content

Commit

Permalink
Split from development branch
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jun 6, 2014
1 parent e96ad91 commit 2387ca8
Show file tree
Hide file tree
Showing 1,996 changed files with 382,097 additions and 9 deletions.
60 changes: 60 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

gem "bson_ext"
# gem 'mongoid', git: 'https://github.com/mongoid/mongoid.git'
gem 'mongoid', github: 'mongoid/mongoid'
gem "mongoid_rails_migrations"
# gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
gem "therubyracer"
# gem "less-rails"
gem "responders"
#gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git'
gem 'protected_attributes'
gem 'rabl'
gem 'seer'
gem 'cancan'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
gem 'bootstrap-sass', '~> 3.0.3.0'
gem "font-awesome-sass", "~> 4.0.2"


gem "highcharts-rails", "~> 3.0.0"
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 1.2'

group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]
169 changes: 169 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
GIT
remote: git://github.com/mongoid/mongoid.git
revision: 9c0fe7f78d667b275da530c5417271a03c47e407
specs:
mongoid (4.0.0.rc1)
activemodel (~> 4.0)
moped (~> 2.0.0.rc1)
origin (~> 2.1)
tzinfo (>= 0.3.37)

GEM
remote: https://rubygems.org/
specs:
actionmailer (4.0.0)
actionpack (= 4.0.0)
mail (~> 2.5.3)
actionpack (4.0.0)
activesupport (= 4.0.0)
builder (~> 3.1.0)
erubis (~> 2.7.0)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
activemodel (4.0.0)
activesupport (= 4.0.0)
builder (~> 3.1.0)
activerecord (4.0.0)
activemodel (= 4.0.0)
activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.0)
arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.0)
i18n (~> 0.6, >= 0.6.4)
minitest (~> 4.2)
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
arel (4.0.2)
bcrypt-ruby (3.0.1)
bootstrap-sass (3.0.3.0)
sass (~> 3.2)
bson (2.3.0)
bson_ext (1.5.1)
builder (3.1.4)
cancan (1.6.10)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.7.0)
connection_pool (2.0.0)
erubis (2.7.0)
execjs (2.2.0)
font-awesome-sass (4.0.3.2)
sass (~> 3.2)
highcharts-rails (3.0.10)
railties (>= 3.1)
hike (1.2.3)
i18n (0.6.9)
jquery-rails (3.1.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
libv8 (3.16.14.3)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
minitest (4.7.5)
mongoid_rails_migrations (1.0.1)
activesupport (>= 3.2.0)
bundler (>= 1.0.0)
rails (>= 3.2.0)
railties (>= 3.2.0)
moped (2.0.0.rc1)
bson (~> 2.2)
connection_pool (~> 2.0)
optionable (~> 0.2.0)
multi_json (1.10.1)
optionable (0.2.0)
origin (2.1.1)
polyglot (0.3.5)
protected_attributes (1.0.3)
activemodel (>= 4.0.0, < 5.0)
rabl (0.10.1)
activesupport (>= 2.3.14)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.0.0)
actionmailer (= 4.0.0)
actionpack (= 4.0.0)
activerecord (= 4.0.0)
activesupport (= 4.0.0)
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.0)
sprockets-rails (~> 2.0.0)
railties (4.0.0)
actionpack (= 4.0.0)
activesupport (= 4.0.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.3.2)
rdoc (4.1.1)
json (~> 1.4)
ref (1.0.5)
responders (1.1.0)
railties (>= 3.2, < 5)
sass (3.2.19)
sass-rails (4.0.3)
railties (>= 4.0.0, < 5.0)
sass (~> 3.2.0)
sprockets (~> 2.8, <= 2.11.0)
sprockets-rails (~> 2.0)
sdoc (0.4.0)
json (~> 1.8)
rdoc (~> 4.0, < 5.0)
seer (0.10.0)
sprockets (2.11.0)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.0.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
therubyracer (0.12.1)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbolinks (2.2.2)
coffee-rails
tzinfo (0.3.39)
uglifier (2.5.0)
execjs (>= 0.3.0)
json (>= 1.8.0)

PLATFORMS
ruby

DEPENDENCIES
bcrypt-ruby (~> 3.0.0)
bootstrap-sass (~> 3.0.3.0)
bson_ext
cancan
coffee-rails (~> 4.0.0)
font-awesome-sass (~> 4.0.2)
highcharts-rails (~> 3.0.0)
jquery-rails
mongoid!
mongoid_rails_migrations
protected_attributes
rabl
rails (= 4.0.0)
responders
sass-rails (~> 4.0.0)
sdoc
seer
therubyracer
turbolinks
uglifier (>= 1.3.0)
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,18 @@ The following software should be installed:

2. Install required Ruby gems

`cd zfsstats-server && bundle install --deployment`
`cd zfsstats-server && bundle install`

3. Review production database configuration

`nano config/mongoid.yml`

4. Seed the database

`RAILS_ENV=production rake db:seed`
`rake db:seed`

5. Install a webserver to server static content. Best way to do this is by installing Passenger
5. Install a webserver to `server` static content. Best way to do this is by installing Passenger

Install prerequisites

`apt-get install libcurl4-openssl-dev apache2-mpm-worker apache2-threaded-dev libapr1-dev libaprutil1-dev`

Start Passenger installation

`sudo gem install passenger && sudo passenger-install-apache2-module`

Then, follow the instructions shown.
Expand Down
6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)

ZfsstatsRails::Application.load_tasks
Binary file added app/.DS_Store
Binary file not shown.
Binary file added app/assets/.DS_Store
Binary file not shown.
Empty file added app/assets/images/.keep
Empty file.
Binary file added app/assets/javascripts/.DS_Store
Binary file not shown.
20 changes: 20 additions & 0 deletions app/assets/javascripts/app.js.coffee.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#= require_self
#= require_tree ./services
#= require_tree ./controllers
#= require_tree ./filters

@Zfsstats = angular.module('Zfsstats', ['Service', 'ui.bootstrap', 'ngRoute', 'ngAnimate'])

Zfsstats.config(['$routeProvider', '$locationProvider', ($routeProvider, $locationProvider) ->
$locationProvider.html5Mode(true)
$routeProvider
.when('/dashboard', { templateUrl: '<%= asset_path "dashboard/index.html" %>', controller: 'DashboardController' } )
.when('/devices/:deviceId', { templateUrl: "<%= asset_path 'devices/show.html' %>", controller: 'DeviceCtrl' } )
.when('/servers/:serverId', { templateUrl: "<%= asset_path 'servers/show.html' %>", controller: 'ServerCtrl' } )
.when('/servers/:serverId/jobs', { templateUrl: "<%= asset_path 'servers/jobs/index.html' %>", controller: 'ServerJobsController' } )
.otherwise({ redirectTo: '/dashboard' })
])

$(document).on('ready page:load', ->
angular.bootstrap(document, ['Zfsstats'])
)
26 changes: 26 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require angular
//= require angular-animate
//= require angular-resource
//= require angular-route
//= require highstock
//= require ui-bootstrap
//= require bootstrap/transition
//= require bootstrap/modal
//= require bootstrap/tooltip
//= require bootstrap/popover
//= require app
3 changes: 3 additions & 0 deletions app/assets/javascripts/bootstrap.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jQuery ->
$("a[rel~=popover], .has-popover").popover()
$("a[rel~=tooltip], .has-tooltip").tooltip()
53 changes: 53 additions & 0 deletions app/assets/javascripts/controllers/dashboardController.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@DashboardController = ($scope, $routeParams, $timeout, Device, User, Server, Job, JobReport, Measurement) ->
$scope.devicesUp = 0
$scope.userId = userId
Device.query type: 'zpool', (devices) ->
angular.forEach devices, (device, deviceIndex) ->
if device.state == 'ONLINE'
$scope.devicesUp += 1
$scope.devices = devices

User.query (users) ->
$scope.users = users

Server.query limit: 4, order: 'desc', order_by: 'status', (servers) ->
$scope.servers = servers

yesterday = new Date()
yesterday.setDate yesterday.getDate() - 1
JobReport.query start: yesterday.toISOString(), status: 1, (jobReports) ->
$scope.jobReportAlert24H = jobReports.length

yesterday.setDate yesterday.getDate() - 6
JobReport.query start: yesterday.toISOString(), status: 1, (jobReports) ->
$scope.jobReportAlert7D = jobReports.length

lastHour = new Date()
lastHour.setHours(lastHour.getHours() - 1)

loadSummary = ->
randomMeasurementValue = 0
measurementNames = ['bytesRead', 'bytesWrite', 'bytesReadL2arc', 'bytesWriteL2arc']
if $scope.randomMeasurementIndex
$scope.randomMeasurementIndex++
$scope.randomMeasurementIndex = $scope.randomMeasurementIndex % measurementNames.length
else
$scope.randomMeasurementIndex = Math.floor(Math.random() * measurementNames.length)
Measurement.query name: measurementNames[$scope.randomMeasurementIndex], (measurements) ->
angular.forEach measurements, (measurement, measurementIndex) ->
$scope.randomMeasurementName = measurement.name
Measurement.get measurementId: measurement.id, start: lastHour.toISOString(), (measurementData) ->
if measurement.is_cumulative
randomMeasurementValue += (measurementData.data[measurementData.data.length-1][1] - measurementData.data[0][1])
else
angular.forEach measurementData.data, (data, dataIndex) ->
randomMeasurementValue += data[1]
$scope.randomMeasurementValue = randomMeasurementValue
$timeout(loadSummary, 8000)
loadSummary()

$scope.gotoServer = (serverId) ->
window.location = '/servers/' + serverId

$scope.gotoUser = (userId) ->
window.location = '/users/' + userId + '/edit'
Loading

0 comments on commit 2387ca8

Please sign in to comment.