chore: adjust the deletion modal config
This commit is contained in:
@@ -15,6 +15,7 @@ const DeleteModal = forwardRef((props, ref) => {
|
||||
okText?: string;
|
||||
cancelText?: string;
|
||||
title?: string;
|
||||
operation: string;
|
||||
}
|
||||
>({});
|
||||
|
||||
@@ -27,6 +28,7 @@ const DeleteModal = forwardRef((props, ref) => {
|
||||
title?: string;
|
||||
cancelText?: string;
|
||||
okText?: string;
|
||||
operation: string;
|
||||
}
|
||||
) => {
|
||||
setConfig(data);
|
||||
@@ -94,9 +96,7 @@ const DeleteModal = forwardRef((props, ref) => {
|
||||
config.content &&
|
||||
intl.formatMessage(
|
||||
{
|
||||
id: config.selection
|
||||
? 'common.delete.confirm'
|
||||
: 'common.delete.single.confirm'
|
||||
id: config.operation || ''
|
||||
},
|
||||
{
|
||||
type: intl.formatMessage({ id: config.content }),
|
||||
|
||||
@@ -194,6 +194,9 @@ export default {
|
||||
'Are you sure you want to delete the selected {type}?',
|
||||
'common.delete.single.confirm':
|
||||
'Are you sure you want to delete <span style="font-size: 13px;font-weight: 700">{name}</span>?',
|
||||
'common.stop.confirm': 'Are you sure you want to stop the selected {type}?',
|
||||
'common.stop.single.confirm':
|
||||
'Are you sure you want to stop <span style="font-size: 13px;font-weight: 700">{name}</span>?',
|
||||
'common.filter.name': 'Filter by name',
|
||||
'common.form.password': 'Password',
|
||||
'common.form.username': 'Username',
|
||||
@@ -204,6 +207,7 @@ export default {
|
||||
'common.button.docs': 'Documentation',
|
||||
'common.button.version': 'Version',
|
||||
'common.title.delete.confirm': 'Confirm delete',
|
||||
'common.title.stop.confirm': 'Confirm stop',
|
||||
'common.title.recreate.confirm': 'Confirm recreate',
|
||||
'common.button.addLabel': 'Add Labels',
|
||||
'common.button.addSelector': 'Add Selectors',
|
||||
|
||||
@@ -187,6 +187,9 @@ export default {
|
||||
'common.delete.confirm': '删除选中的{type},确定吗?',
|
||||
'common.delete.single.confirm':
|
||||
'删除 <span style="font-size: 13px;font-weight: 700">{name}</span>,确定吗?',
|
||||
'common.stop.confirm': '停止选中的{type},确定吗?',
|
||||
'common.stop.single.confirm':
|
||||
'停止 <span style="font-size: 13px;font-weight: 700">{name}</span>,确定吗?',
|
||||
'common.filter.name': '名称查询',
|
||||
'common.form.password': '密码',
|
||||
'common.form.username': '用户名',
|
||||
@@ -197,6 +200,7 @@ export default {
|
||||
'common.button.docs': '文档',
|
||||
'common.button.version': '版本',
|
||||
'common.title.delete.confirm': '确认删除',
|
||||
'common.title.stop.confirm': '确认',
|
||||
'common.title.recreate.confirm': '确认重新创建',
|
||||
'common.button.addLabel': '添加标签',
|
||||
'common.button.addSelector': '添加选择器',
|
||||
|
||||
@@ -118,6 +118,7 @@ const APIKeys: React.FC = () => {
|
||||
const handleDelete = (row: ListItem) => {
|
||||
modalRef.current.show({
|
||||
content: 'apikeys.table.apikeys',
|
||||
operation: 'common.delete.single.confirm',
|
||||
name: row.name,
|
||||
async onOk() {
|
||||
console.log('OK');
|
||||
@@ -130,6 +131,7 @@ const APIKeys: React.FC = () => {
|
||||
const handleDeleteBatch = () => {
|
||||
modalRef.current.show({
|
||||
content: 'apikeys.table.apikeys',
|
||||
operation: 'common.delete.confirm',
|
||||
selection: true,
|
||||
async onOk() {
|
||||
await handleBatchRequest(rowSelection.selectedRowKeys, deleteApisKey);
|
||||
|
||||
@@ -301,7 +301,7 @@ const Models: React.FC<ModelsProps> = ({
|
||||
message.success(intl.formatMessage({ id: 'common.message.success' }));
|
||||
};
|
||||
|
||||
const handleToggleStart = async (row: ListItem, action: string) => {
|
||||
const handleStartModel = async (row: ListItem) => {
|
||||
try {
|
||||
await updateModel({
|
||||
id: row.id,
|
||||
@@ -313,7 +313,28 @@ const Models: React.FC<ModelsProps> = ({
|
||||
'updated_at',
|
||||
'rowIndex'
|
||||
]),
|
||||
replicas: action === 'start' ? 1 : 0
|
||||
replicas: 1
|
||||
}
|
||||
});
|
||||
message.success(intl.formatMessage({ id: 'common.message.success' }));
|
||||
} catch (error) {
|
||||
// ingore
|
||||
}
|
||||
};
|
||||
|
||||
const handleStopModel = async (row: ListItem) => {
|
||||
try {
|
||||
await updateModel({
|
||||
id: row.id,
|
||||
data: {
|
||||
..._.omit(row, [
|
||||
'id',
|
||||
'ready_replicas',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'rowIndex'
|
||||
]),
|
||||
replicas: 0
|
||||
}
|
||||
});
|
||||
message.success(intl.formatMessage({ id: 'common.message.success' }));
|
||||
@@ -385,6 +406,7 @@ const Models: React.FC<ModelsProps> = ({
|
||||
const handleDelete = async (row: any) => {
|
||||
modalRef.current.show({
|
||||
content: 'models.table.models',
|
||||
operation: 'common.delete.single.confirm',
|
||||
name: row.name,
|
||||
async onOk() {
|
||||
await deleteModel(row.id);
|
||||
@@ -398,6 +420,7 @@ const Models: React.FC<ModelsProps> = ({
|
||||
const handleDeleteBatch = () => {
|
||||
modalRef.current.show({
|
||||
content: 'models.table.models',
|
||||
operation: 'common.delete.confirm',
|
||||
selection: true,
|
||||
async onOk() {
|
||||
await handleBatchRequest(rowSelection.selectedRowKeys, deleteModel);
|
||||
@@ -450,6 +473,7 @@ const Models: React.FC<ModelsProps> = ({
|
||||
modalRef.current.show({
|
||||
content: 'models.instances',
|
||||
okText: 'common.button.delrecreate',
|
||||
operation: 'common.delete.single.confirm',
|
||||
name: row.name,
|
||||
async onOk() {
|
||||
await deleteModelInstance(row.id);
|
||||
@@ -487,8 +511,21 @@ const Models: React.FC<ModelsProps> = ({
|
||||
if (val === 'delete') {
|
||||
handleDelete(row);
|
||||
}
|
||||
if (val === 'start' || val === 'stop') {
|
||||
handleToggleStart(row, val);
|
||||
if (val === 'start') {
|
||||
handleStartModel(row);
|
||||
}
|
||||
|
||||
if (val === 'stop') {
|
||||
modalRef.current.show({
|
||||
content: 'models.instances',
|
||||
title: 'common.title.stop.confirm',
|
||||
okText: 'common.button.stop',
|
||||
operation: 'common.stop.single.confirm',
|
||||
name: row.name,
|
||||
async onOk() {
|
||||
await handleStopModel(row);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
[handleEdit, handleOpenPlayGround, handleDelete]
|
||||
|
||||
@@ -49,8 +49,8 @@ const options = [
|
||||
value: '--image-strength'
|
||||
},
|
||||
{
|
||||
label: '--image-sampler',
|
||||
value: '--image-sampler',
|
||||
label: '--image-sample-method',
|
||||
value: '--image-sample-method',
|
||||
options: [
|
||||
'euler_a',
|
||||
'euler',
|
||||
@@ -65,8 +65,8 @@ const options = [
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '--image-sampler-steps',
|
||||
value: '--image-sample-steps'
|
||||
label: '--image-sampling-steps',
|
||||
value: '--image-sampling-steps'
|
||||
},
|
||||
{
|
||||
label: '--image-cfg-scale',
|
||||
@@ -85,8 +85,8 @@ const options = [
|
||||
value: '--image-slg-end'
|
||||
},
|
||||
{
|
||||
label: '--image-schedule',
|
||||
value: '--image-schedule',
|
||||
label: '--image-schedule-method',
|
||||
value: '--image-schedule-method',
|
||||
options: ['default', 'discrete', 'karras', 'exponential', 'ays', 'gits']
|
||||
},
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
|
||||
width={600}
|
||||
styles={{
|
||||
body: {
|
||||
height: 410
|
||||
height: 420
|
||||
}
|
||||
}}
|
||||
footer={null}
|
||||
|
||||
@@ -149,6 +149,7 @@ const Resources: React.FC = () => {
|
||||
const handleDelete = (row: ListItem) => {
|
||||
modalRef.current.show({
|
||||
content: 'worker',
|
||||
operation: 'common.delete.single.confirm',
|
||||
name: row.name,
|
||||
async onOk() {
|
||||
console.log('OK');
|
||||
@@ -161,6 +162,7 @@ const Resources: React.FC = () => {
|
||||
const handleDeleteBatch = () => {
|
||||
modalRef.current.show({
|
||||
content: 'wokers',
|
||||
operation: 'common.delete.confirm',
|
||||
selection: true,
|
||||
async onOk() {
|
||||
await handleBatchRequest(rowSelection.selectedRowKeys, deleteWorker);
|
||||
|
||||
@@ -160,6 +160,7 @@ const Users: React.FC = () => {
|
||||
const handleDelete = (row: ListItem) => {
|
||||
modalRef.current.show({
|
||||
content: 'users.table.user',
|
||||
operation: 'common.delete.single.confirm',
|
||||
name: row.name,
|
||||
async onOk() {
|
||||
console.log('OK');
|
||||
@@ -172,6 +173,7 @@ const Users: React.FC = () => {
|
||||
const handleDeleteBatch = () => {
|
||||
modalRef.current.show({
|
||||
content: 'users.table.user',
|
||||
operation: 'common.delete.confirm',
|
||||
selection: true,
|
||||
async onOk() {
|
||||
await handleBatchRequest(rowSelection.selectedRowKeys, deleteUser);
|
||||
|
||||
Reference in New Issue
Block a user