Skip to content

Commit 389273b

Browse files
new empty state
1 parent 936f61c commit 389273b

File tree

8 files changed

+158
-5
lines changed

8 files changed

+158
-5
lines changed
Lines changed: 17 additions & 0 deletions
Loading
Lines changed: 28 additions & 0 deletions
Loading
Lines changed: 22 additions & 0 deletions
Loading
Lines changed: 16 additions & 0 deletions
Loading
Lines changed: 28 additions & 0 deletions
Loading
Lines changed: 14 additions & 0 deletions
Loading

frontend/src/Pioreactors.jsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,20 @@ import {
9292
disabledColor,
9393
stateDisplay,
9494
} from "./color";
95-
import cloudImage from './assets/pioreactor_cloud.webp'
9695
import MissingWorkerModelModal from "./components/MissingWorkerModelModal";
9796

9897
const workerMissingModelDetails = (worker) =>
9998
worker?.model_name == null || worker?.model_version == null;
10099

100+
const EMPTY_STATE_ILLUSTRATIONS = [
101+
"/static/svgs/yeast-cells.svg",
102+
"/static/svgs/bacteria-cells.svg",
103+
"/static/svgs/coccus-cells.svg",
104+
"/static/svgs/spore-forming-bacilli.svg",
105+
"/static/svgs/bacteria-two-bacillus-touching.svg",
106+
"/static/svgs/bacteria-three-bacillus-touching.svg",
107+
];
108+
101109

102110

103111
function StateTypography({ state, isDisabled=false }) {
@@ -3373,6 +3381,10 @@ function Pioreactors({title}) {
33733381
const [isLoading, setIsLoading] = useState(true);
33743382
const [availableModels, setAvailableModels] = useState([]);
33753383
const [modelCheckKey, setModelCheckKey] = useState(0);
3384+
const emptyStateIllustration = useMemo(() => {
3385+
const randomIndex = Math.floor(Math.random() * EMPTY_STATE_ILLUSTRATIONS.length);
3386+
return EMPTY_STATE_ILLUSTRATIONS[randomIndex];
3387+
}, []);
33763388

33773389
useEffect(() => {
33783390
document.title = title;
@@ -3434,7 +3446,11 @@ function Pioreactors({title}) {
34343446
<Box sx={{textAlign: "center"}}>
34353447
{isLoading ? <CircularProgress /> : (
34363448
<>
3437-
<img alt="filler image for no pioreactor assigned" src={cloudImage} style={{width: "500px", opacity: 0.9, filter: "grayscale(50%)", marginLeft: "30px"}}/>
3449+
<img
3450+
alt="filler image for no pioreactor assigned"
3451+
src={emptyStateIllustration}
3452+
style={{width: "420px", opacity: 0.8, marginBottom: "8px"}}
3453+
/>
34383454
<Typography component='div' variant='h6' sx={{mb: 2}}>
34393455
No Pioreactors assigned to this experiment
34403456
</Typography>

frontend/src/components/PaginatedLogsTable.jsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect } from 'react';
1+
import React, { useState, useEffect, useMemo } from 'react';
22
import { useMQTT } from '../providers/MQTTContext'; // Import the useMQTT hook
33
import dayjs from 'dayjs';
44
import utc from 'dayjs/plugin/utc';
@@ -19,7 +19,6 @@ import { ERROR_COLOR, WARNING_COLOR, NOTICE_COLOR } from "../color";
1919
import Chip from '@mui/material/Chip';
2020
import PioreactorIcon from "./PioreactorIcon"
2121
import { Link } from 'react-router';
22-
import emptyStateIllustration from '../assets/undraw_clouds_bmtk.svg';
2322

2423
// Activate the UTC plugin
2524
dayjs.extend(utc);
@@ -68,11 +67,24 @@ const LEVELS = [
6867
"CRITICAL"
6968
]
7069

70+
const EMPTY_STATE_ILLUSTRATIONS = [
71+
"/static/svgs/yeast-cells.svg",
72+
"/static/svgs/bacteria-cells.svg",
73+
"/static/svgs/coccus-cells.svg",
74+
"/static/svgs/spore-forming-bacilli.svg",
75+
"/static/svgs/bacteria-two-bacillus-touching.svg",
76+
"/static/svgs/bacteria-three-bacillus-touching.svg",
77+
];
78+
7179
function PaginatedLogTable({pioreactorUnit, experiment, relabelMap, logLevel }) {
7280
const [listOfLogs, setListOfLogs] = useState([]);
7381
const [skip, setSkip] = useState(0); // Tracks the number of logs already loaded
7482
const [loading, setLoading] = useState(false); // Tracks if the logs are currently loading
7583
const [onlyAssignedLogs, setOnlyAssignedLogs] = useState(true);
84+
const emptyStateIllustration = useMemo(() => {
85+
const randomIndex = Math.floor(Math.random() * EMPTY_STATE_ILLUSTRATIONS.length);
86+
return EMPTY_STATE_ILLUSTRATIONS[randomIndex];
87+
}, []);
7688
const { client, subscribeToTopic, unsubscribeFromTopic } = useMQTT();
7789

7890
const getAPIURL = (unit, onlyAssignedLogs, experiment) => {
@@ -236,7 +248,7 @@ function PaginatedLogTable({pioreactorUnit, experiment, relabelMap, logLevel })
236248
</TableContainer>
237249
) : showEmptyState ? (
238250
<Box display="flex" flexDirection="column" alignItems="center" justifyContent="center" sx={{ minHeight: "350px", gap: 2, textAlign: "center" }}>
239-
<Box component="img" src={emptyStateIllustration} alt="No logs illustration" sx={{ maxWidth: "320px", width: "100%", opacity: 0.9 }} />
251+
<Box component="img" src={emptyStateIllustration} alt="No logs illustration" sx={{ maxWidth: "350px", width: "100%", opacity: 0.8 }} />
240252
<Box sx={{ color: "#5f6a7d", fontSize: "14px" }}>
241253
No logs yet. They will appear here once your Pioreactor starts reporting activity.
242254
</Box>

0 commit comments

Comments
 (0)