diff --git a/Gemfile b/Gemfile
index 933772f00..a1c2c94e0 100644
--- a/Gemfile
+++ b/Gemfile
@@ -71,6 +71,10 @@ gem 'redis-search'
gem 'syslog-logger'
gem "recaptcha", :require => "recaptcha/rails"
+gem 'puma'
+gem 'request-log-analyzer'
+gem 'usagewatch'
+
# Gems used only for assets and not required
# in production environments by default.
group :assets do
diff --git a/app/controllers/admin/dashboards_controller.rb b/app/controllers/admin/dashboards_controller.rb
index c0acaf8db..e7fd745e8 100644
--- a/app/controllers/admin/dashboards_controller.rb
+++ b/app/controllers/admin/dashboards_controller.rb
@@ -1,3 +1,6 @@
+require 'fileutils'
+require 'usagewatch'
+
class Admin::DashboardsController < OrbitBackendController
open_for_visitor
@@ -8,7 +11,7 @@ class Admin::DashboardsController < OrbitBackendController
check_backend_openness
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'page_context', 'web_link')
@recent_updated = get_recently_updated('bulletin', 'page_context', 'web_link')
- @most_visited = get_most_visited('bulletin', 'page_context')
+ @most_visited = get_most_visited('bulletin', 'page_context','page')
end
def reload_all_content
@@ -19,7 +22,7 @@ class Admin::DashboardsController < OrbitBackendController
end
def reload_most_visited
- @most_visited = get_most_visited('bulletin', 'page_context')
+ @most_visited = get_most_visited('bulletin', 'page_context','page')
respond_to do |format|
format.js { render 'reload', locals: {div_id: 'most_visited'} }
end
@@ -32,6 +35,31 @@ class Admin::DashboardsController < OrbitBackendController
end
end
+ def get_cpu_usage
+ @usw = Usagewatch
+ render :js => @usw.uw_cpuused.to_s
+ end
+
+ def get_mem_usage
+ @usw = Usagewatch
+ render :js => @usw.uw_memused.to_s
+ end
+
+ def get_disk_usage
+ @usw = Usagewatch
+ render :json => @usw.uw_diskused_perc.to_s
+ end
+
+ def get_month_traffic
+ result = []
+ (0..31).each do |i|
+ the_day = i.day.ago
+ visits = Impression.where( created_at: {'$gte' => the_day.beginning_of_day, '$lte' => the_day.end_of_day}).count
+ result.push({the_day.strftime("%b-%d")=>visits})
+ end
+ render :js => result.to_json
+ end
+
protected
def get_module_app_count(*args)
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index 430bc4084..0accef0b4 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -8,7 +8,8 @@ class PagesController < ApplicationController
@item = Page.find_by_name('home')
if @item
- delayed_impressionist(@item)
+ # delayed_impressionist(@item)
+ impressionist(@item)
if params[:edit]
if request.referer && request.referer.ends_with?("admin/items")
redirect_to admin_page_url(@item)
@@ -29,7 +30,8 @@ class PagesController < ApplicationController
@item = Item.first(:conditions => {:path => params[:page_name]})
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
- delayed_impressionist(@item)
+ # delayed_impressionist(@item)
+ impressionist(@item)
case @item.class.to_s
when 'Page'
if params[:clicked_field_name]
diff --git a/app/views/admin/dashboards/_server_loading.erb b/app/views/admin/dashboards/_server_loading.erb
new file mode 100644
index 000000000..6ff3fa003
--- /dev/null
+++ b/app/views/admin/dashboards/_server_loading.erb
@@ -0,0 +1,400 @@
+
+
+
+
+ Server Loading
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/admin/dashboards/_traffic_loading.erb b/app/views/admin/dashboards/_traffic_loading.erb
new file mode 100644
index 000000000..0dee91c68
--- /dev/null
+++ b/app/views/admin/dashboards/_traffic_loading.erb
@@ -0,0 +1,62 @@
+
+
+
+
+ Traffic Loading
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/admin/dashboards/index.html.erb b/app/views/admin/dashboards/index.html.erb
index 236f9c70d..1d7007916 100644
--- a/app/views/admin/dashboards/index.html.erb
+++ b/app/views/admin/dashboards/index.html.erb
@@ -1,5 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+ <%= render 'server_loading' %>
+
+
+
+
+ <%= render 'traffic' %>
+
+
+
+
+
+
+ <%= render 'traffic_loading' %>
+
+
+
+
@@ -14,11 +42,6 @@
-
-
- <%= render 'traffic' %>
-
-
<%= render 'most_visited' %>
@@ -26,4 +49,4 @@
-
+
\ No newline at end of file
diff --git a/config/mongoid.yml b/config/mongoid.yml
index 49a7167ce..1b3b0585d 100644
--- a/config/mongoid.yml
+++ b/config/mongoid.yml
@@ -8,7 +8,7 @@ defaults: &defaults
development:
<<: *defaults
- database: test_site
+ database: test_site_new
@@ -24,4 +24,4 @@ production:
# password: <%= ENV['MONGOID_PASSWORD'] %>
# database: <%= ENV['MONGOID_DATABASE'] %>
<<: *defaults
- database: test_site
+ database: test_site_new
diff --git a/config/routes.rb b/config/routes.rb
index 6d1e40c12..f15898c7a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -67,6 +67,10 @@ Orbit::Application.routes.draw do
get 'reload_all_content'
get 'reload_most_visited'
get 'reload_recent_update'
+ get 'get_cpu_usage'
+ get 'get_mem_usage'
+ get 'get_disk_usage'
+ get 'get_month_traffic'
end
end
resources :designs do
diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
index 07ba9fa21..407a5e44f 100644
--- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
+++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
@@ -53,7 +53,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
else
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
end
- delayed_impressionist(@tag) if @tag
+ # delayed_impressionist(@tag) if @tag
end
end
@@ -66,7 +66,8 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
@bulletin = Bulletin.all.can_display.where(_id: params[:id]).first
if @bulletin and !@bulletin.disable? and !@bulletin.is_rejected
if @bulletin.enabled_for_lang(I18n.locale.to_s)
- delayed_impressionist(@bulletin)
+ # delayed_impressionist(@bulletin)
+ impressionist(@bulletin)
else
render :text => "