This repository has been archived by the owner on Mar 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show metrics for function invocation for 1hr and 24hr periods. The metrics component resolves #189 Signed-off-by: jagreehal <[email protected]>
- Loading branch information
Showing
5 changed files
with
220 additions
and
70 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
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
3 changes: 3 additions & 0 deletions
3
dashboard/client/src/components/FunctionInvocation/FunctionInvocation.css
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.nav-link.active { | ||
border-bottom: 5px solid #007bff; | ||
} |
82 changes: 82 additions & 0 deletions
82
dashboard/client/src/components/FunctionInvocation/index.jsx
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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import React from 'react'; | ||
import { | ||
Badge, | ||
ListGroup, | ||
ListGroupItem, | ||
Nav, | ||
NavLink, | ||
Progress | ||
} from 'reactstrap'; | ||
|
||
import './FunctionInvocation.css'; | ||
|
||
const OPTIONS = { | ||
'1hr': '60m', | ||
'24hr': '1440m' | ||
}; | ||
|
||
export class FunctionInvocation extends React.Component { | ||
state = { | ||
selected: '1hr' | ||
}; | ||
|
||
render() { | ||
const { functionInvocationData } = this.props; | ||
let { success, failure } = functionInvocationData; | ||
const navLinks = Object.keys(OPTIONS).map(option => { | ||
return ( | ||
<NavLink | ||
key={option} | ||
href="#" | ||
active={option === this.state.selected} | ||
onClick={() => this.navLinkClickHandle(option)} | ||
> | ||
{option} | ||
</NavLink> | ||
); | ||
}); | ||
|
||
const total = success + failure; | ||
const successPercent = (success / total) * 100; | ||
const failurePercent = (failure / total) * 100; | ||
|
||
return ( | ||
<div className=""> | ||
<Nav className="d-flex justify-content-center"> | ||
<span className="d-flex align-items-center mr-4 font-weight-bold"> | ||
Period: | ||
</span> | ||
{navLinks} | ||
</Nav> | ||
<div> | ||
<Progress multi={true} className="mt-3 d-flex justify-content-center"> | ||
<Progress bar={true} color="success" value={successPercent} /> | ||
<Progress bar={true} color="danger" value={failurePercent} /> | ||
</Progress> | ||
<span className="font-weight-bold">{total}</span> invocations | ||
</div> | ||
<ListGroup className="mt-3 m0 flex-row"> | ||
<ListGroupItem className="d-flex flex-fill flex-column align-items-center"> | ||
<h5 className="m-0"> | ||
<Badge color="success">{success}</Badge> | ||
</h5> | ||
<span>Success</span> | ||
</ListGroupItem> | ||
<ListGroupItem className="d-flex flex-fill flex-column align-items-center"> | ||
<h5 className="m0"> | ||
<Badge color="danger">{failure}</Badge> | ||
</h5> | ||
<span>Error</span> | ||
</ListGroupItem> | ||
</ListGroup> | ||
</div> | ||
); | ||
} | ||
|
||
navLinkClickHandle = option => { | ||
this.setState({ | ||
selected: option | ||
}); | ||
this.props.changeFunctionInvocationTimePeriod(OPTIONS[option]); | ||
}; | ||
} |
Oops, something went wrong.