Skip to content

Commit ea8d312

Browse files
committed
[UI] A prototype of the "Connect" section to show on the running dev environment page (WIP)
1 parent 015f9f8 commit ea8d312

File tree

1 file changed

+16
-20
lines changed
  • frontend/src/pages/Runs/Details/RunDetails

1 file changed

+16
-20
lines changed

frontend/src/pages/Runs/Details/RunDetails/index.tsx

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ import {
2525
import { DATE_TIME_FORMAT } from 'consts';
2626
import { copyToClipboard } from 'libs';
2727
import { getRunError, getRunPriority, getRunStatusMessage, getStatusIconColor, getStatusIconType } from 'libs/run';
28+
import { ROUTES } from 'routes';
2829
import { useGetRunQuery } from 'services/run';
2930

3031
import { finishedRunStatuses } from 'pages/Runs/constants';
3132
import { runIsStopped } from 'pages/Runs/utils';
3233

33-
import { ROUTES } from '../../../../routes';
3434
import {
3535
getRunListItemBackend,
3636
getRunListItemInstanceId,
@@ -44,6 +44,9 @@ import { JobList } from '../Jobs/List';
4444

4545
import styles from './styles.module.scss';
4646

47+
const UvInstallCommand = 'uv tool install dstack -U';
48+
const PipInstallCommand = 'pip install dstack -U';
49+
4750
export const RunDetails = () => {
4851
const { t } = useTranslation();
4952
const params = useParams();
@@ -94,6 +97,7 @@ export const RunDetails = () => {
9497
const status = finishedRunStatuses.includes(runData.status)
9598
? (runData.latest_job_submission?.status ?? runData.status)
9699
: runData.status;
100+
97101
const terminationReason = finishedRunStatuses.includes(runData.status)
98102
? runData.latest_job_submission?.termination_reason
99103
: null;
@@ -233,15 +237,12 @@ export const RunDetails = () => {
233237
}}
234238
onNavigate={({ detail }) => setActiveStepIndex(detail.requestedStepIndex)}
235239
activeStepIndex={activeStepIndex}
236-
onSubmit={() => {
237-
window.open(openInIDEUrl, '_blank');
238-
}}
240+
onSubmit={() => window.open(openInIDEUrl, '_blank')}
239241
submitButtonText="Open in VS Code"
240242
allowSkipTo={true}
241243
steps={[
242244
{
243245
title: 'Attach',
244-
// info: <InfoLink onFollow={() => openHelpPanel(CLI_INFO)} />,
245246
content: (
246247
<SpaceBetween size="s">
247248
<Box>To access this run, first you need to attach to it.</Box>
@@ -272,8 +273,9 @@ export const RunDetails = () => {
272273

273274
<ExpandableSection headerText="No CLI installed?">
274275
<SpaceBetween size="s">
275-
<Box></Box>
276+
<Box />
276277
<Box>To use dstack, install the CLI on your local machine.</Box>
278+
277279
<Tabs
278280
variant="container"
279281
tabs={[
@@ -284,7 +286,7 @@ export const RunDetails = () => {
284286
<>
285287
<div className={styles.codeWrapper}>
286288
<Code className={styles.code}>
287-
uv tool install dstack -U
289+
{UvInstallCommand}
288290
</Code>
289291

290292
<div className={styles.copy}>
@@ -304,9 +306,7 @@ export const RunDetails = () => {
304306
iconName="copy"
305307
variant="normal"
306308
onClick={() =>
307-
copyToClipboard(
308-
'uv tool install dstack -U',
309-
)
309+
copyToClipboard(UvInstallCommand)
310310
}
311311
/>
312312
</Popover>
@@ -322,7 +322,7 @@ export const RunDetails = () => {
322322
<>
323323
<div className={styles.codeWrapper}>
324324
<Code className={styles.code}>
325-
pip install dstack -U
325+
{PipInstallCommand}
326326
</Code>
327327

328328
<div className={styles.copy}>
@@ -342,9 +342,7 @@ export const RunDetails = () => {
342342
iconName="copy"
343343
variant="normal"
344344
onClick={() =>
345-
copyToClipboard(
346-
'pip install dstack -U',
347-
)
345+
copyToClipboard(PipInstallCommand)
348346
}
349347
/>
350348
</Popover>
@@ -363,22 +361,20 @@ export const RunDetails = () => {
363361
},
364362
{
365363
title: 'Open',
366-
// info: <InfoLink onFollow={() => openHelpPanel(CLI_INFO)} />,
367364
description: 'After the CLI is attached, you can open the dev environment in VS Code.',
368365
content: (
369366
<SpaceBetween size="s">
370367
<Button
371368
variant="primary"
372369
external={true}
373-
onClick={() => {
374-
window.open(openInIDEUrl, '_blank');
375-
}}
370+
onClick={() => window.open(openInIDEUrl, '_blank')}
376371
>
377372
Open in VS Code
378373
</Button>
374+
379375
<ExpandableSection headerText="Need plain SSH?">
380376
<SpaceBetween size="s">
381-
<Box></Box>
377+
<Box />
382378
<div className={styles.codeWrapper}>
383379
<Code className={styles.code}>{sshCommand}</Code>
384380

@@ -415,7 +411,7 @@ export const RunDetails = () => {
415411

416412
{runData.status === 'running' && (
417413
<SpaceBetween size="s">
418-
<Box></Box>
414+
<Box />
419415
<Alert type="info">Waiting for the run to start.</Alert>
420416
</SpaceBetween>
421417
)}

0 commit comments

Comments
 (0)