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

Remove camel case ignore rule in ESLint #278

Merged
merged 12 commits into from
Apr 3, 2020
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module.exports = {
"require-jsdoc" : 0,
"valid-jsdoc" : 0,
"max-len" : ["error", { "code": 120 ,"ignoreTemplateLiterals": true},],
"camelcase" : 0,
"no-unused-vars" : 0,
"no-var" : 0,
"new-cap" : 0,
Expand Down
4 changes: 2 additions & 2 deletions apps/heatmap/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,6 @@ function createExportEditData() {
}
function getUserId() {
const token = getCookie('token');
const token_data = parseJwt(token);
return token_data.name;
const tokenData = parseJwt(token);
return tokenData.name;
}
12 changes: 6 additions & 6 deletions apps/heatmap/uicallbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function toggleViewerMode(opt) {
}

// mainfest
function multSelector_action(size) {
function multSelectorAction(size) {
// hidden main viewer's bottom right control and get navigator
$CAMIC.viewer.controls.bottomright.style.display = 'none';
// if(event.data.length == 0){
Expand Down Expand Up @@ -126,12 +126,12 @@ function openSecondaryViewer() {
// minor.classList.add('display');
minor.classList.add('right');

const nav_size = {
const navSize = {
'height': $CAMIC.viewer.controls.bottomright.querySelector('.navigator').style.height,
'width': $CAMIC.viewer.controls.bottomright.querySelector('.navigator').style.width,
};
setTimeout(function() {
multSelector_action(nav_size);
multSelectorAction(navSize);
}, 100);
}

Expand Down Expand Up @@ -464,7 +464,7 @@ async function saveEditData() {


// delete old one
let create_date = now;
let createDate = now;

if (ImgloaderMode!='imgbox') {
// find editor data
Expand All @@ -477,7 +477,7 @@ async function saveEditData() {
}

if (data.length!==0) {
create_date = data[0].create_date;
createDate = data[0].create_date;
const del = await $CAMIC.store.deleteHeatmapEdit(user, slide, exec);
// error
if (del.hasError&&del.hasError==true) {
Expand All @@ -489,7 +489,7 @@ async function saveEditData() {
// add new one
const add = await $CAMIC.store.addHeatmapEdit({
user_id: user,
create_date: create_date,
create_date: createDate,
update_date: now,
provenance: $D.heatMapData.provenance,
data: editData,
Expand Down
14 changes: 7 additions & 7 deletions apps/labeling/labeling.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function initCore() {

$CAMIC.viewer.addHandler('open', function() {
if ($CAMIC.viewer.pmanager)$CAMIC.viewer.pmanager.on();
if (!$CAMIC.viewer.measureInstance) $UI.toolbar._sub_tools[2].style.display = 'none';
if (!$CAMIC.viewer.measureInstance) $UI.toolbar._subTools[2].style.display = 'none';
});

// ui init
Expand Down Expand Up @@ -221,12 +221,12 @@ function getPatchsZip(data) {
delete p.label;
delete p.widthInClient;
});
const meta_content = [['name', 'location'], [data.name, data.location]];
const patch_cols = ['id', 'color', 'note', 'isPoint', 'x', 'y', 'width', 'height', 'location'];
const patches_content = [patch_cols];
const metaContent = [['name', 'location'], [data.name, data.location]];
const patchCols = ['id', 'color', 'note', 'isPoint', 'x', 'y', 'width', 'height', 'location'];
const patchesContent = [patchCols];

data.patches.forEach((p, idx)=>{
patches_content.push([idx,
patchesContent.push([idx,
p['color'],
p['note'],
p['isPoint'],
Expand All @@ -237,8 +237,8 @@ function getPatchsZip(data) {
p['location']]);
});

zip.file(`metadata.csv`, meta_content.map((r)=>r.join(',')).join('\n'));
zip.file(`patches.csv`, patches_content.map((r)=>r.join(',')).join('\n'));
zip.file(`metadata.csv`, metaContent.map((r)=>r.join(',')).join('\n'));
zip.file(`patches.csv`, patchesContent.map((r)=>r.join(',')).join('\n'));

zip.generateAsync({type: 'blob'})
.then(function(content) {
Expand Down
30 changes: 15 additions & 15 deletions apps/loader/chunked_upload.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// expects changeStatus to be defined from loader.js

var start_url = '../load/Upload/start';
var continue_url = '../load/Upload/continue/';
var finish_url = '../load/Upload/finish/';
var startUrl = '../load/Upload/start';
var continueUrl = '../load/Upload/continue/';
var finishUrl = '../load/Upload/finish/';
var chunkSize = 5*1024*1024;

// read a chunk of the file
Expand Down Expand Up @@ -33,7 +33,7 @@ async function readFileChunks(file, token) {
try {
const data = await promiseChunkFileReader(file, part);
const body = {chunkSize: chunkSize, offset: part*chunkSize, data: data};
const res = await continue_upload(token)(body);
const res = await continueUpload(token)(body);
part++;
console.log(part);
} catch (e) {
Expand All @@ -45,7 +45,7 @@ async function readFileChunks(file, token) {
}


async function handle_upload(selectedFiles) {
async function handleUpload(selectedFiles) {
var fnametr = document.getElementById('filenameRow');
var tokentr = document.getElementById('tokenRow');
var slidetr = document.getElementById('slidenameRow');
Expand Down Expand Up @@ -73,8 +73,8 @@ async function handle_upload(selectedFiles) {

selectedFile = selectedFiles[i];
const filename = document.getElementById('filename'+currID).value;
const token = await start_upload(filename);
const callback = continue_upload(token);
const token = await startUpload(filename);
const callback = continueUpload(token);
document.getElementById('token'+currID).value = token;
readFileChunks(selectedFile, token);
// parseFile(selectedFile, callback, 0, x=>(changeStatus("UPLOAD", "Finished Reading File")))
Expand All @@ -84,9 +84,9 @@ async function handle_upload(selectedFiles) {
document.getElementById('controlButtons').colSpan = selectedFiles.length+1;
}

async function start_upload(filename) {
async function startUpload(filename) {
const body = {filename: filename};
const token = fetch(start_url, {method: 'POST', body: JSON.stringify(body), headers: {
const token = fetch(startUrl, {method: 'POST', body: JSON.stringify(body), headers: {
'Content-Type': 'application/json; charset=utf-8',
}}).then((x)=>x.json());
try {
Expand All @@ -98,29 +98,29 @@ async function start_upload(filename) {
}
}

function continue_upload(token) {
function continueUpload(token) {
return async function(body) {
changeStatus('UPLOAD', 'Uploading chunk at: '+ body.offset +' of size '+ body.chunkSize);
return await fetch(continue_url + token, {method: 'POST', body: JSON.stringify(body), headers: {
return await fetch(continueUrl + token, {method: 'POST', body: JSON.stringify(body), headers: {
'Content-Type': 'application/json; charset=utf-8',
}});
};
}
function finish_upload() {
function finishUpload() {
var reset = true;
for (var i=0; i<document.getElementById('fileIdRow').cells.length-1; i++) {
const token = document.getElementById('token'+i).value;
const filename = document.getElementById('filename'+i).value;
const body = {filename: filename};
changeStatus('UPLOAD', 'Finished Reading File, Posting');
const reg_req = fetch(finish_url + token, {method: 'POST', body: JSON.stringify(body), headers: {
const regReq = fetch(finishUrl + token, {method: 'POST', body: JSON.stringify(body), headers: {
'Content-Type': 'application/json; charset=utf-8',
}});
console.log(i);
reg_req.then((x)=>x.json()).then((a)=>{
regReq.then((x)=>x.json()).then((a)=>{
changeStatus('UPLOAD | Finished', a, reset); console.log(a); reset = false;
});
reg_req.then((e)=> {
regReq.then((e)=> {
if (e['ok']===false) {
changeStatus('UPLOAD | ERROR;', e);
reset = true;
Expand Down
14 changes: 7 additions & 7 deletions apps/loader/loader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var upload_url = '../load/Slide/upload';
var check_url = '../load/Slide/info/';
var thumb_url = '../load/Slide/thumb/';
var uploadUrl = '../load/Slide/upload';
var checkUrl = '../load/Slide/info/';
var thumbUrl = '../load/Slide/thumb/';

var store = new Store('../data/');

Expand Down Expand Up @@ -51,7 +51,7 @@ function changeStatus(step, text, reset=true) {
if (step == 'CHECK') {
// During check, thumbnail needs to be fetched & added to the table
// In this case, text[col[col.length - 1]] is the filename
fetch(thumb_url + text[col[col.length - 1]], {credentials: 'same-origin'}).then(
fetch(thumbUrl + text[col[col.length - 1]], {credentials: 'same-origin'}).then(
(response) => response.json(), // if the response is a JSON object
).then((x)=>{
var tabCell = tr.cells[tr.cells.length-1];
Expand Down Expand Up @@ -80,7 +80,7 @@ function handleUpload(file, filename) {
data.append('file', file);
data.append('filename', filename);
changeStatus('UPLOAD', 'Begun upload');
fetch(upload_url, {
fetch(uploadUrl, {
credentials: 'same-origin',
method: 'POST',
body: data,
Expand All @@ -94,7 +94,7 @@ function handleUpload(file, filename) {
}

function handleCheck(filename, reset, id) {
fetch(check_url + filename, {credentials: 'same-origin'}).then(
fetch(checkUrl + filename, {credentials: 'same-origin'}).then(
(response) => response.json(), // if the response is a JSON object
).then(
(success) => {
Expand All @@ -109,7 +109,7 @@ function handleCheck(filename, reset, id) {
}

function handlePost(filename, slidename, reset) {
fetch(check_url + filename, {credentials: 'same-origin'}).then(
fetch(checkUrl + filename, {credentials: 'same-origin'}).then(
(response) => response.json(), // if the response is a JSON object
).then(
(data) => {
Expand Down
Loading