mirror of
https://github.com/openziti/zrok.git
synced 2024-12-22 23:02:52 +01:00
expandable rows for services
This commit is contained in:
parent
dd2b9d006b
commit
347df266e9
@ -1,4 +1,5 @@
|
||||
import DataTable from 'react-data-table-component';
|
||||
import Services from './Services';
|
||||
|
||||
const Environments = (props) => {
|
||||
const columns = [
|
||||
@ -29,6 +30,9 @@ const Environments = (props) => {
|
||||
},
|
||||
]
|
||||
|
||||
const servicesComponent = ({ data }) => <Services services={data.services} />
|
||||
const servicesExpanded = row => row.services != null && row.services.length > 0
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2>Environments</h2>
|
||||
@ -38,6 +42,9 @@ const Environments = (props) => {
|
||||
columns={columns}
|
||||
data={props.overview}
|
||||
defaultSortFieldId={1}
|
||||
expandableRows
|
||||
expandableRowsComponent={servicesComponent}
|
||||
expandableRowExpanded={servicesExpanded}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
31
ui/src/Services.js
Normal file
31
ui/src/Services.js
Normal file
@ -0,0 +1,31 @@
|
||||
import DataTable from 'react-data-table-component';
|
||||
import {useEffect} from "react";
|
||||
|
||||
const Services = (props) => {
|
||||
useEffect((props) => {
|
||||
console.log(props)
|
||||
}, [])
|
||||
|
||||
const columns = [
|
||||
{
|
||||
name: 'Endpoint',
|
||||
selector: row => row.endpoint,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'Service Id',
|
||||
selector: row => row.zitiServiceId,
|
||||
sortable: true,
|
||||
}
|
||||
]
|
||||
|
||||
return (
|
||||
<div className={"nested-services"}>
|
||||
{ props.services && props.services.length > 0 && (
|
||||
<DataTable columns={columns} data={props.services} defaultSortFieldId={1}/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Services;
|
@ -121,4 +121,8 @@ h1, h2, h3, h4, h5, h6 {
|
||||
|
||||
.react-flow__attribution {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.nested-services {
|
||||
padding-left: 10em;
|
||||
}
|
Loading…
Reference in New Issue
Block a user