Skip to content

Commit ad048a9

Browse files
committed
feat: backend entrypoint
1 parent 14d944a commit ad048a9

File tree

21 files changed

+277
-88
lines changed

21 files changed

+277
-88
lines changed

src/components/alert-info/block.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { WarningFilled } from '@ant-design/icons';
1+
import {
2+
CheckCircleFilled,
3+
LoadingOutlined,
4+
WarningFilled
5+
} from '@ant-design/icons';
26
import { Typography } from 'antd';
37
import { createStyles } from 'antd-style';
48
import classNames from 'classnames';
@@ -122,6 +126,17 @@ const AlertInfo: React.FC<AlertInfoProps> = (props) => {
122126
overlayScrollerProps = {}
123127
} = props;
124128
const { styles } = useStyles();
129+
130+
const renderIcon = () => {
131+
if (type === 'transition') {
132+
return <LoadingOutlined />;
133+
}
134+
if (type === 'success') {
135+
return <CheckCircleFilled />;
136+
}
137+
return <WarningFilled />;
138+
};
139+
125140
return (
126141
<>
127142
{message ? (
@@ -139,7 +154,7 @@ const AlertInfo: React.FC<AlertInfoProps> = (props) => {
139154
>
140155
<div className={classNames('title', type)}>
141156
<span className={classNames('info-icon', type)}>
142-
{icon ?? <WarningFilled />}
157+
{icon ?? renderIcon()}
143158
</span>
144159
</div>
145160
{title && (

src/components/seal-form/seal-textarea.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const SealTextArea: React.FC<InputTextareaProps & SealFormItemProps> = (
102102
<InputWrapper>
103103
<Wrapper
104104
status={status}
105-
label={<LabelWrapper>{label}</LabelWrapper>}
105+
label={label && <LabelWrapper>{label}</LabelWrapper>}
106106
isFocus={alwaysFocus || isFocus}
107107
required={required}
108108
description={description}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import { Switch, Tooltip } from 'antd';
2+
import React, { useState } from 'react';
3+
import styled from 'styled-components';
4+
import LabelInfo from '../seal-form/components/label-info';
5+
6+
const SwitchContainer = styled.div`
7+
display: flex;
8+
flex-direction: column;
9+
justify-content: center;
10+
gap: 8px;
11+
border: 1px solid var(--ant-color-border);
12+
border-radius: var(--ant-border-radius);
13+
padding: 12px 14px;
14+
min-height: 54px;
15+
`;
16+
17+
const LabelContainer = styled.div`
18+
display: flex;
19+
justify-content: space-between;
20+
align-items: center;
21+
`;
22+
23+
interface SwitchInputProps {
24+
label?: React.ReactNode;
25+
description?: string;
26+
checked?: boolean;
27+
defaultChecked?: boolean;
28+
onChange?: (checked: boolean) => void;
29+
children?: React.ReactNode;
30+
style?: React.CSSProperties;
31+
alwaysShowChildren?: boolean;
32+
btnTips?: React.ReactNode;
33+
size?: 'small' | 'default';
34+
}
35+
36+
const SwitchInput: React.FC<SwitchInputProps> = (props) => {
37+
const {
38+
label,
39+
description,
40+
checked,
41+
defaultChecked,
42+
onChange,
43+
children,
44+
style,
45+
alwaysShowChildren = true,
46+
size,
47+
btnTips
48+
} = props;
49+
const [internalChecked, setInternalChecked] = useState<boolean>(
50+
defaultChecked || false
51+
);
52+
53+
const handleChange = (checked: boolean) => {
54+
setInternalChecked(checked);
55+
onChange?.(checked);
56+
};
57+
58+
return (
59+
<SwitchContainer style={style}>
60+
<LabelContainer>
61+
<LabelInfo label={label} description={description} />
62+
<Tooltip title={btnTips}>
63+
<Switch
64+
size={size}
65+
checked={checked !== undefined ? checked : internalChecked}
66+
onChange={handleChange}
67+
/>
68+
</Tooltip>
69+
</LabelContainer>
70+
{(alwaysShowChildren || internalChecked) && children}
71+
</SwitchContainer>
72+
);
73+
};
74+
75+
export default SwitchInput;

src/global.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ body {
203203

204204
// form item help
205205
.ant-form-item-with-help .ant-form-item-explain {
206-
padding-left: 16px;
206+
// padding-left: 16px;
207207
}
208208

209209
// icon

src/locales/en-US/backends.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,9 @@ export default {
3434
'The custom backend name must end with "-custom".',
3535
'backend.quickConfig': 'Quick Config',
3636
'backend.version.default.not.exists':
37-
'The default version does not exist in {versions}.'
37+
'The default version does not exist in {versions}.',
38+
'backend.replaceEntrypoint': 'Override Image Entrypoint',
39+
'backend.entrypoint': 'Image Entrypoint',
40+
'backend.entrypoint.tips':
41+
'If specified, the ENTRYPOINT defined in the image will be ignored, and the command below will be used as the container startup entrypoint.'
3842
};

src/locales/en-US/clusters.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ Same applies to the <span class="bold-text">/opt/dtk</span> directory.`,
8989
'clusters.button.genToken':
9090
'Need to create a new token? Click <a href="{link}" target="_blank">here</a>.',
9191
'clusters.addworker.amdNotes-01': `If the <span class="bold-text">/opt/rocm</span> directory does not exist, please create a symbolic link pointing to the ROCm installed path: <span class="bold-text">ln -s /path/to/rocm /opt/rocm</span>.`,
92-
'clusters.addworker.message.success':
93-
'{count} workers have been added to the cluster.',
92+
'clusters.addworker.message.success_single':
93+
'{count} new worker has been added to the cluster.',
94+
'clusters.addworker.message.success_multiple':
95+
'{count} new workers have been added to the cluster.',
9496
'clusters.create.serverUrl': 'Server URL',
9597
'clusters.create.workerConfig': 'Worker Configuration',
9698
'clusters.addworker.containerName': 'Worker Container Name',

src/locales/ja-JP/backends.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,9 @@ export default {
3434
'The custom backend name must end with "-custom".',
3535
'backend.quickConfig': 'Quick Config',
3636
'backend.version.default.not.exists':
37-
'The default version does not exist in {versions}.'
37+
'The default version does not exist in {versions}.',
38+
'backend.replaceEntrypoint': 'Override Image Entrypoint',
39+
'backend.entrypoint': 'Image Entrypoint',
40+
'backend.entrypoint.tips':
41+
'If specified, the ENTRYPOINT defined in the image will be ignored, and the command below will be used as the container startup entrypoint.'
3842
};

src/locales/ja-JP/clusters.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ Same applies to the <span class="bold-text">/opt/dtk</span> directory.`,
8989
'clusters.button.genToken':
9090
'Need to create a new token? Click <a href="{link}" target="_blank">here</a>.',
9191
'clusters.addworker.amdNotes-01': `If the <span class="bold-text">/opt/rocm</span> directory does not exist, please create a symbolic link pointing to the ROCm installed path: <span class="bold-text">ln -s /path/to/rocm /opt/rocm</span>.`,
92-
'clusters.addworker.message.success':
93-
'{count} workers have been added to the cluster.',
92+
'clusters.addworker.message.success_single':
93+
'{count} new worker has been added to the cluster.',
94+
'clusters.addworker.message.success_multiple':
95+
'{count} new workers have been added to the cluster.',
9496
'clusters.create.serverUrl': 'Server URL',
9597
'clusters.create.workerConfig': 'Worker Configuration',
9698
'clusters.addworker.containerName': 'Worker Container Name',
@@ -179,11 +181,12 @@ Same applies to the <span class="bold-text">/opt/dtk</span> directory.`,
179181
// 71. 'clusters.addworker.cacheVolume': 'Model Cache Volume Mount',
180182
// 72. 'clusters.addworker.cacheVolume.tips': 'If you want to customize the model cache directory, you can specify the path to mount it.',
181183
// 73. 'clusters.addworker.cacheVolume.holder': 'e.g. /data/cache (path must start with /)',
182-
// 74. 'clusters.addworker.message.success': '{count} workers have been added to the cluster.',
183-
// 75. 'clusters.create.serverUrl': 'Server URL',
184-
// 76. 'clusters.create.workerConfig': 'Worker Configuration'
185-
// 75. 'clusters.addworker.containerName': 'Worker Container Name',
186-
// 76. 'clusters.addworker.containerName.tips':'Specify a name for the worker container.',
184+
// 74. 'clusters.addworker.message.success_single': '{count} new worker has been added to the cluster.',
185+
// 75. 'clusters.addworker.message.success_multiple': '{count} new workers have been added to the cluster.',
186+
// 76. 'clusters.create.serverUrl': 'Server URL',
187+
// 77. 'clusters.create.workerConfig': 'Worker Configuration'
188+
// 78. 'clusters.addworker.containerName': 'Worker Container Name',
189+
// 79. 'clusters.addworker.containerName.tips':'Specify a name for the worker container.',
187190
// 77. 'clusters.addworker.dataVolume': 'GPUStack Data Volume',
188191
// 78. 'clusters.addworker.dataVolume.tips': 'Specify a data storage path for GPUStack.',
189192
// 79. 'clusters.table.ip.internal': 'Internal',

src/locales/ru-RU/backends.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,17 @@ export default {
3434
'Пользовательское название бэкенда должно оканчиваться на «-custom».',
3535
'backend.quickConfig': 'Быстрая настройка',
3636
'backend.version.default.not.exists':
37-
'The default version does not exist in {versions}.'
37+
'The default version does not exist in {versions}.',
38+
'backend.replaceEntrypoint': 'Override Image Entrypoint',
39+
'backend.entrypoint': 'Image Entrypoint',
40+
'backend.entrypoint.tips':
41+
'If specified, the ENTRYPOINT defined in the image will be ignored, and the command below will be used as the container startup entrypoint.'
3842
};
3943

4044
// ========== To-Do: Translate Keys (Remove After Translation) ==========
41-
// 1. 'backend.version.default.not.exists': 'The default version does not exist in {versions}.'
45+
// 1. 'backend.version.default.not.exists': 'The default version does not exist in {versions}.',
46+
// 2. 'backend.replaceEntrypoint': 'Override Image Entrypoint',
47+
// 3. 'backend.entrypoint': 'Image Entrypoint',
48+
// 4. 'backend.entrypoint.tips':
49+
// 'If specified, the ENTRYPOINT defined in the image will be ignored, and the command below will be used as the container startup entrypoint.'
4250
// ========== End of To-Do List ==========

src/locales/ru-RU/clusters.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ export default {
8989
'clusters.button.genToken':
9090
'Need to create a new token? Click <a href="{link}" target="_blank">here</a>.',
9191
'clusters.addworker.amdNotes-01': `If the <span class="bold-text">/opt/rocm</span> directory does not exist, please create a symbolic link pointing to the ROCm installed path: <span class="bold-text">ln -s /path/to/rocm /opt/rocm</span>.`,
92-
'clusters.addworker.message.success':
93-
'{count} workers have been added to the cluster.',
92+
'clusters.addworker.message.success_single':
93+
'{count} new worker has been added to the cluster.',
94+
'clusters.addworker.message.success_multiple':
95+
'{count} new workers have been added to the cluster.',
9496
'clusters.create.serverUrl': 'Server URL',
9597
'clusters.create.workerConfig': 'Worker Configuration',
9698
'clusters.addworker.containerName': 'Worker Container Name',
@@ -110,13 +112,14 @@ export default {
110112
// 2. 'clusters.button.genToken': 'Need to create a new token? Click <a href="{link}" target="_blank">here</a>.',
111113
// 3. 'clusters.addworker.cacheVolume': 'Model Cache Volume Mount',
112114
// 4. 'clusters.addworker.cacheVolume.tips': 'If you want to customize the model cache directory, you can specify the path to mount it.',
113-
// 5. 'clusters.addworker.message.success': '{count} workers have been added to the cluster.',
114-
// 6. 'clusters.create.serverUrl': 'Server URL',
115-
// 7. 'clusters.create.workerConfig': 'Worker Configuration'
116-
// 6. 'clusters.addworker.containerName': 'Worker Container Name',
117-
// 7. 'clusters.addworker.containerName.tips':'Specify a name for the worker container.',
118-
// 8. 'clusters.addworker.dataVolume': 'GPUStack Data Volume',
119-
// 9. 'clusters.addworker.dataVolume.tips': 'Specify a data storage path for GPUStack.',
115+
// 5. 'clusters.addworker.message.success_single': '{count} new worker has been added to the cluster.',
116+
// 6. 'clusters.addworker.message.success_multiple': '{count} new workers have been added to the cluster.',
117+
// 7. 'clusters.create.serverUrl': 'Server URL',
118+
// 8. 'clusters.create.workerConfig': 'Worker Configuration'
119+
// 9. 'clusters.addworker.containerName': 'Worker Container Name',
120+
// 10. 'clusters.addworker.containerName.tips':'Specify a name for the worker container.',
121+
// 11. 'clusters.addworker.dataVolume': 'GPUStack Data Volume',
122+
// 12. 'clusters.addworker.dataVolume.tips': 'Specify a data storage path for GPUStack.',
120123
// 10. 'clusters.table.ip.internal': 'Internal',
121124
// 11. 'clusters.table.ip.external': 'External',
122125
// 12. 'clusters.form.serverUrl.tips': 'Specify the server URL accessible from your cloud provider.'

0 commit comments

Comments
 (0)