mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 07:46:23 -04:00
Merge pull request #2526 from GSA/2525-bugfix-js-socket-io-connection-variable
Fix connection url
This commit is contained in:
@@ -13,11 +13,12 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
const jobEl = document.querySelector('[data-job-id]');
|
const jobEl = document.querySelector('[data-job-id]');
|
||||||
const jobId = jobEl?.dataset?.jobId;
|
const jobId = jobEl?.dataset?.jobId;
|
||||||
const featureEnabled = jobEl?.dataset?.feature === 'true';
|
const featureEnabled = jobEl?.dataset?.feature === 'true';
|
||||||
|
const apiHost = jobEl?.dataset?.host;
|
||||||
|
|
||||||
if (!jobId) return;
|
if (!jobId) return;
|
||||||
|
|
||||||
if (featureEnabled) {
|
if (featureEnabled) {
|
||||||
const socket = io('http://localhost:6011');
|
const socket = io(apiHost);
|
||||||
|
|
||||||
socket.on('connect', () => {
|
socket.on('connect', () => {
|
||||||
socket.emit('join', { room: `job-${jobId}` });
|
socket.emit('join', { room: `job-${jobId}` });
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import os
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from flask import (
|
from flask import (
|
||||||
@@ -58,8 +58,11 @@ def view_job(service_id, job_id):
|
|||||||
|
|
||||||
filter_args = parse_filter_args(request.args)
|
filter_args = parse_filter_args(request.args)
|
||||||
filter_args["status"] = set_status_filters(filter_args)
|
filter_args["status"] = set_status_filters(filter_args)
|
||||||
|
api_host_name = os.environ.get('API_HOST_NAME')
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"views/jobs/job.html",
|
"views/jobs/job.html",
|
||||||
|
api_host_name=api_host_name,
|
||||||
FEATURE_SOCKET_ENABLED=current_app.config["FEATURE_SOCKET_ENABLED"],
|
FEATURE_SOCKET_ENABLED=current_app.config["FEATURE_SOCKET_ENABLED"],
|
||||||
job=job,
|
job=job,
|
||||||
status=request.args.get("status", ""),
|
status=request.args.get("status", ""),
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
{% block maincolumn_content %}
|
{% block maincolumn_content %}
|
||||||
|
|
||||||
{{ page_header("Message status") }}
|
{{ page_header("Message status") }}
|
||||||
<div data-job-id="{{ job.id }}" data-feature="{{FEATURE_SOCKET_ENABLED | lower}}">
|
<div data-job-id="{{ job.id }}" data-feature="{{FEATURE_SOCKET_ENABLED | lower}}" data-host="{{ api_host_name }}">
|
||||||
{% if not job.finished_processing %}
|
{% if not job.finished_processing %}
|
||||||
<div
|
<div
|
||||||
data-resource="{{ updates_url }}"
|
data-resource="{{ updates_url }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user