Skip to content

Loading…

Feature/groups #44

Merged
merged 4 commits into from

2 participants

@stelcheck

Reopening from #38, contains only feature group.

@obazoud obazoud merged commit 9f801c1 into statusdashboard:master
@obazoud
Statusdashboard project member

Awesome feature! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 24, 2013
  1. @stelcheck
  2. @stelcheck

    * Bugfix: Ftp methods were note prototype methods

    stelcheck committed
    * Uncaught exception now prints stacktrace instead of just the error message
  3. @stelcheck

    * Bug fix: missing callback argument

    stelcheck committed
    * Refactored ftp.js
  4. @stelcheck
This page is out of date. Refresh to see the latest.
Showing with 55 additions and 19 deletions.
  1. +1 −0 api.js
  2. +46 −19 public/index.html
  3. +8 −0 public/styles/master.css
View
1 api.js
@@ -93,6 +93,7 @@ module.exports.checkAllServices = function() {
for (var i = 0; i < settings.services.length; i++) {
status.services[i] = {};
status.services[i].name = settings.services[i].name;
+ status.services[i].group = settings.services[i].group;
status.services[i].label = settings.services[i].label;
status.services[i].status = 'unknown';
status.services[i].statusCode = 0;
View
65 public/index.html
@@ -44,13 +44,32 @@
});
socket.on('status', function (status) {
- var statusTab = _.map(status.services, function(value, key) { return value; });
+ var statusTab = [];
+ var groups = [];
+
+ _.each(status.services, function(value, key) {
+ if (typeof(value.group) !== 'string') {
+ value.group = 'others';
+ }
+
+ var groupIndex = groups.indexOf(value.group);
+
+ if (groupIndex === -1) {
+ groupIndex = groups.length;
+ groups.push(value.group);
+ statusTab.push({ name:value.group, projects: []});
+ };
+
+ statusTab[groupIndex].projects.push(value);
+ });
$('#summarize').empty();
$('#projects').empty();
- $("#projectTemplate").template("projectsList");
+
+ $("#groupTemplate").template("group");
$("#summarizeTemplate").template("summarizeData");
- $.tmpl("projectsList", statusTab).appendTo("#projects");
+
+ $.tmpl("group", statusTab).appendTo("#projects");
$.tmpl("summarizeData", status.summarize).appendTo("#summarize");
});
@@ -96,17 +115,30 @@
});
});
</script>
- <script id="projectTemplate" type="text/html">
- <li class="project">
- <h2>
- <span class="service"><span class="strikethrough"></span><strong>${label}</strong></span>
- <span class="status ${status} glow"><span class="strikethrough"></span><strong>${status}</strong></span>
- <span class="code"><span class="strikethrough"></span><strong>{{if statusCode != 0 && status != 'up'}}${statusCode}{{else}}&nbsp;{{/if}}</strong></span>
- </h2>
- {{if message }}
- <p class="info"><span class="label">Message:</span>${message}</p>
- {{/if}}
- </li>
+ <script id="groupTemplate" type="text/html">
+ <li>
+ <h1 class="legend">${name}</h1>
+
+ <div class="legend">
+ <span class="service">Service</span>
+ <span class="status">Status</span>
+ <span class="code">Code</span>
+ </div>
+ <ul>
+ {{each(i, project) projects}}
+ <li class="project">
+ <h2>
+ <span class="service"><span class="strikethrough"></span><strong>${project.label}</strong></span>
+ <span class="status ${project.status} glow"><span class="strikethrough"></span><strong>${project.status}</strong></span>
+ <span class="code"><span class="strikethrough"></span><strong>{{if project.statusCode != 0 && project.status != 'up'}}${project.statusCode}{{else}}&nbsp;{{/if}}</strong></span>
+ </h2>
+ {{if project.message }}
+ <p class="info"><span class="label">Message:</span>${project.message}</p>
+ {{/if}}
+ </li>
+ {{/each}}
+ </ul>
+ </li>
</script>
<script id="summarizeTemplate" type="text/html">
<li class="project">
@@ -148,11 +180,6 @@ <h1 id="title">Services Status Dashboard</h1>
</div>
<div id="plugins" class="plugins">
</div>
- <div class="legend">
- <span class="service">Service</span>
- <span class="status">Status</span>
- <span class="code">Code</span>
- </div>
<ul id="projects"></ul>
</div>
<div id="footer">
View
8 public/styles/master.css
@@ -106,6 +106,14 @@ body {
left: 507px;
}
+ h1.legend {
+ height:auto;
+ font-size:24px;
+ line-height:36px;
+ padding:20px 10px 0px;
+ text-align:left;
+ color: #888;
+ }
/* PROJECTS */
.plugin {
cursor: pointer;
Something went wrong with that request. Please try again.