feat core
react
: add files for account and make serverTerminal work
This commit is contained in:
parent
673e9d13cc
commit
30c40c5edf
7 changed files with 117 additions and 0 deletions
|
@ -633,10 +633,18 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) ]]; then VCMD="y"
|
||||||
__Navigation_NavigationBar_AdditionalItems="@/blueprint/extensions/${identifier}/${Components_Navigation_NavigationBar_AdditionalItems}"
|
__Navigation_NavigationBar_AdditionalItems="@/blueprint/extensions/${identifier}/${Components_Navigation_NavigationBar_AdditionalItems}"
|
||||||
__Navigation_NavigationBar_AfterNavigation="@/blueprint/extensions/${identifier}/${Components_Navigation_NavigationBar_AfterNavigation}"
|
__Navigation_NavigationBar_AfterNavigation="@/blueprint/extensions/${identifier}/${Components_Navigation_NavigationBar_AfterNavigation}"
|
||||||
|
|
||||||
|
__Server_Terminal_BeforeContent="@/blueprint/extensions/${identifier}/${Components_Server_Terminal_BeforeContent}"
|
||||||
|
__Server_Terminal_AfterContent="@/blueprint/extensions/${identifier}/${Components_Server_Terminal_AfterContent}"
|
||||||
|
|
||||||
|
|
||||||
|
# place component items
|
||||||
PLACE_REACT "$__Navigation_NavigationBar_BeforeNavigation" "$Components_Navigation_NavigationBar_BeforeNavigation" "Navigation/NavigationBar/BeforeNavigation.tsx"
|
PLACE_REACT "$__Navigation_NavigationBar_BeforeNavigation" "$Components_Navigation_NavigationBar_BeforeNavigation" "Navigation/NavigationBar/BeforeNavigation.tsx"
|
||||||
PLACE_REACT "$__Navigation_NavigationBar_AdditionalItems" "$Components_Navigation_NavigationBar_AdditionalItems" "Navigation/NavigationBar/AdditionalItems.tsx"
|
PLACE_REACT "$__Navigation_NavigationBar_AdditionalItems" "$Components_Navigation_NavigationBar_AdditionalItems" "Navigation/NavigationBar/AdditionalItems.tsx"
|
||||||
PLACE_REACT "$__Navigation_NavigationBar_AfterNavigation" "$Components_Navigation_NavigationBar_AfterNavigation" "Navigation/NavigationBar/AfterNavigation.tsx"
|
PLACE_REACT "$__Navigation_NavigationBar_AfterNavigation" "$Components_Navigation_NavigationBar_AfterNavigation" "Navigation/NavigationBar/AfterNavigation.tsx"
|
||||||
|
|
||||||
|
PLACE_REACT "$__Server_Terminal_BeforeContent" "$Components_Server_Terminal_BeforeContent" "Server/Terminal/BeforeContent.tsx"
|
||||||
|
PLACE_REACT "$__Server_Terminal_AfterContent" "$Components_Server_Terminal_AfterContent" "Server/Terminal/AfterContent.tsx"
|
||||||
|
|
||||||
else
|
else
|
||||||
# warn about missing components.yml file
|
# warn about missing components.yml file
|
||||||
log_yellow "[WARNING] Could not find '$dashboard_components/Components.yml', React component extendability might be limited."
|
log_yellow "[WARNING] Could not find '$dashboard_components/Components.yml', React component extendability might be limited."
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
import React from 'react';
|
||||||
|
/* blueprint/import */
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* blueprint/react */}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
|
@ -0,0 +1,10 @@
|
||||||
|
import React from 'react';
|
||||||
|
/* blueprint/import */
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* blueprint/react */}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
|
@ -0,0 +1,10 @@
|
||||||
|
import React from 'react';
|
||||||
|
/* blueprint/import */
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* blueprint/react */}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
|
@ -0,0 +1,10 @@
|
||||||
|
import React from 'react';
|
||||||
|
/* blueprint/import */
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* blueprint/react */}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
|
@ -0,0 +1,69 @@
|
||||||
|
import React, { memo } from 'react';
|
||||||
|
import { ServerContext } from '@/state/server';
|
||||||
|
import Can from '@/components/elements/Can';
|
||||||
|
import ServerContentBlock from '@/components/elements/ServerContentBlock';
|
||||||
|
import isEqual from 'react-fast-compare';
|
||||||
|
import Spinner from '@/components/elements/Spinner';
|
||||||
|
import Features from '@feature/Features';
|
||||||
|
import Console from '@/components/server/console/Console';
|
||||||
|
import StatGraphs from '@/components/server/console/StatGraphs';
|
||||||
|
import PowerButtons from '@/components/server/console/PowerButtons';
|
||||||
|
import ServerDetailsBlock from '@/components/server/console/ServerDetailsBlock';
|
||||||
|
import { Alert } from '@/components/elements/alert';
|
||||||
|
|
||||||
|
import BeforeContent from '@/blueprint/components/Server/Terminal/BeforeContent';
|
||||||
|
import AfterContent from '@/blueprint/components/Server/Terminal/AfterContent';
|
||||||
|
|
||||||
|
export type PowerAction = 'start' | 'stop' | 'restart' | 'kill';
|
||||||
|
|
||||||
|
const ServerConsoleContainer = () => {
|
||||||
|
const name = ServerContext.useStoreState((state) => state.server.data!.name);
|
||||||
|
const description = ServerContext.useStoreState((state) => state.server.data!.description);
|
||||||
|
const isInstalling = ServerContext.useStoreState((state) => state.server.isInstalling);
|
||||||
|
const isTransferring = ServerContext.useStoreState((state) => state.server.data!.isTransferring);
|
||||||
|
const eggFeatures = ServerContext.useStoreState((state) => state.server.data!.eggFeatures, isEqual);
|
||||||
|
const isNodeUnderMaintenance = ServerContext.useStoreState((state) => state.server.data!.isNodeUnderMaintenance);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ServerContentBlock title={'Console'}>
|
||||||
|
{(isNodeUnderMaintenance || isInstalling || isTransferring) && (
|
||||||
|
<Alert type={'warning'} className={'mb-4'}>
|
||||||
|
{isNodeUnderMaintenance
|
||||||
|
? 'The node of this server is currently under maintenance and all actions are unavailable.'
|
||||||
|
: isInstalling
|
||||||
|
? 'This server is currently running its installation process and most actions are unavailable.'
|
||||||
|
: 'This server is currently being transferred to another node and all actions are unavailable.'}
|
||||||
|
</Alert>
|
||||||
|
)}
|
||||||
|
<BeforeContent />
|
||||||
|
<div className={'grid grid-cols-4 gap-4 mb-4'}>
|
||||||
|
<div className={'hidden sm:block sm:col-span-2 lg:col-span-3 pr-4'}>
|
||||||
|
<h1 className={'font-header text-2xl text-gray-50 leading-relaxed line-clamp-1'}>{name}</h1>
|
||||||
|
<p className={'text-sm line-clamp-2'}>{description}</p>
|
||||||
|
</div>
|
||||||
|
<div className={'col-span-4 sm:col-span-2 lg:col-span-1 self-end'}>
|
||||||
|
<Can action={['control.start', 'control.stop', 'control.restart']} matchAny>
|
||||||
|
<PowerButtons className={'flex sm:justify-end space-x-2'} />
|
||||||
|
</Can>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className={'grid grid-cols-4 gap-2 sm:gap-4 mb-4'}>
|
||||||
|
<div className={'flex col-span-4 lg:col-span-3'}>
|
||||||
|
<Spinner.Suspense>
|
||||||
|
<Console />
|
||||||
|
</Spinner.Suspense>
|
||||||
|
</div>
|
||||||
|
<ServerDetailsBlock className={'col-span-4 lg:col-span-1 order-last lg:order-none'} />
|
||||||
|
</div>
|
||||||
|
<div className={'grid grid-cols-1 md:grid-cols-3 gap-2 sm:gap-4'}>
|
||||||
|
<Spinner.Suspense>
|
||||||
|
<StatGraphs />
|
||||||
|
</Spinner.Suspense>
|
||||||
|
</div>
|
||||||
|
<AfterContent />
|
||||||
|
<Features enabled={eggFeatures} />
|
||||||
|
</ServerContentBlock>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default memo(ServerConsoleContainer, isEqual);
|
Loading…
Reference in a new issue