mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
remove serverStatus
component
This commit is contained in:
parent
2cb806fde9
commit
dfcf086d6c
@ -313,19 +313,35 @@ class App extends React.Component {
|
|||||||
const initializationTasks = [
|
const initializationTasks = [
|
||||||
async () => {
|
async () => {
|
||||||
try {
|
try {
|
||||||
|
// get remotes origins from config
|
||||||
|
const defaultRemotes = config.remotes
|
||||||
|
|
||||||
|
// get storaged remotes origins
|
||||||
|
const storedRemotes = await app.settings.get("remotes") ?? {}
|
||||||
|
|
||||||
// mount main api bridge
|
// mount main api bridge
|
||||||
await this.props.cores.ApiCore.connectBridge("main", {
|
await this.props.cores.ApiCore.connectBridge("main", {
|
||||||
locked: true
|
origin: storedRemotes.mainApi ?? defaultRemotes.mainApi,
|
||||||
|
locked: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
// and initialize it
|
// and initialize it
|
||||||
await this.props.cores.ApiCore.namespaces["main"].initialize()
|
await this.props.cores.ApiCore.namespaces["main"].initialize()
|
||||||
|
|
||||||
|
// now attach the auth server
|
||||||
|
await this.props.cores.ApiCore.connectBridge("auth", {
|
||||||
|
origin: storedRemotes.authApi ?? defaultRemotes.authApi,
|
||||||
|
locked: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
// and initialize it
|
||||||
|
await this.props.cores.ApiCore.namespaces["auth"].initialize()
|
||||||
|
|
||||||
app.eventBus.emit("app.initialization.api_success")
|
app.eventBus.emit("app.initialization.api_success")
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
app.eventBus.emit("app.initialization.api_error", error)
|
app.eventBus.emit("app.initialization.api_error", error)
|
||||||
console.error(`[App] Error while initializing api`, error)
|
console.error(`[App] Error while initializing api`, error)
|
||||||
|
|
||||||
throw {
|
throw {
|
||||||
cause: "Cannot connect to API",
|
cause: "Cannot connect to API",
|
||||||
details: `Sorry but we cannot connect to the API. Please try again later. [${config.remotes.mainApi}]`,
|
details: `Sorry but we cannot connect to the API. Please try again later. [${config.remotes.mainApi}]`,
|
||||||
|
@ -12,8 +12,6 @@ import "./index.less"
|
|||||||
|
|
||||||
export const Card = (props) => {
|
export const Card = (props) => {
|
||||||
const isProduction = import.meta.env.PROD
|
const isProduction = import.meta.env.PROD
|
||||||
const isWSMainConnected = window.app.ws.mainSocketConnected
|
|
||||||
const WSMainOrigin = app.ws.sockets.main.io.uri
|
|
||||||
|
|
||||||
return <ACard
|
return <ACard
|
||||||
bodyClassName="aboutApp_card"
|
bodyClassName="aboutApp_card"
|
||||||
@ -35,12 +33,6 @@ export const Card = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div className="group">
|
|
||||||
<h3><Icons.Globe />Server information</h3>
|
|
||||||
<div>
|
|
||||||
<antd.Tag color={isWSMainConnected ? "green" : "red"}><Icons.Cpu />{WSMainOrigin}</antd.Tag>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="group">
|
<div className="group">
|
||||||
<h3><Icons.GitMerge />Versions</h3>
|
<h3><Icons.GitMerge />Versions</h3>
|
||||||
<div>
|
<div>
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
import React from "react"
|
|
||||||
import * as antd from "antd"
|
|
||||||
import { Icons } from "components/Icons"
|
|
||||||
|
|
||||||
export default () => {
|
|
||||||
const [connected, setConnected] = React.useState(window.app.ws.mainSocketConnected ?? false)
|
|
||||||
|
|
||||||
window.app.eventBus.on("websocket_connected", (status) => {
|
|
||||||
setConnected(true)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.app.eventBus.on("websocket_disconnected", (status) => {
|
|
||||||
setConnected(false)
|
|
||||||
})
|
|
||||||
|
|
||||||
const getColor = () => {
|
|
||||||
if (!connected) {
|
|
||||||
return "red"
|
|
||||||
}
|
|
||||||
|
|
||||||
return "blue"
|
|
||||||
}
|
|
||||||
|
|
||||||
return <div>
|
|
||||||
<div key="health">
|
|
||||||
<Icons.Activity /> <antd.Tag color={getColor()}>
|
|
||||||
{connected ? "Connected" : "Disconnected"}
|
|
||||||
</antd.Tag>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
@ -7,7 +7,6 @@ export { default as RenderError } from "./RenderError"
|
|||||||
export { default as ActionsBar } from "./ActionsBar"
|
export { default as ActionsBar } from "./ActionsBar"
|
||||||
export { default as SelectableList } from "./SelectableList"
|
export { default as SelectableList } from "./SelectableList"
|
||||||
export { default as ObjectInspector } from "./ObjectInspector"
|
export { default as ObjectInspector } from "./ObjectInspector"
|
||||||
export { default as ServerStatus } from "./ServerStatus"
|
|
||||||
export { default as ModifierTag } from "./ModifierTag"
|
export { default as ModifierTag } from "./ModifierTag"
|
||||||
export { default as UserSelector } from "./UserSelector"
|
export { default as UserSelector } from "./UserSelector"
|
||||||
export { default as Clock } from "./Clock"
|
export { default as Clock } from "./Clock"
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import * as antd from "antd"
|
import * as antd from "antd"
|
||||||
import { Icons } from "components/Icons"
|
|
||||||
|
|
||||||
import { AppSearcher, ServerStatus, Clock, } from "components"
|
import { AppSearcher, Clock } from "components"
|
||||||
import { Translation } from "react-i18next"
|
import { Translation } from "react-i18next"
|
||||||
|
|
||||||
import "./index.less"
|
import "./index.less"
|
||||||
@ -31,9 +30,6 @@ export default class Main extends React.Component {
|
|||||||
(t) => <h1>{t("main_welcome")} {user.fullName ?? user.username ?? "Guest"}</h1>
|
(t) => <h1>{t("main_welcome")} {user.fullName ?? user.username ?? "Guest"}</h1>
|
||||||
}</Translation>
|
}</Translation>
|
||||||
</div>
|
</div>
|
||||||
{!window.isMobile && <div>
|
|
||||||
<ServerStatus />
|
|
||||||
</div>}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user