|
1 | 1 | import * as React from 'react'; |
2 | 2 | import { AppBar, Box, Button, Chip, CircularProgress, Collapse, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, FormControl, IconButton, InputLabel, List, ListItem, ListItemIcon, ListItemText, OutlinedInput, Stack, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Toolbar, Tooltip, Typography } from '@mui/material'; |
3 | | -import { AddCircleRounded, ArticleRounded, ContentCopyRounded, StopRounded, PlayArrowRounded, KeyboardArrowUpRounded, KeyboardArrowDownRounded, TerminalRounded, DvrRounded, CloseRounded, DeleteRounded } from "@mui/icons-material"; |
| 3 | +import { AddCircleRounded, ArticleRounded, ContentCopyRounded, StopRounded, PlayArrowRounded, KeyboardArrowUpRounded, KeyboardArrowDownRounded, TerminalRounded, CloseRounded, DeleteRounded } from "@mui/icons-material"; |
4 | 4 |
|
5 | 5 | import { SqlContainer } from '../models/SqlContainer'; |
| 6 | +import { ConnectionOptions } from './ConnectionOptions'; |
6 | 7 | import { useDockerDesktopClient } from '../App'; |
7 | 8 |
|
8 | | -const copyToClipboard = (text: string) => { |
| 9 | +export const copyToClipboard = (text: string) => { |
9 | 10 | navigator.clipboard.writeText(text); |
| 11 | + const ddClient = useDockerDesktopClient(); |
| 12 | + ddClient.desktopUI.toast.success("Password copied to clipboard"); |
10 | 13 | } |
11 | 14 |
|
12 | 15 | const navigateToContainer = (containerId: string) => { |
13 | 16 | const ddClient = useDockerDesktopClient(); |
14 | 17 | ddClient.desktopUI.navigate.viewContainerLogs(containerId); |
15 | 18 | } |
16 | 19 |
|
17 | | -// copies the password to the clipboard, then opens the connectionURI |
18 | | -const openADS = (connectionURI: string, saPassword: string) => { |
19 | | - copyToClipboard(saPassword); |
20 | | - window.location.href = connectionURI; |
21 | | -} |
22 | | - |
23 | 20 | var ContainerStatus = ({ status }) => { |
24 | 21 | if (status === "running") { |
25 | 22 | return ( |
@@ -205,15 +202,7 @@ var ContainerRow = ({ container, startContainer, stopContainer, deleteContainer, |
205 | 202 | <ContentCopyRounded /> |
206 | 203 | </IconButton> |
207 | 204 | </Tooltip> |
208 | | - <Tooltip title="Connect in Azure Data Studio"> |
209 | | - <IconButton size="small" aria-label='connect' disabled={!(container.Status === "running")} |
210 | | - onClick={() => { |
211 | | - trackEvent('OpenADS', { containerId: container.Id }); |
212 | | - openADS(container.adsConnectionURI(), container.SApassword); |
213 | | - }}> |
214 | | - <DvrRounded /> |
215 | | - </IconButton> |
216 | | - </Tooltip> |
| 205 | + <ConnectionOptions container={container} trackEvent={trackEvent} /> |
217 | 206 | <Tooltip title="Container logs"> |
218 | 207 | <IconButton size="small" aria-label='logs' onClick={() => { |
219 | 208 | trackEvent('ViewLogs', { containerId: container.Id }); |
|
0 commit comments