1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

F OpenNebula/one#5422: Remove web console page

This commit is contained in:
Sergio Betanzos 2021-06-22 18:34:40 +02:00
parent b987aaea25
commit 4880eefb8e
No known key found for this signature in database
GPG Key ID: E3E704F097737136
2 changed files with 1 additions and 91 deletions

View File

@ -1,80 +0,0 @@
/* Copyright 2002-2021, OpenNebula Project, OpenNebula Systems */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
import React, { useState, useEffect, memo } from 'react'
import { Button, makeStyles } from '@material-ui/core'
import { useSocket } from 'client/hooks'
const useStyles = makeStyles(theme => ({
sticky: {
position: 'sticky',
top: 0,
padding: '1em',
backgroundColor: theme.palette.background.paper
},
loading: {
'&::after': {
overflow: 'hidden',
display: 'inline-block',
verticalAlign: 'bottom',
animation: '$ellipsis steps(4,end) 1000ms infinite',
content: '"\\2026"', /* ascii code for the ellipsis character */
width: 0
}
},
'@keyframes ellipsis': {
to: { width: 20 }
}
}))
const ResponseComponent = memo(response => (
<p style={{ wordBreak: 'break-all' }}>{JSON.stringify(response)}</p>
))
ResponseComponent.displayName = 'ResponseComponent'
const Webconsole = () => {
const classes = useStyles()
const [listening, setListening] = useState(false)
const [response, setResponse] = useState([])
const { getHooksSocket } = useSocket()
const toggleListening = () => setListening(list => !list)
useEffect(() => {
listening && getHooksSocket(data => setResponse(prev => [...prev, data]))
}, [listening])
return (
<>
<div className={classes.sticky}>
<p className={listening ? classes.loading : ''}>
{`socket is ${listening ? '' : 'not'} listening`}
</p>
<Button
variant="contained"
color="primary"
onClick={toggleListening}>
{listening ? 'Disconnect' : 'Connect'}
</Button>
</div>
{response?.map((res, index) =>
<ResponseComponent key={index} {...res} />
)}
</>
)
}
export default Webconsole

View File

@ -6,12 +6,10 @@ import {
const Newstone = loadable(() => import('client/containers/Newstone'), { ssr: false })
const TestApi = loadable(() => import('client/containers/TestApi'), { ssr: false })
const WebConsole = loadable(() => import('client/containers/WebConsole'), { ssr: false })
export const PATH = {
NEWSTONE: '/newstone/:resource',
TEST_API: '/test-api',
WEB_CONSOLE: '/webconsole'
TEST_API: '/test-api'
}
export const ENDPOINTS = [
@ -29,14 +27,6 @@ export const ENDPOINTS = [
sidebar: true,
icon: DevIcon,
Component: TestApi
},
{
label: 'Web Console',
path: PATH.WEB_CONSOLE,
devMode: true,
sidebar: true,
icon: DevIcon,
Component: WebConsole
}
]