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
3e9d749574
commit
5df3c8be35
@ -16,10 +16,24 @@ class App {
|
|||||||
this.data.promises.getUser[userId] = new Promise((resolve, reject) => {
|
this.data.promises.getUser[userId] = new Promise((resolve, reject) => {
|
||||||
fetch(`/users/${userId}?backrefs=true&relationships=true`, {headers: {Accept: 'application/json'}})
|
fetch(`/users/${userId}?backrefs=true&relationships=true`, {headers: {Accept: 'application/json'}})
|
||||||
.then(
|
.then(
|
||||||
(response) => {return response.json();},
|
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.status === 403) {this.flash('Forbidden', 'error');}
|
switch (response.status) {
|
||||||
if (response.status === 404) {this.flash('Not Found', 'error');}
|
case 403: {
|
||||||
|
this.flash('Forbidden', 'error');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 404: {
|
||||||
|
this.flash('Not Found', 'error');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
response.json();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(response) => {
|
||||||
|
this.flash('Something went wrong', 'error');
|
||||||
reject(response);
|
reject(response);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -31,7 +31,7 @@ class SpaCyNLPPipelineModelList extends RessourceList {
|
|||||||
<td><b><span class="title"></span> <span class="version"></span></b><br><i><span class="description"></span></i></td>
|
<td><b><span class="title"></span> <span class="version"></span></b><br><i><span class="description"></span></i></td>
|
||||||
<td><a class="publisher-url"><span class="publisher"></span></a> (<span class="publishing-year"></span>)<br><a class="publishing-url"><span class="publishing-url-2"></span></a></td>
|
<td><a class="publisher-url"><span class="publisher"></span></a> (<span class="publishing-year"></span>)<br><a class="publishing-url"><span class="publishing-url-2"></span></a></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="switch action-switch center-align" data-action="share-request">
|
<div class="switch action-switch center-align" data-action="share-request" data-user-role=>
|
||||||
<span class="share"></span>
|
<span class="share"></span>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" class="shared">
|
<input type="checkbox" class="shared">
|
||||||
@ -86,6 +86,11 @@ class SpaCyNLPPipelineModelList extends RessourceList {
|
|||||||
|
|
||||||
init (user) {
|
init (user) {
|
||||||
this._init(user.spacy_nlp_pipeline_models);
|
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') {
|
||||||
|
switchElement.setAttribute('disabled', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_init(ressources) {
|
_init(ressources) {
|
||||||
|
@ -12,13 +12,27 @@ class Utils {
|
|||||||
fetch(`/corpora/${corpus.id}/build`, {method: 'POST', headers: {Accept: 'application/json'}})
|
fetch(`/corpora/${corpus.id}/build`, {method: 'POST', headers: {Accept: 'application/json'}})
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
app.flash(`Corpus "${corpus.title}" marked for building`, 'corpus');
|
switch(response.status) {
|
||||||
resolve(response);
|
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:
|
||||||
|
app.flash(`Corpus "${corpus.title}" marked for building`, 'corpus');
|
||||||
|
resolve(response);
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.status === 403) {app.flash('Forbidden', 'error');}
|
app.flash('Something went wrong', 'error');
|
||||||
if (response.status === 404) {app.flash('Not Found', 'error');}
|
|
||||||
if (response.status === 409) {app.flash('Conflict', 'error');}
|
|
||||||
reject(response);
|
reject(response);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -61,12 +75,23 @@ class Utils {
|
|||||||
fetch(`/corpora/${corpus.id}`, {method: 'DELETE', headers: {Accept: 'application/json'}})
|
fetch(`/corpora/${corpus.id}`, {method: 'DELETE', headers: {Accept: 'application/json'}})
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
app.flash(`Corpus "${corpusTitle}" marked for deletion`, 'corpus');
|
switch(response.status) {
|
||||||
resolve(response);
|
case 403:
|
||||||
|
app.flash('Forbidden', 'error');
|
||||||
|
reject(response);
|
||||||
|
break;
|
||||||
|
case 404:
|
||||||
|
app.flash('Not Found', 'error');
|
||||||
|
reject(response);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
app.flash(`Corpus "${corpus.title}" marked for deletion`, 'corpus');
|
||||||
|
resolve(response);
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.status === 403) {app.flash('Forbidden', 'error');}
|
app.flash('Something went wrong', 'error');
|
||||||
if (response.status === 404) {app.flash('Not Found', 'error');}
|
|
||||||
reject(response);
|
reject(response);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -112,12 +137,23 @@ class Utils {
|
|||||||
fetch(`/corpora/${corpusId}/files/${corpusFileId}`, {method: 'DELETE', headers: {Accept: 'application/json'}})
|
fetch(`/corpora/${corpusId}/files/${corpusFileId}`, {method: 'DELETE', headers: {Accept: 'application/json'}})
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
app.flash(`Corpus file "${corpusFileTitle}" marked for deletion`, 'corpus');
|
switch(response.status) {
|
||||||
resolve(response);
|
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');
|
||||||
|
resolve(response);
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.status === 403) {app.flash('Forbidden', 'error');}
|
app.flash('Something went wrong', 'error');
|
||||||
if (response.status === 404) {app.flash('Not Found', 'error');}
|
|
||||||
reject(response);
|
reject(response);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -160,12 +196,23 @@ class Utils {
|
|||||||
fetch(`/contributions/spacy-nlp-pipeline-models/${spaCyNLPPipelineModelId}`, {method: 'DELETE'})
|
fetch(`/contributions/spacy-nlp-pipeline-models/${spaCyNLPPipelineModelId}`, {method: 'DELETE'})
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
app.flash(`SpaCy NLP Pipeline Model "${spaCyNLPPipelineModelTitle}" marked for deletion`);
|
switch(response.status) {
|
||||||
resolve(response);
|
case 403:
|
||||||
|
app.flash('Forbidden', 'error');
|
||||||
|
reject(response);
|
||||||
|
break;
|
||||||
|
case 404:
|
||||||
|
app.flash('Not Found', 'error');
|
||||||
|
reject(response);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
app.flash(`SpaCy NLP Pipeline Model "${spaCyNLPPipelineModelTitle}" marked for deletion`);
|
||||||
|
resolve(response);
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.status === 403) {app.flash('Forbidden', 'error');}
|
app.flash('Something went wrong', 'error');
|
||||||
if (response.status === 404) {app.flash('Not Found', 'error');}
|
|
||||||
reject(response);
|
reject(response);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -208,12 +255,24 @@ class Utils {
|
|||||||
fetch(`/contributions/tesseract-ocr-pipeline-models/${tesseractOCRPipelineModelId}`, {method: 'DELETE'})
|
fetch(`/contributions/tesseract-ocr-pipeline-models/${tesseractOCRPipelineModelId}`, {method: 'DELETE'})
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
app.flash(`Tesseract OCR Pipeline Model "${tesseractOCRPipelineModelTitle}" marked for deletion`);
|
switch(response.status) {
|
||||||
resolve(response);
|
case 403:
|
||||||
|
app.flash('Forbidden', 'error');
|
||||||
|
reject(response);
|
||||||
|
break;
|
||||||
|
case 404:
|
||||||
|
app.flash('Not Found', 'error');
|
||||||
|
reject(response);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
app.flash(`Tesseract OCR Pipeline Model "${tesseractOCRPipelineModelTitle}" marked for deletion`);
|
||||||
|
resolve(response);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.status === 403) {app.flash('Forbidden', 'error');}
|
app.flash('Something went wrong', 'error');
|
||||||
if (response.status === 404) {app.flash('Not Found', 'error');}
|
|
||||||
reject(response);
|
reject(response);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -258,12 +317,23 @@ class Utils {
|
|||||||
fetch(`/jobs/${job.id}`, {method: 'DELETE', headers: {Accept: 'application/json'}})
|
fetch(`/jobs/${job.id}`, {method: 'DELETE', headers: {Accept: 'application/json'}})
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
app.flash(`Job "${jobTitle}" marked for deletion`, 'job');
|
switch(response.status) {
|
||||||
resolve(response);
|
case 403:
|
||||||
|
app.flash('Forbidden', 'error');
|
||||||
|
reject(response);
|
||||||
|
break;
|
||||||
|
case 404:
|
||||||
|
app.flash('Not Found', 'error');
|
||||||
|
reject(response);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
app.flash(`Job "${jobTitle}" marked for deletion`, 'job');
|
||||||
|
resolve(response);
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.status === 403) {app.flash('Forbidden', 'error');}
|
app.flash('Something went wrong', 'error');
|
||||||
if (response.status === 404) {app.flash('Not Found', 'error');}
|
|
||||||
reject(response);
|
reject(response);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -279,12 +349,23 @@ class Utils {
|
|||||||
fetch(`/jobs/${job.id}/log`, {method: 'GET', headers: {Accept: 'application/json, text/plain'}})
|
fetch(`/jobs/${job.id}/log`, {method: 'GET', headers: {Accept: 'application/json, text/plain'}})
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
resolve(response);
|
switch(response.status) {
|
||||||
return response.text();
|
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;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.status === 403) {app.flash('Forbidden', 'error');}
|
app.flash('Something went wrong', 'error');
|
||||||
if (response.status === 404) {app.flash('Not Found', 'error');}
|
|
||||||
reject(response);
|
reject(response);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -355,13 +436,26 @@ class Utils {
|
|||||||
fetch(`/jobs/${job.id}/restart`, {method: 'POST', headers: {Accept: 'application/json'}})
|
fetch(`/jobs/${job.id}/restart`, {method: 'POST', headers: {Accept: 'application/json'}})
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
app.flash(`Job "${jobTitle}" restarted.`, 'job');
|
switch(response.status) {
|
||||||
resolve(response);
|
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:
|
||||||
|
app.flash(`Job "${jobTitle}" restarted.`, 'job');
|
||||||
|
resolve(response);
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.status === 403) {app.flash('Forbidden', 'error');}
|
app.flash('Something went wrong', 'error');
|
||||||
if (response.status === 404) {app.flash('Not Found', 'error');}
|
|
||||||
if (response.status === 409) {app.flash('Conflict', 'error');}
|
|
||||||
reject(response);
|
reject(response);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -406,12 +500,24 @@ class Utils {
|
|||||||
fetch(`/users/${user.id}`, {method: 'DELETE', headers: {Accept: 'application/json'}})
|
fetch(`/users/${user.id}`, {method: 'DELETE', headers: {Accept: 'application/json'}})
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
app.flash(`User "${userName}" marked for deletion`);
|
switch(response.status) {
|
||||||
resolve(response);
|
case 403:
|
||||||
|
app.flash('Forbidden', 'error');
|
||||||
|
reject(response);
|
||||||
|
break;
|
||||||
|
case 404:
|
||||||
|
app.flash('Not Found', 'error');
|
||||||
|
reject(response);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
app.flash(`User "${userName}" marked for deletion`);
|
||||||
|
resolve(response);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.status === 403) {app.flash('Forbidden', 'error');}
|
app.flash('Something went wrong', 'error');
|
||||||
if (response.status === 404) {app.flash('Not Found', 'error');}
|
|
||||||
reject(response);
|
reject(response);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -432,11 +538,19 @@ class Utils {
|
|||||||
fetch(`/contributions/tesseract-ocr-pipeline-models/${tesseractOCRPipelineModel.id}/toggle-public-status`, {method: 'POST', headers: {Accept: 'application/json'}})
|
fetch(`/contributions/tesseract-ocr-pipeline-models/${tesseractOCRPipelineModel.id}/toggle-public-status`, {method: 'POST', headers: {Accept: 'application/json'}})
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
app.flash(msg, 'corpus');
|
switch(response.status) {
|
||||||
resolve(response);
|
case 403:
|
||||||
|
app.flash('Forbidden', 'error');
|
||||||
|
reject(response);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
app.flash(msg, 'corpus');
|
||||||
|
resolve(response);
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.status === 403) {app.flash('Forbidden', 'error');}
|
app.flash('Something went wrong', 'error');
|
||||||
reject(response);
|
reject(response);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -455,11 +569,19 @@ class Utils {
|
|||||||
fetch(`/contributions/spacy-nlp-pipeline-models/${spaCyNLPPipelineModel.id}/toggle-public-status`, {method: 'POST', headers: {Accept: 'application/json'}})
|
fetch(`/contributions/spacy-nlp-pipeline-models/${spaCyNLPPipelineModel.id}/toggle-public-status`, {method: 'POST', headers: {Accept: 'application/json'}})
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
app.flash(msg, 'corpus');
|
switch(response.status) {
|
||||||
resolve(response);
|
case 403:
|
||||||
|
app.flash('Forbidden', 'error');
|
||||||
|
reject(response);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
app.flash(msg, 'corpus');
|
||||||
|
resolve(response);
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.status === 403) {app.flash('Forbidden', 'error');}
|
app.flash('Something went wrong', 'error');
|
||||||
reject(response);
|
reject(response);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user