forked from bee-queue/arena
-
Notifications
You must be signed in to change notification settings - Fork 2
/
queueDetails.hbs
80 lines (74 loc) · 2.4 KB
/
queueDetails.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<h2>Queue <code>{{ queueHost }}/{{ queueName }}</code></h2>
<div class="row">
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">
<div class="btn btn-default btn-xs pull-right" onClick="toggleJsonEditor()">Add Job</div>
<h4 class="panel-title">Job Types</h4>
</div>
<div class="panel-body">
<div class="jsoneditorx form-group hide overflow">
<div class="jsoneditorx hide" id="jsoneditor" style="height:200px;"></div>
<br />
<div class="btn btn-primary btn-sm pull-right" onClick="addJob()">Create</div>
</div>
<ul class="list-group">
{{#each jobCounts}}
<li class="list-group-item">
<span class="badge">{{ this }}</span>
<a href="{{ ../basePath }}/{{ encodeURI ../queueHost }}/{{ encodeURI ../queueName }}/{{ @key }}">
<span class="text-capitalize">{{ @key }}</span>
</a>
</li>
{{/each}}
</ul>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">Redis Statistics</h4>
</div>
<div class="panel-body">
<table class="table">
{{#each stats}}
<tr>
<th>{{ @key }}</th>
<th>{{ this }}</th>
</tr>
{{/each}}
</table>
</div>
</div>
</div>
</div>
{{#contentFor 'sidebar'}}
<li><a href="{{ basePath }}/">Queues Overview</a></li>
<li class="active"><a href="#">Queue <code>{{ queueHost }}/{{ queueName }}</code></a></li>
{{/contentFor}}
{{#contentFor 'script'}}
var jsonEditor = false;
(function(){
var options = {};
jsonEditor = new JSONEditor(document.getElementById('jsoneditor'), options);
})()
var toggleJsonEditor = function(){
$('.jsoneditorx').toggleClass('hide');
var data = localStorage.getItem('ArenaSavedJobData') || '{ id: \'\' }';
jsonEditor.set(JSON.parse(data));
};
var addJob = function(){
var data = jsonEditor.get();
localStorage.setItem('ArenaSavedJobData', JSON.stringify(data));
$.ajax({
url: '/api/queue/{{queueHost}}/{{queueName}}/job/new',
type: 'POST',
data: JSON.stringify(data),
contentType: 'application/json',
success: function(res) {
alert('Job successfully added!');
}
});
};
{{/contentFor}}