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

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

@ -16,7 +16,6 @@ import OutlinedInput from '../components/OutlinedInput';
import { Panel, PanelHeader } from '../components/Panels';
import periodicFetch from '../lib/fetchers/periodicFetch';
import ProvisionServerDialog from '../components/ProvisionServerDialog';
import ServerMenu from '../components/ServerMenu';
import Spinner from '../components/Spinner';
import { HeaderText } from '../components/Text';
import { last } from '../lib/time';
@ -80,13 +79,6 @@ const createServerPreviewContainer = (servers: ServerListItem[]) => (
>
{anvilName}
</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`}
isExternalLoading={loading}

Loading…
Cancel
Save