lib/qless/server/views/layout.erb in qless-0.9.3 vs lib/qless/server/views/layout.erb in qless-0.10.0
- old
+ new
@@ -10,17 +10,17 @@
<link href="<%= u '/css/bootstrap.css' %>" rel="stylesheet">
<link href="<%= u '/css/bootstrap-responsive.css' %>" rel="stylesheet">
<link href="<%= u '/css/docs.css' %>" rel="stylesheet">
<link href="<%= u '/css/jquery.noty.css' %>" rel="stylesheet">
<link href="<%= u '/css/noty_theme_twitter.css' %>" rel="stylesheet">
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<style type="text/css">
body {
padding-top: 60px;
}
-
+
.btn-group span {
/* This is ugly. Anyone want to change it? */
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
border: 1px solid #cccccc;
@@ -28,30 +28,39 @@
background-color: #f5f5f5;
font-size: 13px;
line-height: 18px;
padding: 4px 10px 4px;
}
-
+
.btn-group input, .btn-group span {
position: relative;
float: left;
margin-left: -1px;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
margin-bottom: 0px;
}
-
+
.btn-group input:first-child, .btn-group span:first-child {
margin-left: 0;
-webkit-border-top-left-radius: 4px;
-moz-border-radius-topleft: 4px;
border-top-left-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-moz-border-radius-bottomleft: 4px;
border-bottom-left-radius: 4px;
}
+
+ .large-text {
+ font-size:18px;
+ }
+
+ .queue-column {
+ min-width:300px;
+ }
+
</style>
<script type="text/javascript">
/* This is a helper method to display an alert at the top of the page,
* in a vein similar to that of Ruby's flash */
@@ -82,21 +91,21 @@
var move = function(jid, queue, cb) {
_ajax({
url: '<%= u "/move" %>',
data: {id:jid, queue:queue},
success: function() { flash('Moved ' + jid + ' to ' + queue, 'success', 1500); cb(jid, queue); },
- erorr: function() { flash('Failed to move ' + jid + ' to ' + queue); }
+ error: function() { flash('Failed to move ' + jid + ' to ' + queue); }
});
}
/* Helper function for retrying a job */
var retry = function(jid, cb) {
_ajax({
url: '<%= u "/retry" %>',
data: {id:jid},
success: function() { flash('Retrying ' + jid, 'success', 1500); if (cb) { cb(jid, 'retry'); } },
- erorr: function() { flash('Failed to retry ' + jid); }
+ error: function() { flash('Failed to retry ' + jid); }
});
}
/* This is a helper method to cancel a job */
var cancel = function(jid, cb) {
@@ -196,17 +205,17 @@
confirmation(button, html, action, delay);
});
action();
});
}
-
+
/* Helper function for adding a tag to a job */
var tag = function(jid, tag) {
var data = {};
data[jid] = [tag];
// The button group of the 'add tag' bit
- var group =
+ var group =
_ajax({
url: '<%= u "/tag" %>',
data: data,
success : function() {
var div = $('<div>').attr('class', 'btn-group').attr('style', 'float:left');
@@ -220,17 +229,17 @@
}, error: function() {
flash('Failed to tag ' + jid + ' with ' + tag);
}
});
}
-
+
/* Helper function for untagging a job */
var untag = function(jid, tag) {
var data = {};
data[jid] = [tag];
// The button group of the 'add tag' bit
- var group =
+ var group =
_ajax({
url: '<%= u "/untag" %>',
data: data,
success : function() {
$("#job-" + jid).find('.tag').filter(function() {
@@ -239,11 +248,11 @@
}, error: function() {
flash('Failed to untag ' + jid + ' with ' + tag);
}
});
}
-
+
/* Helper function for changing a job's priority */
var priority = function(jid, priority) {
var p = parseInt(priority);
var input = $('#job-' + jid).find('.priority');
if (p != null) {
@@ -268,9 +277,59 @@
} else {
// Reset it to its original value, and print an error
flash('Cannot derive integer from "' + priority + '"');
input.val(null).blur();
}
+ }
+
+ var pause = function(queue) {
+ _ajax({
+ url: '<%= u "/pause" %>',
+ data: {
+ 'queue': queue
+ }, success: function(data) {
+ var button = $('#' + queue + '-pause');
+ button.attr('title', 'Unpause').attr(
+ 'data-original-title', 'Unpause');
+ button.addClass('btn-success').removeClass('btn-warning');
+ button.children().addClass('icon-play').removeClass('icon-pause');
+ button.attr('onclick', 'unpause("' + queue + '")');
+ }, error: function() {
+ flash('Couldn\'t pause queue ' + queue);
+ }
+ })
+ }
+
+ var unpause = function(queue) {
+ _ajax({
+ url: '<%= u "/unpause" %>',
+ data: {
+ 'queue': queue
+ }, success: function(data) {
+ var button = $('#' + queue + '-pause');
+ button.attr('title', 'Pause').attr(
+ 'data-original-title', 'Pause');
+ button.addClass('btn-warning').removeClass('btn-success');
+ button.children().addClass('icon-pause').removeClass('icon-play');
+ button.attr('onclick', 'pause("' + queue + '")');
+ }, error: function() {
+ flash('Couldn\'t unpause queue ' + queue);
+ }
+ })
+ }
+
+ var timeout = function(jid) {
+ _ajax({
+ url: '<%= u "/timeout" %>',
+ data: {
+ 'jid': jid
+ }, success: function(data) {
+ flash('Job timed out', 'success');
+ }, error: function(data) {
+ flash('Failed to time out job: ' + data);
+ console.log(data);
+ }
+ })
}
$(document).ready(function() {
$('button').tooltip({delay:200});
});