Skip to content

Commit 1a1db4b

Browse files
committed
feat: add zetaPotential
1 parent 29cf08b commit 1a1db4b

2 files changed

Lines changed: 38 additions & 2 deletions

File tree

eln/ExtSample.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ class Sample {
177177
droppedHg: 'hgPorosimetry',
178178
droppedDCS: 'differentialCentrifugalSedimentation',
179179
droppedDLS: 'dls',
180+
droppedZetaPotential: 'zetaPotential',
180181
droppedXRF: 'xrf',
181182
droppedImage: 'image',
182183
droppedGenbank: 'genbank',

eln/Sample.js

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ Your local changes will be lost.</p>`;
183183
createVar(sampleVar, 'xps');
184184
createVar(sampleVar, 'icp');
185185
createVar(sampleVar, 'dls');
186+
createVar(sampleVar, 'zetaPotential');
186187
createVar(sampleVar, 'cyclicVoltammetry');
187188
createVar(sampleVar, 'elementalAnalysis');
188189
createVar(sampleVar, 'differentialScanningCalorimetry');
@@ -324,6 +325,7 @@ Your local changes will be lost.</p>`;
324325
droppedCV: 'cyclicVoltammetry',
325326
droppedTGA: 'thermogravimetricAnalysis',
326327
droppedDLS: 'dls',
328+
droppedZetaPotential: 'zetaPotential',
327329
droppedIsotherm: 'isotherm',
328330
droppedDSC: 'differentialScanningCalorimetry',
329331
droppedHg: 'hgPorosimetry',
@@ -368,7 +370,8 @@ Your local changes will be lost.</p>`;
368370
cyclicVoltammetry: 'Cyclic voltammetry (csv, tsv, txt, jcamp, pdf)',
369371
differentialScanningCalorimetry:
370372
'Differential Scanning Calorimetry (csv, tsv, txt, jcamp)',
371-
dls: 'Dynamic light scattering Analysis (csv, tsv, txt, jcamp)',
373+
dls: 'Dynamic light scattering Analysis (csv, tsv, txt, jcamp, zmes)',
374+
zetaPotential: 'Zeta Potential (csv, tsv, txt, jcamp, zmes)',
372375
xray: 'Crystal structure (cif, pdb)',
373376
image: 'Images (jpg, png or tiff)',
374377
video: 'Videos (mp4, m4a, avi, wav)',
@@ -436,9 +439,23 @@ Your local changes will be lost.</p>`;
436439
droppedData.converted = true;
437440
}
438441
}
442+
// Keep original files alongside converted ones
443+
const originalFiles = droppedDatas
444+
.filter((droppedData) => droppedData.converted)
445+
.map((droppedData) => {
446+
const original = { ...droppedData };
447+
delete original.converted;
448+
// If no extension or text-like, ensure .txt extension
449+
const extension = original.filename.replace(/.*\./, '').toLowerCase();
450+
if (['csv', 'tsv', 'txt'].includes(extension) || !extension) {
451+
original.filename = original.filename.replace(/\.[^.]*$/, '.txt');
452+
}
453+
return original;
454+
});
439455
droppedDatas = droppedDatas
440456
.filter((droppedData) => !droppedData.converted)
441-
.concat(newData);
457+
.concat(newData)
458+
.concat(originalFiles);
442459
}
443460

444461
/*
@@ -542,6 +559,11 @@ Your local changes will be lost.</p>`;
542559
xUnit: 'Diameter [nm]',
543560
yUnit: 'Intensity',
544561
},
562+
zetaPotential: {
563+
type: 'Zeta potential',
564+
xUnit: 'Zeta potential [mV]',
565+
yUnit: 'Intensity',
566+
},
545567
};
546568

547569
for (let droppedData of droppedDatas) {
@@ -614,6 +636,19 @@ Your local changes will be lost.</p>`;
614636
);
615637
if (!meta) return;
616638

639+
// Keep the original text file alongside the converted jcamp
640+
const originalFilename = droppedData.filename.replace(
641+
/\.[^.]*$/,
642+
'.txt',
643+
);
644+
droppedDatas.push({
645+
filename: originalFilename,
646+
mimetype: droppedData.mimetype,
647+
contentType: droppedData.contentType,
648+
encoding: droppedData.encoding,
649+
content: droppedData.content,
650+
});
651+
617652
droppedData.filename = `${meta.filename}`;
618653
droppedData.mimetype = 'chemical/x-jcamp-dx';
619654
droppedData.contentType = 'chemical/x-jcamp-dx';

0 commit comments

Comments
 (0)