Skip to content

Commit

Permalink
Merge pull request #75 from Hannes221/73-mixed-content-unable-to-serv…
Browse files Browse the repository at this point in the history
…e-correctly-over-https

73 mixed content unable to serve correctly over https
  • Loading branch information
Hannes221 committed Mar 13, 2024
2 parents 1258533 + 4d6cb62 commit fb3351c
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 50 deletions.
46 changes: 23 additions & 23 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions rq_dashboard_fast/templates/jobs.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
<script>
let autoRefreshEnabled = true;
let autoRefreshInterval;
const protocol = '{{ protocol }}';
const host = window.location.host;
const prefix = '{{ prefix }}';

const baseurl = protocol + '://' + host + prefix;
function showNotification(message) {
const notification = document.createElement('div');
notification.className = 'notification';
Expand Down Expand Up @@ -98,7 +100,7 @@
}

function previousPage() {
if(page > 1){
if (page > 1) {
page -= 1;
updatePageNumber();
updateJobsData();
Expand All @@ -115,7 +117,7 @@
let selectedQueue = $('#queue-name-filter').val();
$.ajax({
url:
prefix +
baseurl +
'/jobs/json?state=' +
selectedState +
'&queue_name=' +
Expand All @@ -129,7 +131,7 @@
},
error: function (error) {
console.error('Error fetching jobs data: ', error);
showErrorNotification('Error fetching jobs data')
showErrorNotification('Error fetching jobs data');
},
});
}
Expand All @@ -153,7 +155,7 @@
$.each(queue[state], function (jobIndex, job) {
var row = $('<tr>');
var jobLink = $('<a>')
.attr('href', prefix + '/job/' + job.id)
.attr('href', baseurl + '/job/' + job.id)
.text(job.id);
row.append($('<td>').append(jobLink));
row.append($('<td>').append(state));
Expand All @@ -179,11 +181,11 @@

function deleteJob(job_id) {
$.ajax({
url: prefix + '/job/' + job_id,
url: baseurl + '/job/' + job_id,
type: 'DELETE',
error: function (error) {
console.error('Error fetching job data: ', error);
showErrorNotification('Error deleting job')
showErrorNotification('Error deleting job');
},
});
}
Expand Down Expand Up @@ -275,11 +277,13 @@ <h2>Jobs</h2>
</tbody>
</table>
<div class="pagination">
<button class="pagination-button" onclick="previousPage()">Previous</button>
<button class="pagination-button" onclick="previousPage()">
Previous
</button>
<span>Page: <span id="page-number">{{ page }}</span></span>
<button class="pagination-button" onclick="nextPage()">Next</button>
</div>
</div>
</div>
</body>
</html>
{% endblock %}
41 changes: 26 additions & 15 deletions rq_dashboard_fast/templates/queues.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
<script>
let autoRefreshEnabled = true;
let autoRefreshInterval;
const protocol = '{{ protocol }}';
const host = window.location.host;
const prefix = '{{ prefix }}';
const baseurl = protocol + '://' + host + prefix;

function showNotification(message) {
const notification = document.createElement('div');
Expand All @@ -31,7 +34,7 @@

setTimeout(() => {
document.body.removeChild(notification);
}, 3000)
}, 3000);
}

function toggleAutorefresh() {
Expand Down Expand Up @@ -59,27 +62,27 @@
function updateQueuesData() {
if (autoRefreshEnabled) {
$.ajax({
url: prefix + '/queues/json',
url: baseurl + '/queues/json',
type: 'GET',
dataType: 'json',
success: function (data) {
updateQueuesTable(data);
},
error: function (error) {
console.error('Error fetching queues data: ', error);
showErrorNotification('Error fetching queues data')
showErrorNotification('Error fetching queues data');
},
});
}
}

function deleteJobsInQueue(queue_name) {
$.ajax({
url: prefix + '/queues/' + queue_name,
url: baseurl + '/queues/' + queue_name,
type: 'DELETE',
error: function (error) {
console.error('Error deleting jobs in queue: ', error);
showErrorNotification('Error deleting job')
showErrorNotification('Error deleting job');
},
});
}
Expand All @@ -99,7 +102,7 @@
$('<a>')
.attr(
'href',
prefix +
baseurl +
'/jobs' +
'?state=queued&queue_name=' +
queue_stats.queue_name
Expand All @@ -112,7 +115,7 @@
$('<a>')
.attr(
'href',
prefix +
baseurl +
'/jobs' +
'?state=started&queue_name=' +
queue_stats.queue_name
Expand All @@ -125,7 +128,7 @@
$('<a>')
.attr(
'href',
prefix +
baseurl +
'/jobs' +
'?state=failed&queue_name=' +
queue_stats.queue_name
Expand All @@ -138,7 +141,7 @@
$('<a>')
.attr(
'href',
prefix +
baseurl +
'/jobs' +
'?state=deferred&queue_name=' +
queue_stats.queue_name
Expand All @@ -151,7 +154,7 @@
$('<a>')
.attr(
'href',
prefix +
baseurl +
'/jobs' +
'?state=finished&queue_name=' +
queue_stats.queue_name
Expand Down Expand Up @@ -213,27 +216,35 @@ <h2>Queues</h2>
{% for queue_stats in queue_data %}
<tr>
<td>
<a href="/jobs?queue={{ queue_stats.queue_name }}">
<a href="{{baseurl}}/jobs?queue={{ queue_stats.queue_name }}">
{{ queue_stats.queue_name }}
</a>
</td>
<td>
<a href="/jobs?queue={{ queue_stats.queue_name }}&state=started">
<a
href="{{baseurl}}/jobs?queue={{ queue_stats.queue_name }}&state=started"
>
{{ queue_stats.started }}
</a>
</td>
<td>
<a href="/jobs?queue={{ queue_stats.queue_name }}&state=failed">
<a
href="{{baseurl}}/jobs?queue={{ queue_stats.queue_name }}&state=failed"
>
{{ queue_stats.failed }}
</a>
</td>
<td>
<a href="/jobs?queue={{ queue_stats.queue_name }}&state=deferred">
<a
href="{{baseurl}}/jobs?queue={{ queue_stats.queue_name }}&state=deferred"
>
{{ queue_stats.deferred }}
</a>
</td>
<td>
<a href="/jobs?queue={{ queue_stats.queue_name }}&state=finished">
<a
href="{{baseurl}}/jobs?queue={{ queue_stats.queue_name }}&state=finished"
>
{{ queue_stats.finished }}
</a>
</td>
Expand Down
9 changes: 6 additions & 3 deletions rq_dashboard_fast/templates/workers.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
<script>
let autoRefreshEnabled = true;
let autoRefreshInterval = null;
const protocol = '{{ protocol }}';
const host = window.location.host;
const prefix = '{{ prefix }}';
const baseurl = protocol + '://' + host + prefix;

function showNotification(message) {
const notification = document.createElement('div');
Expand Down Expand Up @@ -60,7 +63,7 @@
function updateData() {
if (autoRefreshEnabled) {
$.ajax({
url: prefix + '/workers/json',
url: baseurl + '/workers/json',
type: 'GET',
dataType: 'json',
success: function (data) {
Expand All @@ -83,7 +86,7 @@
row.append($('<td>').text(worker.name));
if (worker.current_job !== 'Idle') {
var jobLink = $('<a>')
.attr('href', '/jobs/' + worker.current_job_id)
.attr('href', baseurl + '/jobs/' + worker.current_job_id)
.text(worker.current_job);
row.append($('<td>').append(jobLink));
} else {
Expand Down Expand Up @@ -141,7 +144,7 @@ <h2>Workers</h2>
<td>{{ worker.name }}</td>
<td>
{% if worker.current_job != 'Idle' %}
<a href="/jobs/{{ worker.current_job_id }}"
<a href="{{baseurl}}/jobs/{{ worker.current_job_id }}"
>{{ worker.current_job }}</a
>
{% else %} {{ worker.current_job }} {% endif %}
Expand Down

0 comments on commit fb3351c

Please sign in to comment.