Skip to content

Commit 7e7d199

Browse files
committed
cooler style
1 parent cd1d669 commit 7e7d199

File tree

2 files changed

+97
-29
lines changed

2 files changed

+97
-29
lines changed

ui/src/scheduler/scheduler.page.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ const TaskStatusHistoryOverviewView = ({
6060
<Card.Header
6161
as="h5"
6262
className="d-flex justify-content-between align-items-center"
63+
style={{
64+
background: "linear-gradient(45deg, #007bff, #00d8ff)",
65+
color: "white",
66+
}}
6367
>
6468
{name}
6569
</Card.Header>

ui/src/scheduler/views/scheduler.view.tsx

Lines changed: 93 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,34 @@ import { Card, Col, Form, ProgressBar, Row } from "react-bootstrap";
55
interface Props {
66
scheduler: SchedulerEntity;
77
}
8+
import { Tooltip, OverlayTrigger } from "react-bootstrap";
9+
810
const SchedulerStatusView = ({ scheduler }: Props) => {
11+
const renderTooltip = (props: any, label: string) => (
12+
<Tooltip id="button-tooltip" {...props}>
13+
{label}
14+
</Tooltip>
15+
);
16+
917
return (
10-
<Card>
18+
<Card className="shadow-sm rounded border-0">
1119
<Card.Header
1220
as="h5"
1321
className="d-flex justify-content-between align-items-center"
22+
style={{
23+
background: "linear-gradient(45deg, #007bff, #00d8ff)",
24+
color: "white",
25+
}}
1426
>
15-
<span>{scheduler.id}</span>
27+
<span>
28+
<i className="fas fa-server"></i> {scheduler.id}
29+
</span>
1630
</Card.Header>
1731
<Card.Body>
1832
<Row>
1933
<Col>
20-
Last Ping: {durationSince(new Date(scheduler.lastPing))}
34+
<strong>Last Ping:</strong>{" "}
35+
{durationSince(new Date(scheduler.lastPing))}
2136
</Col>
2237
<Col>
2338
<Form.Label htmlFor={"slot-" + scheduler.id}>
@@ -26,32 +41,60 @@ const SchedulerStatusView = ({ scheduler }: Props) => {
2641
" of " +
2742
scheduler.tasksSlotCount}
2843
</Form.Label>
29-
<ProgressBar
30-
id={"slot-" + scheduler.id}
31-
animated={true}
32-
min={0}
33-
now={scheduler.runningTasks}
34-
max={scheduler.tasksSlotCount}
35-
></ProgressBar>
44+
<OverlayTrigger
45+
placement="top"
46+
overlay={(props) =>
47+
renderTooltip(
48+
props,
49+
`${scheduler.runningTasks} tasks running`
50+
)
51+
}
52+
>
53+
<ProgressBar
54+
id={"slot-" + scheduler.id}
55+
animated={true}
56+
striped
57+
variant={getVariant(
58+
scheduler.runningTasks,
59+
scheduler.tasksSlotCount
60+
)}
61+
now={scheduler.runningTasks}
62+
max={scheduler.tasksSlotCount}
63+
/>
64+
</OverlayTrigger>
3665
</Col>
3766
</Row>
3867
<Row>
3968
<Col>
4069
<Form.Label htmlFor={"cpu-" + scheduler.id}>
4170
CPU
4271
</Form.Label>
43-
<ProgressBar
44-
id={"cpu-" + scheduler.id}
45-
animated={true}
46-
min={0}
47-
now={scheduler.systemLoadAverage}
48-
max={100}
49-
label={
50-
Math.round(scheduler.systemLoadAverage * 10) /
51-
10 +
52-
"%"
72+
<OverlayTrigger
73+
placement="top"
74+
overlay={(props) =>
75+
renderTooltip(
76+
props,
77+
`CPU Load: ${scheduler.systemLoadAverage}%`
78+
)
5379
}
54-
></ProgressBar>
80+
>
81+
<ProgressBar
82+
id={"cpu-" + scheduler.id}
83+
animated={true}
84+
striped
85+
variant={getVariant(
86+
scheduler.systemLoadAverage,
87+
100
88+
)}
89+
now={scheduler.systemLoadAverage}
90+
max={100}
91+
label={`${
92+
Math.round(
93+
scheduler.systemLoadAverage * 10
94+
) / 10
95+
}%`}
96+
/>
97+
</OverlayTrigger>
5598
</Col>
5699
<Col>
57100
<Form.Label htmlFor={"memory-" + scheduler.id}>
@@ -60,14 +103,28 @@ const SchedulerStatusView = ({ scheduler }: Props) => {
60103
" of " +
61104
formatMemory(scheduler.maxHeap)}
62105
</Form.Label>
63-
<ProgressBar
64-
id={"memory-" + scheduler.id}
65-
animated={true}
66-
min={0}
67-
now={scheduler.usedHeap}
68-
max={scheduler.maxHeap}
69-
label={formatMemory(scheduler.usedHeap)}
70-
></ProgressBar>
106+
<OverlayTrigger
107+
placement="top"
108+
overlay={(props) =>
109+
renderTooltip(
110+
props,
111+
`${formatMemory(scheduler.usedHeap)} used`
112+
)
113+
}
114+
>
115+
<ProgressBar
116+
id={"memory-" + scheduler.id}
117+
animated={true}
118+
striped
119+
variant={getVariant(
120+
scheduler.usedHeap,
121+
scheduler.maxHeap
122+
)}
123+
now={scheduler.usedHeap}
124+
max={scheduler.maxHeap}
125+
label={formatMemory(scheduler.usedHeap)}
126+
/>
127+
</OverlayTrigger>
71128
</Col>
72129
</Row>
73130
</Card.Body>
@@ -106,3 +163,10 @@ function formatMemory(value: number) {
106163
}
107164
return Math.round(result) + "MB";
108165
}
166+
167+
function getVariant(value: number, max: number) {
168+
const percentage = (value / max) * 100;
169+
if (percentage < 80) return "success"; // Grün
170+
if (percentage < 100) return "warning"; // Gelb
171+
return "danger"; // Rot
172+
}

0 commit comments

Comments
 (0)