@@ -29,14 +29,15 @@ import { HelperText, HelperTextItem } from "@patternfly/react-core/dist/esm/comp
2929import { TextInput } from "@patternfly/react-core/dist/esm/components/TextInput" ;
3030import { InputGroup } from "@patternfly/react-core/dist/esm/components/InputGroup" ;
3131import { EyeIcon , EyeSlashIcon , PendingIcon , HelpIcon } from "@patternfly/react-icons" ;
32+ import { ToggleGroup , ToggleGroupItem } from '@patternfly/react-core/dist/esm/components/ToggleGroup' ;
3233
3334import {
3435 EmptyState , EmptyStateHeader , EmptyStateIcon , EmptyStateBody , EmptyStateFooter , EmptyStateActions
3536} from "@patternfly/react-core/dist/esm/components/EmptyState" ;
3637import { Split , SplitItem } from "@patternfly/react-core/dist/esm/layouts/Split/index.js" ;
3738
3839import { KebabDropdown } from 'cockpit-components-dropdown.jsx' ;
39- import { DropdownItem } from "@patternfly/react-core/dist/esm/components/Dropdown" ;
40+ import { DropdownItem , DropdownGroup } from "@patternfly/react-core/dist/esm/components/Dropdown" ;
4041
4142import { Modal , ModalVariant } from "@patternfly/react-core/dist/esm/components/Modal" ;
4243import { ModalError } from 'cockpit-components-inline-notification.jsx' ;
@@ -189,7 +190,11 @@ const VncEditModal = ({ vm, inactive_vnc }) => {
189190 ) ;
190191} ;
191192
192- const VncFooter = ( { vm, vnc, inactive_vnc, connected, onDisconnect, onAddErrorNotification } ) => {
193+ const VncFooter = ( {
194+ vm, vnc, inactive_vnc, connected, onDisconnect,
195+ isExpanded, sizeMode, setSizeMode,
196+ onAddErrorNotification
197+ } ) => {
193198 const Dialogs = useDialogs ( ) ;
194199
195200 const renderDropdownItem = keyName => {
@@ -261,6 +266,24 @@ const VncFooter = ({ vm, vnc, inactive_vnc, connected, onDisconnect, onAddErrorN
261266 </ Button >
262267 </ Popover >
263268 </ SplitItem >
269+ { isExpanded &&
270+ < SplitItem >
271+ < ToggleGroup >
272+ < ToggleGroupItem
273+ text = { _ ( "No scaling or resizing" ) }
274+ isSelected = { ! sizeMode }
275+ onChange = { ( ) => setSizeMode ( null ) } />
276+ < ToggleGroupItem
277+ text = { _ ( "Local scaling" ) }
278+ isSelected = { sizeMode == "local" }
279+ onChange = { ( ) => setSizeMode ( "local" ) } />
280+ < ToggleGroupItem
281+ text = { _ ( "Remote resizing" ) }
282+ isSelected = { sizeMode == "remote" }
283+ onChange = { ( ) => setSizeMode ( "remote" ) } />
284+ </ ToggleGroup >
285+ </ SplitItem >
286+ }
264287 < SplitItem >
265288 < KebabDropdown
266289 toggleButtonId = "vnc-actions"
@@ -344,7 +367,8 @@ export class VncActive extends React.Component {
344367
345368 render ( ) {
346369 const {
347- consoleDetail, inactiveConsoleDetail, vm, onAddErrorNotification, isExpanded
370+ consoleDetail, inactiveConsoleDetail, vm, onAddErrorNotification, isExpanded,
371+ sizeMode, setSizeMode,
348372 } = this . props ;
349373 const { path, connected } = this . state ;
350374
@@ -363,12 +387,15 @@ export class VncActive extends React.Component {
363387
364388 const footer = (
365389 < VncFooter
366- vm = { vm }
367- vnc = { consoleDetail }
368- inactive_vnc = { inactiveConsoleDetail }
369- connected = { connected }
370- onDisconnect = { ( ) => this . setState ( { connected : false } ) }
371- onAddErrorNotification = { onAddErrorNotification } />
390+ vm = { vm }
391+ vnc = { consoleDetail }
392+ inactive_vnc = { inactiveConsoleDetail }
393+ connected = { connected }
394+ isExpanded = { isExpanded }
395+ sizeMode = { sizeMode }
396+ setSizeMode = { setSizeMode }
397+ onDisconnect = { ( ) => this . setState ( { connected : false } ) }
398+ onAddErrorNotification = { onAddErrorNotification } />
372399 ) ;
373400
374401 return (
@@ -387,8 +414,8 @@ export class VncActive extends React.Component {
387414 onSecurityFailure = { this . onSecurityFailure }
388415 textConnecting = { _ ( "Connecting" ) }
389416 consoleContainerId = { isExpanded ? "vnc-display-container-expanded" : "vnc-display-container-minimized" }
390- resizeSession
391- scaleViewport
417+ scaleViewport = { ! isExpanded || sizeMode == "local" }
418+ resizeSession = { ! ! isExpanded && sizeMode == "remote" }
392419 />
393420 : < div className = "pf-v5-c-console__vnc" >
394421 < EmptyState >
0 commit comments