From 874c963cc42752ae82585ee2c0e4d5cf0080e00e Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Fri, 10 Feb 2023 14:51:47 +0100
Subject: [PATCH] Fix some list problems
---
app/static/js/ResourceLists/CorpusFileList.js | 1 +
app/static/js/ResourceLists/CorpusList.js | 3 ++-
app/static/js/ResourceLists/JobInputList.js | 1 +
app/static/js/ResourceLists/JobList.js | 1 +
app/static/js/ResourceLists/JobResultList.js | 1 +
app/static/js/ResourceLists/SpacyNLPPipelineModelList.js | 1 +
app/static/js/ResourceLists/TesseractOCRPipelineModelList.js | 1 +
7 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/app/static/js/ResourceLists/CorpusFileList.js b/app/static/js/ResourceLists/CorpusFileList.js
index ca27fe27..c052b2ea 100644
--- a/app/static/js/ResourceLists/CorpusFileList.js
+++ b/app/static/js/ResourceLists/CorpusFileList.js
@@ -11,6 +11,7 @@ class CorpusFileList extends ResourceList {
this.isInitialized = false;
this.userId = listContainerElement.dataset.userId;
this.corpusId = listContainerElement.dataset.corpusId;
+ if (this.userId === undefined || this.corpusId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
app.socket.on('PATCH', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}
diff --git a/app/static/js/ResourceLists/CorpusList.js b/app/static/js/ResourceLists/CorpusList.js
index e4af0b12..bf62ebed 100644
--- a/app/static/js/ResourceLists/CorpusList.js
+++ b/app/static/js/ResourceLists/CorpusList.js
@@ -8,8 +8,9 @@ class CorpusList extends ResourceList {
constructor(listContainerElement, options = {}) {
super(listContainerElement, options);
this.listjs.list.addEventListener('click', (event) => {this.onClick(event)});
- this.isInitialized = false;
+ this.isInitialized = false
this.userId = listContainerElement.dataset.userId;
+ if (this.userId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
app.socket.on('PATCH', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}
diff --git a/app/static/js/ResourceLists/JobInputList.js b/app/static/js/ResourceLists/JobInputList.js
index 36cb47f7..7f1a5105 100644
--- a/app/static/js/ResourceLists/JobInputList.js
+++ b/app/static/js/ResourceLists/JobInputList.js
@@ -11,6 +11,7 @@ class JobInputList extends ResourceList {
this.isInitialized = false;
this.userId = listContainerElement.dataset.userId;
this.jobId = listContainerElement.dataset.jobId;
+ if (this.userId === undefined || this.jobId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
app.socket.on('PATCH', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}
diff --git a/app/static/js/ResourceLists/JobList.js b/app/static/js/ResourceLists/JobList.js
index 1fa14ea2..ff7f82b2 100644
--- a/app/static/js/ResourceLists/JobList.js
+++ b/app/static/js/ResourceLists/JobList.js
@@ -10,6 +10,7 @@ class JobList extends ResourceList {
this.listjs.list.addEventListener('click', (event) => {this.onClick(event)});
this.isInitialized = false;
this.userId = listContainerElement.dataset.userId;
+ if (this.userId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
app.socket.on('PATCH', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}
diff --git a/app/static/js/ResourceLists/JobResultList.js b/app/static/js/ResourceLists/JobResultList.js
index 71c430af..b0cbc088 100644
--- a/app/static/js/ResourceLists/JobResultList.js
+++ b/app/static/js/ResourceLists/JobResultList.js
@@ -11,6 +11,7 @@ class JobResultList extends ResourceList {
this.isInitialized = false;
this.userId = listContainerElement.dataset.userId;
this.jobId = listContainerElement.dataset.jobId;
+ if (this.userId === undefined || this.jobId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
app.socket.on('PATCH', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}
diff --git a/app/static/js/ResourceLists/SpacyNLPPipelineModelList.js b/app/static/js/ResourceLists/SpacyNLPPipelineModelList.js
index 078ec90c..b90fb06b 100644
--- a/app/static/js/ResourceLists/SpacyNLPPipelineModelList.js
+++ b/app/static/js/ResourceLists/SpacyNLPPipelineModelList.js
@@ -11,6 +11,7 @@ class SpaCyNLPPipelineModelList extends ResourceList {
this.listjs.list.addEventListener('click', (event) => {this.onClick(event)});
this.isInitialized = false;
this.userId = listContainerElement.dataset.userId;
+ if (this.userId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
app.socket.on('PATCH', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}
diff --git a/app/static/js/ResourceLists/TesseractOCRPipelineModelList.js b/app/static/js/ResourceLists/TesseractOCRPipelineModelList.js
index ad319041..4ad3f5b1 100644
--- a/app/static/js/ResourceLists/TesseractOCRPipelineModelList.js
+++ b/app/static/js/ResourceLists/TesseractOCRPipelineModelList.js
@@ -11,6 +11,7 @@ class TesseractOCRPipelineModelList extends ResourceList {
this.listjs.list.addEventListener('click', (event) => {this.onClick(event)});
this.isInitialized = false;
this.userId = listContainerElement.dataset.userId;
+ if (this.userId === undefined) {return;}
app.subscribeUser(this.userId).then((response) => {
app.socket.on('PATCH', (patch) => {
if (this.isInitialized) {this.onPatch(patch);}