fix(striker-ui): apply server menu to server details and VNC screen

main
Tsu-ba-me 1 year ago
parent 01c580c6a9
commit d211143494
  1. 15
      striker-ui/components/Display/FullSize.tsx
  2. 11
      striker-ui/components/Display/Preview.tsx
  3. 8
      striker-ui/pages/index.tsx

@ -12,6 +12,7 @@ import IconButton from '../IconButton';
import keyCombinations from './keyCombinations'; import keyCombinations from './keyCombinations';
import MenuItem from '../MenuItem'; import MenuItem from '../MenuItem';
import { Panel, PanelHeader } from '../Panels'; import { Panel, PanelHeader } from '../Panels';
import ServerMenu from '../ServerMenu';
import Spinner from '../Spinner'; import Spinner from '../Spinner';
import { HeaderText } from '../Text'; import { HeaderText } from '../Text';
import useIsFirstRender from '../../hooks/useIsFirstRender'; import useIsFirstRender from '../../hooks/useIsFirstRender';
@ -215,11 +216,23 @@ const FullSize: FC<FullSizeProps> = ({
showScreen && ( showScreen && (
<> <>
{keyboardMenuElement} {keyboardMenuElement}
<ServerMenu
serverName={serverName}
serverState="running"
serverUuid={serverUUID}
/>
{returnHomeElement} {returnHomeElement}
{vncDisconnectElement} {vncDisconnectElement}
</> </>
), ),
[keyboardMenuElement, returnHomeElement, showScreen, vncDisconnectElement], [
keyboardMenuElement,
returnHomeElement,
serverName,
serverUUID,
showScreen,
vncDisconnectElement,
],
); );
useEffect(() => { useEffect(() => {

@ -19,6 +19,7 @@ import api from '../../lib/api';
import FlexBox from '../FlexBox'; import FlexBox from '../FlexBox';
import IconButton, { IconButtonProps } from '../IconButton'; import IconButton, { IconButtonProps } from '../IconButton';
import { InnerPanel, InnerPanelHeader, Panel, PanelHeader } from '../Panels'; import { InnerPanel, InnerPanelHeader, Panel, PanelHeader } from '../Panels';
import ServerMenu from '../ServerMenu';
import Spinner from '../Spinner'; import Spinner from '../Spinner';
import { BodyText, HeaderText } from '../Text'; import { BodyText, HeaderText } from '../Text';
import { elapsed, last, now } from '../../lib/time'; import { elapsed, last, now } from '../../lib/time';
@ -105,7 +106,7 @@ const Preview: FC<PreviewProps> = ({
isShowControls = PREVIEW_DEFAULT_PROPS.isShowControls, isShowControls = PREVIEW_DEFAULT_PROPS.isShowControls,
isUseInnerPanel = PREVIEW_DEFAULT_PROPS.isUseInnerPanel, isUseInnerPanel = PREVIEW_DEFAULT_PROPS.isUseInnerPanel,
onClickPreview: previewClickHandler, onClickPreview: previewClickHandler,
serverName, serverName = PREVIEW_DEFAULT_PROPS.serverName,
serverState = PREVIEW_DEFAULT_PROPS.serverState, serverState = PREVIEW_DEFAULT_PROPS.serverState,
serverUUID, serverUUID,
onClickConnectButton: connectButtonClickHandle = previewClickHandler, onClickConnectButton: connectButtonClickHandle = previewClickHandler,
@ -239,12 +240,18 @@ const Preview: FC<PreviewProps> = ({
<PreviewPanel isUseInnerPanel={isUseInnerPanel}> <PreviewPanel isUseInnerPanel={isUseInnerPanel}>
<PreviewPanelHeader isUseInnerPanel={isUseInnerPanel} text={serverName}> <PreviewPanelHeader isUseInnerPanel={isUseInnerPanel} text={serverName}>
{headerEndAdornment} {headerEndAdornment}
<ServerMenu
iconButtonProps={{ size: isUseInnerPanel ? 'small' : undefined }}
serverName={serverName}
serverState={serverState}
serverUuid={serverUUID}
/>
</PreviewPanelHeader> </PreviewPanelHeader>
<FlexBox row sx={{ '& > :first-child': { flexGrow: 1 } }}> <FlexBox row sx={{ '& > :first-child': { flexGrow: 1 } }}>
{/* Box wrapper below is required to keep external preview size sane. */} {/* Box wrapper below is required to keep external preview size sane. */}
<Box textAlign="center">{iconButton}</Box> <Box textAlign="center">{iconButton}</Box>
{isShowControls && preview && ( {isShowControls && preview && (
<FlexBox> <FlexBox spacing=".3em">
<IconButton onClick={connectButtonClickHandle}> <IconButton onClick={connectButtonClickHandle}>
<DesktopWindowsIcon /> <DesktopWindowsIcon />
</IconButton> </IconButton>

@ -16,7 +16,6 @@ import OutlinedInput from '../components/OutlinedInput';
import { Panel, PanelHeader } from '../components/Panels'; import { Panel, PanelHeader } from '../components/Panels';
import periodicFetch from '../lib/fetchers/periodicFetch'; import periodicFetch from '../lib/fetchers/periodicFetch';
import ProvisionServerDialog from '../components/ProvisionServerDialog'; import ProvisionServerDialog from '../components/ProvisionServerDialog';
import ServerMenu from '../components/ServerMenu';
import Spinner from '../components/Spinner'; import Spinner from '../components/Spinner';
import { HeaderText } from '../components/Text'; import { HeaderText } from '../components/Text';
import { last } from '../lib/time'; import { last } from '../lib/time';
@ -80,13 +79,6 @@ const createServerPreviewContainer = (servers: ServerListItem[]) => (
> >
{anvilName} {anvilName}
</Link>, </Link>,
<ServerMenu
iconButtonProps={{ size: 'small' }}
key={`server_${serverUUID}_power_options`}
serverName={serverName}
serverState={serverState}
serverUuid={serverUUID}
/>,
]} ]}
hrefPreview={`/server?uuid=${serverUUID}&server_name=${serverName}&server_state=${serverState}&vnc=1`} hrefPreview={`/server?uuid=${serverUUID}&server_name=${serverName}&server_state=${serverState}&vnc=1`}
isExternalLoading={loading} isExternalLoading={loading}

Loading…
Cancel
Save