Titles on index / account pages
Also changed to use `const { ..., name: serverName } = useServer();` where feasible
This commit is contained in:
parent
27f201f27e
commit
d3316f61d7
9 changed files with 30 additions and 19 deletions
|
@ -1,4 +1,5 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { Helmet } from 'react-helmet';
|
||||||
import ContentBox from '@/components/elements/ContentBox';
|
import ContentBox from '@/components/elements/ContentBox';
|
||||||
import CreateApiKeyForm from '@/components/dashboard/forms/CreateApiKeyForm';
|
import CreateApiKeyForm from '@/components/dashboard/forms/CreateApiKeyForm';
|
||||||
import getApiKeys, { ApiKey } from '@/api/account/getApiKeys';
|
import getApiKeys, { ApiKey } from '@/api/account/getApiKeys';
|
||||||
|
@ -7,7 +8,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { faKey, faTrashAlt } from '@fortawesome/free-solid-svg-icons';
|
import { faKey, faTrashAlt } from '@fortawesome/free-solid-svg-icons';
|
||||||
import ConfirmationModal from '@/components/elements/ConfirmationModal';
|
import ConfirmationModal from '@/components/elements/ConfirmationModal';
|
||||||
import deleteApiKey from '@/api/account/deleteApiKey';
|
import deleteApiKey from '@/api/account/deleteApiKey';
|
||||||
import { Actions, useStoreActions } from 'easy-peasy';
|
import { Actions, useStoreActions, useStoreState } from 'easy-peasy';
|
||||||
import { ApplicationStore } from '@/state';
|
import { ApplicationStore } from '@/state';
|
||||||
import FlashMessageRender from '@/components/FlashMessageRender';
|
import FlashMessageRender from '@/components/FlashMessageRender';
|
||||||
import { httpErrorToHuman } from '@/api/http';
|
import { httpErrorToHuman } from '@/api/http';
|
||||||
|
@ -21,6 +22,7 @@ export default () => {
|
||||||
const [ keys, setKeys ] = useState<ApiKey[]>([]);
|
const [ keys, setKeys ] = useState<ApiKey[]>([]);
|
||||||
const [ loading, setLoading ] = useState(true);
|
const [ loading, setLoading ] = useState(true);
|
||||||
const { addError, clearFlashes } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes);
|
const { addError, clearFlashes } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes);
|
||||||
|
const name = useStoreState((state: ApplicationStore) => state.settings.data!.name);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
clearFlashes('account');
|
clearFlashes('account');
|
||||||
|
@ -49,6 +51,9 @@ export default () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContentBlock>
|
<PageContentBlock>
|
||||||
|
<Helmet>
|
||||||
|
<title> {name} | API</title>
|
||||||
|
</Helmet>
|
||||||
<FlashMessageRender byKey={'account'} css={tw`mb-4`}/>
|
<FlashMessageRender byKey={'account'} css={tw`mb-4`}/>
|
||||||
<div css={tw`flex`}>
|
<div css={tw`flex`}>
|
||||||
<ContentBox title={'Create API Key'} css={tw`flex-1`}>
|
<ContentBox title={'Create API Key'} css={tw`flex-1`}>
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import { Helmet } from 'react-helmet';
|
||||||
|
import { ApplicationStore } from '@/state';
|
||||||
import ContentBox from '@/components/elements/ContentBox';
|
import ContentBox from '@/components/elements/ContentBox';
|
||||||
import UpdatePasswordForm from '@/components/dashboard/forms/UpdatePasswordForm';
|
import UpdatePasswordForm from '@/components/dashboard/forms/UpdatePasswordForm';
|
||||||
import UpdateEmailAddressForm from '@/components/dashboard/forms/UpdateEmailAddressForm';
|
import UpdateEmailAddressForm from '@/components/dashboard/forms/UpdateEmailAddressForm';
|
||||||
|
@ -7,6 +9,7 @@ import PageContentBlock from '@/components/elements/PageContentBlock';
|
||||||
import tw from 'twin.macro';
|
import tw from 'twin.macro';
|
||||||
import { breakpoint } from '@/theme';
|
import { breakpoint } from '@/theme';
|
||||||
import styled from 'styled-components/macro';
|
import styled from 'styled-components/macro';
|
||||||
|
import { useStoreState } from 'easy-peasy';
|
||||||
|
|
||||||
const Container = styled.div`
|
const Container = styled.div`
|
||||||
${tw`flex flex-wrap my-10`};
|
${tw`flex flex-wrap my-10`};
|
||||||
|
@ -25,8 +28,12 @@ const Container = styled.div`
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
|
const name = useStoreState((state: ApplicationStore) => state.settings.data!.name);
|
||||||
return (
|
return (
|
||||||
<PageContentBlock>
|
<PageContentBlock>
|
||||||
|
<Helmet>
|
||||||
|
<title> {name} | Account Overview</title>
|
||||||
|
</Helmet>
|
||||||
<Container>
|
<Container>
|
||||||
<ContentBox title={'Update Password'} showFlashes={'account:password'}>
|
<ContentBox title={'Update Password'} showFlashes={'account:password'}>
|
||||||
<UpdatePasswordForm/>
|
<UpdatePasswordForm/>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { Helmet } from 'react-helmet';
|
||||||
import { Server } from '@/api/server/getServer';
|
import { Server } from '@/api/server/getServer';
|
||||||
|
import { ApplicationStore } from '@/state';
|
||||||
import getServers from '@/api/getServers';
|
import getServers from '@/api/getServers';
|
||||||
import ServerRow from '@/components/dashboard/ServerRow';
|
import ServerRow from '@/components/dashboard/ServerRow';
|
||||||
import Spinner from '@/components/elements/Spinner';
|
import Spinner from '@/components/elements/Spinner';
|
||||||
|
@ -18,6 +20,7 @@ export default () => {
|
||||||
const [ page, setPage ] = useState(1);
|
const [ page, setPage ] = useState(1);
|
||||||
const { rootAdmin } = useStoreState(state => state.user.data!);
|
const { rootAdmin } = useStoreState(state => state.user.data!);
|
||||||
const [ showOnlyAdmin, setShowOnlyAdmin ] = usePersistedState('show_all_servers', false);
|
const [ showOnlyAdmin, setShowOnlyAdmin ] = usePersistedState('show_all_servers', false);
|
||||||
|
const name = useStoreState((state: ApplicationStore) => state.settings.data!.name);
|
||||||
|
|
||||||
const { data: servers, error } = useSWR<PaginatedResult<Server>>(
|
const { data: servers, error } = useSWR<PaginatedResult<Server>>(
|
||||||
[ '/api/client/servers', showOnlyAdmin, page ],
|
[ '/api/client/servers', showOnlyAdmin, page ],
|
||||||
|
@ -31,6 +34,9 @@ export default () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContentBlock showFlashKey={'dashboard'}>
|
<PageContentBlock showFlashKey={'dashboard'}>
|
||||||
|
<Helmet>
|
||||||
|
<title> {name} | Dashboard</title>
|
||||||
|
</Helmet>
|
||||||
{rootAdmin &&
|
{rootAdmin &&
|
||||||
<div css={tw`mb-2 flex justify-end items-center`}>
|
<div css={tw`mb-2 flex justify-end items-center`}>
|
||||||
<p css={tw`uppercase text-xs text-neutral-400 mr-2`}>
|
<p css={tw`uppercase text-xs text-neutral-400 mr-2`}>
|
||||||
|
|
|
@ -14,12 +14,11 @@ import PageContentBlock from '@/components/elements/PageContentBlock';
|
||||||
import tw from 'twin.macro';
|
import tw from 'twin.macro';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const { uuid, featureLimits } = useServer();
|
const { uuid, featureLimits, name: serverName } = useServer();
|
||||||
const { addError, clearFlashes } = useFlash();
|
const { addError, clearFlashes } = useFlash();
|
||||||
const [ loading, setLoading ] = useState(true);
|
const [ loading, setLoading ] = useState(true);
|
||||||
|
|
||||||
const backups = ServerContext.useStoreState(state => state.backups.data);
|
const backups = ServerContext.useStoreState(state => state.backups.data);
|
||||||
const server = ServerContext.useStoreState(state => state.server.data!);
|
|
||||||
const setBackups = ServerContext.useStoreActions(actions => actions.backups.setBackups);
|
const setBackups = ServerContext.useStoreActions(actions => actions.backups.setBackups);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -40,7 +39,7 @@ export default () => {
|
||||||
return (
|
return (
|
||||||
<PageContentBlock>
|
<PageContentBlock>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
<title> {server.name} | Backups</title>
|
<title> {serverName} | Backups</title>
|
||||||
</Helmet>
|
</Helmet>
|
||||||
<FlashMessageRender byKey={'backups'} css={tw`mb-4`}/>
|
<FlashMessageRender byKey={'backups'} css={tw`mb-4`}/>
|
||||||
{!backups.length ?
|
{!backups.length ?
|
||||||
|
|
|
@ -15,12 +15,11 @@ import tw from 'twin.macro';
|
||||||
import Fade from '@/components/elements/Fade';
|
import Fade from '@/components/elements/Fade';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const { uuid, featureLimits } = useServer();
|
const { uuid, featureLimits, name: serverName } = useServer();
|
||||||
const { addError, clearFlashes } = useFlash();
|
const { addError, clearFlashes } = useFlash();
|
||||||
const [ loading, setLoading ] = useState(true);
|
const [ loading, setLoading ] = useState(true);
|
||||||
|
|
||||||
const databases = ServerContext.useStoreState(state => state.databases.data);
|
const databases = ServerContext.useStoreState(state => state.databases.data);
|
||||||
const servername = ServerContext.useStoreState(state => state.server.data.name);
|
|
||||||
const setDatabases = ServerContext.useStoreActions(state => state.databases.setDatabases);
|
const setDatabases = ServerContext.useStoreActions(state => state.databases.setDatabases);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -39,7 +38,7 @@ export default () => {
|
||||||
return (
|
return (
|
||||||
<PageContentBlock>
|
<PageContentBlock>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
<title> {servername} | Databases </title>
|
<title> {serverName} | Databases </title>
|
||||||
</Helmet>
|
</Helmet>
|
||||||
<FlashMessageRender byKey={'databases'} css={tw`mb-4`}/>
|
<FlashMessageRender byKey={'databases'} css={tw`mb-4`}/>
|
||||||
{(!databases.length && loading) ?
|
{(!databases.length && loading) ?
|
||||||
|
|
|
@ -24,11 +24,10 @@ const sortFiles = (files: FileObject[]): FileObject[] => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const { id } = useServer();
|
const { id, name: serverName } = useServer();
|
||||||
const { hash } = useLocation();
|
const { hash } = useLocation();
|
||||||
const { data: files, error, mutate } = useFileManagerSwr();
|
const { data: files, error, mutate } = useFileManagerSwr();
|
||||||
|
|
||||||
const servername = ServerContext.useStoreState(state => state.server.data.name);
|
|
||||||
const setDirectory = ServerContext.useStoreActions(actions => actions.files.setDirectory);
|
const setDirectory = ServerContext.useStoreActions(actions => actions.files.setDirectory);
|
||||||
const setSelectedFiles = ServerContext.useStoreActions(actions => actions.files.setSelectedFiles);
|
const setSelectedFiles = ServerContext.useStoreActions(actions => actions.files.setSelectedFiles);
|
||||||
|
|
||||||
|
@ -46,7 +45,7 @@ export default () => {
|
||||||
return (
|
return (
|
||||||
<PageContentBlock showFlashKey={'files'}>
|
<PageContentBlock showFlashKey={'files'}>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
<title> {servername} | File Manager </title>
|
<title> {serverName} | File Manager </title>
|
||||||
</Helmet>
|
</Helmet>
|
||||||
<FileManagerBreadcrumbs/>
|
<FileManagerBreadcrumbs/>
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { Helmet } from 'react-helmet';
|
import { Helmet } from 'react-helmet';
|
||||||
import { ServerContext } from '@/state/server';
|
|
||||||
import tw from 'twin.macro';
|
import tw from 'twin.macro';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { faNetworkWired } from '@fortawesome/free-solid-svg-icons';
|
import { faNetworkWired } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
@ -25,13 +24,11 @@ const Code = styled.code`${tw`font-mono py-1 px-2 bg-neutral-900 rounded text-sm
|
||||||
const Label = styled.label`${tw`uppercase text-xs mt-1 text-neutral-400 block px-1 select-none transition-colors duration-150`}`;
|
const Label = styled.label`${tw`uppercase text-xs mt-1 text-neutral-400 block px-1 select-none transition-colors duration-150`}`;
|
||||||
|
|
||||||
const NetworkContainer = () => {
|
const NetworkContainer = () => {
|
||||||
const { uuid, allocations } = useServer();
|
const { uuid, allocations, name: serverName } = useServer();
|
||||||
const { clearFlashes, clearAndAddHttpError } = useFlash();
|
const { clearFlashes, clearAndAddHttpError } = useFlash();
|
||||||
const [ loading, setLoading ] = useState<false | number>(false);
|
const [ loading, setLoading ] = useState<false | number>(false);
|
||||||
const { data, error, mutate } = useSWR<Allocation[]>(uuid, key => getServerAllocations(key), { initialData: allocations });
|
const { data, error, mutate } = useSWR<Allocation[]>(uuid, key => getServerAllocations(key), { initialData: allocations });
|
||||||
|
|
||||||
const servername = ServerContext.useStoreState(state => state.server.data.name);
|
|
||||||
|
|
||||||
const setPrimaryAllocation = (id: number) => {
|
const setPrimaryAllocation = (id: number) => {
|
||||||
clearFlashes('server:network');
|
clearFlashes('server:network');
|
||||||
|
|
||||||
|
@ -66,7 +63,7 @@ const NetworkContainer = () => {
|
||||||
return (
|
return (
|
||||||
<PageContentBlock showFlashKey={'server:network'}>
|
<PageContentBlock showFlashKey={'server:network'}>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
<title> {servername} | Network </title>
|
<title> {serverName} | Network </title>
|
||||||
</Helmet>
|
</Helmet>
|
||||||
{!data ?
|
{!data ?
|
||||||
<Spinner size={'large'} centered/>
|
<Spinner size={'large'} centered/>
|
||||||
|
|
|
@ -17,13 +17,12 @@ import GreyRowBox from '@/components/elements/GreyRowBox';
|
||||||
import Button from '@/components/elements/Button';
|
import Button from '@/components/elements/Button';
|
||||||
|
|
||||||
export default ({ match, history }: RouteComponentProps) => {
|
export default ({ match, history }: RouteComponentProps) => {
|
||||||
const { uuid } = useServer();
|
const { uuid, name: serverName } = useServer();
|
||||||
const { clearFlashes, addError } = useFlash();
|
const { clearFlashes, addError } = useFlash();
|
||||||
const [ loading, setLoading ] = useState(true);
|
const [ loading, setLoading ] = useState(true);
|
||||||
const [ visible, setVisible ] = useState(false);
|
const [ visible, setVisible ] = useState(false);
|
||||||
|
|
||||||
const schedules = ServerContext.useStoreState(state => state.schedules.data);
|
const schedules = ServerContext.useStoreState(state => state.schedules.data);
|
||||||
const servername = ServerContext.useStoreState(state => state.server.data.name);
|
|
||||||
const setSchedules = ServerContext.useStoreActions(actions => actions.schedules.setSchedules);
|
const setSchedules = ServerContext.useStoreActions(actions => actions.schedules.setSchedules);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -40,7 +39,7 @@ export default ({ match, history }: RouteComponentProps) => {
|
||||||
return (
|
return (
|
||||||
<PageContentBlock>
|
<PageContentBlock>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
<title> {servername} | Schedules </title>
|
<title> {serverName} | Schedules </title>
|
||||||
</Helmet>
|
</Helmet>
|
||||||
<FlashMessageRender byKey={'schedules'} css={tw`mb-4`}/>
|
<FlashMessageRender byKey={'schedules'} css={tw`mb-4`}/>
|
||||||
{(!schedules.length && loading) ?
|
{(!schedules.length && loading) ?
|
||||||
|
|
|
@ -18,7 +18,7 @@ export default () => {
|
||||||
|
|
||||||
const uuid = ServerContext.useStoreState(state => state.server.data!.uuid);
|
const uuid = ServerContext.useStoreState(state => state.server.data!.uuid);
|
||||||
const subusers = ServerContext.useStoreState(state => state.subusers.data);
|
const subusers = ServerContext.useStoreState(state => state.subusers.data);
|
||||||
const servername = ServerContext.useStoreState(state => state.server.data.name);
|
const servername = ServerContext.useStoreState(state => state.server.data!.name);
|
||||||
const setSubusers = ServerContext.useStoreActions(actions => actions.subusers.setSubusers);
|
const setSubusers = ServerContext.useStoreActions(actions => actions.subusers.setSubusers);
|
||||||
|
|
||||||
const permissions = useStoreState((state: ApplicationStore) => state.permissions.data);
|
const permissions = useStoreState((state: ApplicationStore) => state.permissions.data);
|
||||||
|
|
Loading…
Reference in a new issue