full support for untunelling services and disabling environments from the ui (#87)

This commit is contained in:
Michael Quigley 2022-11-02 13:25:15 -04:00
parent 37ef68af45
commit b3f3b3bd73
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 7 additions and 7 deletions

View File

@ -9,7 +9,6 @@ const Environments = (props) => {
const disableEnvironment = (envId) => {
console.log(envId)
if(window.confirm('really disable environment "' + envId +'"?')) {
console.log("will delete environment: " + envId)
identity.disable({body: {identity: envId}}).then(resp => {
console.log(resp);
})
@ -52,11 +51,9 @@ const Environments = (props) => {
},
]
const servicesComponent = ({ data }) => <Services services={data.services} />
const servicesComponent = ({ data }) => <Services envId={data.environment.zId} services={data.services} />
const servicesExpanded = row => row.services != null && row.services.length > 0
console.log('now', Date.now())
return (
<div>
<h2>Environments</h2>

View File

@ -2,12 +2,15 @@ import DataTable from 'react-data-table-component';
import {Sparklines, SparklinesLine, SparklinesSpots} from 'react-sparklines';
import {mdiCloseOutline} from "@mdi/js";
import Icon from "@mdi/react";
import * as tunnel from './api/tunnel';
const Services = (props) => {
const humanizeDuration = require("humanize-duration")
const untunnelService = (svcName) => {
const untunnelService = (envId, svcName) => {
if(window.confirm('really disable service "' + svcName +'"?')) {
console.log("will disable serivce: " + svcName)
tunnel.untunnel({body: {zId: envId, svcName: svcName}}).then(resp => {
console.log(resp)
})
}
}
@ -25,7 +28,7 @@ const Services = (props) => {
{
name: 'Actions',
selector: row => <>
<button data-value={row.name} onClick={e => untunnelService(row.name)} title={"Disable Service '"+row.name+"'"}>
<button data-value={row.name} onClick={e => untunnelService(props.envId, row.name)} title={"Disable Service '"+row.name+"'"}>
<Icon path={mdiCloseOutline} size={0.7}/>
</button>
</>