mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
changed debugger directories
This commit is contained in:
parent
2aa02a5009
commit
45e4d2cd96
@ -24,6 +24,7 @@ export default defineConfig({
|
||||
api: resolve(__dirname, './node_modules/@ragestudio/nodecore-api-lib/src'),
|
||||
plugins: resolve(__dirname, './plugins'),
|
||||
globals: resolve(__dirname, './globals'),
|
||||
debuggers: resolve(__dirname, './src/debuggers'),
|
||||
core: resolve(__dirname, './src/core'),
|
||||
theme: resolve(__dirname, './src/theme'),
|
||||
config: resolve(__dirname, './config'),
|
||||
|
54
src/debuggers/redux.js
Normal file
54
src/debuggers/redux.js
Normal file
@ -0,0 +1,54 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'umi';
|
||||
import * as antd from 'antd'
|
||||
import * as Icons from 'components/Icons'
|
||||
import { __legacy__objectToArray } from 'core'
|
||||
|
||||
class ReduxDebugger extends React.Component {
|
||||
state = {
|
||||
app_state: null
|
||||
}
|
||||
|
||||
render() {
|
||||
const modelToMap = (data) => {
|
||||
if (!data) return false
|
||||
return __legacy__objectToArray(data).map(e => {
|
||||
try {
|
||||
const v = JSON.stringify(e.value)
|
||||
if (!v) return false
|
||||
return (
|
||||
<div style={{ margin: '0 5px 15px 5px' }} key={e.key} >
|
||||
<h4>{e.key}</h4>
|
||||
{v.length < 500 ? <span>{v}</span> : <antd.Collapse ><antd.Collapse.Panel header={`Hidden text ( ${v.length} Characters )`}><span>{v}</span></antd.Collapse.Panel></antd.Collapse>}
|
||||
</div>
|
||||
)
|
||||
} catch (error) {
|
||||
return null
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<antd.Collapse style={{ border: 0 }}>
|
||||
|
||||
<antd.Collapse.Panel style={{ wordBreak: 'break-all' }} header={<><Icons.Redux style={{ height: '19px', marginRight: '7px' }} /> socket</>}>
|
||||
{modelToMap(this.props.app)}
|
||||
</antd.Collapse.Panel>
|
||||
|
||||
<antd.Collapse.Panel style={{ wordBreak: 'break-all' }} header={<><Icons.Redux style={{ height: '19px', marginRight: '7px' }} /> contextmenu</>}>
|
||||
{modelToMap(this.props.contextMenu)}
|
||||
</antd.Collapse.Panel>
|
||||
|
||||
<antd.Collapse.Panel style={{ wordBreak: 'break-all' }} header={<><Icons.Redux style={{ height: '19px', marginRight: '7px' }} /> socket</>}>
|
||||
{modelToMap(this.props.socket)}
|
||||
</antd.Collapse.Panel>
|
||||
|
||||
</antd.Collapse>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default connect((store) => (store))(ReduxDebugger)
|
97
src/debuggers/socket.js
Normal file
97
src/debuggers/socket.js
Normal file
@ -0,0 +1,97 @@
|
||||
import React from 'react'
|
||||
import jwt from 'jsonwebtoken'
|
||||
import io from 'socket.io-client'
|
||||
import { connect } from 'umi'
|
||||
import * as antd from 'antd'
|
||||
import { __legacy__objectToArray } from 'core'
|
||||
import settings from 'core/libs/settings'
|
||||
|
||||
const defaultSocketAddress = "localhost:7000"
|
||||
|
||||
@connect(({ app, socket }) => ({ app, socket }))
|
||||
export default class SocketDebug extends React.Component {
|
||||
state = {
|
||||
resolvers: __legacy__objectToArray(this.props.app.resolvers),
|
||||
InputRaw: defaultSocketAddress
|
||||
}
|
||||
|
||||
dispatchSocket(value) {
|
||||
this.props.dispatch({
|
||||
type: `socket/initializeSocket`,
|
||||
payload: {
|
||||
address: value
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
handleDisconnectSocket() {
|
||||
const socket = this.props.socket.socket_conn
|
||||
if (socket) {
|
||||
console.log("closing")
|
||||
socket.conn.close()
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { socket_opt } = this.props.socket
|
||||
return (
|
||||
<div>
|
||||
<antd.Card>
|
||||
<h2>socket state</h2>
|
||||
<antd.List
|
||||
dataSource={__legacy__objectToArray(this.props.socket)}
|
||||
renderItem={(e) => {
|
||||
try {
|
||||
const v = JSON.stringify(e.value)
|
||||
if (!v) return false
|
||||
return (
|
||||
<antd.Collapse>
|
||||
<antd.Collapse.Panel header={`${e.key} (${v.length}) characters`}>
|
||||
<div style={{ margin: '0 5px 15px 5px', wordBreak: "break-all" }} key={e.key} >
|
||||
<span>{v}</span>
|
||||
</div>
|
||||
</antd.Collapse.Panel>
|
||||
</antd.Collapse>
|
||||
)
|
||||
} catch (error) {
|
||||
return <div style={{ display: "flex", alignItems: "center", padding: "12px 16px", height: "47px", backgroundColor: "#d9d9d9" }} >
|
||||
This could not be rendered > ({e.key}) [{typeof(e.value)}]
|
||||
</div>
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</antd.Card>
|
||||
|
||||
|
||||
{socket_opt ?
|
||||
<antd.Card>
|
||||
<h2> socket_opt </h2>
|
||||
<antd.List
|
||||
grid={{
|
||||
gutter: 5,
|
||||
xxl: 3,
|
||||
}}
|
||||
dataSource={__legacy__objectToArray(socket_opt)}
|
||||
renderItem={(e) => {
|
||||
return (
|
||||
<div style={{ border: "0.1px rgb(217, 217, 217) solid", backgroundColor: "rgb(250, 250, 250)", borderRadius: "4px", width: "fit-content", paddingRight: "12px" }}>
|
||||
<antd.Tag>{e.key}</antd.Tag>{JSON.stringify(e.value)}
|
||||
</div>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</antd.Card>
|
||||
: null}
|
||||
|
||||
<antd.Card>
|
||||
<antd.Button onClick={() => this.dispatchSocket(this.state.InputRaw)} > Connect </antd.Button>
|
||||
<antd.Button onClick={() => this.handleDisconnectSocket()} > Disconnect </antd.Button>
|
||||
<antd.Button onClick={() => this.setState({ InputRaw: defaultSocketAddress })} > Set default </antd.Button>
|
||||
<antd.Input onChange={(e) => this.setState({ InputRaw: e.target.value })} value={this.state.InputRaw} placeholder="ws:// http:// some.bruh:9090" />
|
||||
<hr />
|
||||
</antd.Card>
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
import React from 'react'
|
||||
import jwt from 'jsonwebtoken'
|
||||
import io from 'socket.io-client'
|
||||
import { connect } from 'umi'
|
||||
import * as antd from 'antd'
|
||||
import { __legacy__objectToArray } from 'core'
|
||||
import settings from 'core/libs/settings'
|
||||
|
||||
const defaultSocketAddress = "localhost:7000"
|
||||
|
||||
@connect(({ app }) => ({ app }))
|
||||
export default class SocketDebug extends React.Component{
|
||||
state = {
|
||||
resolvers: __legacy__objectToArray(this.props.app.resolvers),
|
||||
InputRaw: defaultSocketAddress
|
||||
}
|
||||
|
||||
dispatchSocket(value){
|
||||
this.props.dispatch({
|
||||
type: `${settings("app_model")}/initializeSocket`,
|
||||
payload: {
|
||||
address: value
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
handleDisconnectSocket(){
|
||||
const socket = this.props.app.socket_conn
|
||||
if (socket) {
|
||||
console.log("closing")
|
||||
socket.conn.close()
|
||||
}
|
||||
}
|
||||
|
||||
render(){
|
||||
const { socket_opt } = this.props.app
|
||||
return(
|
||||
<div>
|
||||
<antd.Card>
|
||||
<antd.List
|
||||
dataSource={this.state.resolvers}
|
||||
renderItem={(e) => {
|
||||
return(
|
||||
<div>
|
||||
* {e.key} => {e.value}
|
||||
</div>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</antd.Card>
|
||||
|
||||
{socket_opt?
|
||||
<antd.List
|
||||
grid={{
|
||||
gutter: 5,
|
||||
xxl: 3,
|
||||
}}
|
||||
dataSource={__legacy__objectToArray(socket_opt)}
|
||||
renderItem={(e) => {
|
||||
return(
|
||||
<div style={{ border: "0.1px rgb(217, 217, 217) solid" ,backgroundColor: "rgb(250, 250, 250)", borderRadius: "4px", width: "fit-content", paddingRight: "12px" }}>
|
||||
<antd.Tag>{e.key}</antd.Tag>{JSON.stringify(e.value)}
|
||||
</div>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
: null}
|
||||
|
||||
<antd.Card>
|
||||
<antd.Button onClick={() => this.dispatchSocket(this.state.InputRaw)} > Connect </antd.Button>
|
||||
<antd.Button onClick={() => this.handleDisconnectSocket()} > Disconnect </antd.Button>
|
||||
<antd.Input onChange={(e) => this.setState({ InputRaw: e.target.value })} value={this.state.InputRaw} placeholder="ws:// http:// some.bruh:9090" />
|
||||
<antd.Button onClick={() => this.setState({ InputRaw: defaultSocketAddress })} > Set default </antd.Button>
|
||||
</antd.Card>
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
@ -2,13 +2,13 @@ import React from 'react'
|
||||
import * as Icons from 'components/Icons'
|
||||
import { ListedMenu } from 'components'
|
||||
|
||||
import ApiDebug from './debuggers/api'
|
||||
import CoreDebug from './debuggers/core'
|
||||
import ThemeDebug from './debuggers/theme'
|
||||
import SocketDebug from './debuggers/socket'
|
||||
import VerbosityDebug from './debuggers/verbosity'
|
||||
import InternalDebug from './debuggers/internals'
|
||||
import ContextMenuDebug from './debuggers/contextmenu.js'
|
||||
import ApiDebug from 'debuggers/api'
|
||||
import CoreDebug from 'debuggers/core'
|
||||
import ThemeDebug from 'debuggers/theme'
|
||||
import SocketDebug from 'debuggers/socket'
|
||||
import VerbosityDebug from 'debuggers/verbosity'
|
||||
import InternalDebug from 'debuggers/internals'
|
||||
import ContextMenuDebug from 'debuggers/contextmenu.js'
|
||||
|
||||
const Debuggers = {
|
||||
api: <ApiDebug />,
|
||||
|
@ -1,59 +1,16 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'umi';
|
||||
import * as antd from 'antd'
|
||||
import * as Icons from 'components/Icons'
|
||||
import { __legacy__objectToArray } from 'core'
|
||||
|
||||
@connect(({ app, contextMenu }) => ({ app, contextMenu }))
|
||||
class PageIndex extends React.PureComponent {
|
||||
constructor(props){
|
||||
super(props)
|
||||
}
|
||||
state = {
|
||||
app_state: null
|
||||
}
|
||||
|
||||
activeOverlay = () => {
|
||||
this.props.dispatch({
|
||||
type: 'app/updateState',
|
||||
payload: {
|
||||
overlayActive: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const modelToMap = (data) => {
|
||||
if(!data) return false
|
||||
return __legacy__objectToArray(data).map(e => {
|
||||
try {
|
||||
const v = JSON.stringify(e.value)
|
||||
if(!v) return false
|
||||
return(
|
||||
<div style={{ margin: '20px 50px 20px 10px' }} key={e.key} >
|
||||
<h4>{e.key}</h4>
|
||||
{v.length < 500? <span>{v}</span> : <antd.Collapse ><antd.Collapse.Panel header={`Hidden text ( ${v.length} Characters )`}><span>{v}</span></antd.Collapse.Panel></antd.Collapse>}
|
||||
</div>
|
||||
)
|
||||
} catch (error) {
|
||||
return null
|
||||
}
|
||||
})
|
||||
|
||||
import React from 'react'
|
||||
import ReduxDebugger from 'debuggers/redux'
|
||||
import { FloatComponent } from 'components'
|
||||
export default class Index extends React.Component {
|
||||
handleOpenFloat() {
|
||||
FloatComponent({ children: <ReduxDebugger {...this.props} />, title: "redux debugger" })
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<antd.Card style={{ wordBreak: 'break-all' }} title={<><Icons.Redux style={{ height: '19px', marginRight: '7px' }} /> App model</>}>
|
||||
{modelToMap(this.props.app)}
|
||||
</antd.Card>
|
||||
<antd.Card style={{ wordBreak: 'break-all' }} title={<><Icons.Redux style={{ height: '19px', marginRight: '7px' }} /> ContextMenu model</>}>
|
||||
{modelToMap(this.props.contextMenu)}
|
||||
</antd.Card>
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default PageIndex;
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<button onClick={() => this.handleOpenFloat()}> open on float </button>
|
||||
<ReduxDebugger />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user