mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
Bug fixes
This commit is contained in:
parent
3f5750a000
commit
0128c6310b
@ -17,20 +17,8 @@ class App {
|
||||
fetch(`/users/${userId}?backrefs=true&relationships=true`, {headers: {Accept: 'application/json'}})
|
||||
.then(
|
||||
(response) => {
|
||||
switch (response.status) {
|
||||
case 403: {
|
||||
this.flash('Forbidden', 'error');
|
||||
break;
|
||||
}
|
||||
case 404: {
|
||||
this.flash('Not Found', 'error');
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
response.json();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (response.status === 403) {this.flash('Forbidden', 'error'); reject(response);}
|
||||
return response.json();
|
||||
},
|
||||
(response) => {
|
||||
this.flash('Something went wrong', 'error');
|
||||
|
@ -84,7 +84,7 @@ class SpaCyNLPPipelineModelList extends RessourceList {
|
||||
this.listjs.list.addEventListener('change', (event) => {this.onChange(event)});
|
||||
}
|
||||
|
||||
init (user) {
|
||||
init(user) {
|
||||
this._init(user.spacy_nlp_pipeline_models);
|
||||
for (let switchElement of this.listjs.list.querySelectorAll('.shared')) {
|
||||
if (user.role.name !== 'Administrator' || user.role.name !== 'Contributor') {
|
||||
|
@ -12,24 +12,11 @@ class Utils {
|
||||
fetch(`/corpora/${corpus.id}/build`, {method: 'POST', headers: {Accept: 'application/json'}})
|
||||
.then(
|
||||
(response) => {
|
||||
switch(response.status) {
|
||||
case 403:
|
||||
app.flash('Forbidden', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
case 404:
|
||||
app.flash('Not Found', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
case 409:
|
||||
app.flash('Conflict', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
default:
|
||||
if (response.status === 403) {app.flash('Forbidden', 'error'); reject(response);}
|
||||
if (response.status === 404) {app.flash('Not Found', 'error'); reject(response);}
|
||||
if (response.status === 409) {app.flash('Conflict', 'error'); reject(response);}
|
||||
app.flash(`Corpus "${corpus.title}" marked for building`, 'corpus');
|
||||
resolve(response);
|
||||
break;
|
||||
}
|
||||
},
|
||||
(response) => {
|
||||
app.flash('Something went wrong', 'error');
|
||||
@ -75,20 +62,10 @@ class Utils {
|
||||
fetch(`/corpora/${corpus.id}`, {method: 'DELETE', headers: {Accept: 'application/json'}})
|
||||
.then(
|
||||
(response) => {
|
||||
switch(response.status) {
|
||||
case 403:
|
||||
app.flash('Forbidden', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
case 404:
|
||||
app.flash('Not Found', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
default:
|
||||
if (response.status === 403) {app.flash('Forbidden', 'error'); reject(response);}
|
||||
if (response.status === 404) {app.flash('Not Found', 'error'); reject(response);}
|
||||
app.flash(`Corpus "${corpus.title}" marked for deletion`, 'corpus');
|
||||
resolve(response);
|
||||
break;
|
||||
}
|
||||
},
|
||||
(response) => {
|
||||
app.flash('Something went wrong', 'error');
|
||||
@ -137,20 +114,10 @@ class Utils {
|
||||
fetch(`/corpora/${corpusId}/files/${corpusFileId}`, {method: 'DELETE', headers: {Accept: 'application/json'}})
|
||||
.then(
|
||||
(response) => {
|
||||
switch(response.status) {
|
||||
case 403:
|
||||
app.flash('Forbidden', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
case 404:
|
||||
app.flash('Not Found', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
default:
|
||||
app.flash(`Corpus file "${corpusFileTitle}" marked for deletion`, 'corpus');
|
||||
if (response.status === 403) {app.flash('Forbidden', 'error'); reject(response);}
|
||||
if (response.status === 404) {app.flash('Not Found', 'error'); reject(response);}
|
||||
app.flash(`Corpus File "${corpusFileTitle}" deleted`, 'corpus');
|
||||
resolve(response);
|
||||
break;
|
||||
}
|
||||
},
|
||||
(response) => {
|
||||
app.flash('Something went wrong', 'error');
|
||||
@ -196,20 +163,10 @@ class Utils {
|
||||
fetch(`/contributions/spacy-nlp-pipeline-models/${spaCyNLPPipelineModelId}`, {method: 'DELETE'})
|
||||
.then(
|
||||
(response) => {
|
||||
switch(response.status) {
|
||||
case 403:
|
||||
app.flash('Forbidden', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
case 404:
|
||||
app.flash('Not Found', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
default:
|
||||
if (response.status === 403) {app.flash('Forbidden', 'error'); reject(response);}
|
||||
if (response.status === 404) {app.flash('Not Found', 'error'); reject(response);}
|
||||
app.flash(`SpaCy NLP Pipeline Model "${spaCyNLPPipelineModelTitle}" marked for deletion`);
|
||||
resolve(response);
|
||||
break;
|
||||
}
|
||||
},
|
||||
(response) => {
|
||||
app.flash('Something went wrong', 'error');
|
||||
@ -255,21 +212,10 @@ class Utils {
|
||||
fetch(`/contributions/tesseract-ocr-pipeline-models/${tesseractOCRPipelineModelId}`, {method: 'DELETE'})
|
||||
.then(
|
||||
(response) => {
|
||||
switch(response.status) {
|
||||
case 403:
|
||||
app.flash('Forbidden', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
case 404:
|
||||
app.flash('Not Found', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
default:
|
||||
if (response.status === 403) {app.flash('Forbidden', 'error'); reject(response);}
|
||||
if (response.status === 404) {app.flash('Not Found', 'error'); reject(response);}
|
||||
app.flash(`Tesseract OCR Pipeline Model "${tesseractOCRPipelineModelTitle}" marked for deletion`);
|
||||
resolve(response);
|
||||
break;
|
||||
}
|
||||
|
||||
},
|
||||
(response) => {
|
||||
app.flash('Something went wrong', 'error');
|
||||
@ -317,20 +263,10 @@ class Utils {
|
||||
fetch(`/jobs/${job.id}`, {method: 'DELETE', headers: {Accept: 'application/json'}})
|
||||
.then(
|
||||
(response) => {
|
||||
switch(response.status) {
|
||||
case 403:
|
||||
app.flash('Forbidden', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
case 404:
|
||||
app.flash('Not Found', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
default:
|
||||
if (response.status === 403) {app.flash('Forbidden', 'error'); reject(response);}
|
||||
if (response.status === 404) {app.flash('Not Found', 'error'); reject(response);}
|
||||
app.flash(`Job "${jobTitle}" marked for deletion`, 'job');
|
||||
resolve(response);
|
||||
break;
|
||||
}
|
||||
},
|
||||
(response) => {
|
||||
app.flash('Something went wrong', 'error');
|
||||
@ -349,20 +285,9 @@ class Utils {
|
||||
fetch(`/jobs/${job.id}/log`, {method: 'GET', headers: {Accept: 'application/json, text/plain'}})
|
||||
.then(
|
||||
(response) => {
|
||||
switch(response.status) {
|
||||
case 403:
|
||||
app.flash('Forbidden', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
case 404:
|
||||
app.flash('Not Found', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
default:
|
||||
resolve(response);
|
||||
response.text();
|
||||
break;
|
||||
}
|
||||
if (response.status === 403) {app.flash('Forbidden', 'error'); reject(response);}
|
||||
if (response.status === 404) {app.flash('Not Found', 'error'); reject(response);}
|
||||
return response.text();
|
||||
},
|
||||
(response) => {
|
||||
app.flash('Something went wrong', 'error');
|
||||
@ -395,6 +320,7 @@ class Utils {
|
||||
}
|
||||
);
|
||||
modal.open();
|
||||
resolve(text);
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -436,23 +362,11 @@ class Utils {
|
||||
fetch(`/jobs/${job.id}/restart`, {method: 'POST', headers: {Accept: 'application/json'}})
|
||||
.then(
|
||||
(response) => {
|
||||
switch(response.status) {
|
||||
case 403:
|
||||
app.flash('Forbidden', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
case 404:
|
||||
app.flash('Not Found', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
case 409:
|
||||
app.flash('Conflict', 'error');
|
||||
reject(response);
|
||||
default:
|
||||
if (response.status === 403) {app.flash('Forbidden', 'error'); reject(response);}
|
||||
if (response.status === 404) {app.flash('Not Found', 'error'); reject(response);}
|
||||
if (response.status === 409) {app.flash('Conflict', 'error'); reject(response);}
|
||||
app.flash(`Job "${jobTitle}" restarted.`, 'job');
|
||||
resolve(response);
|
||||
break;
|
||||
}
|
||||
},
|
||||
(response) => {
|
||||
app.flash('Something went wrong', 'error');
|
||||
@ -500,21 +414,10 @@ class Utils {
|
||||
fetch(`/users/${user.id}`, {method: 'DELETE', headers: {Accept: 'application/json'}})
|
||||
.then(
|
||||
(response) => {
|
||||
switch(response.status) {
|
||||
case 403:
|
||||
app.flash('Forbidden', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
case 404:
|
||||
app.flash('Not Found', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
default:
|
||||
if (response.status === 403) {app.flash('Forbidden', 'error'); reject(response);}
|
||||
if (response.status === 404) {app.flash('Not Found', 'error'); reject(response);}
|
||||
app.flash(`User "${userName}" marked for deletion`);
|
||||
resolve(response);
|
||||
break;
|
||||
}
|
||||
|
||||
},
|
||||
(response) => {
|
||||
app.flash('Something went wrong', 'error');
|
||||
@ -538,16 +441,9 @@ class Utils {
|
||||
fetch(`/contributions/tesseract-ocr-pipeline-models/${tesseractOCRPipelineModel.id}/toggle-public-status`, {method: 'POST', headers: {Accept: 'application/json'}})
|
||||
.then(
|
||||
(response) => {
|
||||
switch(response.status) {
|
||||
case 403:
|
||||
app.flash('Forbidden', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
default:
|
||||
if (response.status === 403) {app.flash('Forbidden', 'error'); reject(response);}
|
||||
app.flash(msg);
|
||||
resolve(response);
|
||||
break;
|
||||
}
|
||||
},
|
||||
(response) => {
|
||||
app.flash('Something went wrong', 'error');
|
||||
@ -569,16 +465,9 @@ class Utils {
|
||||
fetch(`/contributions/spacy-nlp-pipeline-models/${spaCyNLPPipelineModel.id}/toggle-public-status`, {method: 'POST', headers: {Accept: 'application/json'}})
|
||||
.then(
|
||||
(response) => {
|
||||
switch(response.status) {
|
||||
case 403:
|
||||
app.flash('Forbidden', 'error');
|
||||
reject(response);
|
||||
break;
|
||||
default:
|
||||
if (response.status === 403) {app.flash('Forbidden', 'error'); reject(response);}
|
||||
app.flash(msg);
|
||||
resolve(response);
|
||||
break;
|
||||
}
|
||||
},
|
||||
(response) => {
|
||||
app.flash('Something went wrong', 'error');
|
||||
|
Loading…
Reference in New Issue
Block a user