Skip to content

Commit

Permalink
fix the file disappearing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ZihengSun committed Sep 15, 2024
1 parent 0263c75 commit 58cdb2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions src/main/resources/static/js/gw.history.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,15 +477,15 @@ GW.history = {

// Function to apply search filter
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
const selectedStatus = $('#statusFilter').val().toLowerCase();
const rowStatus = data[4].toLowerCase();



if(selectedStatus === "" && rowStatus === "skipped") {
const selectedStatus = ($('#statusFilter').val() || "").toLowerCase(); // Ensure it's a string
const rowStatus = (data[4] || "").toLowerCase(); // Ensure it's a string

// If selected status is empty and the row status is "skipped", exclude this row
if (selectedStatus === "" && rowStatus === "skipped") {
return false;
}


// If no filter is applied or the row matches the selected filter, include the row
return selectedStatus === "" || rowStatus === selectedStatus;
});

Expand Down
14 changes: 7 additions & 7 deletions src/main/resources/static/js/gw.result.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GW.result.browser = {
GW.result.browser.render_file_list()

$('#result-refresh-button').on('click', function() {
GW.result.browser.loadFolderContents("", GW.result.browser.fileTable);; // Reload the data from the server
GW.result.browser.loadFolderContents("");; // Reload the data from the server
});

},
Expand Down Expand Up @@ -77,15 +77,15 @@ GW.result.browser = {
]
});

GW.result.browser.loadFolderContents("", GW.result.browser.fileTable);
GW.result.browser.loadFolderContents("");

// Add click event to folder rows
$('#file-list-table tbody').on('click', 'tr td:first-child', function () {
var rowData = GW.result.browser.fileTable.row($(this).closest('tr')).data();
if (rowData.isDirectory) {
// If the row is a folder, navigate into it
var path = rowData.path;
GW.result.browser.loadFolderContents(path, GW.result.browser.fileTable);
GW.result.browser.loadFolderContents(path);
}
});

Expand Down Expand Up @@ -119,7 +119,7 @@ GW.result.browser = {
},

// Function to load folder contents
loadFolderContents: function(folderPath = '', fileTable) {
loadFolderContents: function(folderPath = '') {
$('#file-list-table').before(`
<div id="loading-message" style="text-align: center; margin-bottom: 10px;">
<i class="fas fa-spinner fa-spin" style="font-size: 24px; margin-right: 10px;"></i>
Expand All @@ -128,7 +128,7 @@ GW.result.browser = {
`);

// Clear existing table data
fileTable.clear().draw();
GW.result.browser.fileTable.clear().draw();

$.ajax({
url: '/Geoweaver/results', // API endpoint to get file list
Expand All @@ -149,8 +149,8 @@ GW.result.browser = {
}

// Add new data to the table
fileTable.rows.add(data);
fileTable.draw();
GW.result.browser.fileTable.rows.add(data);
GW.result.browser.fileTable.draw();
},
error: function (err) {
// Remove loading message
Expand Down

0 comments on commit 58cdb2e

Please sign in to comment.