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

make ganglia optional #67

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
8 changes: 6 additions & 2 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@

# more details see ood_appkit lib/ood_appkit/configuration.rb
begin
CLUSTERS = OodCore::Clusters.new(OodCore::Clusters.load_file(ENV['OOD_CLUSTERS'] || '/etc/ood/config/clusters.d').select(&:job_allow?)
GANGLIA_CLUSTERS = OodCore::Clusters.new(OodCore::Clusters.load_file(ENV['OOD_CLUSTERS'] || '/etc/ood/config/clusters.d').select(&:job_allow?)
.select { |c| c.custom_config[:moab] }
.select { |c| c.custom_config[:ganglia] }
.reject { |c| c.metadata.hidden }
)
CLUSTERS = OodCore::Clusters.new(OodCore::Clusters.load_file(ENV['OOD_CLUSTERS'] || '/etc/ood/config/clusters.d').select(&:job_allow?)
.select { |c| c.custom_config[:moab] }
.reject { |c| c.metadata.hidden }
)
rescue OodCore::ConfigurationNotFound
CLUSTERS = OodCore::Clusters.new([])
end
Expand Down Expand Up @@ -42,7 +46,7 @@ def graph_types
@id=params[:id].to_sym
graph_time.keys.include?(params[:time].to_sym) ? @time=params[:time].to_sym : @time=:hour
graph_types.keys.include?(params[:type].to_sym) ? @type=params[:type].to_sym : @type=:report_moab_nodes
cluster = CLUSTERS[@id]
cluster = GANGLIA_CLUSTERS[@id]
if cluster.nil?
raise Sinatra::NotFound
else
Expand Down
7 changes: 7 additions & 0 deletions views/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
<!-- node status on /clusters page -->
<% @clusters.each_with_index do |cluster, index | %>
<div class="<%= 'col-sm-offset-3' if index == @clusters.count - 1 && @clusters.count.odd? %> col-sm-6 col-xs-12">
<% if GANGLIA_CLUSTERS[cluster.cluster_id].nil? %>
<div class="panel panel-default bs-callout bs-callout-info text-center panel-unclickable">
<h4><strong><%= cluster.cluster_title %> Cluster Status</strong></h4>
<%= erb :_node_status, :locals => { :showqer => cluster } %>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create a partial with a local "clickable" which is true or false - that's the only thing that changes between the two. Make sure whitespace is good also.

<% else %>
<a href = "<%= url("/clusters/#{cluster.cluster_id}/hour/report_moab_nodes") %>">
<div class="panel panel-default bs-callout bs-callout-info text-center panel-clickable">
<h4><strong><%= cluster.cluster_title %> Cluster Status</strong></h4>
<%= erb :_node_status, :locals => { :showqer => cluster } %>
</div>
</a>
<% end %>
</div>
<% end %>
</div>
Expand Down
9 changes: 6 additions & 3 deletions views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/* Internet Explorer 5.5+ */
}
/* Base styles */
div a .bs-callout {
div .bs-callout {
margin: 20px 0;
padding: 15px 30px 15px 15px;
border-left: 5px solid #eee;
Expand All @@ -39,7 +39,7 @@
.bs-callout code, .bs-callout .highlight {
background-color: #fff;
}
div a .bs-callout-info {
div .bs-callout-info {
background-color: #f0f7fd;
border-color: #d0e3f0;
}
Expand All @@ -54,6 +54,9 @@
background-color: #6c75f0;
border-color: #6c75f0;
}
.panel-unclickable {
cursor: default;
}
a:-webkit-any-link {
text-decoration: none !important;
}
Expand Down Expand Up @@ -107,7 +110,7 @@
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-responsive-collapse">
<ul class="nav navbar-nav">
<% CLUSTERS.each do |cluster| %>
<% GANGLIA_CLUSTERS.each do |cluster| %>
<li class="<%= 'active' if @ganglia && @ganglia.server_id == cluster.id %>">
<a href="<%= url("/clusters/#{cluster.id}/hour/report_moab_nodes") %>"><span><i class="fa fa-chart-area"></i></span> <%=cluster.metadata.title %> Cluster</a>
</li>
Expand Down