Browse Source

UI improvements

pull/41/head
Kalle Stenflo 10 years ago
parent
commit
b0badd1cfa
  1. 32
      json-path-web-test/src/main/resources/html/index.html

32
json-path-web-test/src/main/resources/html/index.html

@ -181,23 +181,37 @@
} }
}); });
function checkPath(force) { function checkPath() {
var pathString = $("#txtPath").val(); var pathString = $("#txtPath").val();
if (!force && pathString.length < 1) return;
var updateDisplay = function(icon, tooltip){
$('#path-status').removeClass().addClass('glyphicon ' + icon);
$('#path-status-tool').attr('data-original-title', tooltip).tooltip('fixTitle');
};
if(pathString.length ==0){
updateDisplay('glyphicon-ban-circle', 'Invalid path');
//$('#path-status').removeClass().addClass('glyphicon glyphicon-ban-circle');
//$('#path-status-tool').attr('data-original-title', 'Invalid path').tooltip('fixTitle');
return;
}
$.get('/api/validate/?path=' + pathString, function(data) { $.get('/api/validate/?path=' + pathString, function(data) {
if(data){ if(data){
if(data.result === -1){ if(data.result === -1){
$('#path-status').removeClass().addClass('glyphicon glyphicon-ban-circle'); updateDisplay('glyphicon-ban-circle', 'Invalid path');
$('#path-status-tool').attr('data-original-title', 'Invalid path').tooltip('fixTitle'); //$('#path-status').removeClass().addClass('glyphicon glyphicon-ban-circle');
//$('#path-status-tool').attr('data-original-title', 'Invalid path').tooltip('fixTitle');
} }
else if(data.result === 0){ else if(data.result === 0){
$('#path-status').removeClass().addClass('glyphicon glyphicon-record'); updateDisplay('glyphicon-record', 'Path is definite');
$('#path-status-tool').attr('data-original-title', 'Definite').tooltip('fixTitle'); //$('#path-status').removeClass().addClass('glyphicon glyphicon-record');
//$('#path-status-tool').attr('data-original-title', 'Definite').tooltip('fixTitle');
} }
else if(data.result === 1){ else if(data.result === 1){
$('#path-status').removeClass().addClass('glyphicon glyphicon-align-justify'); updateDisplay('glyphicon-align-justify', 'Path is indefinite');
$('#path-status-tool').attr('data-original-title', 'Not definite').tooltip('fixTitle'); //$('#path-status').removeClass().addClass('glyphicon glyphicon-align-justify');
//$('#path-status-tool').attr('data-original-title', 'Not definite').tooltip('fixTitle');
} }
} }
@ -253,7 +267,7 @@
} }
var start = new Date().getTime(); var start = new Date().getTime();
var res = jsonPath(JSON.parse(json), path, {resultType: $('input[name=rbType]:checked', '#form').val() }); var res = jsonPath(JSON.parse(json), path, {resultType: $('input[name=rbType]:checked').val() });
var elapsed = new Date().getTime() - start; var elapsed = new Date().getTime() - start;
$("#goessner-time").text(elapsed); $("#goessner-time").text(elapsed);

Loading…
Cancel
Save