style: border radius 8px

This commit is contained in:
jialin
2024-06-28 17:14:34 +08:00
parent 4a5e20f491
commit 871bca1916
20 changed files with 100 additions and 82 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ export default defineConfig({
}, },
token: { token: {
colorPrimary: '#2fbf85', colorPrimary: '#2fbf85',
borderRadius: 16, borderRadius: 8,
fontSize: 12, fontSize: 12,
motion: true motion: true
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 896 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

+1 -1
View File
@@ -1,5 +1,5 @@
.cardWrapper { .cardWrapper {
border-radius: var(--border-radius-middle); border-radius: var(--border-radius-small);
background-color: var(--color-white-1); background-color: var(--color-white-1);
box-shadow: var(--box-shadow-base); box-shadow: var(--box-shadow-base);
padding: 10px; padding: 10px;
+6
View File
@@ -45,6 +45,12 @@ const LineChart: React.FC<LineChartProps> = (props) => {
style: { style: {
lineWidth: 1.5, lineWidth: 1.5,
opacity: 0.8 opacity: 0.8
// stroke: (params: any) => {
// return (
// params.color ||
// 'linear-gradient(90deg,rgba(84, 204, 152,0.8) 0%,rgba(0, 168, 143,.7) 100%)'
// );
// }
}, },
legend: { legend: {
color: { color: {
@@ -1,7 +1,7 @@
:local(.wrapper) { :local(.wrapper) {
@wrapheight: 54px; @wrapheight: 54px;
@inputheight: 32px; @inputheight: 32px;
@borderRadius: 20px; @borderRadius: 8px;
position: relative; position: relative;
display: flex; display: flex;
+11 -17
View File
@@ -7,7 +7,7 @@ html {
// --color-fill-1: #fff; // --color-fill-1: #fff;
--color-fill-2: #fff; --color-fill-2: #fff;
--color-fill-3: #f3f6fa; --color-fill-3: #f3f6fa;
--menu-border-radius-base: 20px; --menu-border-radius-base: 8px;
--border-radius-base: 16px; --border-radius-base: 16px;
--border-radius-middle: 20px; --border-radius-middle: 20px;
--border-radius-small: 8px; --border-radius-small: 8px;
@@ -20,11 +20,11 @@ html {
--font-size-large: 16px; --font-size-large: 16px;
--font-size-middle: 14px; --font-size-middle: 14px;
--ant-color-fill-secondary: rgba(0, 0, 0, 6%); --ant-color-fill-secondary: rgba(0, 0, 0, 6%);
--table-td-radius: 20px; --table-td-radius: 8px;
--checkbox-border-radius: 4px; --checkbox-border-radius: 4px;
--ant-table-cell-padding-inline: 16px; --ant-table-cell-padding-inline: 8px;
--ant-table-cell-padding-block: 16px; --ant-table-cell-padding-block: 8px;
--ant-table-header-border-radius: 16px; --ant-table-header-border-radius: 8px;
--ant-table-header-split-color: #f0f0f0; --ant-table-header-split-color: #f0f0f0;
--ant-table-row-selected-bg: #f0fff6; --ant-table-row-selected-bg: #f0fff6;
--ant-table-row-selected-hover-bg: #d8f2e4; --ant-table-row-selected-hover-bg: #d8f2e4;
@@ -51,7 +51,7 @@ html {
&.ant-menu-css-var { &.ant-menu-css-var {
--ant-menu-item-height: 46px; --ant-menu-item-height: 46px;
--ant-menu-item-selected-bg: var(--color-white-1); --ant-menu-item-selected-bg: var(--color-white-1);
--ant-menu-item-border-radius: 16px; --ant-menu-item-border-radius: 8px;
--ant-menu-item-selected-color: var(--ant-color-primary); --ant-menu-item-selected-color: var(--ant-color-primary);
--ant-menu-item-hover-bg: var(--color-white-1); --ant-menu-item-hover-bg: var(--color-white-1);
--ant-menu-item-color: var(--color-text-1); --ant-menu-item-color: var(--color-text-1);
@@ -66,7 +66,7 @@ html {
--ant-font-size-xl: 20px; --ant-font-size-xl: 20px;
--ant-font-size: var(--font-size-base); --ant-font-size: var(--font-size-base);
--ant-padding-sm: 14px; --ant-padding-sm: 14px;
--ant-border-radius-lg: 16px; --ant-border-radius-lg: 8px;
--ant-color-error: #ff4d4f; --ant-color-error: #ff4d4f;
--ant-color-bg-mask: rgba(0, 0, 0, 35%); --ant-color-bg-mask: rgba(0, 0, 0, 35%);
--ant-color-border: rgb(217 217 217 / 50%); --ant-color-border: rgb(217 217 217 / 50%);
@@ -98,7 +98,7 @@ html {
.css-var-rh.ant-menu-css-var { .css-var-rh.ant-menu-css-var {
--ant-menu-item-height: 46px; --ant-menu-item-height: 46px;
--ant-menu-item-selected-bg: var(--color-white-1); --ant-menu-item-selected-bg: var(--color-white-1);
--ant-menu-item-border-radius: 20px; --ant-menu-item-border-radius: 8px;
--ant-menu-item-selected-color: var(--ant-color-primary); --ant-menu-item-selected-color: var(--ant-color-primary);
--ant-menu-item-hover-bg: var(--color-white-1); --ant-menu-item-hover-bg: var(--color-white-1);
--ant-menu-item-color: var(--color-text-1); --ant-menu-item-color: var(--color-text-1);
@@ -290,7 +290,7 @@ body {
.ant-pro-sider { .ant-pro-sider {
.ant-menu { .ant-menu {
.ant-menu-item { .ant-menu-item {
border-radius: 16px; border-radius: var(--border-radius-small);
&:active { &:active {
background-color: var(--ant-menu-item-selected-bg); background-color: var(--ant-menu-item-selected-bg);
@@ -307,6 +307,7 @@ body {
.ant-menu-item.ant-menu-item-selected:hover { .ant-menu-item.ant-menu-item-selected:hover {
color: var(--ant-color-primary); color: var(--ant-color-primary);
background-color: var(--ant-menu-item-selected-bg);
} }
.ant-menu-item.ant-menu-item-selected { .ant-menu-item.ant-menu-item-selected {
@@ -329,12 +330,7 @@ body {
left: 0; left: 0;
bottom: 0; bottom: 0;
right: 0; right: 0;
// background: radial-gradient( background: url('./assets/images/bg-11.png') center center no-repeat;
// circle,
// rgba(47, 191, 133, 0.02),
// rgba(55, 125, 184, 0.2)
// );
background: url('./assets/images/bg.png') center center no-repeat;
background-size: cover; background-size: cover;
&::after { &::after {
@@ -345,8 +341,6 @@ body {
bottom: 0; bottom: 0;
right: 0; right: 0;
z-index: 1; z-index: 1;
backdrop-filter: blur(100px);
filter: blur(100px);
height: 100%; height: 100%;
} }
} }
+5 -1
View File
@@ -5,5 +5,9 @@ export default {
'apikeys.form.expiretime': 'Expiration', 'apikeys.form.expiretime': 'Expiration',
'apikeys.table.name': 'Key Name', 'apikeys.table.name': 'Key Name',
'apikeys.table.save.tips': 'apikeys.table.save.tips':
'Make sure to copy your key immediately. You will not be able to see it again.' 'Make sure to copy your key immediately. You will not be able to see it again.',
'apikeys.form.expiration.7days': '7 days',
'apikeys.form.expiration.1month': '1 month',
'apikeys.form.expiration.6months': '6 months',
'apikeys.form.expiration.never': 'never'
}; };
+5 -1
View File
@@ -4,5 +4,9 @@ export default {
'apikeys.button.create': '新建 API 密钥', 'apikeys.button.create': '新建 API 密钥',
'apikeys.form.expiretime': '过期时间', 'apikeys.form.expiretime': '过期时间',
'apikeys.table.name': '密钥名称', 'apikeys.table.name': '密钥名称',
'apikeys.table.save.tips': '确保立即复制您的密钥。您将无法再次看到它!' 'apikeys.table.save.tips': '确保立即复制您的密钥。您将无法再次看到它!',
'apikeys.form.expiration.7days': '7天',
'apikeys.form.expiration.1month': '1个月',
'apikeys.form.expiration.6months': '6个月',
'apikeys.form.expiration.never': '永不'
}; };
+17 -12
View File
@@ -1,10 +1,10 @@
import ModalFooter from '@/components/modal-footer'; import ModalFooter from '@/components/modal-footer';
import SealInput from '@/components/seal-form/seal-input'; import SealInput from '@/components/seal-form/seal-input';
import SealSelect from '@/components/seal-form/seal-select'; import SealSelect from '@/components/seal-form/seal-select';
import { PageAction } from '@/config';
import { PageActionType } from '@/config/types'; import { PageActionType } from '@/config/types';
import { SyncOutlined } from '@ant-design/icons';
import { useIntl } from '@umijs/max'; import { useIntl } from '@umijs/max';
import { Form, Modal } from 'antd'; import { Form, Modal, Select } from 'antd';
import { expirationOptions } from '../config'; import { expirationOptions } from '../config';
import { FormData } from '../config/types'; import { FormData } from '../config/types';
@@ -25,14 +25,12 @@ const AddModal: React.FC<AddModalProps> = ({
}) => { }) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const intl = useIntl(); const intl = useIntl();
const Suffix = (
<SyncOutlined if (action === PageAction.CREATE && open) {
style={{ form.setFieldsValue({
fontSize: 16, expires_in: 1
color: '#1677ff' });
}} }
/>
);
const handleSumit = () => { const handleSumit = () => {
form.submit(); form.submit();
@@ -91,8 +89,15 @@ const AddModal: React.FC<AddModalProps> = ({
<SealSelect <SealSelect
label={intl.formatMessage({ id: 'apikeys.form.expiretime' })} label={intl.formatMessage({ id: 'apikeys.form.expiretime' })}
required required
options={expirationOptions} >
></SealSelect> {expirationOptions.map((option) => {
return (
<Select.Option key={option.value} value={option.value}>
{intl.formatMessage({ id: option.label })}
</Select.Option>
);
})}
</SealSelect>
</Form.Item> </Form.Item>
<Form.Item<FormData> name="description" rules={[{ required: false }]}> <Form.Item<FormData> name="description" rules={[{ required: false }]}>
<SealInput.TextArea <SealInput.TextArea
+4 -5
View File
@@ -1,7 +1,6 @@
export const expirationOptions = [ export const expirationOptions = [
{ label: '7 days', type: 'day', value: 7 }, { label: 'apikeys.form.expiration.7days', type: 'day', value: 7 },
{ label: '1 month', type: 'month', value: 1 }, { label: 'apikeys.form.expiration.1month', type: 'month', value: 1 },
{ label: '6 months', type: 'month', value: 6 }, { label: 'apikeys.form.expiration.6months', type: 'month', value: 6 },
// { label: '1 year', type: 'year', value: 1 }, { label: 'apikeys.form.expiration.never', type: 'never', value: -1 }
{ label: 'never', type: 'never', value: -1 }
]; ];
@@ -5,10 +5,25 @@ import { useContext, useEffect, useState } from 'react';
import { DashboardContext } from '../config/dashboard-context'; import { DashboardContext } from '../config/dashboard-context';
const TypeKeyMap = { const TypeKeyMap = {
cpu: 'CPU', cpu: {
memory: 'Memory', label: 'CPU',
gpu: 'GPU', color:
gpu_memory: 'VRAM' 'linear-gradient(90deg,rgba(84, 204, 152,0.8) 0%,rgba(0, 168, 143,.7) 100%)'
},
memory: {
label: 'Memory',
color:
'linear-gradient(90deg,rgba(249, 248, 113,.8) 0%,rgba(255, 199, 92,0.7) 100%)'
},
gpu: {
label: 'GPU',
color: 'rgba(84, 204, 152,0.8)'
},
gpu_memory: {
label: 'VRAM',
color:
'linear-gradient(90deg,rgba(84, 204, 152,0.8) 0%,rgba(0, 168, 143,.7) 100%)'
}
}; };
const UtilizationOvertime: React.FC = () => { const UtilizationOvertime: React.FC = () => {
@@ -44,7 +59,8 @@ const UtilizationOvertime: React.FC = () => {
return { return {
value: _.round(item.value, 2) || 0, value: _.round(item.value, 2) || 0,
time: dayjs(item.timestamp * 1000).format('HH:mm:ss'), time: dayjs(item.timestamp * 1000).format('HH:mm:ss'),
type: _.get(TypeKeyMap, type, '') type: _.get(TypeKeyMap, [type, 'label'], ''),
color: 'red'
}; };
}); });
list.push(...dataList); list.push(...dataList);
+8 -5
View File
@@ -13,6 +13,7 @@ import {
callHuggingfaceQuickSearch, callHuggingfaceQuickSearch,
queryHuggingfaceModelFiles queryHuggingfaceModelFiles
} from '../apis'; } from '../apis';
import { ollamaModelOptions } from '../config';
import { FormData, ListItem } from '../config/types'; import { FormData, ListItem } from '../config/types';
type AddModalProps = { type AddModalProps = {
@@ -99,7 +100,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
const handleOnSearchRepo = async (text: string) => { const handleOnSearchRepo = async (text: string) => {
try { try {
const params = { const params = {
q: text, q: `${text} gguf`,
type: 'model' type: 'model'
}; };
const res = await callHuggingfaceQuickSearch(params); const res = await callHuggingfaceQuickSearch(params);
@@ -164,7 +165,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
]} ]}
> >
<SealAutoComplete <SealAutoComplete
showSearch filterOption
label={intl.formatMessage({ id: 'models.form.filename' })} label={intl.formatMessage({ id: 'models.form.filename' })}
required required
options={fileOptions} options={fileOptions}
@@ -220,10 +221,12 @@ const AddModal: React.FC<AddModalProps> = (props) => {
} }
]} ]}
> >
<SealInput.Input <SealAutoComplete
label={intl.formatMessage({ id: 'models.table.name' })} filterOption
label="Ollama Model"
required required
></SealInput.Input> options={ollamaModelOptions}
></SealAutoComplete>
</Form.Item> </Form.Item>
</> </>
); );
+9 -30
View File
@@ -1,35 +1,14 @@
import { StatusMaps } from '@/config'; import { StatusMaps } from '@/config';
export const modelInstanceCols = [ export const ollamaModelOptions = [
{ { label: 'llama3', value: 'llama3' },
title: 'Name', { label: 'gemma', value: 'gemma' },
dataIndex: 'name', { label: 'mistral', value: 'mistral' },
key: 'name' { label: 'qwen', value: 'qwen' },
}, { label: 'llama2', value: 'llama2' },
{ { label: 'phi3', value: 'phi3' },
title: 'Create Time', { label: 'codellama', value: 'codellama' },
dataIndex: 'createTime', { label: 'deepseek-coder', value: 'deepseek-coder' }
key: 'createTime'
},
{
title: 'Status',
dataIndex: 'status',
key: 'status'
},
{
title: 'Utilization',
dataIndex: 'utilization',
key: 'utilization'
},
{
title: 'Host Name',
dataIndex: 'hostName',
key: 'hostName'
},
{
title: 'Operation',
key: 'Operation'
}
]; ];
export const status: any = { export const status: any = {
+1 -1
View File
@@ -8,7 +8,7 @@
overflow-y: auto; overflow-y: auto;
.ant-pro-page-container-children-container { .ant-pro-page-container-children-container {
padding-inline: 26px; padding-inline: 16px 26px;
} }
} }
+4
View File
@@ -46,6 +46,10 @@ const AddModal: React.FC<AddModalProps> = ({
...data, ...data,
is_admin: data?.is_admin ? UserRoles.ADMIN : UserRoles.USER is_admin: data?.is_admin ? UserRoles.ADMIN : UserRoles.USER
}); });
} else if (action === PageAction.CREATE && open) {
form.setFieldsValue({
is_admin: UserRoles.USER
});
} }
}; };
+6 -2
View File
@@ -1,4 +1,4 @@
import { RequestConfig } from '@umijs/max'; import { RequestConfig, history } from '@umijs/max';
import { message } from 'antd'; import { message } from 'antd';
const NoBaseURLAPIs = ['/auth', '/v1-openai']; const NoBaseURLAPIs = ['/auth', '/v1-openai'];
@@ -6,13 +6,16 @@ const NoBaseURLAPIs = ['/auth', '/v1-openai'];
export const requestConfig: RequestConfig = { export const requestConfig: RequestConfig = {
errorConfig: { errorConfig: {
errorThrower: (res: any) => { errorThrower: (res: any) => {
console.log('errorThrower+++++++++++++++', res); // to do something
}, },
errorHandler: (error: any, opts: any) => { errorHandler: (error: any, opts: any) => {
if (opts?.skipErrorHandler) throw error; if (opts?.skipErrorHandler) throw error;
const { message: errorMessage, response } = error; const { message: errorMessage, response } = error;
const errMsg = response?.data?.message || errorMessage; const errMsg = response?.data?.message || errorMessage;
message.error(errMsg); message.error(errMsg);
if (response.status === 401) {
history.push('/login', { replace: true });
}
console.log('errorHandler+++++++++++++++', error, opts); console.log('errorHandler+++++++++++++++', error, opts);
} }
}, },
@@ -28,6 +31,7 @@ export const requestConfig: RequestConfig = {
], ],
responseInterceptors: [ responseInterceptors: [
(response) => { (response) => {
// to do something
return response; return response;
} }
] ]