Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions html_client/FAIR_validator.css
Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,12 @@ p#suggest {
overflow-wrap: break-word;
word-break: break-word;
}

#run_button {
float: right;
margin-left: 10px;
}

#run_button:disabled {
opacity: 0.7;
}
69 changes: 43 additions & 26 deletions html_client/FAIR_validator.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,39 @@
$(document).ready(function(){
$('#loader').hide();
$('#run_button').click(function(){
$('#loader').show();
$('#run_button').hide();
$('#run_button').prop('disabled', true);
// $('#run_button').hide();
const MAX_FILE_SIZE = 20 * 1024 * 1024; // 20MB
const selected = document.querySelector('.selector.active');
// console.log("Selected:", selected.id);
// console.log("Selected label:", selected.textContent.trim());
if (selected.textContent.trim() == "URI"){
if ($('#URI_input').val() != ""){
$('#loader').show();
$.ajax({
// url:"https://foops.linkeddata.es/assessOntology",
url:"http://localhost:8080/assessOntology",
// url:"http://localhost:8080/assessOntology",
url: SERVER_URL + "/assessOntology",
type:"POST",
data:"{ \"ontologyUri\": \""+$('#URI_input').val()+"\"}",
contentType:"application/json; charset=utf-8",
success: function(data, status){
$('#loader').hide();
$('#run_button').show();
// $('#run_button').show();
$('#run_button').prop('disabled', false);
run(data)
console.log("ontology received correctly");
}
}).fail(function (jqXHR, textStatus, error) {
$('#loader').hide();
$('#run_button').show();
// $('#run_button').show();
$('#run_button').prop('disabled', false);
alert('Error when contacting the server!' );
});
}else{
$('#loader').hide();
$('#run_button').show();
// $('#loader').hide();
// $('#run_button').show();
$('#run_button').prop('disabled', false);
alert('Please enter a valid ontology URI' );
}
}
Expand All @@ -72,37 +77,43 @@
var file = fileInput.files[0];
if(!file){
alert('A file has not been selected');
$('#loader').hide();
$('#run_button').show();
// $('#loader').hide();
// $('#run_button').show();
$('#run_button').prop('disabled', false);
return;
}
if (file.size > MAX_FILE_SIZE) {
alert('File to assess is too big');
$('#loader').hide();
$('#run_button').show();
// $('#loader').hide();
// $('#run_button').show();
$('#run_button').prop('disabled', false);
return;
}
var formData = new FormData();
formData.append('file', file);
$.ajax({
url: "http://localhost:8080/assessOntologyFile",
// url: "http://localhost:8080/assessOntologyFile",
url: SERVER_URL + "/assessOntologyFile",
type: "POST",
data: formData,
processData: false,
contentType: false,
success: function(data, status){
$('#loader').hide();
$('#run_button').show();
// $('#run_button').show();
$('#run_button').prop('disabled', false);
run(data);
}
}).fail(function (jqXHR, textStatus, error) {
$('#loader').hide();
$('#run_button').show();
$('#loader').hide();
// $('#run_button').show();
$('#run_button').prop('disabled', false);
alert('Error when contacting the server!');
});
}else{
$('#loader').hide();
$('#run_button').show();
// $('#loader').hide();
// $('#run_button').show();
$('#run_button').prop('disabled', false);
alert('Please input a valid file' );
}
}
Expand All @@ -113,31 +124,37 @@
var blob = new Blob([ontologyCode], { type: 'text/plain' });
var file = new File([blob], "ontology.owl", { type: "text/plain" });
if (file.size > MAX_FILE_SIZE) {
// $('#run_button').show();
$('#run_button').prop('disabled', false);
alert('The code entered is too long. Please insert a shorter ontology (< 20mb)');
return;
}

formData2.append('file', file);
$.ajax({
url: "http://localhost:8080/assessOntologyFile",
// url: "http://localhost:8080/assessOntologyFile",
url: SERVER_URL + "/assessOntologyFile",
type: "POST",
data: formData2,
processData: false,
contentType: false,
success: function(data, status){
$('#loader').hide();
$('#run_button').show();
// $('#run_button').show();
$('#run_button').prop('disabled', false);
run(data);
}
}).fail(function (jqXHR, textStatus, error) {
$('#loader').hide();
$('#run_button').show();
// $('#run_button').show();
$('#run_button').prop('disabled', false);
alert('Error when contacting the server!');
});

}else{
$('#loader').hide();
$('#run_button').show();
// $('#run_button').show();
$('#run_button').prop('disabled', false);
alert('Please enter some ontology code' );
}
}
Expand Down Expand Up @@ -241,8 +258,9 @@
<!-- Input from URI-->
<div id="URI" class="row selector-content mt-3" style="display: flex">

<div class="col-12 center">
<input id="URI_input" class="input-1" placeholder="Enter an ontology URI...">
<div class="col-12 center" style="display: flex; align-items: center;">
<input id="URI_input" class="input-1" style="flex: 1;" placeholder="Enter an ontology URI...">
<button class="run px-5" id="run_button">RUN</button>
</div>
<div id="example" class="col-12 texto6">
<br>
Expand Down Expand Up @@ -298,11 +316,10 @@

<!-- Boton RUN -->
<div class="row justify-content-center mt-4">
<button class="run px-5" id="run_button">RUN</button>
<div id='loader'>
<img src="assets/croisant_mini.gif"/>
<img src="assets/croisant_mini.gif" style="width: 300px; height: auto;" />
</div>
</div>
</div>



Expand Down
5 changes: 5 additions & 0 deletions html_client/FAIR_validator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
const SERVER_URL = (window.location.hostname === 'localhost' || window.location.hostname === '')
? 'http://localhost:8080'
: 'https://foops.linkeddata.es';


var typeInputSelected = "URI";


Expand Down
Loading