diff --git a/app/static/js/ResourceLists/CorpusFileList.js b/app/static/js/ResourceLists/CorpusFileList.js
index 9fc7c7f1..2397cd72 100644
--- a/app/static/js/ResourceLists/CorpusFileList.js
+++ b/app/static/js/ResourceLists/CorpusFileList.js
@@ -24,15 +24,15 @@ class CorpusFileList extends ResourceList {
get item() {
return `
-
+
|
|
|
|
- delete
- file_download
- send
+ delete
+ file_download
+ send
|
`.trim();
@@ -92,23 +92,26 @@ class CorpusFileList extends ResourceList {
}
onClick(event) {
- let corpusFileElement = event.target.closest('tr');
- if (corpusFileElement === null) {return;}
- let corpusFileId = corpusFileElement.dataset.id;
- if (corpusFileId === undefined) {return;}
- let actionButtonElement = event.target.closest('.action-button');
- let action = actionButtonElement === null ? 'view' : actionButtonElement.dataset.action;
- switch (action) {
+ let listItemElement = event.target.closest('.list-item');
+ if (listItemElement === null) {return;}
+ if (!('id' in listItemElement.dataset)) {return;}
+ let itemId = listItemElement.dataset.id;
+ if (itemId === undefined) {return;}
+ let listActionElement = event.target.closest('.list-item .list-action-trigger');
+ let listAction =
+ listActionElement === null || !('listAction' in listActionElement.dataset)
+ ? 'view' : listActionElement.dataset.listAction;
+ switch (listAction) {
case 'delete': {
- Utils.deleteCorpusFileRequest(this.userId, this.corpusId, corpusFileId);
+ Utils.deleteCorpusFileRequest(this.userId, this.corpusId, itemId);
break;
}
case 'download': {
- window.location.href = `/corpora/${this.corpusId}/files/${corpusFileId}/download`;
+ window.location.href = `/corpora/${this.corpusId}/files/${itemId}/download`;
break;
}
case 'view': {
- window.location.href = `/corpora/${this.corpusId}/files/${corpusFileId}`;
+ window.location.href = `/corpora/${this.corpusId}/files/${itemId}`;
break;
}
default: {
diff --git a/app/static/js/ResourceLists/CorpusList.js b/app/static/js/ResourceLists/CorpusList.js
index c8122894..eff52814 100644
--- a/app/static/js/ResourceLists/CorpusList.js
+++ b/app/static/js/ResourceLists/CorpusList.js
@@ -24,13 +24,13 @@ class CorpusList extends ResourceList {
// #region Mandatory getters and methods to implement
get item() {
return `
-
+
book |
|
|
- delete
- send
+ delete
+ send
|
`.trim();
@@ -87,19 +87,22 @@ class CorpusList extends ResourceList {
}
onClick(event) {
- let corpusElement = event.target.closest('tr');
- if (corpusElement === null) {return;}
- let corpusId = corpusElement.dataset.id;
- if (corpusId === undefined) {return;}
- let actionButtonElement = event.target.closest('.action-button');
- let action = actionButtonElement === null ? 'view' : actionButtonElement.dataset.action;
- switch (action) {
+ let listItemElement = event.target.closest('.list-item');
+ if (listItemElement === null) {return;}
+ if (!('id' in listItemElement.dataset)) {return;}
+ let itemId = listItemElement.dataset.id;
+ if (itemId === undefined) {return;}
+ let listActionElement = event.target.closest('.list-item .list-action-trigger');
+ let listAction =
+ listActionElement === null || !('listAction' in listActionElement.dataset)
+ ? 'view' : listActionElement.dataset.listAction;
+ switch (listAction) {
case 'delete-request': {
- Utils.deleteCorpusRequest(this.userId, corpusId);
+ Utils.deleteCorpusRequest(this.userId, itemId);
break;
}
case 'view': {
- window.location.href = `/corpora/${corpusId}`;
+ window.location.href = `/corpora/${itemId}`;
break;
}
default: {
diff --git a/app/static/js/ResourceLists/JobInputList.js b/app/static/js/ResourceLists/JobInputList.js
index ce537084..784e767a 100644
--- a/app/static/js/ResourceLists/JobInputList.js
+++ b/app/static/js/ResourceLists/JobInputList.js
@@ -24,10 +24,10 @@ class JobInputList extends ResourceList {
get item() {
return `
-
+
|
- file_download
+ file_download
|
`.trim();
@@ -78,15 +78,18 @@ class JobInputList extends ResourceList {
}
onClick(event) {
- let jobInputElement = event.target.closest('tr');
- if (jobInputElement === null) {return;}
- let jobInputId = jobInputElement.dataset.id;
- if (jobInputId === undefined) {return;}
- let actionButtonElement = event.target.closest('.action-button');
- let action = actionButtonElement === null ? 'download' : actionButtonElement.dataset.action;
- switch (action) {
+ let listItemElement = event.target.closest('.list-item');
+ if (listItemElement === null) {return;}
+ if (!('id' in listItemElement.dataset)) {return;}
+ let itemId = listItemElement.dataset.id;
+ if (itemId === undefined) {return;}
+ let listActionElement = event.target.closest('.list-item .list-action-trigger');
+ let listAction =
+ listActionElement === null || !('listAction' in listActionElement.dataset)
+ ? 'download' : listActionElement.dataset.listAction;
+ switch (listAction) {
case 'download': {
- window.location.href = `/jobs/${this.jobId}/inputs/${jobInputId}/download`;
+ window.location.href = `/jobs/${this.jobId}/inputs/${itemId}/download`;
break;
}
default: {
diff --git a/app/static/js/ResourceLists/JobList.js b/app/static/js/ResourceLists/JobList.js
index de4b2ee8..49999053 100644
--- a/app/static/js/ResourceLists/JobList.js
+++ b/app/static/js/ResourceLists/JobList.js
@@ -23,13 +23,13 @@ class JobList extends ResourceList {
get item() {
return `
-
+
|
|
|
- delete
- send
+ delete
+ send
|
`.trim();
@@ -88,19 +88,22 @@ class JobList extends ResourceList {
}
onClick(event) {
- let jobElement = event.target.closest('tr');
- if (jobElement === null) {return;}
- let jobId = jobElement.dataset.id;
- if (jobId === undefined) {return;}
- let actionButtonElement = event.target.closest('.action-button');
- let action = actionButtonElement === null ? 'view' : actionButtonElement.dataset.action;
- switch (action) {
+ let listItemElement = event.target.closest('.list-item');
+ if (listItemElement === null) {return;}
+ if (!('id' in listItemElement.dataset)) {return;}
+ let itemId = listItemElement.dataset.id;
+ if (itemId === undefined) {return;}
+ let listActionElement = event.target.closest('.list-item .list-action-trigger');
+ let listAction =
+ listActionElement === null || !('listAction' in listActionElement.dataset)
+ ? 'view' : listActionElement.dataset.listAction;
+ switch (listAction) {
case 'delete-request': {
- Utils.deleteJobRequest(this.userId, jobId);
+ Utils.deleteJobRequest(this.userId, itemId);
break;
}
case 'view': {
- window.location.href = `/jobs/${jobId}`;
+ window.location.href = `/jobs/${itemId}`;
break;
}
default: {
diff --git a/app/static/js/ResourceLists/JobResultList.js b/app/static/js/ResourceLists/JobResultList.js
index 282a4ba1..b8ef95c0 100644
--- a/app/static/js/ResourceLists/JobResultList.js
+++ b/app/static/js/ResourceLists/JobResultList.js
@@ -24,11 +24,11 @@ class JobResultList extends ResourceList {
get item() {
return `
-
+
|
|
- file_download
+ file_download
|
`.trim();
@@ -82,15 +82,18 @@ class JobResultList extends ResourceList {
}
onClick(event) {
- let jobResultElement = event.target.closest('tr');
- if (jobResultElement === null) {return;}
- let jobResultId = jobResultElement.dataset.id;
- if (jobResultId === undefined) {return;}
- let actionButtonElement = event.target.closest('.action-button');
- let action = actionButtonElement === null ? 'download' : actionButtonElement.dataset.action;
- switch (action) {
+ let listItemElement = event.target.closest('.list-item');
+ if (listItemElement === null) {return;}
+ if (!('id' in listItemElement.dataset)) {return;}
+ let itemId = listItemElement.dataset.id;
+ if (itemId === undefined) {return;}
+ let listActionElement = event.target.closest('.list-item .list-action-trigger');
+ let listAction =
+ listActionElement === null || !('listAction' in listActionElement.dataset)
+ ? 'download' : listActionElement.dataset.listAction;
+ switch (listAction) {
case 'download': {
- window.location.href = `/jobs/${this.jobId}/results/${jobResultId}/download`;
+ window.location.href = `/jobs/${this.jobId}/results/${itemId}/download`;
break;
}
default: {
diff --git a/app/static/js/ResourceLists/PublicUserList.js b/app/static/js/ResourceLists/PublicUserList.js
index 39974349..bde271ef 100644
--- a/app/static/js/ResourceLists/PublicUserList.js
+++ b/app/static/js/ResourceLists/PublicUserList.js
@@ -12,7 +12,7 @@ class PublicUserList extends ResourceList {
get item() {
return `
-
+
|
|
|
@@ -20,7 +20,7 @@ class PublicUserList extends ResourceList {
|
|
- send
+ send
|
`.trim();
@@ -86,13 +86,18 @@ class PublicUserList extends ResourceList {
}
onClick(event) {
- let actionButtonElement = event.target.closest('.action-button');
- let action = actionButtonElement === null ? 'view' : actionButtonElement.dataset.action;
- let publicUserElement = event.target.closest('tr');
- let publicUserId = publicUserElement.dataset.id;
- switch (action) {
+ let listItemElement = event.target.closest('.list-item');
+ if (listItemElement === null) {return;}
+ if (!('id' in listItemElement.dataset)) {return;}
+ let itemId = listItemElement.dataset.id;
+ if (itemId === undefined) {return;}
+ let listActionElement = event.target.closest('.list-item .list-action-trigger');
+ let listAction =
+ listActionElement === null || !('listAction' in listActionElement.dataset)
+ ? 'view' : listActionElement.dataset.listAction;
+ switch (listAction) {
case 'view': {
- window.location.href = `/users/${publicUserId}`;
+ window.location.href = `/users/${itemId}`;
break;
}
default: {
diff --git a/app/static/js/ResourceLists/SpacyNLPPipelineModelList.js b/app/static/js/ResourceLists/SpacyNLPPipelineModelList.js
index 6e1bbc30..f3959a79 100644
--- a/app/static/js/ResourceLists/SpacyNLPPipelineModelList.js
+++ b/app/static/js/ResourceLists/SpacyNLPPipelineModelList.js
@@ -32,11 +32,11 @@ class SpaCyNLPPipelineModelList extends ResourceList {
get item() {
return `
-
+
|
()
|
- |
- delete
- send
+ delete
+ send
|
`.trim();
@@ -117,8 +117,8 @@ class SpaCyNLPPipelineModelList extends ResourceList {
}
onChange(event) {
- let actionSwitchElement = event.target.closest('.action-switch');
- let action = actionSwitchElement.dataset.action;
+ let actionSwitchElement = event.target.closest('.list-action-trigger');
+ let action = actionSwitchElement.dataset.listAction;
let spaCyNLPPipelineModelElement = event.target.closest('tr');
let spaCyNLPPipelineModelId = spaCyNLPPipelineModelElement.dataset.id;
switch (action) {
@@ -141,8 +141,8 @@ class SpaCyNLPPipelineModelList extends ResourceList {
}
return;
}
- let actionButtonElement = event.target.closest('.action-button');
- let action = actionButtonElement === null ? 'view' : actionButtonElement.dataset.action;
+ let actionButtonElement = event.target.closest('.list-action-trigger');
+ let action = actionButtonElement === null ? 'view' : actionButtonElement.dataset.listAction;
let spaCyNLPPipelineModelElement = event.target.closest('tr');
let spaCyNLPPipelineModelId = spaCyNLPPipelineModelElement.dataset.id;
switch (action) {
diff --git a/app/static/js/ResourceLists/TesseractOCRPipelineModelList.js b/app/static/js/ResourceLists/TesseractOCRPipelineModelList.js
index 4a9827f4..c3bc6447 100644
--- a/app/static/js/ResourceLists/TesseractOCRPipelineModelList.js
+++ b/app/static/js/ResourceLists/TesseractOCRPipelineModelList.js
@@ -32,11 +32,11 @@ class TesseractOCRPipelineModelList extends ResourceList {
get item() {
return `
-
+
|
()
|
- |
- delete
- send
+ delete
+ send
|
`.trim();
@@ -117,8 +117,8 @@ class TesseractOCRPipelineModelList extends ResourceList {
}
onChange(event) {
- let actionSwitchElement = event.target.closest('.action-switch');
- let action = actionSwitchElement.dataset.action;
+ let actionSwitchElement = event.target.closest('.list-action-trigger');
+ let action = actionSwitchElement.dataset.listAction;
let tesseractOCRPipelineModelElement = event.target.closest('tr');
let tesseractOCRPipelineModelId = tesseractOCRPipelineModelElement.dataset.id;
switch (action) {
@@ -141,8 +141,8 @@ class TesseractOCRPipelineModelList extends ResourceList {
}
return;
}
- let actionButtonElement = event.target.closest('.action-button');
- let action = actionButtonElement === null ? 'view' : actionButtonElement.dataset.action;
+ let actionButtonElement = event.target.closest('.list-action-trigger');
+ let action = actionButtonElement === null ? 'view' : actionButtonElement.dataset.listAction;
let tesseractOCRPipelineModelElement = event.target.closest('tr');
let tesseractOCRPipelineModelId = tesseractOCRPipelineModelElement.dataset.id;
switch (action) {
diff --git a/app/static/js/ResourceLists/UserList.js b/app/static/js/ResourceLists/UserList.js
index aedba114..841f08b7 100644
--- a/app/static/js/ResourceLists/UserList.js
+++ b/app/static/js/ResourceLists/UserList.js
@@ -12,16 +12,16 @@ class UserList extends ResourceList {
get item() {
return `
-
+
|
|
|
|
|
- delete
- edit
- send
+ delete
+ edit
+ send
|
`.trim();
@@ -84,24 +84,27 @@ class UserList extends ResourceList {
}
onClick(event) {
- let userElement = event.target.closest('tr');
- if (userElement === null) {return;}
- let userId = userElement.dataset.id;
- if (userId === undefined) {return;}
- let actionButtonElement = event.target.closest('.action-button');
- let action = actionButtonElement === null ? 'view' : actionButtonElement.dataset.action;
- switch (action) {
+ let listItemElement = event.target.closest('.list-item');
+ if (listItemElement === null) {return;}
+ if (!('id' in listItemElement.dataset)) {return;}
+ let itemId = listItemElement.dataset.id;
+ if (itemId === undefined) {return;}
+ let listActionElement = event.target.closest('.list-item .list-action-trigger');
+ let listAction =
+ listActionElement === null || !('listAction' in listActionElement.dataset)
+ ? 'view' : listActionElement.dataset.listAction;
+ switch (listAction) {
case 'delete': {
- Utils.deleteUserRequest(userId);
- if (userId === currentUserId) {window.location.href = '/';}
+ Utils.deleteUserRequest(itemId);
+ if (itemId === currentUserId) {window.location.href = '/';}
break;
}
case 'edit': {
- window.location.href = `/admin/users/${userId}/edit`;
+ window.location.href = `/admin/users/${itemId}/edit`;
break;
}
case 'view': {
- window.location.href = `/admin/users/${userId}`;
+ window.location.href = `/admin/users/${itemId}`;
break;
}
default: {