diff options
| author | Alireza Ahmadi <alireza7@gmail.com> | 2023-12-08 22:08:44 +0300 |
|---|---|---|
| committer | Alireza Ahmadi <alireza7@gmail.com> | 2023-12-08 22:08:44 +0300 |
| commit | 35feef650f793ffbec2af51a18fd25d8b0beefb1 (patch) | |
| tree | f36cac6a4c188118418b53f45c681e7a4e821e6d /web/html | |
| parent | 38013e5ea942f35d7f187b476c2f8914281b6c18 (diff) | |
import-export inbound #1300
Diffstat (limited to 'web/html')
| -rw-r--r-- | web/html/common/prompt_modal.html | 1 | ||||
| -rw-r--r-- | web/html/common/text_modal.html | 5 | ||||
| -rw-r--r-- | web/html/xui/inbounds.html | 30 |
3 files changed, 34 insertions, 2 deletions
diff --git a/web/html/common/prompt_modal.html b/web/html/common/prompt_modal.html index a61b4454..edfad682 100644 --- a/web/html/common/prompt_modal.html +++ b/web/html/common/prompt_modal.html @@ -1,7 +1,6 @@ {{define "promptModal"}} <a-modal id="prompt-modal" v-model="promptModal.visible" :title="promptModal.title" :closable="true" @ok="promptModal.ok" :mask-closable="false" - :class="themeSwitcher.darkCardClass" :ok-text="promptModal.okText" cancel-text='{{ i18n "cancel" }}' :class="themeSwitcher.currentTheme"> <a-input id="prompt-modal-input" :type="promptModal.type" v-model="promptModal.value" diff --git a/web/html/common/text_modal.html b/web/html/common/text_modal.html index 2b455ae4..4fe2f175 100644 --- a/web/html/common/text_modal.html +++ b/web/html/common/text_modal.html @@ -31,7 +31,10 @@ this.clipboard = new ClipboardJS('#txt-modal-ok-btn', { text: () => this.content, }); - this.clipboard.on('success', () => app.$message.success('{{ i18n "copied" }}')); + this.clipboard.on('success', () => { + app.$message.success('{{ i18n "copied" }}') + this.close(); + }); } }); }, diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index 13808ac9..31595f00 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -121,6 +121,10 @@ <template v-if="!isMobile">{{ i18n "pages.inbounds.generalActions" }}</template> </a-button> <a-menu slot="overlay" @click="a => generalActions(a)" :theme="themeSwitcher.currentTheme"> + <a-menu-item key="import"> + <a-icon type="import"></a-icon> + {{ i18n "pages.inbounds.importInbound" }} + </a-menu-item> <a-menu-item key="export"> <a-icon type="export"></a-icon> {{ i18n "pages.inbounds.export" }} @@ -221,6 +225,10 @@ {{ i18n "info"}} </a-menu-item> </template> + <a-menu-item key="clipboard"> + <a-icon type="copy"></a-icon> + {{ i18n "pages.inbounds.copyToClipboard" }} + </a-menu-item> <a-menu-item key="resetTraffic"> <a-icon type="retweet"></a-icon> {{ i18n "pages.inbounds.resetTraffic" }} </a-menu-item> @@ -708,6 +716,9 @@ }, generalActions(action) { switch (action.key) { + case "import": + this.importInbound(); + break; case "export": this.exportAllLinks(); break; @@ -742,6 +753,9 @@ case "export": this.inboundLinks(dbInbound.id); break; + case "clipboard": + this.copyToClipboard(dbInbound.id); + break; case "resetTraffic": this.resetTraffic(dbInbound.id); break; @@ -1162,6 +1176,18 @@ newDbInbound = this.checkFallback(dbInbound); txtModal.show('{{ i18n "pages.inbounds.export"}}', newDbInbound.genInboundLinks, newDbInbound.remark); }, + importInbound() { + promptModal.open({ + title: '{{ i18n "pages.inbounds.importInbound" }}', + type: 'textarea', + value: '', + okText: '{{ i18n "pages.inbounds.import" }}', + confirm: async (dbInboundText) => { + await this.submit('/panel/inbound/import', {data: dbInboundText}, promptModal); + promptModal.close(); + }, + }); + }, exportAllLinks() { let copyText = []; for (const dbInbound of this.dbInbounds) { @@ -1169,6 +1195,10 @@ } txtModal.show('{{ i18n "pages.inbounds.export"}}', copyText.join('\r\n'), 'All-Inbounds'); }, + copyToClipboard(dbInboundId) { + dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); + txtModal.show('{{ i18n "pages.inbounds.inboundData" }}', JSON.stringify(dbInbound, null, 2)); + }, async startDataRefreshLoop() { while (this.isRefreshEnabled) { try { |
