74 lines
1.9 KiB
React
74 lines
1.9 KiB
React
/*
|
|
Copyright (C) 2025 QuantumNous
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as
|
|
published by the Free Software Foundation, either version 3 of the
|
|
License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
For commercial licensing, please contact support@quantumnous.com
|
|
*/
|
|
|
|
import React from 'react';
|
|
import { Modal, Banner } from '@douyinfe/semi-ui';
|
|
|
|
const actionMeta = {
|
|
enable: { title: '批量启用', danger: false, hint: '将选中秘钥批量启用' },
|
|
disable: {
|
|
title: '批量禁用',
|
|
danger: true,
|
|
hint: '将选中秘钥批量禁用,用户将无法使用',
|
|
},
|
|
delete: {
|
|
title: '批量删除',
|
|
danger: true,
|
|
hint: '将选中秘钥批量删除,操作不可恢复',
|
|
},
|
|
};
|
|
|
|
const AdminBatchActionModal = ({
|
|
visible,
|
|
onCancel,
|
|
onConfirm,
|
|
action,
|
|
count,
|
|
t,
|
|
}) => {
|
|
const meta = actionMeta[action] || {
|
|
title: '批量操作',
|
|
danger: false,
|
|
hint: '',
|
|
};
|
|
|
|
return (
|
|
<Modal
|
|
title={t(meta.title)}
|
|
visible={visible}
|
|
onCancel={onCancel}
|
|
onOk={onConfirm}
|
|
type={meta.danger ? 'danger' : 'warning'}
|
|
okType={meta.danger ? 'danger' : 'primary'}
|
|
okText={t('确认执行')}
|
|
>
|
|
<div className='space-y-2'>
|
|
<div>{t('共选中 {{count}} 个秘钥', { count })}</div>
|
|
<Banner
|
|
type={meta.danger ? 'danger' : 'info'}
|
|
description={t(meta.hint)}
|
|
closeIcon={null}
|
|
/>
|
|
</div>
|
|
</Modal>
|
|
);
|
|
};
|
|
|
|
export default AdminBatchActionModal;
|