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