Skip to content

Commit c89f24f

Browse files
authored
UI improvements (#2489)
* [Feature] Implemented improvements on the UI * [Feature] Show Run metrics on the UI
1 parent 53fd622 commit c89f24f

File tree

32 files changed

+532
-403
lines changed

32 files changed

+532
-403
lines changed

frontend/src/App/Login/EnterpriseLogin/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const EnterpriseLogin: React.FC = () => {
2323
const entraEnabled = entraData?.enabled;
2424

2525
const isLoading = isLoadingOkta || isLoadingEntra;
26+
const isShowTokenForm = !oktaEnabled && !entraEnabled;
2627

2728
return (
2829
<UnauthorizedLayout>
@@ -32,11 +33,11 @@ export const EnterpriseLogin: React.FC = () => {
3233
{t('auth.sign_in_to_dstack_enterprise')}
3334
</Box>
3435

35-
{!isLoading && !oktaEnabled && <LoginByTokenForm />}
36+
{!isLoading && isShowTokenForm && <LoginByTokenForm />}
3637
{!isLoadingOkta && oktaEnabled && <LoginByOkta className={styles.okta} />}
3738
{!isLoadingEntra && entraEnabled && <LoginByEntraID className={styles.entra} />}
3839

39-
{!isLoading && (oktaEnabled || entraEnabled) && (
40+
{!isLoading && !isShowTokenForm && (
4041
<Box color="text-body-secondary">
4142
<NavigateLink href={ROUTES.AUTH.TOKEN}>{t('auth.login_by_token')}</NavigateLink>
4243
</Box>

frontend/src/layouts/AppLayout/hooks.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const useSideNavigation = () => {
2222

2323
const isPoolDetails = Boolean(useMatch(ROUTES.FLEETS.DETAILS.TEMPLATE));
2424
const billingUrl = ROUTES.USER.BILLING.LIST.FORMAT(userName);
25+
const userProjectsUrl = ROUTES.USER.PROJECTS.FORMAT(userName);
2526

2627
const generalLinks = [
2728
{ type: 'link', text: t('navigation.runs'), href: ROUTES.RUNS.LIST },
@@ -49,6 +50,11 @@ export const useSideNavigation = () => {
4950
text: t('navigation.billing'),
5051
href: billingUrl,
5152
},
53+
{
54+
type: 'link',
55+
text: t('users.projects'),
56+
href: userProjectsUrl,
57+
},
5258
].filter(Boolean);
5359

5460
const navLinks: SideNavigationProps['items'] = [
@@ -93,7 +99,8 @@ export const useSideNavigation = () => {
9399

94100
{
95101
type: 'link',
96-
text: `dstack version: ${serverInfoData?.server_version}`,
102+
href: '#version',
103+
text: `dstack version: ${serverInfoData?.server_version ?? 'No version'}`,
97104
},
98105
].filter(Boolean) as SideNavigationProps['items'];
99106

frontend/src/layouts/AppLayout/index.module.scss

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@
1818

1919
[class^='awsui_navigation'] {
2020
[class^='awsui_list-container'] {
21-
[class*='awsui_list-variant-root--last'] {
22-
[class^='awsui_list-item']:last-child {
23-
a {
24-
pointer-events: none;
25-
color: awsui.$color-text-status-inactive !important;
26-
}
27-
}
21+
a[href='#version'] {
22+
pointer-events: none;
23+
color: awsui.$color-text-status-inactive !important;
2824
}
2925
}
3026
}

frontend/src/locale/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@
337337
"provider_name": "Provider",
338338
"status": "Status",
339339
"submitted_at": "Submitted",
340+
"finished_at": "Finished",
340341
"metrics": {
341342
"title": "Metrics",
342343
"show_metrics": "Show metrics",

frontend/src/pages/Models/Details/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,12 +433,12 @@ export const ModelDetails: React.FC = () => {
433433
activeTabId={codeTab}
434434
tabs={[
435435
{
436-
label: 'Python',
436+
label: 'python',
437437
id: CodeTab.Python,
438438
content: <Code>{pythonCode}</Code>,
439439
},
440440
{
441-
label: 'Curl',
441+
label: 'curl',
442442
id: CodeTab.Curl,
443443
content: <Code>{curlCode}</Code>,
444444
},

frontend/src/pages/Project/Backends/Table/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export const BackendsTable: React.FC<IProps> = ({
4949

5050
const { columns } = useColumnsDefinitions({
5151
...(editBackend ? { onEditClick: (backend) => editBackend(backend) } : {}),
52-
...(deleteBackends ? { onDeleteClick: (backend) => deleteBackends([backend]) } : {}),
5352
});
5453

5554
const renderCounter = () => {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
3+
export const CLI_INFO = {
4+
header: <h2>CLI</h2>,
5+
body: (
6+
<>
7+
<p>Some text</p>
8+
</>
9+
),
10+
};

frontend/src/pages/Project/Details/Settings/index.tsx

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
Container,
1212
Header,
1313
Hotspot,
14+
InfoLink,
1415
Loader,
1516
Popover,
1617
SelectCSD,
@@ -19,7 +20,7 @@ import {
1920
} from 'components';
2021
import { HotspotIds } from 'layouts/AppLayout/TutorialPanel/constants';
2122

22-
import { useBreadcrumbs, useNotifications } from 'hooks';
23+
import { useBreadcrumbs, useHelpPanel, useNotifications } from 'hooks';
2324
import { riseRouterException } from 'libs';
2425
import { ROUTES } from 'routes';
2526
import { useGetProjectQuery, useUpdateProjectMembersMutation } from 'services/project';
@@ -33,6 +34,7 @@ import { useBackendsTable } from '../../Backends/hooks';
3334
import { BackendsTable } from '../../Backends/Table';
3435
import { GatewaysTable } from '../../Gateways';
3536
import { useGatewaysTable } from '../../Gateways/hooks';
37+
import { CLI_INFO } from './constants';
3638

3739
import styles from './styles.module.scss';
3840

@@ -41,7 +43,9 @@ export const ProjectSettings: React.FC = () => {
4143
const params = useParams();
4244
const navigate = useNavigate();
4345
const paramProjectName = params.projectName ?? '';
46+
const [openHelpPanel] = useHelpPanel();
4447
const [configCliCommand, copyCliCommand] = useConfigProjectCliCommand({ projectName: paramProjectName });
48+
4549
const { isAvailableDeletingPermission, isProjectManager, isProjectAdmin, isAvailableProjectManaging } =
4650
useCheckAvailableProjectPermission();
4751

@@ -132,22 +136,7 @@ export const ProjectSettings: React.FC = () => {
132136
<SpaceBetween size="l">
133137
<Container
134138
header={
135-
<Header
136-
variant="h2"
137-
actions={
138-
<Popover
139-
dismissButton={false}
140-
position="top"
141-
size="small"
142-
triggerType="custom"
143-
content={<StatusIndicator type="success">{t('common.copied')}</StatusIndicator>}
144-
>
145-
<Button formAction="none" iconName="copy" variant="normal" onClick={copyCliCommand}>
146-
{t('common.copy')}
147-
</Button>
148-
</Popover>
149-
}
150-
>
139+
<Header variant="h2" info={<InfoLink onFollow={() => openHelpPanel(CLI_INFO)} />}>
151140
{t('projects.edit.cli')}
152141
</Header>
153142
}
@@ -157,9 +146,28 @@ export const ProjectSettings: React.FC = () => {
157146
Run the following commands to set up the CLI for this project
158147
</Box>
159148

160-
<Hotspot hotspotId={HotspotIds.CONFIGURE_CLI_COMMAND}>
161-
<Code>{configCliCommand}</Code>
162-
</Hotspot>
149+
<div className={styles.codeWrapper}>
150+
<Hotspot hotspotId={HotspotIds.CONFIGURE_CLI_COMMAND}>
151+
<Code className={styles.code}>{configCliCommand}</Code>
152+
153+
<div className={styles.copy}>
154+
<Popover
155+
dismissButton={false}
156+
position="top"
157+
size="small"
158+
triggerType="custom"
159+
content={<StatusIndicator type="success">{t('common.copied')}</StatusIndicator>}
160+
>
161+
<Button
162+
formAction="none"
163+
iconName="copy"
164+
variant="normal"
165+
onClick={copyCliCommand}
166+
/>
167+
</Popover>
168+
</div>
169+
</Hotspot>
170+
</div>
163171
</SpaceBetween>
164172
</Container>
165173

frontend/src/pages/Project/Details/Settings/styles.module.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,17 @@
77
.dangerSectionField {
88
width: 300px;
99
}
10+
11+
.codeWrapper {
12+
position: relative;
13+
14+
.code {
15+
padding: 16px 12px;
16+
}
17+
18+
.copy {
19+
position: absolute;
20+
top: 10px;
21+
right: 8px;
22+
}
23+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
3+
export const GATEWAYS_INFO = {
4+
header: <h2>Gateways</h2>,
5+
body: (
6+
<>
7+
<p>Some text</p>
8+
</>
9+
),
10+
};

0 commit comments

Comments
 (0)