-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #832 from DanaOrr/adding-option-to-enable-rdp-service
Bug 2099556: Adding the option to enable Rdp service in one click to windows vm
- Loading branch information
Showing
12 changed files
with
216 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 16 additions & 6 deletions
22
src/utils/components/Consoles/components/DesktopViewer/Components/RDPConnector.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/utils/components/Consoles/components/DesktopViewer/Components/RDPServiceModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import * as React from 'react'; | ||
|
||
import { V1VirtualMachine, V1VirtualMachineInstance } from '@kubevirt-ui/kubevirt-api/kubevirt'; | ||
import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation'; | ||
import { Alert, Checkbox, ModalVariant, Stack, StackItem } from '@patternfly/react-core'; | ||
import TabModal from '@kubevirt-utils/components/TabModal/TabModal'; | ||
import ExternalLink from '@kubevirt-utils/components/ExternalLink/ExternalLink'; | ||
import { NODE_PORTS_LINK } from '../utils/constants'; | ||
import { createRDPService } from '../utils/utils'; | ||
|
||
type RDPServiceModalProps = { | ||
vmi: V1VirtualMachineInstance; | ||
vm: V1VirtualMachine; | ||
isOpen: boolean; | ||
onClose: () => void; | ||
}; | ||
|
||
const RDPServiceModal: React.FC<RDPServiceModalProps> = ({ vmi, vm, isOpen, onClose }) => { | ||
const { t } = useKubevirtTranslation(); | ||
const [isChecked, setChecked] = React.useState<boolean>(false); | ||
|
||
return ( | ||
<TabModal | ||
isOpen={isOpen} | ||
isDisabled={!isChecked} | ||
onClose={onClose} | ||
onSubmit={() => createRDPService(vm, vmi)} | ||
headerText={t('RDP Service')} | ||
modalVariant={ModalVariant.medium} | ||
> | ||
<Stack hasGutter> | ||
<StackItem> | ||
<Checkbox | ||
id="rdp-service-checkbox" | ||
className="kv-rdp-service-checkbox--main" | ||
label={t('Expose RDP Service')} | ||
isChecked={isChecked} | ||
data-checked-state={isChecked} | ||
onChange={setChecked} | ||
/> | ||
</StackItem> | ||
<StackItem> | ||
<Alert variant="info" isInline title={t('Node port')}> | ||
<div> | ||
{t('RDP Service is using a node port. Node port requires additional port resources.')} | ||
<div> | ||
<ExternalLink text={t('Learn more')} href={NODE_PORTS_LINK} /> | ||
</div> | ||
</div> | ||
</Alert> | ||
</StackItem> | ||
</Stack> | ||
</TabModal> | ||
); | ||
}; | ||
|
||
export default RDPServiceModal; |
34 changes: 34 additions & 0 deletions
34
...utils/components/Consoles/components/DesktopViewer/Components/RDPServiceNotConfigured.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import { Trans } from 'react-i18next'; | ||
|
||
import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation'; | ||
import { RDPServiceNotConfiguredProps } from '../utils/types'; | ||
import { Button, ButtonVariant } from '@patternfly/react-core'; | ||
import RDPServiceModal from './RDPServiceModal'; | ||
import { useModal } from '@kubevirt-utils/components/ModalProvider/ModalProvider'; | ||
import './rdp-service.scss'; | ||
const RDPServiceNotConfigured: React.FC<RDPServiceNotConfiguredProps> = ({ vm, vmi }) => { | ||
const { t } = useKubevirtTranslation(); | ||
const { createModal } = useModal(); | ||
return ( | ||
<Trans t={t} ns="plugin__kubevirt-plugin"> | ||
<span> | ||
This is a Windows VirtualMachine but no Service for the RDP (Remote Desktop Protocol) can be | ||
found. | ||
</span> | ||
<br /> | ||
<span> | ||
For better experience accessing Windows console, it is recommended to use the RDP. | ||
<Button | ||
className="kv-create-rdp-service-button" | ||
variant={ButtonVariant.secondary} | ||
onClick={() => createModal((props) => <RDPServiceModal vm={vm} vmi={vmi} {...props} />)} | ||
> | ||
Create RDP Service | ||
</Button> | ||
</span> | ||
</Trans> | ||
); | ||
}; | ||
|
||
export default RDPServiceNotConfigured; |
52 changes: 0 additions & 52 deletions
52
...utils/components/Consoles/components/DesktopViewer/Components/RdpServiceNotConfigured.tsx
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
src/utils/components/Consoles/components/DesktopViewer/Components/rdp-service.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.kv-create-rdp-service-button { | ||
display: block; | ||
margin-top: var(--pf-global--spacer--md) | ||
; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.