mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-17 10:35:02 +03:00
feat(xray): preview export in a modal and switch rule enable toggle
Routing and Outbounds export now opens a TextModal showing the JSON with copy/download buttons instead of auto-downloading the file. Routing import and export are collapsed into a "More" dropdown to match the Outbounds tab. The rule form Enabled field becomes a Switch instead of an Enabled/Disabled Select.
This commit is contained in:
@@ -37,8 +37,9 @@ import {
|
||||
ImportOutlined,
|
||||
} from '@ant-design/icons';
|
||||
|
||||
import { FileManager, HttpUtil } from '@/utils';
|
||||
import { HttpUtil } from '@/utils';
|
||||
import PromptModal from '@/components/feedback/PromptModal';
|
||||
import TextModal from '@/components/feedback/TextModal';
|
||||
|
||||
import OutboundFormModal from './OutboundFormModal';
|
||||
import { propagateOutboundTagRename } from '../basics/helpers';
|
||||
@@ -226,11 +227,12 @@ export default function OutboundsTab({
|
||||
}
|
||||
|
||||
const [importOpen, setImportOpen] = useState(false);
|
||||
const [exportOpen, setExportOpen] = useState(false);
|
||||
const [exportContent, setExportContent] = useState('');
|
||||
|
||||
function exportOutbounds() {
|
||||
FileManager.downloadTextFile(JSON.stringify(outbounds, null, 2), 'outbounds.json', {
|
||||
type: 'application/json',
|
||||
});
|
||||
setExportContent(JSON.stringify(outbounds, null, 2));
|
||||
setExportOpen(true);
|
||||
}
|
||||
|
||||
function importOutbounds(value: string) {
|
||||
@@ -531,6 +533,14 @@ export default function OutboundsTab({
|
||||
json
|
||||
onConfirm={importOutbounds}
|
||||
/>
|
||||
<TextModal
|
||||
open={exportOpen}
|
||||
onClose={() => setExportOpen(false)}
|
||||
title={t('pages.xray.exportOutbounds')}
|
||||
content={exportContent}
|
||||
fileName="outbounds.json"
|
||||
json
|
||||
/>
|
||||
|
||||
{/* Subscription outbounds (read-only, merged at runtime) */}
|
||||
{Array.isArray(subscriptionOutbounds) && subscriptionOutbounds.length > 0 && (
|
||||
|
||||
Reference in New Issue
Block a user