Update for dashboard and Fix site.rake,new_site.rake for missing "menu_enabled_for"
This commit is contained in:
parent
9d7af2ccac
commit
7401a6ae59
|
@ -5,42 +5,62 @@
|
||||||
<%= t(:server_usage) %>
|
<%= t(:server_usage) %>
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-content" style='overflow: hidden;'>
|
<div class="box-content" style='overflow: hidden; text-align:center;'>
|
||||||
<span id="cpu_usage" style="display:inline-block;margin: 0 auto"></span>
|
<div id="cpu_usage" class="pull-left" style="width:200px; height:160px; display: inline-block;"></div>
|
||||||
<span id="mem_usage" style="display:inline-block;margin: 0 auto"></span>
|
<div id="mem_usage" style="width:200px; height:160px; display: inline-block;"></div>
|
||||||
<span id="disk_usage" style="display:inline-block;margin: 0 auto"></span>
|
<div id="disk_usage" class="pull-right" style="width:200px; height:160px; display: inline-block;"></div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
google.load('visualization', '1', {packages:['gauge']});
|
var Gages = { 'CPU':{
|
||||||
|
'JustGage': null,
|
||||||
var UsageTpye = {'CPU':{'fn':'get_cpu_usage','chart':null,'id':'cpu_usage','interval':2000},
|
'container': 'cpu_usage',
|
||||||
'Mem':{'fn':'get_mem_usage','chart':null,'id':'mem_usage','interval':5000},
|
'title': 'CPU Usage',
|
||||||
'Disk':{'fn':'get_disk_usage','chart':null,'id':'disk_usage','interval':30000}};
|
'fn': 'get_cpu_usage',
|
||||||
|
'update_interval': 2000
|
||||||
|
},
|
||||||
|
'Mem':{
|
||||||
|
'JustGage': null,
|
||||||
|
'container': 'mem_usage',
|
||||||
|
'title': 'Memory Usage',
|
||||||
|
'fn': 'get_mem_usage',
|
||||||
|
'update_interval': 10000
|
||||||
|
},
|
||||||
|
'Disk':{
|
||||||
|
'JustGage': null,
|
||||||
|
'container': 'disk_usage',
|
||||||
|
'title': 'Disk Usage',
|
||||||
|
'fn': 'get_disk_usage',
|
||||||
|
'update_interval': 30000
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
$.each(UsageTpye,function(type,option){
|
$.each(Gages,function(id,Gage){
|
||||||
option['chart'] = new google.visualization.Gauge(document.getElementById(option['id']));
|
Gage['JustGage'] = new JustGage({
|
||||||
update_usage(type,option);
|
id: Gage['container'],
|
||||||
|
value: 0,
|
||||||
|
min: 0,
|
||||||
|
max: 100,
|
||||||
|
title: Gage['title'],
|
||||||
|
shadowVerticalOffset: 10,
|
||||||
|
levelColors: ['#39D824','#FFC33F','#F51F1F'],
|
||||||
|
titleFontColor: '#666',
|
||||||
|
valueFontColor: '#666',
|
||||||
|
labelFontColor: '#666',
|
||||||
|
label: '%',
|
||||||
|
refreshAnimationTime: 200
|
||||||
|
});
|
||||||
|
|
||||||
setInterval(function() { update_usage(type,option); }, option['interval']);
|
update_usage(Gage);
|
||||||
|
|
||||||
|
setInterval(function() { update_usage(Gage); }, Gage['update_interval']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function update_usage(type,option){
|
function update_usage(Gage){
|
||||||
$.get('/admin/dashboards/'+option['fn'],function(usage){
|
$.get('/admin/dashboards/'+Gage['fn'],function(usage){
|
||||||
var data = google.visualization.arrayToDataTable([
|
Gage['JustGage'].refresh(parseInt(usage));
|
||||||
['Label', 'Value'],
|
});
|
||||||
[type, parseInt(usage)]
|
|
||||||
]);
|
|
||||||
|
|
||||||
var options = {
|
|
||||||
width: 400, height: 180,
|
|
||||||
redFrom: 80, redTo: 100,
|
|
||||||
yellowFrom:60, yellowTo: 80,
|
|
||||||
minorTicks: 5
|
|
||||||
};
|
|
||||||
|
|
||||||
option['chart'].draw(data, options);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
|
@ -16,19 +16,3 @@
|
||||||
} %>
|
} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
|
||||||
renderLineChart = function (element, series, opts) {
|
|
||||||
waitForLoaded(function () {
|
|
||||||
var options = jsOptions(series, opts);
|
|
||||||
var data = createDataTable(series, "datetime");
|
|
||||||
var formatter = new google.visualization.DateFormat({
|
|
||||||
pattern: options.pattern
|
|
||||||
});
|
|
||||||
formatter.format(data, 0);
|
|
||||||
var chart = new google.visualization.LineChart(element);
|
|
||||||
resize(function () {
|
|
||||||
chart.draw(data, options);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
</script>
|
|
|
@ -1,15 +1,18 @@
|
||||||
<%= javascript_include_tag "//www.google.com/jsapi", "chartkick" %>
|
<%= javascript_include_tag "//www.google.com/jsapi", "chartkick" %>
|
||||||
|
<%= javascript_include_tag "/static/justgage.1.0.1.min.js" %>
|
||||||
|
<%= javascript_include_tag "/static/raphael.2.1.0.min.js" %>
|
||||||
|
|
||||||
<section id="main-wrap">
|
<section id="main-wrap">
|
||||||
<div class="wrap-inner initial">
|
<div class="wrap-inner initial">
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<% if is_admin? %>
|
<% if is_admin? %>
|
||||||
<div class="box span6">
|
<div class="box span7">
|
||||||
<div id='server_loading'>
|
<div id='server_loading'>
|
||||||
<%= render 'server_loading' %>
|
<%= render 'server_loading' %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="box span6">
|
<div class="box span5">
|
||||||
<div id='traffic'>
|
<div id='traffic'>
|
||||||
<%= render 'traffic' %>
|
<%= render 'traffic' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -93,7 +93,7 @@ def unzip_design(file, zip_name)
|
||||||
site.design = design
|
site.design = design
|
||||||
site.save
|
site.save
|
||||||
theme = design.themes.first
|
theme = design.themes.first
|
||||||
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => theme.id, :menu_enabled_for => [] )
|
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => nil, :menu_enabled_for => {"zh_tw"=>"true", "en"=>"true"} )
|
||||||
|
|
||||||
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
|
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
|
||||||
home.save
|
home.save
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace :site do
|
||||||
site.design = design
|
site.design = design
|
||||||
site.save
|
site.save
|
||||||
theme = design.themes.first
|
theme = design.themes.first
|
||||||
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => theme.id, :menu_enabled_for => [] )
|
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => nil, :menu_enabled_for => {"zh_tw"=>"true", "en"=>"true"} )
|
||||||
|
|
||||||
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
|
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
|
||||||
home.save
|
home.save
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue