From 0756e4884104a590077dc9dc8f47449ba3ef6907 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Thu, 22 Dec 2022 15:18:49 -0500 Subject: [PATCH] roughed in ServiceDetail (#107) --- ui/src/console/detail/Detail.js | 4 ++ ui/src/console/detail/EnvironmentDetail.js | 1 - ui/src/console/detail/ServiceDetail.js | 45 ++++++++++++++++++++++ ui/src/index.css | 5 +++ 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 ui/src/console/detail/ServiceDetail.js diff --git a/ui/src/console/detail/Detail.js b/ui/src/console/detail/Detail.js index 5170cdc9..ea6e4503 100644 --- a/ui/src/console/detail/Detail.js +++ b/ui/src/console/detail/Detail.js @@ -1,5 +1,6 @@ import EnvironmentDetail from "./EnvironmentDetail"; import AccountDetail from "./AccountDetail"; +import ServiceDetail from "./ServiceDetail"; const Detail = (props) => { let detailComponent =

{props.selection.id} ({props.selection.type})

; @@ -12,6 +13,9 @@ const Detail = (props) => { case "environment": detailComponent = ; break; + + case "service": + detailComponent = ; } return ( diff --git a/ui/src/console/detail/EnvironmentDetail.js b/ui/src/console/detail/EnvironmentDetail.js index 404ac51a..5f3de4c0 100644 --- a/ui/src/console/detail/EnvironmentDetail.js +++ b/ui/src/console/detail/EnvironmentDetail.js @@ -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) { diff --git a/ui/src/console/detail/ServiceDetail.js b/ui/src/console/detail/ServiceDetail.js new file mode 100644 index 00000000..5d0d5a5c --- /dev/null +++ b/ui/src/console/detail/ServiceDetail.js @@ -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 ( +
+

Service: {detail.token}

+
+ + + + +
+
+ ); + } + return <>; +} + +export default ServiceDetail; \ No newline at end of file diff --git a/ui/src/index.css b/ui/src/index.css index 57a8a774..b9258239 100644 --- a/ui/src/index.css +++ b/ui/src/index.css @@ -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;