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

Fix #726 Update slide upload instructions and error message for missing file extensions #1053

Open
wants to merge 5 commits into
base: develop
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
17 changes: 17 additions & 0 deletions .github/workflows/stale_issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Stale Issues and PRs'
on:
schedule:
- cron: '30 1 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity.'
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
days-before-stale: 30
days-before-close: 5
days-before-pr-close: -1
2 changes: 1 addition & 1 deletion apps/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ <h5 class="modal-title" id="title-of-dialog">Upload New Slide</h5>
<h3>Steps for uploading.</h3>
<ul>
<li>Select the file you wish to upload. The <b>Token</b> field should be automatically populated .</li>
<li>Enter the desired filename, including its extension, for the destination file.</li>
<li> Provide the destination filename with extension. For example "sample.svs"</li>
<li>Click on the <b><i class="fas fa-arrow-right"></i></b> button to preview the slide.</li>
<li>Click on <b>Finish Upload</b> to complete the process and post the slide to caMicroscope.</li>
</ul>
Expand Down
20 changes: 18 additions & 2 deletions apps/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,22 @@ function fileNameChange() {
const fileName = fileNameInput.val();
let newFileName = fileName.split(' ').join('_');
fileNameInput.val(newFileName);
let fileExtension = newFileName.toLowerCase().split('.').reverse()[0];
if (!allowedExtensions.includes(fileExtension)) {
let fileParts = newFileName.split('.');
let fileExtension = fileParts.length > 1 ? fileParts.reverse()[0].toLowerCase() : null;
if (!fileExtension) {
fileNameInput.addClass('is-invalid');
let fDiv = document.getElementById('filename-feedback0');

if (!fDiv) {
fileNameInput.addClass('is-invalid');
let fDiv = document.createElement('div');
fDiv.classList.add('invalid-feedback');
fDiv.id = 'filename-feedback0';
fDiv.textContent = 'The file name you provided is incompatible. File names should follow this format "filename.ext"';
fileNameInput.parent().append(fDiv);
}

} else if (!allowedExtensions.includes(fileExtension)) {
fileNameInput.addClass('is-invalid');
let fDiv = document.createElement('div');
fDiv.classList.add('invalid-feedback');
Expand All @@ -734,6 +748,8 @@ function fileNameChange() {
}
}
}


function switchToFile() {
$('.urlUploadClass').css('display', 'none');
$('.fileInputClass').css('display', 'block');
Expand Down