|
| 1 | +/* |
| 2 | + * This file is part of Cockpit. |
| 3 | + * |
| 4 | + * Copyright (C) 2025 Red Hat, Inc. |
| 5 | + * |
| 6 | + * Cockpit is free software; you can redistribute it and/or modify it |
| 7 | + * under the terms of the GNU Lesser General Public License as published by |
| 8 | + * the Free Software Foundation; either version 2.1 of the License, or |
| 9 | + * (at your option) any later version. |
| 10 | + * |
| 11 | + * Cockpit is distributed in the hope that it will be useful, but |
| 12 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | + * Lesser General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU Lesser General Public License |
| 17 | + * along with Cockpit; If not, see <http://www.gnu.org/licenses/>. |
| 18 | + */ |
| 19 | + |
| 20 | +import React from 'react'; |
| 21 | +import cockpit from 'cockpit'; |
| 22 | + |
| 23 | +import { Text, TextContent, TextVariants, TextList, TextListItem, TextListItemVariants, TextListVariants } from "@patternfly/react-core/dist/esm/components/Text"; |
| 24 | +import { ClipboardCopy } from "@patternfly/react-core/dist/esm/components/ClipboardCopy/index.js"; |
| 25 | +import { fmt_to_fragments } from 'utils.jsx'; |
| 26 | + |
| 27 | +const _ = cockpit.gettext; |
| 28 | + |
| 29 | +export const RemoteConnectionInfo = ({ url, editor }) => { |
| 30 | + function TLI(term, description) { |
| 31 | + // What is this? Java? |
| 32 | + return ( |
| 33 | + <> |
| 34 | + <TextListItem component={TextListItemVariants.dt}>{term}</TextListItem> |
| 35 | + <TextListItem component={TextListItemVariants.dd}>{description}</TextListItem> |
| 36 | + </> |
| 37 | + ); |
| 38 | + } |
| 39 | + |
| 40 | + return ( |
| 41 | + <TextContent> |
| 42 | + <Text component={TextVariants.p}> |
| 43 | + {fmt_to_fragments(_('Clicking "Launch viewer" will download a $0 file and launch the Remote Viewer application on your system.'), <code>.vv</code>)} |
| 44 | + </Text> |
| 45 | + <Text component={TextVariants.p}> |
| 46 | + {_('Remote Viewer is available for most operating systems. To install it, search for "Remote Viewer" in GNOME Software, KDE Discover, or run the following:')} |
| 47 | + </Text> |
| 48 | + <TextList component={TextListVariants.dl}> |
| 49 | + {TLI(_("RHEL, CentOS"), <code>sudo yum install virt-viewer</code>)} |
| 50 | + {TLI(_("Fedora"), <code>sudo dnf install virt-viewer</code>)} |
| 51 | + {TLI(_("Ubuntu, Debian"), <code>sudo apt-get install virt-viewer</code>)} |
| 52 | + {TLI(_("Windows"), |
| 53 | + fmt_to_fragments( |
| 54 | + _("Download the MSI from $0"), |
| 55 | + <a href="https://virt-manager.org/download" target="_blank" rel="noopener noreferrer"> |
| 56 | + virt-manager.org |
| 57 | + </a>))} |
| 58 | + </TextList> |
| 59 | + { url && |
| 60 | + <> |
| 61 | + <Text component={TextVariants.p}> |
| 62 | + {_('Other remote viewer applications can connect to the following address:')} |
| 63 | + </Text> |
| 64 | + <Text component={TextVariants.p}> |
| 65 | + <ClipboardCopy |
| 66 | + hoverTip={_("Copy to clipboard")} |
| 67 | + clickTip={_("Successfully copied to clipboard!")} |
| 68 | + variant="inline-compact" |
| 69 | + isCode> |
| 70 | + {url} |
| 71 | + </ClipboardCopy> |
| 72 | + </Text> |
| 73 | + </> |
| 74 | + } |
| 75 | + { editor } |
| 76 | + </TextContent> |
| 77 | + ); |
| 78 | +}; |
0 commit comments