2014-05-01 17:15:33 +00:00
|
|
|
Ember.Handlebars.helper('panelBar', function(status) {
|
|
|
|
var highlightClass;
|
|
|
|
|
|
|
|
if (status == "passing") {
|
|
|
|
highlightClass = "bg-green";
|
|
|
|
} else {
|
|
|
|
highlightClass = "bg-orange";
|
|
|
|
}
|
|
|
|
return new Handlebars.SafeString('<div class="panel-bar ' + highlightClass + '"></div>');
|
|
|
|
});
|
2014-06-05 18:28:40 +00:00
|
|
|
|
|
|
|
Ember.Handlebars.helper('listBar', function(status) {
|
|
|
|
var highlightClass;
|
|
|
|
|
|
|
|
if (status == "passing") {
|
|
|
|
highlightClass = "bg-green";
|
|
|
|
} else {
|
|
|
|
highlightClass = "bg-orange";
|
|
|
|
}
|
|
|
|
return new Handlebars.SafeString('<div class="list-bar-horizontal ' + highlightClass + '"></div>');
|
|
|
|
});
|
2014-06-09 18:58:48 +00:00
|
|
|
|
|
|
|
Ember.Handlebars.helper('sessionName', function(session) {
|
2015-02-12 02:51:30 +00:00
|
|
|
var name;
|
|
|
|
|
2014-06-09 18:58:48 +00:00
|
|
|
if (session.Name === "") {
|
2015-02-12 02:51:30 +00:00
|
|
|
name = '<span>' + session.ID + '</span>';
|
2014-06-09 18:58:48 +00:00
|
|
|
} else {
|
2015-02-12 02:51:30 +00:00
|
|
|
name = '<span>' + session.Name + '</span>' + ' <small>' + session.ID + '</small>';
|
2014-06-09 18:58:48 +00:00
|
|
|
}
|
2015-02-12 02:51:30 +00:00
|
|
|
|
|
|
|
return new Handlebars.SafeString(name);
|
|
|
|
});
|
|
|
|
|
|
|
|
Ember.Handlebars.helper('sessionMeta', function(session) {
|
|
|
|
var meta = '<div class="metadata">' + session.Behavior + ' behavior</div>';
|
|
|
|
|
|
|
|
if (session.TTL !== "") {
|
|
|
|
meta = meta + '<div class="metadata">, ' + session.TTL + ' TTL</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Handlebars.SafeString(meta);
|
2014-06-09 18:58:48 +00:00
|
|
|
});
|
2014-06-11 20:54:03 +00:00
|
|
|
|
2014-08-22 19:25:10 +00:00
|
|
|
Ember.Handlebars.helper('aclName', function(name, id) {
|
|
|
|
if (name === "") {
|
|
|
|
return id;
|
|
|
|
} else {
|
2014-08-25 18:27:46 +00:00
|
|
|
return new Handlebars.SafeString(name + ' <small class="pull-right no-case">' + id + '</small>');
|
2014-08-22 19:25:10 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Ember.Handlebars.helper('formatRules', function(rules) {
|
|
|
|
if (rules === "") {
|
|
|
|
return "No rules defined";
|
|
|
|
} else {
|
|
|
|
return rules;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2014-06-11 20:54:03 +00:00
|
|
|
// We need to do this because of our global namespace properties. The
|
|
|
|
// service.Tags
|
|
|
|
Ember.Handlebars.helper('serviceTagMessage', function(tags) {
|
|
|
|
if (tags === null) {
|
|
|
|
return "No tags";
|
|
|
|
}
|
|
|
|
});
|
2014-08-22 23:03:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Sends a new notification to the UI
|
|
|
|
function notify(message, ttl) {
|
|
|
|
if (window.notifications !== undefined && window.notifications.length > 0) {
|
|
|
|
$(window.notifications).each(function(i, v) {
|
|
|
|
v.dismiss();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
var notification = new NotificationFx({
|
|
|
|
message : '<p>'+ message + '</p>',
|
|
|
|
layout : 'growl',
|
|
|
|
effect : 'slide',
|
|
|
|
type : 'notice',
|
|
|
|
ttl: ttl,
|
|
|
|
});
|
|
|
|
|
|
|
|
// show the notification
|
|
|
|
notification.show();
|
|
|
|
|
|
|
|
// Add the notification to the queue to be closed
|
|
|
|
window.notifications = [];
|
|
|
|
window.notifications.push(notification);
|
|
|
|
}
|