fix: do not paste multiple lines
This commit is contained in:
@@ -475,9 +475,7 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
|
||||
<div className="flex-center">
|
||||
<ThunderboltFilled className="m-r-5" />
|
||||
{intl.formatMessage({ id: 'models.form.backend' })}:{' '}
|
||||
{modelData?.backend === backendOptionsMap.custom
|
||||
? intl.formatMessage({ id: 'models.form.backend.custom' })
|
||||
: modelData?.backend || ''}
|
||||
{modelData?.backend || ''}
|
||||
{modelData.backend_version ? `(${modelData.backend_version})` : ''}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,6 @@ import SealSelect from '@/components/seal-form/seal-select';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { Form } from 'antd';
|
||||
import _ from 'lodash';
|
||||
import { useCallback } from 'react';
|
||||
import { DeployFormKeyMap, modelCategories } from '../config';
|
||||
import { backendOptionsMap } from '../config/backend-parameters';
|
||||
import { useFormContext } from '../config/form-context';
|
||||
@@ -17,16 +16,13 @@ const AdvanceConfig = () => {
|
||||
const intl = useIntl();
|
||||
const form = Form.useFormInstance();
|
||||
const EnviromentVars = Form.useWatch('env', form);
|
||||
const scheduleType = Form.useWatch('scheduleType', form);
|
||||
const backend = Form.useWatch('backend', form);
|
||||
const { onValuesChange, formKey } = useFormContext();
|
||||
|
||||
const handleEnviromentVarsChange = useCallback(
|
||||
(labels: Record<string, any>) => {
|
||||
form.setFieldValue('env', labels);
|
||||
},
|
||||
[]
|
||||
);
|
||||
const handleEnviromentVarsChange = (labels: Record<string, any>) => {
|
||||
console.log('handleEnviromentVarsChange', labels);
|
||||
form.setFieldValue('env', labels);
|
||||
};
|
||||
|
||||
const onSelectorChange = (field: string, allowEmpty?: boolean) => {
|
||||
const workerSelector = form.getFieldValue(field);
|
||||
|
||||
@@ -38,8 +38,12 @@ const BackendFields: React.FC = () => {
|
||||
}, [backend]);
|
||||
|
||||
const backendGroupedOptions = useMemo(() => {
|
||||
const builtInBackends = backendOptions?.filter((item) => item.isBuiltIn);
|
||||
const customBackends = backendOptions?.filter((item) => !item.isBuiltIn);
|
||||
const builtInBackends = backendOptions?.filter(
|
||||
(item) => item.isBuiltIn || item.value === backendOptionsMap.custom
|
||||
);
|
||||
const customBackends = backendOptions?.filter(
|
||||
(item) => !item.isBuiltIn && item.value !== backendOptionsMap.custom
|
||||
);
|
||||
|
||||
const options = [];
|
||||
|
||||
@@ -52,7 +56,7 @@ const BackendFields: React.FC = () => {
|
||||
|
||||
if (customBackends && customBackends.length > 0) {
|
||||
options.push({
|
||||
label: intl.formatMessage({ id: 'backend.custom' }),
|
||||
label: intl.formatMessage({ id: 'models.form.backend.custom' }),
|
||||
options: customBackends
|
||||
});
|
||||
}
|
||||
@@ -93,7 +97,7 @@ const BackendFields: React.FC = () => {
|
||||
|
||||
if (customVersions.length > 0) {
|
||||
options.push({
|
||||
label: intl.formatMessage({ id: 'backend.custom' }),
|
||||
label: intl.formatMessage({ id: 'models.form.backend.custom' }),
|
||||
options: customVersions
|
||||
});
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@ const actionList: Global.ActionItem[] = [
|
||||
icon: icons.EditOutlined
|
||||
},
|
||||
{
|
||||
label: 'Active Account',
|
||||
label: 'users.status.activate',
|
||||
key: 'active',
|
||||
icon: icons.EditOutlined
|
||||
icon: icons.LockOpen
|
||||
},
|
||||
{
|
||||
label: 'Deactivate Account',
|
||||
label: 'users.status.deactivate',
|
||||
key: 'inactive',
|
||||
icon: icons.EditOutlined
|
||||
icon: icons.LockPerson
|
||||
},
|
||||
{
|
||||
label: 'common.button.delete',
|
||||
|
||||
+20
-13
@@ -10,7 +10,13 @@ import { Button, ConfigProvider, message, Table } from 'antd';
|
||||
import { useMemo, useState } from 'react';
|
||||
import NoResult from '../_components/no-result';
|
||||
import PageBox from '../_components/page-box';
|
||||
import { createUser, deleteUser, queryUsersList, updateUser } from './apis';
|
||||
import {
|
||||
createUser,
|
||||
deleteUser,
|
||||
queryUsersList,
|
||||
updateUser,
|
||||
updateUserStatus
|
||||
} from './apis';
|
||||
import AddModal from './components/add-modal';
|
||||
import { FormData, ListItem } from './config/types';
|
||||
import useUsersColumns from './hooks/use-users-columns';
|
||||
@@ -105,21 +111,12 @@ const Users: React.FC = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const handleSelect = useMemoizedFn((val: any, row: ListItem) => {
|
||||
if (val === 'edit') {
|
||||
handleEditUser(row);
|
||||
} else if (val === 'delete') {
|
||||
handleDelete({ ...row, name: row.username });
|
||||
}
|
||||
});
|
||||
|
||||
const handleActiveChange = async (checked: boolean, row: ListItem) => {
|
||||
try {
|
||||
await updateUser({
|
||||
await updateUserStatus({
|
||||
id: row.id,
|
||||
data: {
|
||||
...row,
|
||||
is_active: checked,
|
||||
id: row?.id
|
||||
is_active: checked
|
||||
}
|
||||
});
|
||||
handleSearch();
|
||||
@@ -129,6 +126,16 @@ const Users: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleSelect = useMemoizedFn((val: any, row: ListItem) => {
|
||||
if (val === 'edit') {
|
||||
handleEditUser(row);
|
||||
} else if (val === 'delete') {
|
||||
handleDelete({ ...row, name: row.username });
|
||||
} else if (val === 'active' || val === 'inactive') {
|
||||
handleActiveChange(val === 'active', row);
|
||||
}
|
||||
});
|
||||
|
||||
const renderEmpty = (type?: string) => {
|
||||
if (type !== 'Table') return;
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user