mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
removed: debuggers
This commit is contained in:
parent
bbcc181ee4
commit
b5c9ce90a4
@ -1,31 +0,0 @@
|
|||||||
import ContextMenu from 'components/Layout/ContextMenu'
|
|
||||||
import { connect } from 'umi'
|
|
||||||
import * as antd from 'antd'
|
|
||||||
import React from 'react'
|
|
||||||
|
|
||||||
@connect(({ app }) => ({ app }))
|
|
||||||
export default class ContextMenuDebug extends React.Component{
|
|
||||||
|
|
||||||
openContext(){
|
|
||||||
const list = [
|
|
||||||
{
|
|
||||||
key: "something",
|
|
||||||
title: "test",
|
|
||||||
params: {
|
|
||||||
onClick: (e) => {
|
|
||||||
console.log("yepe", e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
ContextMenu({ xPos: 0, yPos: 0, renderList: list })
|
|
||||||
}
|
|
||||||
|
|
||||||
render(){
|
|
||||||
return(
|
|
||||||
<div>
|
|
||||||
<antd.Button onClick={this.openContext}> openNew </antd.Button>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import * as antd from 'antd'
|
|
||||||
import * as core from 'core'
|
|
||||||
import { connect } from 'umi'
|
|
||||||
|
|
||||||
@connect(({ app, extended }) => ({ app, extended }))
|
|
||||||
export default class CoreDebug extends React.Component {
|
|
||||||
state = {
|
|
||||||
rawPluginInitInput: null
|
|
||||||
}
|
|
||||||
handleInitPlugin(e){
|
|
||||||
this.props.dispatch({
|
|
||||||
type: "app/initializePlugins",
|
|
||||||
payload: {
|
|
||||||
array: e
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
render(){
|
|
||||||
const handleGenerateUUID = () => { console.log(core.generateUUID()) }
|
|
||||||
const handleChange = (e) => { this.setState({ rawPluginInitInput: e.target.value }) }
|
|
||||||
const module3TestString = "https://api.ragestudio.net/std/moduleTest3.js"
|
|
||||||
|
|
||||||
return(
|
|
||||||
<div>
|
|
||||||
<antd.Button onClick={() => handleGenerateUUID()} >generate uuid</antd.Button>
|
|
||||||
<antd.Card>
|
|
||||||
<antd.Button onClick={() => this.setState({ rawPluginInitInput: module3TestString })}> Set MODULE3 TEST </antd.Button>
|
|
||||||
<antd.Input onChange={handleChange} value={this.state.rawPluginInitInput} placeholder="https://api.ragestudio.net/std/example.js" />
|
|
||||||
<antd.Button onClick={() => { this.handleInitPlugin(this.state.rawPluginInitInput) }} > init </antd.Button>
|
|
||||||
</antd.Card>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import * as antd from 'antd'
|
|
||||||
import { connect } from 'umi'
|
|
||||||
|
|
||||||
@connect(({ app }) => ({ app }))
|
|
||||||
export default class InternalDebug extends React.Component{
|
|
||||||
state = {
|
|
||||||
internals: window.Internal
|
|
||||||
}
|
|
||||||
|
|
||||||
handleDispatch(){
|
|
||||||
this.props.dispatch({
|
|
||||||
type: "app/initializeInternal",
|
|
||||||
payload: [
|
|
||||||
{
|
|
||||||
id: "test",
|
|
||||||
payload: () => {
|
|
||||||
console.log("Hey i am alivee")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
handleCallTest(){
|
|
||||||
if (window.Internal.test != null) {
|
|
||||||
window.Internal.test()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render(){
|
|
||||||
return(
|
|
||||||
<div>
|
|
||||||
<antd.Card>
|
|
||||||
{JSON.stringify(this.state.internals) ?? "No internals to show"}
|
|
||||||
</antd.Card>
|
|
||||||
<div style={{ marginTop: "12px" }}>
|
|
||||||
<antd.Button onClick={() => this.handleDispatch()} > init example </antd.Button>
|
|
||||||
<antd.Button onClick={() => this.handleCallTest()} > Call test </antd.Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,109 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { connect } from 'umi';
|
|
||||||
import * as antd from 'antd'
|
|
||||||
import { Database, Redux, AlertTriangle } from 'components/Icons'
|
|
||||||
import { ParamsList } from 'components'
|
|
||||||
import { objectToArrayMap } from 'core'
|
|
||||||
import store from 'store'
|
|
||||||
|
|
||||||
const storeKey = "dbg_redux_selecteKeys"
|
|
||||||
class ReduxDebugger extends React.Component {
|
|
||||||
constructor(props){
|
|
||||||
super(props)
|
|
||||||
this.state = {
|
|
||||||
selectedKeys: this.storagedKeys.get() ?? []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
renderAllStore() {
|
|
||||||
return objectToArrayMap(this.props).map(element => {
|
|
||||||
return (
|
|
||||||
<antd.Collapse.Panel key={element.key} style={{ wordBreak: 'break-all' }} header={`${element.key}`}>
|
|
||||||
{ParamsList(element.value)}
|
|
||||||
</antd.Collapse.Panel>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
storagedKeys = {
|
|
||||||
get: () => {
|
|
||||||
try {
|
|
||||||
const storaged = store.get(storeKey)
|
|
||||||
if (typeof(storaged) == "object" && storaged !== null) {
|
|
||||||
let mix = []
|
|
||||||
storaged.forEach(e => {
|
|
||||||
mix[e.key] = e.value
|
|
||||||
})
|
|
||||||
return mix
|
|
||||||
}
|
|
||||||
return []
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
set: (data) => {
|
|
||||||
store.set(storeKey, objectToArrayMap(data))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
renderCheckboxes() {
|
|
||||||
const keys = Object.keys(this.props)
|
|
||||||
const onChange = (event, key) => {
|
|
||||||
let resultKeys = this.state.selectedKeys
|
|
||||||
resultKeys[key] = event.target.checked
|
|
||||||
|
|
||||||
|
|
||||||
this.storagedKeys.set(resultKeys)
|
|
||||||
this.setState({ selectedKeys: resultKeys })
|
|
||||||
}
|
|
||||||
return keys.map((e) => {
|
|
||||||
return (
|
|
||||||
<antd.Checkbox defaultChecked={this.state.selectedKeys[e] ?? false} key={e} onChange={(event) => onChange(event, e)}>{e}</antd.Checkbox>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
render() {
|
|
||||||
const returnSelectedKeys = () => {
|
|
||||||
// const getStores = () => {
|
|
||||||
// let stores = []
|
|
||||||
// objectToArrayMap(this.state.selectedKeys).forEach((e) => {
|
|
||||||
// if (this.props[e.key] && e.value) {
|
|
||||||
// stores[e.key] = this.props[e.key]
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
return objectToArrayMap(this.props).map(e => {
|
|
||||||
if (!this.state.selectedKeys[e.key]) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<antd.Collapse.Panel
|
|
||||||
key={e.key}
|
|
||||||
style={{ wordBreak: 'break-all' }}
|
|
||||||
header={
|
|
||||||
<div style={{ display: "flex", alignItems: "center", marginLeft: '10px' }} >
|
|
||||||
<Database />
|
|
||||||
<strong>{e.key}</strong>
|
|
||||||
</div>
|
|
||||||
}>
|
|
||||||
{ParamsList(e.value)}
|
|
||||||
</antd.Collapse.Panel>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<div style={{ background: "#fff", borderRadius: "8px", padding: "25px 15px" }}>
|
|
||||||
<div style={{ marginBottom: "35px" }}>
|
|
||||||
<h1 style={{ fontSize: '24px' }}><Redux /> Redux Store <span style={{ fontSize: '14px', float: "right" }}><AlertTriangle />Dangerously experimental debugger</span></h1>
|
|
||||||
<antd.Card>{this.renderCheckboxes()}</antd.Card>
|
|
||||||
</div>
|
|
||||||
<hr />
|
|
||||||
<antd.Collapse style={{ border: 0 }}>
|
|
||||||
{returnSelectedKeys()}
|
|
||||||
</antd.Collapse>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect((store) => (store))(ReduxDebugger)
|
|
@ -1,96 +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 { objectToArrayMap } 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 = {
|
|
||||||
InputRaw: defaultSocketAddress
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatchSocket(value) {
|
|
||||||
this.props.dispatch({
|
|
||||||
type: `socket/createNodeSocket`,
|
|
||||||
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={objectToArrayMap(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={objectToArrayMap(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 * as antd from 'antd'
|
|
||||||
import * as themeLIB from 'core/libs/style'
|
|
||||||
|
|
||||||
function getBase64(img, callback) {
|
|
||||||
const reader = new FileReader()
|
|
||||||
reader.addEventListener('load', () => callback(reader.result))
|
|
||||||
reader.readAsDataURL(img)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class themedebug extends React.PureComponent {
|
|
||||||
state = {
|
|
||||||
textColor: {r: '255', g: '255', b: '255'},
|
|
||||||
overlayColor: {r: '0', g: '0', b: '0'},
|
|
||||||
|
|
||||||
optimal: null,
|
|
||||||
file: null,
|
|
||||||
fileURL: null,
|
|
||||||
}
|
|
||||||
ToogleUpload() {
|
|
||||||
this.setState({ uploader: !this.state.uploader })
|
|
||||||
}
|
|
||||||
handleDeleteFile = () => {
|
|
||||||
this.setState({ fileURL: null })
|
|
||||||
}
|
|
||||||
handleFileUpload = info => {
|
|
||||||
if (info.file.status === 'uploading') {
|
|
||||||
this.setState({ loading: true })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (info.file.status === 'done') {
|
|
||||||
this.setState({ file: info.file.originFileObj, uploader: false })
|
|
||||||
getBase64(info.file.originFileObj, fileURL => {
|
|
||||||
this.setState({ fileURL, loading: false })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handleGetOptimal() {
|
|
||||||
const optimal = themeLIB.getOptimalOpacityFromIMG({ textColor: this.state.textColor, overlayColor: this.state.overlayColor, img: this.state.fileURL })
|
|
||||||
this.setState({ optimal: optimal })
|
|
||||||
}
|
|
||||||
|
|
||||||
schemeToRGB(values) {
|
|
||||||
return `rgb(${values.r}, ${values.g}, ${values.b})`
|
|
||||||
}
|
|
||||||
|
|
||||||
render(){
|
|
||||||
|
|
||||||
return(
|
|
||||||
<div style={{ wordBreak: 'keep-all' }}>
|
|
||||||
<antd.Button onClick={() => this.handleGetOptimal()}> Get OPACITY </antd.Button>
|
|
||||||
<antd.Upload
|
|
||||||
multiple="false"
|
|
||||||
onChange={this.handleFileUpload}
|
|
||||||
>
|
|
||||||
<antd.Button>
|
|
||||||
Click to Upload
|
|
||||||
</antd.Button>
|
|
||||||
</antd.Upload>
|
|
||||||
<div>
|
|
||||||
{JSON.stringify(this.state.file)}<br/><br/>
|
|
||||||
textColor:{JSON.stringify(this.state.textColor)}<br/><br/>
|
|
||||||
overlayColor:{JSON.stringify(this.state.overlayColor)}<br/><br/>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div style={{ position: 'absolute', backgroundColor: this.schemeToRGB(this.state.overlayColor) , display: 'flex', width: '500px', height: '500px' }}>
|
|
||||||
<h2 style={{ position: 'absolute', zIndex: '10', color: this.schemeToRGB(this.state.textColor) }}>Sample text</h2>
|
|
||||||
<img style={{ position: 'absolute',opacity: this.state.optimal, zIndex: '9', width: '500px' }} src={this.state.fileURL} />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import settings from 'core/libs/settings'
|
|
||||||
import { verbosity } from '@nodecorejs/utils'
|
|
||||||
import * as antd from 'antd'
|
|
||||||
|
|
||||||
const verbosity_enabled = settings('verbosity')
|
|
||||||
export default class Verbosity extends React.Component{
|
|
||||||
state = {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount(){
|
|
||||||
verbosity("Single text test")
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSend(){
|
|
||||||
const { raw0, raw1, color, type, method, line, file, time } = this.state
|
|
||||||
let data = []
|
|
||||||
let params = { color, type}
|
|
||||||
let stackTraceParams = { line, file, time, method }
|
|
||||||
|
|
||||||
if (typeof(raw0) !== "undefined") {
|
|
||||||
data[0] = raw0
|
|
||||||
}
|
|
||||||
if (typeof(raw1) !== "undefined") {
|
|
||||||
data[1] = raw1
|
|
||||||
}
|
|
||||||
|
|
||||||
verbosity(
|
|
||||||
data,
|
|
||||||
params,
|
|
||||||
stackTraceParams
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
render(){
|
|
||||||
const handleRawChange = (e) => {
|
|
||||||
const obj = {}
|
|
||||||
obj[e.target.id] = e.target.value
|
|
||||||
this.setState(obj)
|
|
||||||
}
|
|
||||||
const handleCheckChange = (e) => {
|
|
||||||
const obj = {}
|
|
||||||
obj[e.target.id] = e.target.checked
|
|
||||||
this.setState(obj)
|
|
||||||
}
|
|
||||||
return(
|
|
||||||
<div>
|
|
||||||
verbosity => {verbosity_enabled ? "enabled" : "disabled"}
|
|
||||||
<antd.Card>
|
|
||||||
<antd.Input id="raw0" onChange={handleRawChange} placeholder="Data 1 (string)" />
|
|
||||||
<antd.Input id="raw1" onChange={handleRawChange} placeholder="Data 2 (string)" />
|
|
||||||
<div style={{ display: "flex", marginTop: "20px" }}>
|
|
||||||
<antd.Button type="primary" onClick={() => this.handleSend()}> send </antd.Button>
|
|
||||||
<antd.Select style={{ width: "200px" }} onChange={(e) => {this.setState({ type: e})}} >
|
|
||||||
<antd.Select.Option value="log"> log </antd.Select.Option>
|
|
||||||
<antd.Select.Option value="debug"> debug </antd.Select.Option>
|
|
||||||
<antd.Select.Option value="error"> error </antd.Select.Option>
|
|
||||||
</antd.Select>
|
|
||||||
<antd.Input id="color" onChange={(e) => handleRawChange(e)} placeholder="color" />
|
|
||||||
<antd.Checkbox id="method" onChange={handleCheckChange}> method </antd.Checkbox>
|
|
||||||
<antd.Checkbox id="line" onChange={handleCheckChange}> line </antd.Checkbox>
|
|
||||||
<antd.Checkbox id="file" onChange={handleCheckChange}> file </antd.Checkbox>
|
|
||||||
<antd.Checkbox id="time" onChange={handleCheckChange}> time </antd.Checkbox>
|
|
||||||
</div>
|
|
||||||
</antd.Card>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user