-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds active runs to Header, changes Layout test (#747)
- Loading branch information
1 parent
39b52e9
commit 2dde578
Showing
4 changed files
with
101 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,83 @@ | ||
import "./header.css"; | ||
|
||
import { Col, Row, Space } from "antd"; | ||
import { Col, Descriptions, Row, Space, Tooltip, Typography } from "antd"; | ||
import React, { useContext } from "react"; | ||
import { Link } from "react-router-dom"; | ||
|
||
import { RunningContext } from "../../context/Running/RunningContext"; | ||
import Logo from "../layout/Logo"; | ||
import Profile from "./Profile"; | ||
|
||
const Header = () => ( | ||
<header> | ||
<Row> | ||
<Col flex="auto"> | ||
<Space size={24}> | ||
<Link to="/"> | ||
<Logo /> | ||
</Link> | ||
<Link to="/history">History</Link> | ||
<Link to="/tests">Tests</Link> | ||
<Link to="/agents">Agents</Link> | ||
</Space> | ||
</Col> | ||
<Col style={{ marginLeft: "auto", display: "flex" }}> | ||
<Profile /> | ||
</Col> | ||
</Row> | ||
</header> | ||
); | ||
const { Text } = Typography; | ||
|
||
const Header = () => { | ||
const { runs } = useContext(RunningContext); | ||
|
||
const activeRunNames = runs ? runs.map((run) => run.title) : []; | ||
|
||
return ( | ||
<header> | ||
<Row> | ||
<Col flex="auto"> | ||
<Space size={24}> | ||
<Link to="/"> | ||
<Logo /> | ||
</Link> | ||
<Link to="/history">History</Link> | ||
<Link to="/tests">Tests</Link> | ||
<Link to="/agents">Agents</Link> | ||
</Space> | ||
</Col> | ||
<Col style={{ display: "flex", alignItems: "center" }}> | ||
{runs && runs.length > 0 && ( | ||
<Tooltip | ||
title={ | ||
<div> | ||
{activeRunNames.map((name, index) => ( | ||
<div key={index}>{name}</div> | ||
))} | ||
</div> | ||
} | ||
placement="bottom" | ||
trigger="hover" | ||
> | ||
<Link to="/"> | ||
<div | ||
style={{ | ||
paddingTop: "5px", | ||
marginRight: "15px", | ||
cursor: "pointer", | ||
display: "inline-block" | ||
}} | ||
> | ||
<Descriptions | ||
size="small" | ||
bordered | ||
labelStyle={{ | ||
borderTopLeftRadius: "20px", | ||
borderBottomLeftRadius: "20px", | ||
borderColor: "#d6d6d6", | ||
background: "white" | ||
}} | ||
contentStyle={{ | ||
borderTopRightRadius: "20px", | ||
borderBottomRightRadius: "20px", | ||
background: "#d9f7be" | ||
}} | ||
> | ||
<Descriptions.Item label="Active Runs"> | ||
<Text strong>{runs.length}</Text> | ||
</Descriptions.Item> | ||
</Descriptions> | ||
</div> | ||
</Link> | ||
</Tooltip> | ||
)} | ||
<Profile /> | ||
</Col> | ||
</Row> | ||
</header> | ||
); | ||
}; | ||
|
||
export default Header; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.