Skip to content

Commit

Permalink
Merge pull request #80 from draftedus/pre-tag-format
Browse files Browse the repository at this point in the history
Styling and formatting fixes for jobDetails view
  • Loading branch information
bradvogel authored Jan 4, 2018
2 parents f5ea23d + 72c89c1 commit be866d3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
5 changes: 5 additions & 0 deletions public/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,8 @@ body {
.select-all-text {
font-weight: 400;
}

pre {
max-height: 250px;
overflow-y: auto;
}
2 changes: 1 addition & 1 deletion src/server/views/dashboard/templates/queueJobsByState.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
</h4>
</a>
<div id="collapse{{encodeIdAttr this.id}}" class="collapse">
{{> dashboard/jobDetails this basePath=../basePath displayJobInline=true queueName=../queueName queueHost=../queueHost jobState=../state }}
{{~> dashboard/jobDetails this basePath=../basePath displayJobInline=true queueName=../queueName queueHost=../queueHost jobState=../state }}
</div>
</li>
{{/each}}
Expand Down
11 changes: 7 additions & 4 deletions src/server/views/helpers/handlebars.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
const _ = require('lodash');
const Handlerbars = require('handlebars');

const helpers = {
json(obj, pretty = false) {
var d;
if (pretty) {
var d = JSON.stringify(obj, null, 2);
return d;
d = JSON.stringify(obj, null, 2);
} else {
d = JSON.stringify(obj);
}
return JSON.stringify(obj);
return new Handlerbars.SafeString(d);
},

adjustedPage(currentPage, pageSize, newPageSize) {
Expand All @@ -25,7 +28,7 @@ const helpers = {
block = blocks[name] || (blocks[name] = []);
block.push(options.fn(this));
},

encodeIdAttr: function (id) {
return id.replace(/:| /g, "");
}
Expand Down
6 changes: 6 additions & 0 deletions src/server/views/layout.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ basePath }}/dashboard.css">

<!-- JSON Viewer -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
Expand Down
12 changes: 7 additions & 5 deletions src/server/views/partials/dashboard/jobDetails.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
{{length this.options.stacktraces}}
{{/if}}
</div>

<div class="col-sm-3">
</div>
<div class="row">
<div class="col-sm-4">
<h5>Permalinks</h5>
<a href="{{ basePath }}/{{ encodeURI queueHost }}/{{ encodeURI queueName }}/{{ this.id }}" class="btn btn-info">Job {{ this.id }}</a>
<a href="{{ basePath }}/{{ encodeURI queueHost }}/{{ encodeURI queueName }}/{{ this.id }}?json=true" class="btn btn-info">JSON</a>
Expand All @@ -63,12 +64,13 @@
{{/unless}}

{{#if this.returnvalue}}
<pre>{{ this.returnvalue }}</pre>
<h5>Return Value</h5>
<pre><code class="json">{{json this.returnvalue true}}</code></pre>
{{/if}}

{{#if this.failedReason}}
<h5>Reason for failure</h5>
<pre>{{ this.failedReason }}</pre>
<pre><code>{{this.failedReason}}</code></pre>
{{/if}}

{{#eq jobState 'failed'}}
Expand All @@ -87,4 +89,4 @@
{{/eq}}

<h5>Data</h5>
<pre>{{ json this.data }}</pre>
<pre><code class="json">{{json this.data true}}</code></pre>

0 comments on commit be866d3

Please sign in to comment.