mirror of
https://github.com/openziti/zrok.git
synced 2024-11-07 08:44:14 +01:00
roughed in ServiceDetail (#107)
This commit is contained in:
parent
a125c4b40b
commit
0756e48841
@ -1,5 +1,6 @@
|
||||
import EnvironmentDetail from "./EnvironmentDetail";
|
||||
import AccountDetail from "./AccountDetail";
|
||||
import ServiceDetail from "./ServiceDetail";
|
||||
|
||||
const Detail = (props) => {
|
||||
let detailComponent = <h1>{props.selection.id} ({props.selection.type})</h1>;
|
||||
@ -12,6 +13,9 @@ const Detail = (props) => {
|
||||
case "environment":
|
||||
detailComponent = <EnvironmentDetail selection={props.selection} />;
|
||||
break;
|
||||
|
||||
case "service":
|
||||
detailComponent = <ServiceDetail selection={props.selection} />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -16,7 +16,6 @@ const EnvironmentDetail = (props) => {
|
||||
useEffect(() => {
|
||||
let mounted = true;
|
||||
let interval = setInterval(() => {
|
||||
if(mounted) {}
|
||||
metadata.getEnvironmentDetail(props.selection.id)
|
||||
.then(resp => {
|
||||
if(mounted) {
|
||||
|
45
ui/src/console/detail/ServiceDetail.js
Normal file
45
ui/src/console/detail/ServiceDetail.js
Normal file
@ -0,0 +1,45 @@
|
||||
import * as metadata from "../../api/metadata";
|
||||
import {Sparklines, SparklinesLine, SparklinesSpots} from "react-sparklines";
|
||||
import {useEffect, useState} from "react";
|
||||
|
||||
const ServiceDetail = (props) => {
|
||||
const [detail, setDetail] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
metadata.getServiceDetail(props.selection.id)
|
||||
.then(resp => {
|
||||
setDetail(resp.data);
|
||||
});
|
||||
}, [props.selection]);
|
||||
|
||||
useEffect(() => {
|
||||
let mounted = true;
|
||||
let interval = setInterval(() => {
|
||||
metadata.getServiceDetail(props.selection.id)
|
||||
.then(resp => {
|
||||
setDetail(resp.data);
|
||||
});
|
||||
}, 1000);
|
||||
return () => {
|
||||
mounted = false;
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, [props.selection]);
|
||||
|
||||
if(detail) {
|
||||
return (
|
||||
<div>
|
||||
<h2>Service: {detail.token}</h2>
|
||||
<div className={"zrok-big-sparkline"}>
|
||||
<Sparklines data={detail.metrics} limit={60} height={20}>
|
||||
<SparklinesLine color={"#3b2693"} />
|
||||
<SparklinesSpots />
|
||||
</Sparklines>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return <></>;
|
||||
}
|
||||
|
||||
export default ServiceDetail;
|
@ -41,6 +41,11 @@ code, pre {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.zrok-big-sparkline {
|
||||
margin-top: 30px;
|
||||
padding: 50px;
|
||||
}
|
||||
|
||||
.btn-close {
|
||||
background: transparent url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3E%3Cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E") 50%/1em auto no-repeat;
|
||||
height: 25px;
|
||||
|
Loading…
Reference in New Issue
Block a user