Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikif70 committed Jan 29, 2015
1 parent 9e7417f commit e9f6401
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 34 deletions.
29 changes: 0 additions & 29 deletions client/lib/utils.js

This file was deleted.

8 changes: 3 additions & 5 deletions client/view/xymonfe.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<template name="xymonfe">
{{#with Slides}}
<div class="navbar-wrapper">
<div class="container">

Expand All @@ -8,7 +7,7 @@
<div id="navbar" class="navbar-collapse collapse">
<div class="centered">
<ul class="nav nav-pills nav-serv">
{{#each this.services}}
{{#each Slide}}
<li role="presentation" id="pill_{{name}}" class="{{class}}"><a style="color: {{color}};">{{Name}}</a></li>
{{/each}}
</ul>
Expand All @@ -24,12 +23,12 @@
<div id="xymonCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
{{#each this.services}}
{{#each Slide}}
<li data-target="#xymonCarousel" data-slide-to="{{id}}" class="{{class}}" id="slide_{{name}}"></li>
{{/each}}
</ol>
<div class="carousel-inner" role="listbox">
{{#each this.services}}
{{#each Slide}}
<div class="item {{class}}" id="inner_{{name}}">
<div class="container">
<div class="carousel-caption">
Expand All @@ -46,7 +45,6 @@
{{/each}}
</div>
</div>
{{/with}}
</template>

<template name="box">
Expand Down
36 changes: 36 additions & 0 deletions client/view/xymonfe.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,43 @@ var interval = Meteor.setInterval(function () {
// console.log("New Time: ", now.get());
}, 60000);

getServices = function() {
var servs = Services.find().fetch();

if (servs.length <= 0) {
return null;
}

var ind = 0;
servs.forEach(function(s) {
s['id'] = ind;
if (ind === 0) {
s['class'] = "active";
} else {
s['class'] = "";
}
s['Name'] = s['name'].charAt(0).toUpperCase() + s['name'].slice(1);
if (Tests.findOne({ service: s['name'], status: "red"}) !== undefined) {
s['color'] = "red";
} else if ( Tests.findOne({ service: s['name'], status: "yellow"}) !== undefined ) {
s['color'] = "yellow";
} else {
s['color'] = "green";
}

ind++;
});

return servs;
}

Template.xymonfe.destroyed = function() {
Meteor.clearInterval(interval);
Meteor.clearInterval(rotate);
};

Template.xymonfe.rendered = function() {

$('#xymonCarousel').carousel({
keyboard: false,
pause: "none",
Expand All @@ -26,6 +58,10 @@ Template.xymonfe.rendered = function() {
}

Template.xymonfe.helpers({
Slide: function() {
return getServices();
},

Slides: function() {
var servs = getServices();

Expand Down

0 comments on commit e9f6401

Please sign in to comment.