Added TELL spreadsheet template
This commit is contained in:
@ -1,11 +1,26 @@
|
|||||||
from fastapi import APIRouter, UploadFile, File, HTTPException
|
from fastapi import APIRouter, UploadFile, File, HTTPException
|
||||||
import logging
|
import logging
|
||||||
from app.services.spreadsheet_service import SampleSpreadsheetImporter, SpreadsheetImportError
|
from app.services.spreadsheet_service import SampleSpreadsheetImporter, SpreadsheetImportError
|
||||||
|
from fastapi.responses import FileResponse
|
||||||
|
import os
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/download-template", response_class=FileResponse)
|
||||||
|
async def download_template():
|
||||||
|
# Constructing the absolute path
|
||||||
|
current_dir = os.path.dirname(__file__)
|
||||||
|
template_path = os.path.join(current_dir, "../../downloads/V7_TELLSamplesSpreadsheetTemplate.xlsx")
|
||||||
|
|
||||||
|
if not os.path.exists(template_path):
|
||||||
|
raise HTTPException(status_code=404, detail="Template file not found.")
|
||||||
|
|
||||||
|
return FileResponse(template_path, filename="V7_TELLSamplesSpreadsheetTemplate.xlsx",
|
||||||
|
media_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
||||||
|
|
||||||
|
|
||||||
@router.post("/upload")
|
@router.post("/upload")
|
||||||
async def upload_file(file: UploadFile = File(...)):
|
async def upload_file(file: UploadFile = File(...)):
|
||||||
try:
|
try:
|
||||||
|
@ -260,4 +260,11 @@ class SpreadsheetModel(BaseModel):
|
|||||||
return v
|
return v
|
||||||
|
|
||||||
class TELLModel(SpreadsheetModel):
|
class TELLModel(SpreadsheetModel):
|
||||||
pass # Extend the SpreadsheetModel with TELL-specific fields if needed
|
input_order: int
|
||||||
|
samplemountcount: int = 0
|
||||||
|
samplestatus: str = "not present"
|
||||||
|
puckaddress: str = "---"
|
||||||
|
username: str
|
||||||
|
puck_number: int
|
||||||
|
prefix: Optional[str]
|
||||||
|
folder: Optional[str]
|
BIN
backend/downloads/V7_TELLSamplesSpreadsheetTemplate.xlsx
Normal file
BIN
backend/downloads/V7_TELLSamplesSpreadsheetTemplate.xlsx
Normal file
Binary file not shown.
@ -28,8 +28,7 @@ const UploadDialog: React.FC<UploadDialogProps> = ({ open, onClose }) => {
|
|||||||
dewars: string[];
|
dewars: string[];
|
||||||
pucks_count: number;
|
pucks_count: number;
|
||||||
pucks: string[];
|
pucks: string[];
|
||||||
samples_count: number;
|
samples_count: string[];
|
||||||
samples: string[];
|
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -86,9 +85,9 @@ const UploadDialog: React.FC<UploadDialogProps> = ({ open, onClose }) => {
|
|||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<Box display="flex" flexDirection="column" alignItems="center" mb={2}>
|
<Box display="flex" flexDirection="column" alignItems="center" mb={2}>
|
||||||
<img src={logo} alt="Logo" style={{ width: 200, marginBottom: 16 }} />
|
<img src={logo} alt="Logo" style={{ width: 200, marginBottom: 16 }} />
|
||||||
<Typography variant="subtitle1">Latest Spreadsheet Template Version 6</Typography>
|
<Typography variant="subtitle1">Latest Spreadsheet Template Version 7</Typography>
|
||||||
<Typography variant="body2" color="textSecondary">Last update: October 18, 2024</Typography>
|
<Typography variant="body2" color="textSecondary">Last update: November 6, 2024</Typography>
|
||||||
<Button variant="outlined" startIcon={<DownloadIcon />} href="/path/to/template.xlsx" download sx={{ mt: 1 }}>
|
<Button variant="outlined" startIcon={<DownloadIcon />} href="http://127.0.0.1:8000/download-template" download sx={{ mt: 1 }}>
|
||||||
Download XLSX
|
Download XLSX
|
||||||
</Button>
|
</Button>
|
||||||
<Typography variant="subtitle1" sx={{ mt: 3 }}>Latest Spreadsheet Instructions Version 2.3</Typography>
|
<Typography variant="subtitle1" sx={{ mt: 3 }}>Latest Spreadsheet Instructions Version 2.3</Typography>
|
||||||
|
Reference in New Issue
Block a user