Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change position of loader #191

Open
wants to merge 2 commits into
base: fix_merge_issues
Choose a base branch
from
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
32 changes: 14 additions & 18 deletions assets/src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,36 +148,29 @@ function changeSkipInput(ev){

function filterChange(ev){
ev.preventDefault();
$container_inner.empty();
$("#skip-to-page").val("");

requestArray.forEach(function (req) {
req.abort();
});
requestArray = [];
scrollPageNum = 1;
imagesOutstanding = 0;
let filters = getFilters();
updateQuery(filters);
loadPage(scrollPageNum)
resetPageAndLoad();
};

$("#skip-form").on('submit', function(ev){//very similar to filter change, consider merging
ev.preventDefault();
let targetPage = $("#skip-to-page").val();
scrollPageNum = targetPage;
resetPageAndLoad();
});

function resetPageAndLoad(){
$container_inner.empty();

requestArray.forEach(function (req) {
req.abort();
});
requestArray = [];
scrollPageNum = targetPage;
let filters = getFilters();
updateQuery(filters);
loadPage(scrollPageNum)


});
imagesOutstanding = 0;
loadPage(scrollPageNum);
}

function filterByLabel(label_name){
$("#filter-label").val(label_name);
Expand Down Expand Up @@ -632,11 +625,12 @@ function loadROIs(filters={}){
let scrollPageNum = 1;
let morePages = true;
let imagesOutstanding = 0;
let $loader = $(`<div id="roi-container-loader"> <i class='fa fa-spinner fa-spin fa-2x'></i></div>`);
function showLoader(show){
if(show){
$("#roi-container-loader").addClass("visible");
$("#roi-container").append($loader);
}else{
$("#roi-container-loader").removeClass("visible");
$loader.remove();
}
}
function imageLoaded(evt) {
Expand Down Expand Up @@ -677,12 +671,14 @@ function checkWindowFull(){//keep loading pages of ROIs until the screen is fill
}
function handleRoiAjax(r) {
if(r.roi_count!=0){
showLoader(false);
for (let i=0;i< r.rois.length; i++) {
imagesOutstanding++;
let $img = $('<img class="image-tile infinite-item" draggable="false" data-roi-id="' + r.rois[i].id + '" src="' + r.rois[i].path + '" style="visibility: hidden" />');
$img.on("load", imageLoaded);
$container_inner.append($img);
}
showLoader(true);
$container_inner.append('<div class="page_divider"><div>' + r.page_num + '</div></div>' );
}else{
showLoader(false);
Expand Down
4 changes: 0 additions & 4 deletions assets/src/scss/global/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
#roi-container-loader{
text-align: center;
margin-bottom:5px;
visibility: hidden;
&.visible{
visibility: visible;
}
i{
color:$primary-color;
}
Expand Down
3 changes: 0 additions & 3 deletions templates/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ <h5>{{ roi_count }} ROI(s) found</h5>
<div id="roi-container">
<h2 style="text-align:center;margin-top:10%; position:relative;">Please choose an image collection and category to view and annotate images</h2>
</div>
<div id="roi-container-loader">
<i class='fa fa-spinner fa-spin fa-2x'></i>
</div>
</div>
</div>
</div>
Expand Down