Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Merge branch 'dev' into ir-3547
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya-mitra committed Aug 12, 2024
2 parents e634854 + 53fc185 commit 238d1bd
Show file tree
Hide file tree
Showing 98 changed files with 2,310 additions and 320 deletions.
6 changes: 6 additions & 0 deletions .env.local.default
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ OPENSEARCH_HOST=http://localhost:9200
# Switch to `true` to enable local file system operations
FS_PROJECT_SYNC_ENABLED=true

# Metabase variables
METABASE_SITE_URL=
METABASE_SECRET_KEY=
METABASE_CRASH_DASHBOARD_ID=
METABASE_EXPIRATION=

# Zendesk key for user authentication
ZENDESK_KEY_NAME=
ZENDESK_SECRET=
Expand Down
13 changes: 12 additions & 1 deletion packages/client-core/i18n/en/admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
"activity": "Activity",
"users": "Users"
},
"crashReport": {
"title": "Crash Report",
"loading": "Loading crash report..."
},
"group": {
"createGroup": "Create Group",
"name": "Name",
Expand Down Expand Up @@ -557,8 +561,15 @@
"port": "Port",
"processInterval": "Process Interval"
},

"plugins": "Plugins",
"metabase": {
"header": "Metabase",
"subtitle": "Edit Metabase Settings",
"siteUrl": "Site Url",
"secretKey": "Secret Key",
"expiration": "Expiration",
"crashDashboardId": "Crash Dashboard Id"
},
"zendesk": {
"header": "Zendesk",
"subtitle": "Edit Zendesk Settings"
Expand Down
2 changes: 1 addition & 1 deletion packages/client-core/i18n/en/editor.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"unknownStatus": "Unknown Status",
"CORS": "Possibly a CORS error",
"urlFetchError": "Failed to fetch \"{{url}}\"",
"invalidSceneName": "Invalid input: Only alphanumeric characters, hyphens, and underscores are allowed."
"invalidSceneName": "Scene name must be 4-64 characters long, using only alphanumeric characters, hyphens, and underscores."
},
"viewport": {
"title": "Viewport",
Expand Down
3 changes: 2 additions & 1 deletion packages/client-core/i18n/en/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@
"setting": "Settings",
"server": "Server",
"recordings": "Recordings",
"channels": "Channels"
"channels": "Channels",
"crashReport": "Crash Report"
},
"resource": {
"createResource": "Create Resource"
Expand Down
10 changes: 10 additions & 0 deletions packages/client-core/src/admin/DefaultAdminRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import React, { lazy } from 'react'
import { HiOutlineCube } from 'react-icons/hi'
import {
HiMapPin,
HiMiniShieldExclamation,
HiOutlineCog6Tooth,
HiOutlineGlobeAlt,
HiOutlineMegaphone,
Expand Down Expand Up @@ -66,6 +67,8 @@ const Settings = lazy(() => import('./components/settings'))

const Channels = lazy(() => import('./components/channel'))

const CrashReport = lazy(() => import('./components/crash-report'))

export const DefaultAdminRoutes: Record<string, AdminRouteStateType> = {
settings: {
name: 'user:dashboard.setting',
Expand Down Expand Up @@ -150,5 +153,12 @@ export const DefaultAdminRoutes: Record<string, AdminRouteStateType> = {
component: Channels,
access: false,
icon: <HiOutlineMegaphone />
},
crashes: {
name: 'user:dashboard.crashReport',
scope: 'server',
component: CrashReport,
access: false,
icon: <HiMiniShieldExclamation />
}
}
2 changes: 0 additions & 2 deletions packages/client-core/src/admin/adminRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { getMutableState, getState, NO_PROXY, useHookstate, useMutableState } fr

import { AuthService, AuthState } from '../user/services/AuthService'
import { AllowedAdminRoutesState } from './AllowedAdminRoutesState'
import Projects from './components/project'

import '@etherealengine/engine/src/EngineModule'

Expand Down Expand Up @@ -161,7 +160,6 @@ const AdminRoutes = () => {
<div className="mb-8 h-[calc(100vh_-_88px_-_4rem)] w-full overflow-x-auto overflow-y-auto px-3">
<Routes>
<Route path="/*" element={<$allowed />} />
{<Route path="/" element={<Projects />} />}
</Routes>
</div>
<PopupMenu />
Expand Down
10 changes: 10 additions & 0 deletions packages/client-core/src/admin/allowedRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ const AllowedRoutes = () => {

const currentRoute = allowedRoutes[path]

const allowedRoutesKeys = Object.keys(allowedRoutes)
if (!path) {
for (const key of allowedRoutesKeys) {
const allowedRoute = allowedRoutes[key]
if (allowedRoute?.value && allowedRoute?.value?.access) {
return <Redirect to={`/admin/${key}`} />
}
}
}

if (currentRoute?.value && currentRoute.redirect.value) return <Redirect to={currentRoute.redirect?.value} />

const Element = currentRoute?.get(NO_PROXY)?.component
Expand Down
2 changes: 1 addition & 1 deletion packages/client-core/src/admin/common/constants/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const userColumns: IUserColumn[] = [
{ id: 'name', sortable: true, label: t('admin:components.user.columns.name') },
{ id: 'avatar', label: t('admin:components.user.columns.avatar') },
{ id: 'accountIdentifier', label: t('admin:components.user.columns.accountIdentifier') },
{ id: 'lastLogin', sortable: true, label: t('admin:components.user.columns.lastLogin') },
{ id: 'lastLogin', label: t('admin:components.user.columns.lastLogin') },
{ id: 'acceptedTOS', sortable: true, label: t('admin:components.user.columns.acceptedTOS') },
{ id: 'isGuest', sortable: true, label: t('admin:components.user.columns.isGuest') },
{ id: 'action', label: t('admin:components.user.columns.action') }
Expand Down
76 changes: 76 additions & 0 deletions packages/client-core/src/admin/components/crash-report/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
CPAL-1.0 License
The contents of this file are subject to the Common Public Attribution License
Version 1.0. (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://github.com/EtherealEngine/etherealengine/blob/dev/LICENSE.
The License is based on the Mozilla Public License Version 1.1, but Sections 14
and 15 have been added to cover use of software over a computer network and
provide for limited attribution for the Original Developer. In addition,
Exhibit A has been modified to be consistent with Exhibit B.
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
specific language governing rights and limitations under the License.
The Original Code is Ethereal Engine.
The Original Developer is the Initial Developer. The Initial Developer of the
Original Code is the Ethereal Engine team.
All portions of the code written by the Ethereal Engine team are Copyright © 2021-2023
Ethereal Engine. All Rights Reserved.
*/

import { metabaseUrlPath } from '@etherealengine/common/src/schema.type.module'
import { useHookstate } from '@etherealengine/hyperflux'
import { useMutation } from '@etherealengine/spatial/src/common/functions/FeathersHooks'
import LoadingView from '@etherealengine/ui/src/primitives/tailwind/LoadingView'
import Text from '@etherealengine/ui/src/primitives/tailwind/Text'
import { isEmpty } from 'lodash'
import React, { useEffect } from 'react'
import { useTranslation } from 'react-i18next'

export default function CrashReport() {
const { t } = useTranslation()
const metabaseMutation = useMutation(metabaseUrlPath)
const iframeUrl = useHookstate<string>('')

useEffect(() => {
metabaseMutation
.create(
{},
{
query: {
action: 'crash'
}
}
)
.then(async (url) => {
iframeUrl.set(url)
})
}, [])

return (
<>
<div>
<Text fontSize="xl" className="mb-6">
{t('admin:components.crashReport.title')}
</Text>
</div>
<div className="flex h-full w-full flex-col">
{isEmpty(iframeUrl.value) && (
<div className="flex h-full w-full flex-col items-center justify-center">
<LoadingView className="block h-12 w-12" title={t('admin:components.crashReport.loading')} />
</div>
)}
{!isEmpty(iframeUrl.value) && (
<div className="flex-1 overflow-auto">
<iframe src={iframeUrl.value} width="100%" height="100%" />
</div>
)}
</div>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export default function AddEditLocationModal(props: { location?: LocationType; s
}
>
<div
className="text-blue-primary cursor-pointer hover:underline"
className="cursor-pointer text-blue-primary hover:underline"
onClick={() => window.open(new URL(location.url))}
>
{location.url}
Expand Down
4 changes: 2 additions & 2 deletions packages/client-core/src/admin/components/server/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ export default function Servers() {
<div
key={info.id}
className={`flex h-16 w-44 cursor-pointer items-start justify-between rounded-2xl bg-theme-surface-main p-4 ${
serverType.value === info.id && 'border-b-blue-primary border-b-2'
serverType.value === info.id && 'border-b-2 border-b-blue-primary'
}`}
onClick={() => serverType.set(info.id)}
>
<Text fontSize="sm">{info.label}</Text>
<Badge
className="bg-blue-primary h-6 rounded-[90px] text-white"
className="h-6 rounded-[90px] bg-blue-primary text-white"
label={`${info.pods.filter((inf) => inf.status === 'Running').length}/${info.pods.length}`}
/>
</div>
Expand Down
7 changes: 7 additions & 0 deletions packages/client-core/src/admin/components/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import EmailTab from './tabs/email'
import FeaturesTab from './tabs/features'
import HelmTab from './tabs/helm'
import InstanceServerTab from './tabs/instanceServer'
import MetabaseTab from './tabs/metabase'
import ProjectTab from './tabs/project'
import RedisTab from './tabs/redis'
import ServerTab from './tabs/server'
Expand Down Expand Up @@ -89,6 +90,11 @@ export const SettingsTabsData = [
Component: FeaturesTab
},
{
label: t('admin:components.setting.metabase.header'),
Component: MetabaseTab
},
{
id: 'metabase',
label: t('admin:components.setting.zendesk.header'),
Component: ZendeskTab
}
Expand All @@ -107,6 +113,7 @@ export default function Settings() {
const refs = useRef<React.RefObject<HTMLDivElement>[]>(SettingsTabsData.map(() => React.createRef()))

const tabsData = SettingsTabsData.map((tabData, idx) => ({
id: tabData.id,
title: t('admin:components.setting.settings'),
tabLabel: tabData.label,
bottomComponent: <tabData.Component ref={refs.current[idx]} open={openState[idx].value} />,
Expand Down
Loading

0 comments on commit 238d1bd

Please sign in to comment.