-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
123 additions
and
18 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export const FLAG_KUBEVIRT_DYNAMIC = 'KUBEVIRT_DYNAMIC'; | ||
export const FLAG_KUBEVIRT_CDI = 'KUBEVIRT_CDI'; | ||
export const FLAG_CONSOLE_CLI_DOWNLOAD = 'CONSOLE_CLI_DOWNLOAD'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.virtctl-popup { | ||
&__body--message { | ||
margin-bottom: var(--pf-global--spacer--md); | ||
} | ||
|
||
&__button { | ||
padding-right: 0; | ||
} | ||
} |
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,66 @@ | ||
import * as React from 'react'; | ||
|
||
import { ConsoleCLIDownloadModelGroupVersionKind } from '@kubevirt-ui/kubevirt-api/console'; | ||
import ExternalLink from '@kubevirt-utils/components/ExternalLink/ExternalLink'; | ||
import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation'; | ||
import { useK8sWatchResource } from '@openshift-console/dynamic-plugin-sdk'; | ||
import { Button, Popover, PopoverPosition } from '@patternfly/react-core'; | ||
|
||
import { VIRTCTL_DOWNLOADS } from './constants'; | ||
import { K8sResourceKind } from './types'; | ||
|
||
import './VirtctlPopup.scss'; | ||
|
||
const VirtctlPopup: React.FC = () => { | ||
const { t } = useKubevirtTranslation(); | ||
const [cliTools] = useK8sWatchResource<K8sResourceKind>({ | ||
groupVersionKind: ConsoleCLIDownloadModelGroupVersionKind, | ||
isList: true, | ||
namespaced: false, | ||
}); | ||
|
||
const tools = Array.isArray(cliTools) ? cliTools : [cliTools]; | ||
const virtctlObj = tools?.find((tool) => tool?.metadata?.name === VIRTCTL_DOWNLOADS); | ||
|
||
const { displayName, links } = virtctlObj?.spec || {}; | ||
|
||
const bodyContent = ( | ||
<> | ||
<div className="virtctl-popup__body--message"> | ||
{t( | ||
'The virtctl client is a supplemental command-line utility for managing virtualization resources from the command line.', | ||
)} | ||
</div> | ||
<div> | ||
{links?.length > 1 && ( | ||
<ul> | ||
{links.map((link) => ( | ||
<li key={`${link?.text}-${link?.href}`}> | ||
<ExternalLink href={link?.href} text={link?.text || displayName} /> | ||
</li> | ||
))} | ||
</ul> | ||
)} | ||
</div> | ||
</> | ||
); | ||
|
||
return ( | ||
<Popover | ||
position={PopoverPosition.left} | ||
headerContent={<>{t('Download the virtctl command-line utility')}</>} | ||
bodyContent={bodyContent} | ||
maxWidth="350px" | ||
> | ||
<Button | ||
id="virtctl-download-links" | ||
className="pf-m-link--align-left virtctl-popup__button" | ||
variant="link" | ||
> | ||
{t('Download virtctl')} | ||
</Button> | ||
</Popover> | ||
); | ||
}; | ||
|
||
export default VirtctlPopup; |
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