diff --git a/idp/src/infra/error.ts b/idp/src/infra/error.ts index 23c43aadf..a68744acf 100644 --- a/idp/src/infra/error.ts +++ b/idp/src/infra/error.ts @@ -53,8 +53,8 @@ const userMessages: { [key: string]: string } = { [ErrorCode.InvalidPassword]: 'Invalid password.', [ErrorCode.InvalidUsernameOrPassword]: 'Invalid username or password.', [ErrorCode.UserSuspended]: 'User suspended.', - [ErrorCode.MissingPermission]: 'You are not an admin', - [ErrorCode.OrphanError]: 'You cannot suspend last admin' + [ErrorCode.MissingPermission]: 'You are not an console', + [ErrorCode.OrphanError]: 'You cannot suspend last console' } export type ErrorData = { diff --git a/ui/.env b/ui/.env index 955fb43cc..e4717aa57 100644 --- a/ui/.env +++ b/ui/.env @@ -1,4 +1,4 @@ PORT=3000 API_URL="http://127.0.0.1:8080" IDP_URL="http://127.0.0.1:8081" -ADMIN_URL="http://127.0.0.1:8086" +CONSOLE_URL="http://127.0.0.1:8086" diff --git a/ui/config/config.go b/ui/config/config.go index 6c600652e..39bd2f6a7 100644 --- a/ui/config/config.go +++ b/ui/config/config.go @@ -34,5 +34,5 @@ func GetConfig() Config { func readURLs(config *Config) { config.APIURL = os.Getenv("API_URL") config.IDPURL = os.Getenv("IDP_URL") - config.AdminURL = os.Getenv("ADMIN_URL") + config.ConsoleUrl = os.Getenv("CONSOLE_URL") } diff --git a/ui/config/types.go b/ui/config/types.go index a9c737741..512d11d4a 100644 --- a/ui/config/types.go +++ b/ui/config/types.go @@ -14,5 +14,5 @@ type Config struct { Port int APIURL string IDPURL string - AdminURL string + ConsoleUrl string } diff --git a/ui/main.go b/ui/main.go index 8caccf326..70cc6ce50 100644 --- a/ui/main.go +++ b/ui/main.go @@ -78,15 +78,15 @@ func main() { }, })) - adminProxy := e.Group("proxy/admin") - adminURL, err := url.Parse(cfg.AdminURL) + consoleProxy := e.Group("proxy/console") + consoleUrl, err := url.Parse(cfg.ConsoleUrl) if err != nil { e.Logger.Fatal(err) } - adminProxy.Use(middleware.ProxyWithConfig(middleware.ProxyConfig{ - Balancer: middleware.NewRoundRobinBalancer([]*middleware.ProxyTarget{{URL: adminURL}}), + consoleProxy.Use(middleware.ProxyWithConfig(middleware.ProxyConfig{ + Balancer: middleware.NewRoundRobinBalancer([]*middleware.ProxyTarget{{URL: consoleUrl}}), Rewrite: map[string]string{ - "^/proxy/admin/*": "/$1", + "^/proxy/console/*": "/$1", }, })) diff --git a/ui/src/client/admin/admin.ts b/ui/src/client/console/console.ts similarity index 94% rename from ui/src/client/admin/admin.ts rename to ui/src/client/console/console.ts index 17997c867..027cae65a 100644 --- a/ui/src/client/admin/admin.ts +++ b/ui/src/client/console/console.ts @@ -9,7 +9,7 @@ // licenses/AGPL.txt. import useSWR, { SWRConfiguration } from 'swr' import { PermissionType } from '@/client/api/permission' -import { adminFetcher } from '@/client/fetcher' +import { consoleFetcher } from '@/client/fetcher' import { getConfig } from '@/config/config' export interface ListResponse { @@ -197,9 +197,9 @@ export const emptyListResponseValue: emptyListResponse = { data: [], } -export default class AdminApi { +export default class ConsoleApi { static async checkIndexesAvailability() { - const response = await fetch(`${getConfig().adminURL}/index/all`, { + const response = await fetch(`${getConfig().consoleURL}/index/all`, { method: 'GET', }) if (response) { @@ -214,7 +214,7 @@ export default class AdminApi { return useSWR( url, () => - adminFetcher({ + consoleFetcher({ url, method: 'GET', }) as Promise, @@ -223,98 +223,98 @@ export default class AdminApi { } static async getUsersByOrganization(options: ListOptions) { - return adminFetcher({ + return consoleFetcher({ url: `/organization/users?${this.paramsFromListOptions(options)}`, method: 'GET', }) as Promise } static async listGroups(options: ListOptions) { - return adminFetcher({ + return consoleFetcher({ url: `/group/all?${this.paramsFromListOptions(options)}`, method: 'GET', }) as Promise } static async getGroupsByUser(options: ListOptions) { - return adminFetcher({ + return consoleFetcher({ url: `/user/groups?${this.paramsFromListOptions(options)}`, method: 'GET', }) as Promise } static async getGroupsByOrganization(options: ListOptions) { - return adminFetcher({ + return consoleFetcher({ url: `/organization/groups?${this.paramsFromListOptions(options)}`, method: 'GET', }) as Promise } static async listOrganizations(options: ListOptions) { - return adminFetcher({ + return consoleFetcher({ url: `/organization/all?${this.paramsFromListOptions(options)}`, method: 'GET', }) as Promise } static async getOrganizationsByUser(options: ListOptions) { - return adminFetcher({ + return consoleFetcher({ url: `/user/organizations?${this.paramsFromListOptions(options)}`, method: 'GET', }) as Promise } static async getOrganizationById(options: baseIdRequest) { - return adminFetcher({ + return consoleFetcher({ url: `/organization?${this.paramsFromListOptions(options)}`, method: 'GET', }) as Promise } static async listWorkspaces(options: ListOptions) { - return adminFetcher({ + return consoleFetcher({ url: `/workspace/all?${this.paramsFromListOptions(options)}`, method: 'GET', }) as Promise } static async getWorkspacesByUser(options: ListOptions) { - return adminFetcher({ + return consoleFetcher({ url: `/user/workspaces?${this.paramsFromListOptions(options)}`, method: 'GET', }) as Promise } static async getWorkspacesByOrganization(options: ListOptions) { - return adminFetcher({ + return consoleFetcher({ url: `/organization/workspaces?${this.paramsFromListOptions(options)}`, method: 'GET', }) as Promise } static async listInvitations(options: ListOptions) { - return adminFetcher({ + return consoleFetcher({ url: `/invitation/all?${this.paramsFromListOptions(options)}`, method: 'GET', }) as Promise } static async countObject(object: string) { - return adminFetcher({ + return consoleFetcher({ url: `/${object}/count`, method: 'GET', }) as Promise } static async getComponentsVersions(options: ListOptions) { - return adminFetcher({ + return consoleFetcher({ url: `/overview/version/internal?${this.paramsFromListOptions(options)}`, method: 'GET', }) as Promise } static async renameObject(options: baseIdNameRequest, object: string) { - return adminFetcher({ + return consoleFetcher({ url: `/${object}`, method: 'PATCH', body: JSON.stringify(options), @@ -322,7 +322,7 @@ export default class AdminApi { } static async invitationChangeStatus(options: invitationStatusRequest) { - return adminFetcher({ + return consoleFetcher({ url: `/invitation`, method: 'PATCH', body: JSON.stringify(options), diff --git a/ui/src/client/fetcher.ts b/ui/src/client/fetcher.ts index 5270c9bc8..ae7eef2a9 100644 --- a/ui/src/client/fetcher.ts +++ b/ui/src/client/fetcher.ts @@ -34,10 +34,10 @@ export function idpFetcher(options: FetcherOptions) { }) } -export function adminFetcher(options: FetcherOptions) { +export function consoleFetcher(options: FetcherOptions) { return fetcher({ ...options, - url: `${getConfig().adminURL}${options.url}`, + url: `${getConfig().consoleURL}${options.url}`, }) } diff --git a/ui/src/client/idp/user.ts b/ui/src/client/idp/user.ts index e6c9f772c..de0e43bcc 100644 --- a/ui/src/client/idp/user.ts +++ b/ui/src/client/idp/user.ts @@ -19,7 +19,7 @@ export type User = { pendingEmail?: string } -export interface AdminUser extends User { +export interface ConsoleUser extends User { isEmailConfirmed: boolean createTime: Date updateTime: Date @@ -27,8 +27,8 @@ export interface AdminUser extends User { isActive: boolean } -export interface AdminUsersResponse { - data: AdminUser[] +export interface ConsoleUsersResponse { + data: ConsoleUser[] totalElements: number page: number size: number @@ -93,14 +93,14 @@ export default class UserAPI { return idpFetcher({ url: `/user/by_id?${this.paramsFromListOptions(options)}`, method: 'GET', - }) as Promise + }) as Promise } static async getAllUsers(options: ListOptions) { return idpFetcher({ url: `/user/all?${this.paramsFromListOptions(options)}`, method: 'GET', - }) as Promise + }) as Promise } static async updateFullName(options: UpdateFullNameOptions) { diff --git a/ui/src/components/app-bar/index.tsx b/ui/src/components/app-bar/index.tsx index 2f8acf0c7..90481cb63 100644 --- a/ui/src/components/app-bar/index.tsx +++ b/ui/src/components/app-bar/index.tsx @@ -11,7 +11,7 @@ import { useEffect } from 'react' import { useLocation } from 'react-router-dom' import cx from 'classnames' import AccountMenu from '@/components/account/menu' -import AdminButton from '@/components/admin/admin-button' +import ConsoleButton from '@/components/console/console-button' import TaskDrawer from '@/components/task/task-drawer' import { getAdminStatus } from '@/infra/token' import { useAppDispatch, useAppSelector } from '@/store/hook' @@ -42,8 +42,8 @@ const AppBar = () => { if (location.pathname.startsWith('/workspace')) { dispatch(activeNavChanged(NavType.Workspaces)) } - if (location.pathname.startsWith('/admin')) { - dispatch(activeNavChanged(NavType.Admin)) + if (location.pathname.startsWith('/console')) { + dispatch(activeNavChanged(NavType.Console)) } }, [location, dispatch]) @@ -68,7 +68,7 @@ const AppBar = () => { {activeNav === NavType.Organizations ? ( ) : null} - {getAdminStatus() ? : null} + {getAdminStatus() ? : null} diff --git a/ui/src/components/admin/admin-button.tsx b/ui/src/components/console/console-button.tsx similarity index 83% rename from ui/src/components/admin/admin-button.tsx rename to ui/src/components/console/console-button.tsx index 8a24a3daf..d9e75016c 100644 --- a/ui/src/components/admin/admin-button.tsx +++ b/ui/src/components/console/console-button.tsx @@ -12,16 +12,16 @@ import { Link } from 'react-router-dom' import { IconButton } from '@chakra-ui/react' import { IconAdmin, IconDeAdmin } from '@/lib/components/icons' -const AdminButton = () => { +const ConsoleButton = () => { const buttonRef = useRef(null) return ( <> - {location.pathname.startsWith('/admin') ? ( + {location.pathname.startsWith('/console') ? ( } aria-label="" /> ) : ( - + } aria-label="" /> )} @@ -29,4 +29,4 @@ const AdminButton = () => { ) } -export default AdminButton +export default ConsoleButton diff --git a/ui/src/components/admin/admin-confirmation-modal.tsx b/ui/src/components/console/console-confirmation-modal.tsx similarity index 93% rename from ui/src/components/admin/admin-confirmation-modal.tsx rename to ui/src/components/console/console-confirmation-modal.tsx index 7a5389bc9..d94139223 100644 --- a/ui/src/components/admin/admin-confirmation-modal.tsx +++ b/ui/src/components/console/console-confirmation-modal.tsx @@ -20,7 +20,7 @@ import { ModalOverlay, } from '@chakra-ui/react' -interface AdminConfirmationModalProps { +interface ConsoleConfirmationModalProps { action: string | undefined closeConfirmationWindow: () => void isOpen: boolean @@ -34,7 +34,7 @@ interface AdminConfirmationModalProps { target: string | undefined } -const AdminConfirmationModal = (props: AdminConfirmationModalProps) => { +const ConsoleConfirmationModal = (props: ConsoleConfirmationModalProps) => { useEffect(() => { if ( props.isOpen && @@ -95,4 +95,4 @@ const AdminConfirmationModal = (props: AdminConfirmationModalProps) => { ) } -export default AdminConfirmationModal +export default ConsoleConfirmationModal diff --git a/ui/src/components/admin/admin-highlightable-tr.tsx b/ui/src/components/console/console-highlightable-tr.tsx similarity index 76% rename from ui/src/components/admin/admin-highlightable-tr.tsx rename to ui/src/components/console/console-highlightable-tr.tsx index 2021c8c9b..30679f4a3 100644 --- a/ui/src/components/admin/admin-highlightable-tr.tsx +++ b/ui/src/components/console/console-highlightable-tr.tsx @@ -2,13 +2,13 @@ import { CSSProperties, MouseEvent, ReactNode } from 'react' import { Tr } from '@chakra-ui/react' import { useColorModeValue } from '@chakra-ui/system' -export interface AdminHighlightableProps { +export interface ConsoleHighlightableProps { onClick: (event: MouseEvent) => void style?: CSSProperties children: ReactNode } -const AdminHighlightableTr = (props: AdminHighlightableProps) => { +const ConsoleHighlightableTr = (props: ConsoleHighlightableProps) => { const hoverBg = useColorModeValue('gray.300', 'gray.700') return ( @@ -24,4 +24,4 @@ const AdminHighlightableTr = (props: AdminHighlightableProps) => { ) } -export default AdminHighlightableTr +export default ConsoleHighlightableTr diff --git a/ui/src/components/admin/admin-rename-modal.tsx b/ui/src/components/console/console-rename-modal.tsx similarity index 96% rename from ui/src/components/admin/admin-rename-modal.tsx rename to ui/src/components/console/console-rename-modal.tsx index d0888a8fa..6fa4ed5bb 100644 --- a/ui/src/components/admin/admin-rename-modal.tsx +++ b/ui/src/components/console/console-rename-modal.tsx @@ -24,7 +24,7 @@ import { import { Field, FieldAttributes, FieldProps, Form, Formik } from 'formik' import * as Yup from 'yup' -interface AdminRenameModalProps { +interface ConsoleRenameModalProps { closeConfirmationWindow: () => void isOpen: boolean isSubmitting: boolean @@ -42,7 +42,7 @@ interface AdminRenameModalProps { confirm: boolean, ) => Promise } -const AdminRenameModal = (props: AdminRenameModalProps) => { +const ConsoleRenameModal = (props: ConsoleRenameModalProps) => { const inputRef = useRef(null) useEffect(() => { if ( @@ -126,4 +126,4 @@ const AdminRenameModal = (props: AdminRenameModalProps) => { ) } -export default AdminRenameModal +export default ConsoleRenameModal diff --git a/ui/src/components/admin/deadmin-button.tsx b/ui/src/components/console/deadmin-button.tsx similarity index 100% rename from ui/src/components/admin/deadmin-button.tsx rename to ui/src/components/console/deadmin-button.tsx diff --git a/ui/src/components/layout/layout-admin.tsx b/ui/src/components/layout/layout-console.tsx similarity index 88% rename from ui/src/components/layout/layout-admin.tsx rename to ui/src/components/layout/layout-console.tsx index 881c779dd..99e87a078 100644 --- a/ui/src/components/layout/layout-admin.tsx +++ b/ui/src/components/layout/layout-console.tsx @@ -27,7 +27,7 @@ import Shell from '@/lib/components/shell' import { useAppDispatch, useAppSelector } from '@/store/hook' import { errorCleared } from '@/store/ui/error' -const LayoutAdmin = () => { +const LayoutConsole = () => { const toast = useToast() const error = useAppSelector((state) => state.ui.error.value) const navigate = useNavigate() @@ -61,43 +61,43 @@ const LayoutAdmin = () => { topBar={} items={[ { - href: '/admin/dashboard', + href: '/console/dashboard', icon: , - primaryText: 'Admin overview', + primaryText: 'Cloud Console overview', secondaryText: 'Basic information about instance', }, { - href: '/admin/users', + href: '/console/users', icon: , primaryText: 'Users management', secondaryText: 'Manage users of your cloud instance', }, { - href: '/admin/groups', + href: '/console/groups', icon: , primaryText: 'Groups management', secondaryText: 'Manage groups of your cloud instance', }, { - href: '/admin/workspaces', + href: '/console/workspaces', icon: , primaryText: 'Workspaces management', secondaryText: 'Manage workspaces of your cloud instance', }, { - href: '/admin/organizations', + href: '/console/organizations', icon: , primaryText: 'Organizations management', secondaryText: 'Manage workspaces of your cloud instance', }, { - href: '/admin/invitations', + href: '/console/invitations', icon: , primaryText: 'Invitations management', secondaryText: 'Manage invitations of your cloud instance', }, { - href: '/admin/database', + href: '/console/database', icon: , primaryText: 'Database management', secondaryText: 'Manage database of your cloud instance', @@ -109,4 +109,4 @@ const LayoutAdmin = () => { ) } -export default LayoutAdmin +export default LayoutConsole diff --git a/ui/src/config/config.ts b/ui/src/config/config.ts index cc97d143d..58d97a8ab 100644 --- a/ui/src/config/config.ts +++ b/ui/src/config/config.ts @@ -12,7 +12,7 @@ import { Config } from './types' const config: Config = { apiURL: '/proxy/api/v2', idpURL: '/proxy/idp/v2', - adminURL: '/proxy/admin/v1', + consoleURL: '/proxy/console/v1', } export function getConfig(): Config { diff --git a/ui/src/config/types.ts b/ui/src/config/types.ts index cc039e635..e0338d1d0 100644 --- a/ui/src/config/types.ts +++ b/ui/src/config/types.ts @@ -11,5 +11,5 @@ export type Config = { apiURL: string idpURL: string - adminURL: string + consoleURL: string } diff --git a/ui/src/infra/pagination.ts b/ui/src/infra/pagination.ts index a3ce3a8c4..73e95969f 100644 --- a/ui/src/infra/pagination.ts +++ b/ui/src/infra/pagination.ts @@ -84,37 +84,37 @@ export function workspacePaginationStorage() { } } -export function adminUsersPaginationStorage() { +export function consoleUsersPaginationStorage() { return { prefix: 'voltaserve', - namespace: 'admin_users', + namespace: 'console_users', } } -export function adminGroupsPaginationStorage() { +export function consoleGroupsPaginationStorage() { return { prefix: 'voltaserve', - namespace: 'admin_groups', + namespace: 'console_groups', } } -export function adminInvitationsPaginationStorage() { +export function consoleInvitationsPaginationStorage() { return { prefix: 'voltaserve', - namespace: 'admin_invitations', + namespace: 'console_invitations', } } -export function adminOrganizationsPaginationStorage() { +export function consoleOrganizationsPaginationStorage() { return { prefix: 'voltaserve', - namespace: 'admin_organizations', + namespace: 'console_organizations', } } -export function adminWorkspacesPaginationStorage() { +export function consoleWorkspacesPaginationStorage() { return { prefix: 'voltaserve', - namespace: 'admin_workspaces', + namespace: 'console_workspaces', } } diff --git a/ui/src/lib/components/drawer/index.tsx b/ui/src/lib/components/drawer/index.tsx index 51953dc46..6a3be51d7 100644 --- a/ui/src/lib/components/drawer/index.tsx +++ b/ui/src/lib/components/drawer/index.tsx @@ -72,7 +72,7 @@ const Drawer = ({ children, storage, logo }: DrawerProps) => { >
diff --git a/ui/src/local-storage/index.ts b/ui/src/local-storage/index.ts index c28823f8e..8df8753b0 100644 --- a/ui/src/local-storage/index.ts +++ b/ui/src/local-storage/index.ts @@ -110,18 +110,4 @@ export function loadTokenExpiry(): string | null { export function removeTokenExpiry() { return localStorage.removeItem(TOKEN_EXPIRY) -} - -export const ADMIN_ACCESS_TOKEN = 'voltaserve_admin_access_token' - -export function saveAdminAccessToken(token: string) { - return localStorage.setItem(ADMIN_ACCESS_TOKEN, token) -} - -export function removeAdminAccessToken() { - return localStorage.removeItem(ADMIN_ACCESS_TOKEN) -} - -export function loadAdminAccessToken(): string | null { - return localStorage.getItem(ADMIN_ACCESS_TOKEN) -} +} \ No newline at end of file diff --git a/ui/src/pages/admin/admin-panel-database-indexes.tsx b/ui/src/pages/console/console-panel-database-indexes.tsx similarity index 96% rename from ui/src/pages/admin/admin-panel-database-indexes.tsx rename to ui/src/pages/console/console-panel-database-indexes.tsx index 70b57bb89..7f244423b 100644 --- a/ui/src/pages/admin/admin-panel-database-indexes.tsx +++ b/ui/src/pages/console/console-panel-database-indexes.tsx @@ -28,7 +28,7 @@ import { } from '@chakra-ui/react' import cx from 'classnames' import { Helmet } from 'react-helmet-async' -import AdminApi from '@/client/admin/admin' +import ConsoleApi from '@/client/console/console' import { swrConfig } from '@/client/options' import { organizationPaginationStorage } from '@/infra/pagination' import PagePagination from '@/lib/components/page-pagination' @@ -38,7 +38,7 @@ import usePagePagination from '@/lib/hooks/page-pagination' import { useAppDispatch } from '@/store/hook' import { mutateUpdated } from '@/store/ui/indexes' -const AdminPanelDatabaseIndexes = () => { +const ConsolePanelDatabaseIndexes = () => { const navigate = useNavigate() const location = useLocation() const dispatch = useAppDispatch() @@ -56,7 +56,7 @@ const AdminPanelDatabaseIndexes = () => { data: list, error, mutate, - } = AdminApi.useListIndexes({ page, size }, swrConfig()) + } = ConsoleApi.useListIndexes({ page, size }, swrConfig()) const sendRebuildRequest = ( indexname: string | null, @@ -195,4 +195,4 @@ const AdminPanelDatabaseIndexes = () => { ) } -export default AdminPanelDatabaseIndexes +export default ConsolePanelDatabaseIndexes diff --git a/ui/src/pages/admin/admin-panel-database-overview.tsx b/ui/src/pages/console/console-panel-database-overview.tsx similarity index 91% rename from ui/src/pages/admin/admin-panel-database-overview.tsx rename to ui/src/pages/console/console-panel-database-overview.tsx index 077ae7179..e32e0ca8b 100644 --- a/ui/src/pages/admin/admin-panel-database-overview.tsx +++ b/ui/src/pages/console/console-panel-database-overview.tsx @@ -10,7 +10,7 @@ import cx from 'classnames' import { Helmet } from 'react-helmet-async' -const AdminPanelDatabaseOverview = () => { +const ConsolePanelDatabaseOverview = () => { // const [socket, setWebsocket] = useState(new WebSocket('ws://192.168.1.254:20002')) // useEffect(() => { // socket.addEventListener("open", event => { @@ -30,4 +30,4 @@ const AdminPanelDatabaseOverview = () => { ) } -export default AdminPanelDatabaseOverview +export default ConsolePanelDatabaseOverview diff --git a/ui/src/pages/admin/admin-panel-database.tsx b/ui/src/pages/console/console-panel-database.tsx similarity index 82% rename from ui/src/pages/admin/admin-panel-database.tsx rename to ui/src/pages/console/console-panel-database.tsx index 5302c2aa8..4c0af7aee 100644 --- a/ui/src/pages/admin/admin-panel-database.tsx +++ b/ui/src/pages/console/console-panel-database.tsx @@ -11,9 +11,9 @@ import { useEffect, useState } from 'react' import { Outlet, useLocation, useNavigate } from 'react-router-dom' import { Heading, Tab, TabList, Tabs } from '@chakra-ui/react' import cx from 'classnames' -import AdminApi from '@/client/admin/admin' +import ConsoleApi from '@/client/console/console' -const AdminPanelDatabase = () => { +const ConsolePanelDatabase = () => { const location = useLocation() const navigate = useNavigate() const [tabIndex, setTabIndex] = useState(0) @@ -30,7 +30,7 @@ const AdminPanelDatabase = () => { }, [location]) useEffect(() => { - AdminApi.checkIndexesAvailability().then((value) => { + ConsoleApi.checkIndexesAvailability().then((value) => { setIndexesAvailable(value) }) }, []) @@ -42,11 +42,11 @@ const AdminPanelDatabase = () => { - navigate(`/admin/database/overview`)}> + navigate(`/console/database/overview`)}> Overview {indexesAvailable ? ( - navigate(`/admin/database/indexes`)}> + navigate(`/console/database/indexes`)}> Indexes ) : null} @@ -57,4 +57,4 @@ const AdminPanelDatabase = () => { ) } -export default AdminPanelDatabase +export default ConsolePanelDatabase diff --git a/ui/src/pages/admin/admin-panel-groups.tsx b/ui/src/pages/console/console-panel-groups.tsx similarity index 89% rename from ui/src/pages/admin/admin-panel-groups.tsx rename to ui/src/pages/console/console-panel-groups.tsx index fb1b0c715..080ee670a 100644 --- a/ui/src/pages/admin/admin-panel-groups.tsx +++ b/ui/src/pages/console/console-panel-groups.tsx @@ -24,21 +24,21 @@ import { import * as Yup from 'yup' import cx from 'classnames' import { Helmet } from 'react-helmet-async' -import AdminApi, { GroupManagementList } from '@/client/admin/admin' -import AdminRenameModal from '@/components/admin/admin-rename-modal' -import { adminGroupsPaginationStorage } from '@/infra/pagination' +import ConsoleApi, { GroupManagementList } from '@/client/console/console' +import ConsoleRenameModal from '@/components/console/console-rename-modal' +import { consoleGroupsPaginationStorage } from '@/infra/pagination' import PagePagination from '@/lib/components/page-pagination' import SectionSpinner from '@/lib/components/section-spinner' import usePagePagination from '@/lib/hooks/page-pagination' -const AdminPanelGroups = () => { +const ConsolePanelGroups = () => { const navigate = useNavigate() const location = useLocation() const [list, setList] = useState(undefined) const { page, size, steps, setPage, setSize } = usePagePagination({ navigate, location, - storage: adminGroupsPaginationStorage(), + storage: consoleGroupsPaginationStorage(), }) const [confirmRenameWindowOpen, setConfirmRenameWindowOpen] = useState(false) const [isSubmitting, setSubmitting] = useState(false) @@ -57,7 +57,7 @@ const AdminPanelGroups = () => { if (confirm && groupId !== undefined && newName !== null) { try { setSubmitting(true) - await AdminApi.renameObject({ id: groupId, name: newName }, 'group') + await ConsoleApi.renameObject({ id: groupId, name: newName }, 'group') } finally { closeConfirmationWindow() } @@ -76,7 +76,7 @@ const AdminPanelGroups = () => { } useEffect(() => { - AdminApi.listGroups({ page: page, size: size }).then((value) => + ConsoleApi.listGroups({ page: page, size: size }).then((value) => setList(value), ) }, [page, size, isSubmitting]) @@ -87,7 +87,7 @@ const AdminPanelGroups = () => { return ( <> - { - + ))} @@ -187,4 +187,4 @@ const AdminPanelOrganizations = () => { ) } -export default AdminPanelOrganizations +export default ConsolePanelOrganizations diff --git a/ui/src/pages/admin/admin-panel-overview.tsx b/ui/src/pages/console/console-panel-overview.tsx similarity index 92% rename from ui/src/pages/admin/admin-panel-overview.tsx rename to ui/src/pages/console/console-panel-overview.tsx index b547fef9b..477a2424e 100644 --- a/ui/src/pages/admin/admin-panel-overview.tsx +++ b/ui/src/pages/console/console-panel-overview.tsx @@ -25,7 +25,7 @@ import { import cx from 'classnames' import { Helmet } from 'react-helmet-async' import semver from 'semver' -import AdminApi, { ComponentVersion } from '@/client/admin/admin' +import ConsoleApi, { ComponentVersion } from '@/client/console/console' import { IconChevronRight, IconFlag, @@ -44,13 +44,13 @@ const internalComponents = [ { id: 'webdav' }, { id: 'idp' }, { id: 'mosaic' }, - { id: 'admin' }, + { id: 'console' }, { id: 'conversion' }, ] const compareFn = (a: ComponentVersion, b: ComponentVersion) => a.name > b.name ? 1 : 0 -const AdminPanelOverview = () => { +const ConsolePanelOverview = () => { const [usersAmount, setUsersAmount] = useState(undefined) const [groupsAmount, setGroupsAmount] = useState( undefined, @@ -64,20 +64,20 @@ const AdminPanelOverview = () => { const [componentsData, setComponentsData] = useState([]) useEffect(() => { - AdminApi.countObject('user').then((value) => { + ConsoleApi.countObject('user').then((value) => { setUsersAmount(value.count) }) - AdminApi.countObject('organization').then((value) => { + ConsoleApi.countObject('organization').then((value) => { setOrganizationsAmount(value.count) }) - AdminApi.countObject('group').then((value) => { + ConsoleApi.countObject('group').then((value) => { setGroupsAmount(value.count) }) - AdminApi.countObject('workspace').then((value) => { + ConsoleApi.countObject('workspace').then((value) => { setWorkspacesAmount(value.count) }) internalComponents.map((component) => { - AdminApi.getComponentsVersions(component).then((value) => { + ConsoleApi.getComponentsVersions(component).then((value) => { if (component.id == 'ui') { value.currentVersion = uiCurrentVersion.version value.updateAvailable = semver.gt( @@ -98,7 +98,7 @@ const AdminPanelOverview = () => { return ( <> - Admin Panel + Console Panel
Cloud Panel @@ -221,4 +221,4 @@ const AdminPanelOverview = () => { ) } -export default AdminPanelOverview +export default ConsolePanelOverview diff --git a/ui/src/pages/admin/admin-panel-user.tsx b/ui/src/pages/console/console-panel-user.tsx similarity index 95% rename from ui/src/pages/admin/admin-panel-user.tsx rename to ui/src/pages/console/console-panel-user.tsx index df144b242..b6ff1a6b9 100644 --- a/ui/src/pages/admin/admin-panel-user.tsx +++ b/ui/src/pages/console/console-panel-user.tsx @@ -27,12 +27,12 @@ import { } from '@chakra-ui/react' import cx from 'classnames' import { Helmet } from 'react-helmet-async' -import AdminApi, { +import ConsoleApi, { GroupUserManagementList, OrganizationUserManagementList, WorkspaceUserManagementList, -} from '@/client/admin/admin' -import UserAPI, { AdminUser } from '@/client/idp/user' +} from '@/client/console/console' +import UserAPI, { ConsoleUser } from '@/client/idp/user' import { IconClose, IconEdit, IconWarning } from '@/lib/components/icons' import PagePagination from '@/lib/components/page-pagination' import SectionSpinner from '@/lib/components/section-spinner' @@ -45,7 +45,7 @@ const EditButton = (props: IconButtonProps) => ( /> ) -const AdminPanelUser = () => { +const ConsolePanelUser = () => { const sectionClassName = cx('flex', 'flex-col', 'gap-1', 'py-1.5') const rowClassName = cx( 'flex', @@ -54,7 +54,7 @@ const AdminPanelUser = () => { 'gap-1', `h-[40px]`, ) - const [userData, setUserData] = useState(undefined) + const [userData, setUserData] = useState(undefined) const [organizationsData, setOrganizationsData] = useState< OrganizationUserManagementList | undefined >(undefined) @@ -74,19 +74,19 @@ const AdminPanelUser = () => { UserAPI.getUserById({ id: id }).then((value) => { setUserData(value) }) - AdminApi.getGroupsByUser({ id: id, page: groupsPage, size: 5 }).then( + ConsoleApi.getGroupsByUser({ id: id, page: groupsPage, size: 5 }).then( (value) => { setGroupsData(value) }, ) - AdminApi.getOrganizationsByUser({ + ConsoleApi.getOrganizationsByUser({ id: id, page: organizationsPage, size: 5, }).then((value) => { setOrganizationsData(value) }) - AdminApi.getWorkspacesByUser({ + ConsoleApi.getWorkspacesByUser({ id: id, page: workspacesPage, size: 5, @@ -98,7 +98,7 @@ const AdminPanelUser = () => { useEffect(() => { if (id) { - AdminApi.getOrganizationsByUser({ + ConsoleApi.getOrganizationsByUser({ id: id, page: organizationsPage, size: 5, @@ -110,7 +110,7 @@ const AdminPanelUser = () => { useEffect(() => { if (id) { - AdminApi.getGroupsByUser({ id: id, page: groupsPage, size: 5 }).then( + ConsoleApi.getGroupsByUser({ id: id, page: groupsPage, size: 5 }).then( (value) => { setGroupsData(value) }, @@ -119,7 +119,7 @@ const AdminPanelUser = () => { }, [groupsPage]) useEffect(() => { - AdminApi.getWorkspacesByUser({ + ConsoleApi.getWorkspacesByUser({ id: id, page: workspacesPage, size: 5, @@ -383,4 +383,4 @@ const AdminPanelUser = () => { ) } -export default AdminPanelUser +export default ConsolePanelUser diff --git a/ui/src/pages/admin/admin-panel-users.tsx b/ui/src/pages/console/console-panel-users.tsx similarity index 92% rename from ui/src/pages/admin/admin-panel-users.tsx rename to ui/src/pages/console/console-panel-users.tsx index fc7736f25..06bb4509d 100644 --- a/ui/src/pages/admin/admin-panel-users.tsx +++ b/ui/src/pages/console/console-panel-users.tsx @@ -29,20 +29,20 @@ import { } from '@chakra-ui/react' import cx from 'classnames' import { Helmet } from 'react-helmet-async' -import UserAPI, { AdminUsersResponse } from '@/client/idp/user' -import AdminConfirmationModal from '@/components/admin/admin-confirmation-modal' -import AdminHighlightableTr from '@/components/admin/admin-highlightable-tr' -import { adminUsersPaginationStorage } from '@/infra/pagination' +import UserAPI, { ConsoleUsersResponse } from '@/client/idp/user' +import ConsoleConfirmationModal from '@/components/console/console-confirmation-modal' +import ConsoleHighlightableTr from '@/components/console/console-highlightable-tr' +import { consoleUsersPaginationStorage } from '@/infra/pagination' import { getUserId } from '@/infra/token' import { IconChevronDown, IconChevronUp } from '@/lib/components/icons' import PagePagination from '@/lib/components/page-pagination' import SectionSpinner from '@/lib/components/section-spinner' import usePagePagination from '@/lib/hooks/page-pagination' -const AdminPanelUsers = () => { +const ConsolePanelUsers = () => { const navigate = useNavigate() const location = useLocation() - const [list, setList] = useState(undefined) + const [list, setList] = useState(undefined) const [isSubmitting, setSubmitting] = useState(false) const [userId, setUserId] = useState(undefined) const [userEmail, setUserEmail] = useState(undefined) @@ -56,7 +56,7 @@ const AdminPanelUsers = () => { const { page, size, steps, setPage, setSize } = usePagePagination({ navigate, location, - storage: adminUsersPaginationStorage(), + storage: consoleUsersPaginationStorage(), }) const suspendUser = async ( @@ -122,7 +122,7 @@ const AdminPanelUsers = () => { return ( <> - { isSubmitting={isSubmitting} request={suspendUser} /> - { {list.data.map((user) => ( - { if ( @@ -167,7 +167,7 @@ const AdminPanelUsers = () => { !(event.target instanceof HTMLSpanElement) && !(event.target instanceof HTMLParagraphElement) ) { - navigate(`/admin/users/${user.id}`) + navigate(`/console/users/${user.id}`) } }} > @@ -262,7 +262,7 @@ const AdminPanelUsers = () => { { setConfirmWindowAction( - 'remove admin rights from', + 'remove console rights from', ) await makeAdminUser( user.id, @@ -277,7 +277,7 @@ const AdminPanelUsers = () => { { setConfirmWindowAction( - 'grant admin rights to', + 'grant console rights to', ) await makeAdminUser( user.id, @@ -295,7 +295,7 @@ const AdminPanelUsers = () => { )} - + ))} @@ -320,4 +320,4 @@ const AdminPanelUsers = () => { ) } -export default AdminPanelUsers +export default ConsolePanelUsers diff --git a/ui/src/pages/admin/admin-panel-workspaces.tsx b/ui/src/pages/console/console-panel-workspaces.tsx similarity index 91% rename from ui/src/pages/admin/admin-panel-workspaces.tsx rename to ui/src/pages/console/console-panel-workspaces.tsx index e6fbd4ae7..54537d155 100644 --- a/ui/src/pages/admin/admin-panel-workspaces.tsx +++ b/ui/src/pages/console/console-panel-workspaces.tsx @@ -28,16 +28,16 @@ import { import * as Yup from 'yup' import cx from 'classnames' import { Helmet } from 'react-helmet-async' -import AdminApi, { WorkspaceManagementList } from '@/client/admin/admin' -import AdminRenameModal from '@/components/admin/admin-rename-modal' -import { adminWorkspacesPaginationStorage } from '@/infra/pagination' +import ConsoleApi, { WorkspaceManagementList } from '@/client/console/console' +import ConsoleRenameModal from '@/components/console/console-rename-modal' +import { consoleWorkspacesPaginationStorage } from '@/infra/pagination' import { IconChevronDown, IconChevronUp } from '@/lib/components/icons' import PagePagination from '@/lib/components/page-pagination' import SectionSpinner from '@/lib/components/section-spinner' import prettyBytes from '@/lib/helpers/pretty-bytes' import usePagePagination from '@/lib/hooks/page-pagination' -const AdminPanelWorkspaces = () => { +const ConsolePanelWorkspaces = () => { const navigate = useNavigate() const location = useLocation() const [list, setList] = useState( @@ -46,7 +46,7 @@ const AdminPanelWorkspaces = () => { const { page, size, steps, setPage, setSize } = usePagePagination({ navigate, location, - storage: adminWorkspacesPaginationStorage(), + storage: consoleWorkspacesPaginationStorage(), }) const [confirmRenameWindowOpen, setConfirmRenameWindowOpen] = useState(false) const [isSubmitting, setSubmitting] = useState(false) @@ -65,7 +65,7 @@ const AdminPanelWorkspaces = () => { if (confirm && workspaceId !== undefined && newName !== null) { try { setSubmitting(true) - await AdminApi.renameObject( + await ConsoleApi.renameObject( { id: workspaceId, name: newName }, 'workspace', ) @@ -87,7 +87,7 @@ const AdminPanelWorkspaces = () => { } useEffect(() => { - AdminApi.listWorkspaces({ page: page, size: size }).then((value) => + ConsoleApi.listWorkspaces({ page: page, size: size }).then((value) => setList(value), ) }, [page, size, isSubmitting]) @@ -98,7 +98,7 @@ const AdminPanelWorkspaces = () => { return ( <> - {