Skip to content

Commit

Permalink
Merge pull request #513 from camicroscope/develop
Browse files Browse the repository at this point in the history
For 3.9.2
  • Loading branch information
birm committed Apr 7, 2021
2 parents b1dd330 + fe8675e commit dfde0b4
Show file tree
Hide file tree
Showing 13 changed files with 487 additions and 53 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 15.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm install
- run: npm install jsdom
- run: npm install -g http-server
- run: npm install -g mocha
- run: npm install eslint
- run: npm install eslint-config-google
- run: http-server -s &
- run: npm run build --if-present
- run: npm run lint
- run: npm test
14 changes: 11 additions & 3 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* **Version 1**
* [1.0.x](#camicroscope-10)

### caMicroscope [Unreleased](https://github.com/camicroscope/camicroscope/compare/v3.9.0...camicroscope:develop)
### caMicroscope [Unreleased](https://github.com/camicroscope/camicroscope/compare/v3.9.2...camicroscope:develop)
###### TBD
*

### caMicroscope [3.9.1](https://github.com/camicroscope/camicroscope/compare/v3.8.4...camicroscope:v3.9.0)
### caMicroscope [3.9.2](https://github.com/camicroscope/camicroscope/compare/v3.9.1...camicroscope:v3.9.2)
###### 2021-04-07
* Github action for ci testing [#502](https://github.com/camicroscope/caMicroscope/pull/502)
* Validate Emails on signup [#501](https://github.com/camicroscope/caMicroscope/pull/501)
* Image Enhancements [#500](https://github.com/camicroscope/caMicroscope/pull/500)
* Configurable Toolbar Links [#511](https://github.com/camicroscope/caMicroscope/pull/511)
* Documentation Improvements [#506](https://github.com/camicroscope/caMicroscope/pull/506)


### caMicroscope [3.9.1](https://github.com/camicroscope/camicroscope/compare/v3.8.4...camicroscope:v3.9.1)
###### 2021-03-05
* Bugfix: Annotation Name Filtering

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2012-2020, caMicroscope
Copyright (c) 2012-2021, caMicroscope
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
36 changes: 20 additions & 16 deletions apps/batchloader/batchLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ let chunkSize = 5*1024*1024;
let finishUploadSuccess = false;
const allowedExtensions = ['svs', 'tif', 'tiff', 'vms', 'vmu', 'ndpi', 'scn', 'mrxs', 'bif', 'svslide'];


// call on document ready
$(document).ready(function() {
// fill all current files and slides to existingFiles[] and existingSlides
$('#files').show(400);
let store = new Store('../../data/');
store.findSlide().then((response) => {
Expand All @@ -26,7 +27,7 @@ $(document).ready(function() {
}).catch((error) => {
console.log(error);
});

// display file details when called
$('#filesInput').change(function() {
let files = $(this).prop('files');
let fileNames = $.map(files, function(val) {
Expand All @@ -46,7 +47,7 @@ $(document).ready(function() {
$('#complete').css('display', 'none');
$('#table').css('display', 'none');
});

// called when filenameswitch checkbox changes
$('#fileNameSwitch').change(function() {
if ($(this).is(':checked')) {
$('.fileName').css('opacity', '1');
Expand All @@ -70,7 +71,7 @@ $(document).ready(function() {
$(this).val($(this).val().split(' ').join('_'));
});
});

// fuction to add each row (per slide)
function addbody(rowData) {
let table = $('table tbody');
let markup = '<tr><th scope="row">'+rowData.serial+'</th><td><span>'+rowData.fileName+
Expand All @@ -88,7 +89,8 @@ function addbody(rowData) {

table.append(markup);
}

// function called on page load
// initializes table, adds rows, monitors change or click events and checks for errors in names
function startTable() {
slideNames = [];
fileNames = [];
Expand Down Expand Up @@ -185,7 +187,7 @@ function startTable() {
$('#complete').css('display', 'none');
}
}

// checks for erroes in names
function checkNames() {
let numErrors = 0;
for (i=0; i<originalFileNames.length; i++) {
Expand Down Expand Up @@ -222,6 +224,7 @@ function checkNames() {
}
}

// showSlideInfoX - shows info of slide based on the slide properties
function showSlideInfo1(index) {
$('#slideInfoContent').html(`<b>Original Filename:</b> `+originalFileNames[index]+`<br><b>Filename:</b> `+fileNames[index]+
`<br><b>Slide name:</b> `+slideNames[index]+`<br><b>Status:</b> Pending Initial Upload`);
Expand All @@ -246,7 +249,7 @@ function showSlideInfo5(index) {
`<br><b>Slide name:</b> `+slideNames[index]+`<br><b>Token:</b> `+
tokens[index]+`<br><b>Status:</b> Posted Successfully`);
}

// updates the name of the slide after checking if it's not null or duplicated
function updateSlideName(oldSlideName) {
$('#confirmUpdateSlideContent').html('Enter the new name for: <br><b>'+oldSlideName+
'</b><br><br><div class="form-group"><input type="text" id="newSlideName" class="form-control"'+
Expand Down Expand Up @@ -276,7 +279,7 @@ function updateSlideName(oldSlideName) {
}
});
}

// updates the name of the file if not null, not duplicated and has the correct file extension
function updateFileName(oldfileName) {
$('#confirmUpdateFileContent').html('Enter the new name for: <br><b>'+oldfileName+
'</b><br><br><div class="form-group"><input type="text" id="newFileName" class="form-control"'+
Expand Down Expand Up @@ -323,7 +326,7 @@ function updateFileName(oldfileName) {
});
}


// function to start batch upload
function startBatch() {
tokens = [];
for (i=0; i<files.length; i++) {
Expand All @@ -335,6 +338,7 @@ function startBatch() {
$('#start').css('display', 'none');
}

// function to finish batch upload
function finishBatch() {
for (i=0; i<fileNames.length; i++) {
finishUpload(tokens[i], fileNames[i], i);
Expand All @@ -359,7 +363,7 @@ async function handleUpload(selectedFile, filename, i) {
continueUpload(token);
readFileChunks(selectedFile, token);
}

// convert to json and POST per file
async function startUpload(filename) {
const body = {filename: filename};
const token = fetch(startUrl, {method: 'POST', body: JSON.stringify(body), headers: {
Expand All @@ -380,7 +384,7 @@ function continueUpload(token) {
}});
};
}

// called when upload of a file is finished.
function finishUpload(token, filename, i) {
// let reset = true;

Expand Down Expand Up @@ -465,13 +469,13 @@ function promiseChunkFileReader(file, part) {
fr.readAsDataURL(blob);
});
}

// checks for all files
function checkBatch() {
for (i=0; i<fileNames.length; i++) {
handleCheck(fileNames[i], i);
}
}

// checks if each file doesn't have an error
function handleCheck(filename, i) {
fetch(checkUrl + filename, {credentials: 'same-origin'}).then(
(response) => response.json(), // if the response is a JSON object
Expand All @@ -492,13 +496,13 @@ function handleCheck(filename, i) {
(error) => console.log(error), // Handle the error response object
);
}

// upload all files
function postBatch() {
for (i=0; i<fileNames.length; i++) {
handlePost(fileNames[i], slideNames[i], i);
}
}

// upload each file with timestamp
function handlePost(filename, slidename, i) {
fetch(checkUrl + filename, {credentials: 'same-origin'}).then(
(response) => response.json(), // if the response is a JSON object
Expand Down Expand Up @@ -547,7 +551,7 @@ function handlePost(filename, slidename, i) {
(error) => console.log(error), // Handle the error response object
);
}

// replace certain symbols for proper parsing in html
function sanitize(string) {
const map = {
'&': '&amp;',
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ <h2>caMicroscope</h2>
<a href="../table.html" class="image"><img src="./camic.jpg" alt=""/></a>
<div class="content">
<h3>caMicroscope</h3>
<p>Use camicroscope to explore and mark slides uploaded.</p>
<p>Use camicroscope to explore and mark slides uploaded. If this is a restricted access deployment, you will be prompted to log in here.</p>
<a href="../table.html" class="button">More</a>
</div>
</section>
Expand Down
6 changes: 6 additions & 0 deletions apps/signup/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ function addUser(){
// var attr = document.querySelector('input[name="attr"]:checked').value
var attrEle = document.getElementById("attr");
var attr = attrEle.options[attrEle.selectedIndex].value;

if (!(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email))) {
window.alert("Please enter a valid email");
return;
}

var userType = "Null"
if (attr == "3"){
userType = "Admin"
Expand Down

0 comments on commit dfde0b4

Please sign in to comment.