Skip to content

Commit 83938ce

Browse files
Update experiment pages layout (#219)
* update fancytree counter font size * add experiment upper bar * solve responsive issues * minor visual fixes * update CHANGELOG
1 parent cfe376a commit 83938ce

14 files changed

+170
-77
lines changed

public/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## Changelog
22

3+
### Pre-release v4.0.1-beta.4 - Release date: TBD
4+
5+
* Updated upper bar in experiment pages to show basic information in all sub sections
6+
* Multiple minor visual improvements
7+
38
### Pre-release v4.0.1-beta.3 - Release date: 2024-12-10
49

510
* **Compatibility with Autosubmit API version >= [4.0.1b5](https://pypi.org/project/autosubmit-api/4.0.1b5/)**

src/App.scss

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -542,45 +542,6 @@ pre.bash-joblog {
542542
height: 22px;
543543
}
544544

545-
.scroll {
546-
max-height: 75vh;
547-
overflow-y: auto;
548-
}
549-
550-
.scroll-ready-tree {
551-
max-height: 308px;
552-
height: 308px;
553-
overflow-y: auto;
554-
}
555-
556-
.scroll-ready-graph {
557-
max-height: 317px;
558-
height: 317px;
559-
overflow-y: auto;
560-
}
561-
562-
.scroll-y {
563-
overflow-y: auto;
564-
height: 275px;
565-
font-size: 0.7rem;
566-
font-family: Arial, Helvetica, sans-serif;
567-
}
568-
569-
.scroll-y-jobs {
570-
overflow-y: auto;
571-
min-height: 100px;
572-
max-height: 500px;
573-
/* font-size: 0.9rem;
574-
font-family: Arial, Helvetica, sans-serif; */
575-
}
576-
577-
.scroll-y-tree {
578-
overflow-y: auto;
579-
height: 281px;
580-
font-size: 0.7rem;
581-
font-family: Arial, Helvetica, sans-serif;
582-
}
583-
584545
.scroll-x {
585546
overflow-x: auto;
586547
}

src/common/AuthBadge.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { useNavigate } from "react-router-dom";
66
import { AUTHENTICATION } from "../consts";
77
import { Menu, Transition } from "@headlessui/react";
88
import { cn } from "../services/utils";
9+
import { DotLoader } from "./Loaders";
910

1011
const AuthBadge = () => {
1112
const authState = useSelector((state) => state.auth);
@@ -114,7 +115,7 @@ const AuthBadge = () => {
114115
className="btn btn-light rounded-full font-bold drop-shadow py-2 px-4 border"
115116
onClick={handleLogin}
116117
>
117-
{isFetching ? "..." : "Login"}
118+
{isFetching ? <DotLoader /> : "Login"}
118119
</button>
119120
)}
120121
</>

src/common/ExperimentCard.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const ActiveIndicator = ({ isActive }) => {
1212
className={cn(
1313
"relative",
1414
"min-w-6 min-h-6 rounded-full border",
15+
"w-6 h-6",
1516
"dark:border-dark",
1617
isActive ? "bg-success animate-pulse-soft" : "bg-white"
1718
)}
@@ -163,3 +164,4 @@ const ExperimentCard = forwardRef(({ experiment }, ref) => {
163164
});
164165

165166
export default ExperimentCard;
167+
export { ActiveIndicator };

src/common/ExperimentInfoHeader.jsx

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import { useState } from "react";
2+
import { autosubmitApiV3 } from "../services/autosubmitApiV3";
3+
import { cn } from "../services/utils";
4+
import { ActiveIndicator } from "./ExperimentCard";
5+
import { DotLoader } from "./Loaders";
6+
7+
const ExperimentInfoHeader = ({ expid }) => {
8+
const [open, setOpen] = useState(false);
9+
10+
const {
11+
data: expInfoData,
12+
isFetching: isExpInfoFetching,
13+
isError: isExpInfoError,
14+
} = autosubmitApiV3.endpoints.getExperimentInfo.useQuery(expid);
15+
16+
const handleToggle = () => {
17+
setOpen((prev) => !prev);
18+
};
19+
20+
return (
21+
<>
22+
<div className="flex flex-col gap-4 mb-2">
23+
<div className="flex px-4 gap-6 items-center">
24+
<ActiveIndicator isActive={expInfoData?.running} />
25+
<div className="text-xl font-semibold grow line-clamp-3">
26+
{isExpInfoFetching ? (
27+
<DotLoader dotClassName={"bg-black dark:bg-white"} />
28+
) : (
29+
<>
30+
{isExpInfoError ? (
31+
<span className="text-danger">
32+
<i className="fa-solid fa-triangle-exclamation"></i>{" "}
33+
{"Error getting experiment info"}
34+
</span>
35+
) : (
36+
<>{expInfoData?.description || "-"}</>
37+
)}
38+
</>
39+
)}
40+
</div>
41+
<button
42+
onClick={handleToggle}
43+
className="btn rounded-full hover:bg-black/5 aspect-square"
44+
>
45+
<i
46+
className={cn(
47+
"ms-auto fa-solid",
48+
open ? "fa-angle-down" : "fa-angle-up"
49+
)}
50+
></i>
51+
</button>
52+
</div>
53+
54+
{open && (
55+
<div className="flex flex-col items-start ps-16 pe-6 gap-2 overflow-auto">
56+
<div className="flex items-center gap-16">
57+
<div>
58+
<span className="font-semibold">User: </span>
59+
{expInfoData?.owner || "-"}
60+
</div>
61+
<div>
62+
<span className="font-semibold">HPC: </span>
63+
{expInfoData?.hpc || "-"}
64+
</div>
65+
<div>
66+
<span className="font-semibold">Autosubmit version: </span>
67+
{expInfoData?.version || "-"}
68+
</div>
69+
</div>
70+
<div className="flex items-center gap-16">
71+
<div>
72+
<span className="font-semibold">Model: </span>
73+
{expInfoData?.model || "-"}
74+
</div>
75+
<div>
76+
<span className="font-semibold">Branch: </span>
77+
{expInfoData?.branch || "-"}
78+
</div>
79+
</div>
80+
</div>
81+
)}
82+
83+
<hr />
84+
</div>
85+
</>
86+
);
87+
};
88+
89+
export default ExperimentInfoHeader;

src/common/FancyTree.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
.fancytree-ext-childcounter span.fancytree-childcounter {
66
border: 0px !important;
7+
font-size: 7px;
78
}
89

910
ul.fancytree-container {
@@ -49,3 +50,7 @@ span.fancytree-node.fancytree-active-clone {
4950
border-color: #dedede; */
5051
background-color: #e0f2fe;
5152
}
53+
54+
.fancytree-title > span {
55+
color: black;
56+
}

src/common/Loaders.css

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.dot-loader {
2+
display: flex;
3+
}
4+
5+
.dot {
6+
width: 10px;
7+
height: 10px;
8+
margin: 0 5px;
9+
background-color: black;
10+
border-radius: 50%;
11+
animation: dot-loader 1.4s infinite ease-in-out both;
12+
}
13+
14+
.dot:nth-child(1) {
15+
animation-delay: -0.32s;
16+
}
17+
18+
.dot:nth-child(2) {
19+
animation-delay: -0.16s;
20+
}
21+
22+
.dot:nth-child(3) {
23+
animation-delay: 0s;
24+
}
25+
26+
@keyframes dot-loader {
27+
0%,
28+
80%,
29+
100% {
30+
opacity: 0;
31+
}
32+
40% {
33+
opacity: 1;
34+
}
35+
}

src/common/Loaders.jsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from "react";
2+
import "./Loaders.css";
3+
import { cn } from "../services/utils";
4+
5+
const DotLoader = ({className, dotClassName}) => {
6+
return (
7+
<div className={cn("dot-loader", className)}>
8+
<div className={cn("dot", dotClassName)}></div>
9+
<div className={cn("dot", dotClassName)}></div>
10+
<div className={cn("dot", dotClassName)}></div>
11+
</div>
12+
);
13+
};
14+
15+
export { DotLoader };

src/common/LogModal.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const LogModal = ({ logFile, show, onHide }) => {
2323
data.found === true &&
2424
data.logcontent &&
2525
data.logcontent.length > 0 && (
26-
<pre className='bash bash-data mb-0 scroll'>
26+
<pre className='bash bash-data mb-0 overflow-y-auto max-h-[75vh]'>
2727
<ul style={{ listStyleType: "none" }} className='p-1 mb-0 ul-2'>
2828
{data.logcontent.map((item) => (
2929
<li key={item.index}>

src/layout/ExperimentWrapper.jsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Link, useLocation, useParams } from "react-router-dom";
22
import { useState } from "react";
33
import { useLocalStorage, useWindowSize } from "@uidotdev/usehooks";
44
import { cn } from "../services/utils";
5+
import ExperimentInfoHeader from "../common/ExperimentInfoHeader";
56

67
const EXPERIMENT_MENU_ITEMS = [
78
{
@@ -76,6 +77,7 @@ const ExperimentMenuItems = ({ showLabels = true }) => {
7677
}
7778

7879
const ExperimentWrapper = ({ children }) => {
80+
const routeParams = useParams()
7981
const { width } = useWindowSize()
8082
const [
8183
showExperimentMenuLabelsDesktop,
@@ -108,7 +110,11 @@ const ExperimentWrapper = ({ children }) => {
108110
(showLabels ? "fa-angles-left" : "fa-angles-right"))}></i>
109111
</div>
110112
</div>
111-
{children}
113+
114+
<div className="flex flex-col gap-4 grow min-w-0">
115+
<ExperimentInfoHeader expid={routeParams.expid} />
116+
{children}
117+
</div>
112118
</div>
113119
:
114120
<div className="flex gap-4 flex-col">
@@ -129,7 +135,8 @@ const ExperimentWrapper = ({ children }) => {
129135
</div>
130136
}
131137
</div>
132-
138+
139+
<ExperimentInfoHeader expid={routeParams.expid} />
133140
{children}
134141
</div>
135142

0 commit comments

Comments
 (0)