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:
MHSanaei
2026-06-21 16:29:46 +02:00
parent 7c8889466b
commit 97c02ef69f
3 changed files with 43 additions and 26 deletions
@@ -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 && (